Skip to content

Is it possible to configure which columns to show in list and switch? #3133

Closed

Description

@jtaby

I have 27 work trees and both list and switch commands take nearly 10-15 seconds to fill in the details in the columns before I can make a switch or execute a follow up command. I would like work trunk to be configurable to be much simpler and dumber and faster

Activity

  1. worktrunk-bot commented on Jun 19, 2026

    @worktrunk-bot
    Collaborator

    Thanks for the suggestion. Two parts to this:

    Per-column selection — there's no config today to pick which columns wt list / wt switch show. The set of columns is derived from which data-collection tasks run, not from a user-supplied allowlist, so "show only these columns" would be new functionality.

    Making it faster — this is the part you can act on right now, and it's likely the real goal. The slow "fill in the columns" phase is the post-skeleton collect step, and worktrunk already exposes knobs for it in the [list] config section (these apply to both wt list and the wt switch picker):

    [list]
    full = false          # keep this off — CI status is the only network-bound column, and --full is what turns it on
    task-timeout-ms = 500 # cap any single git command; render whatever's ready past the cap (list + switch picker)
    timeout-ms = 1000     # wall-clock budget for the whole collect phase (wt list); abandons stragglers and renders

    full is already false by default, so a plain wt list shouldn't be hitting the network at all — which makes 10–15s for 27 worktrees higher than I'd expect from purely-local git operations. task-timeout-ms / timeout-ms will bound the wait regardless (the picker renders progressively, so you can interact before columns finish filling), but it's worth finding out what is slow.

    Could you run wt -vv list and share the resulting diagnostic report? That command writes .git/wt/logs/diagnostic.md with a trace of every git invocation and its timing, and prints a gh gist create hint at the end. One gist URL would show exactly which operations are eating the 10–15s across your 27 worktrees — that tells us whether this is a config tweak or a genuine performance gap worth fixing.

    Config reference: worktrunk.dev/config/ (see the List section).

    A maintainer will weigh in on the per-column-toggle request.

  2. max-sixty commented on Jun 19, 2026

    @max-sixty
    Owner

    agree re dumb & fast:

    with both of those, they should show the basic details in <50ms and then fill things in

    particularly with wt switch, where the command can exit without completing the details

    is that sufficient or not quite?

  3. jtaby commented on Jun 19, 2026

    @jtaby
    Author

    yup! I just want to get a list printed so I can manage which to delete, and I want to get a name for a worktree out of the path or vice versa

  4. worktrunk-bot commented on Jun 19, 2026

    @worktrunk-bot
    Collaborator

    Both of those last two are already possible today, independent of the dumb-and-fast rendering work:

    A printed list to triage deletions — wt list already dims rows that are safe to delete (same commit + clean, or content integrated), and wt remove removes a worktree and deletes its branch if it's merged. If you want just the integrated branches as plain text:

    wt list --format=json | jq -r '.[] | select(.main_state == "integrated" or .main_state == "empty") | .branch'

    Name ↔ path mapping — the JSON output carries both branch and path per worktree, so either direction is a one-liner:

    # name from a path
    wt list --format=json | jq -r --arg p "$PWD" '.[] | select(.path == $p) | .branch'
    
    # path from a name
    wt list --format=json | jq -r '.[] | select(.branch == "my-feature") | .path'

    Docs: worktrunk.dev/list/ (JSON output section).

    So the genuinely-new ask here is the fast/progressive rendering — the structured-data side of "get a name out of a path" is covered.

  5. max-sixty commented on Jun 19, 2026

    @max-sixty
    Owner

    @worktrunk-bot can you show those as aliases? not really practical with the full commands each time!

    ...but it's still too onerous, @jtaby's point is v reasonable

    I think the way forward might be a custom list spec; building off #3073, so we can give a full spec for wt list. There's also one that excludes columns, though it blanket excludes them, which is probably too severe

  6. worktrunk-bot commented on Jun 19, 2026

    @worktrunk-bot
    Collaborator

    Yep. Since aliases run through the template engine, {{ args }} splices in arguments shell-escaped, so the jq one-liners drop straight into [aliases]:

    [aliases]
    # Branches safe to delete (integrated or empty), one per line
    prunable = '''wt list --format=json | jq -r '.[] | select(.main_state == "integrated" or .main_state == "empty") | .branch' '''
    
    # Branch name for a worktree path — `wt name [PATH]` (defaults to current dir)
    name = '''
    p={{ args }}; : "${p:=$PWD}"
    wt list --format=json | jq -r --arg p "$p" '.[] | select(.path == $p) | .branch'
    '''
    
    # Worktree path for a branch — `wt path BRANCH`
    path = '''wt list --format=json | jq -r --arg b {{ args }} '.[] | select(.branch == $b) | .path' '''

    Then wt prunable, wt name, wt name /some/path, wt path my-feature.

    Worth noting for @jtaby's latency point: plain wt list --format=json (no --full) is local-only — it doesn't touch the network for CI status, which is what the slow column-fill is. So these aliases return immediately regardless of how many worktrees you have.

    On the way forward — agreed the aliases are a workaround, not the fix. [list.custom-columns] from #3073 already lets you add templated columns; the missing half is a way to say "render only these columns" without the blanket-exclude being too severe. A per-invocation/config column spec for wt list (allowlist of built-in + custom columns) seems like the right shape, and it composes with the dumb-and-fast rendering since a narrowed spec also narrows what has to be computed. Happy to sketch that as a separate issue/PR if you want to lock down the surface.

  7. jtaby commented on Jun 20, 2026

    @jtaby
    Author

    Yes I am running simply wt list but it still takes >10s to resolve everything before I get my command back. I just want to print the Branch/Path columns.

    Anecdotally, the commit columns comes in instantly but the "message" column fills in slowly. Same with " Status HEAD± main↕ Remote⇅"

  8. jtaby commented on Jun 20, 2026

    @jtaby
    Author
    CleanShot.2026-06-19.at.20.18.19.mp4
  9. worktrunk-bot commented on Jun 20, 2026

    @worktrunk-bot
    Collaborator

    That column-by-column timing is a precise diagnosis, and it maps exactly onto how collection works:

    • Commit columns instant — the abbreviated SHA + sort key come from a single batched git log --no-walk … SHA₁ … SHA_N fork that runs once for all worktrees (O(1) forks, before the table even renders).
    • Status / HEAD± / main↕ / Remote⇅ slow — each of those is a per-worktree task (git status --porcelain, ahead/behind vs default, branch diff, the integration/merged checks). That work is O(N): ~27 worktrees × several git invocations each. It's all local — no network, since you're not on --full — so what you're waiting on is pure fork/CPU cost fanning out across the worktrees.

    Two corrections/additions to what I said earlier in the thread:

    1. --format=json is not the instant escape hatch I implied. It runs the same local collection synchronously and only emits once it's done — it skips the network CI column, but not the per-worktree git work that's actually slow for you. So the name/path aliases will still wait on the same collection at 27 worktrees. Sorry for the misdirection there.

    2. You can bound the wait today. By default there's no wall-clock cap (timeout-ms is unset = disabled), which is why a plain wt list blocks until everything resolves. Set:

      [list]
      timeout-ms = 500       # whole-collect budget for `wt list`; render what's ready, abandon stragglers
      task-timeout-ms = 300  # also caps any single git command (applies to the `wt switch` picker too)

      Branch and Path are known before any of the slow tasks run, so they're always present — with a 500ms budget you'd get your list back in ~half a second with the slow columns simply left blank rather than blocking on them.

    That said, this confirms @max-sixty's dumb-and-fast direction is the real fix, not a config knob: a narrowed column spec (building on #3073) would skip those per-worktree tasks at the source instead of timeout-racing them, so "just Branch/Path" would be genuinely instant rather than bounded-and-partial.

    One thing still worth a wt -vv list gist if you have a moment: 10–15s for 27 purely-local worktrees is on the high side even for O(N) fanout, so the trace would tell us whether it's evenly spread (expected, fixed by the column spec) or dominated by one pathological op (a separate bug worth fixing regardless).

  10. worktrunk-bot commented on Jun 20, 2026

    @worktrunk-bot
    Collaborator

    Thanks — that trace answers it precisely, and it's not evenly-spread cheap fanout. It's dominated by a class of per-worktree ops that are each unusually heavy because your working tree is large and dirty. The worst single ops in your trace (dur_us, all local):

    op worst why it runs
    git --no-optional-locks status --porcelain 2.41s (also 2.13s, 1.93s, 1.50s…) the Status column + dirty-check, once per worktree
    git diff --shortstat HEAD 1.88s (also 1.74s…) HEAD± diffstat
    git add -A (into a temp index) + write-tree 2.39s (also 2.07s, 1.68s…) the main↕ conflict check on a dirty worktree

    At ~27 worktrees fanned across a ~16-thread pool, that's the ~7s of collect the trace ends with (List collect complete at ts≈7.12s) — consistent with the 10–15s you feel once skeleton + render are added.

    Two things worth calling out:

    1. The git add -A is the expensive surprise, and it only fires because the worktrees are dirty. For a clean worktree the conflict check is a single write-tree; for a dirty one wt copies the index, runs git add -A, then write-tree (real index untouched — src/commands/list/collect/tasks.rs:677). On your tree that add -A is a full re-stat of every file, hence the 1–2.4s. So dirtiness is what pushes each worktree onto the slow path for both status and the conflict check.

    2. You appear to have hundreds of binary assets that are Modified in essentially every worktree — the trace tail is ~200 lines of M darkroom-website/public/assets/.../*.jpg. Image files showing as perpetually-modified across all worktrees is abnormal and is very likely a real, separate problem (a text filter or EOL normalization applied to binaries, core.autocrlf, or a filemode/chmod mismatch). If those weren't dirty, every worktree would take the fast path and wt list would speed up dramatically on its own. Quick check from inside one worktree:

    git diff -- darkroom-website/public/assets/images/about/majd.jpg | head -3   # "Binary files differ" = real bytes; a text hunk = a filter mangling it
    git check-attr -a -- darkroom-website/public/assets/images/about/majd.jpg     # any filter=/text= attribute?
    git config --get core.autocrlf

    So the net: your trace confirms @max-sixty's dumb-and-fast / narrowed-column direction is the right structural fix — a "just Branch/Path" spec skips status + shortstat + the add -A conflict check at the source, making it genuinely instant rather than timeout-racing 27× ~1–2s ops. And independently, sorting out why those .jpgs are perpetually dirty would speed up the full list too. Happy to dig into either thread.

  11. max-sixty commented on Jun 27, 2026

    @max-sixty
    Owner

    @worktrunk-bot please post here the 0.62 changes, show an alias to show only some of the columns

    also the profile feature

  12. worktrunk-bot commented on Jun 27, 2026

    @worktrunk-bot
    Collaborator

    Here's everything you asked for, all run against 0.62.0 to confirm.

    The 0.62 changes relevant to this thread

    • [list] columns selects and orders columns (#3141) — a user-config key (also settable via --config-set) takes an ordered array of column names and renders exactly those, in that order. This is the direct answer to "configure which columns to show". Where v0.61's [list.custom-columns] adds columns, this selects and reorders the whole set.
    • main…± diff column shows by default (#3236) — line diffs since the merge-base with the default branch now render without --full, served from a persistent cache. --full now adds only the off-machine columns (CI status + LLM summaries).
    • wt config state logs profile performance profiler (#3184, #3186) — turns a -vv trace into a profile (subprocess time by command shape, slowest calls, redundant re-runs, collect timeline). The "what's slow" tool for this exact thread.

    Full changelog: CHANGELOG.md.

    An alias to show only some columns

    The column names are kebab identifiers, not the rendered headers: branch, status, working-diff (HEAD±), ahead-behind (main↕), branch-diff (main…±), upstream (Remote⇅), summary, ci, path, url, commit, age, message.

    Persistent (every wt list + the picker):

    [list]
    columns = ["branch", "path"]

    As an alias, so plain wt list keeps the full set and wt ls is the narrow view:

    [aliases]
    # branch + path only
    ls = '''wt --config-set 'list.columns=["branch","path"]' list'''

    Tested — wt ls:

      Branch  Path
    @ main    .
    
    ○ Showing 1 worktree

    The profile feature

    wt -vv list                      # writes .git/wt/logs/trace.log
    wt config state logs profile     # renders the profile from it

    (Takes a path arg or - for stdin too; every -vv bug-report bundle now inlines a rendered profile.) Output on this checkout:

    BY COMMAND TYPE
      command                   count    total      max      avg
      git status                    1  59.57ms  59.57ms  59.57ms
      gh                            1  34.71ms  34.71ms  34.71ms
      git for-each-ref              3   6.78ms   2.90ms   2.26ms
      ...
    CACHE
      2 duplicate calls wasting ~3.26ms (same context, slowest run kept)
    

    For @jtaby's 27 dirty worktrees, this is the tool that pinpointed the git status / git diff --shortstat / git add -A cost in the earlier trace.

    One correction worth flagging

    I claimed earlier in this thread that a narrowed column spec would "skip those per-worktree tasks at the source." As shipped in 0.62 it doesn't — [list] columns filters at the layout layer (src/commands/list/layout.rs), and the collection skip_tasks set is derived only from --full gating, never from the column selection. I verified with two traces: columns = ["branch", "path"] vs the default set produce an identical command list — git status and every per-worktree task still run, the extra columns are just hidden.

    So column selection makes the output cleaner but not faster on its own. To bound @jtaby's wait today, it still needs to pair with [list] timeout-ms / task-timeout-ms. The genuinely-fast version of "just branch/path" is the follow-up: have collection prune the tasks no selected column requires (skip the requires_task set for unselected columns) — that's the piece that would turn the dumb-and-fast direction into actual collection savings rather than render-only.

    Verification

    columns = ["branch","path"] trace — BY COMMAND TYPE includes git status (×1), git for-each-ref (×3), etc. Default-columns trace — same counts. The one-directional wiring (skip_tasks hides a column, selection never sets skip_tasks) is at collect/mod.rs where selected_columns flows into layout::ColumnSelection only, while effective_skip_tasks is built from the --full gate. The requires_task → visibility filter is at layout.rs:787.

  13. max-sixty commented on Jun 27, 2026

    @max-sixty
    Owner

    I claimed earlier in this thread that a narrowed column spec would "skip those per-worktree tasks at the source." As shipped in 0.62 it doesn't — [list] columns filters at the layout layer (src/commands/list/layout.rs), and the collection skip_tasks set is derived only from --full gating, never from the column selection. I verified with two traces: columns = ["branch", "path"] vs the default set produce an identical command list — git status and every per-worktree task still run, the extra columns are just hidden.

    ah, this is a mistake in our impl. we should only run the tasks for the things we're showing.

    implement this change in a new PR

  14. max-sixty commented on Jun 27, 2026

    @max-sixty
    Owner

    @jtaby hope the ls alias concept is sufficient, lmk if not!

    (at least after the backend change re what we compute)

  15. worktrunk-bot commented on Jun 27, 2026

    @worktrunk-bot
    Collaborator

    Opened #3274 to fix this. It maps each column to the tasks it consumes and, when [list] columns names a subset, drops every task no selected column needs from collection — so a branch/path-style view now runs no git status, diffs, or ahead/behind walks rather than computing and discarding them. Additive only (it never overrides the --full/[commit.generation] gates), and the wt switch picker is left as-is since it fetches CI for its preview panes regardless of column visibility.

    The end-to-end test mirrors the trace method from above: the default set runs git status --porcelain, columns = ["branch", "age"] runs none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions