Skip to content

Cmd+K: fix Recent Files flicker - #890

Merged
wingleeio merged 2 commits into
zeronsh:mainfrom
Sushants-Git:fix/cmdk-recent-files-late
Oct 14, 2026
Merged

wingleeio merged 2 commits into
zeronsh:mainfrom
Sushants-Git:fix/cmdk-recent-files-late

Conversation

@Sushants-Git

@Sushants-Git Sushants-Git commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #889: Cmd+K now opens with Recent Files already drawn, so the menu no longer flickers.

Why

Before every workspace-file request, resolve_target checks the chat's folder. That check ran 6 git processes one after another (~37 ms). The search itself takes ~0.3 ms, so Recent Files arrived a frame or two after the palette was drawn.

Fix

  • workspace_checkout: one git worktree list instead of refs(), which ran 4 commands to read one column. This also accepts detached worktrees, which the old code rejected.
  • checkout_identity: one git rev-parse call instead of two.
  • resolve_target: for chat targets, the two calls run concurrently. A request-supplied checkoutPath is still checked before git runs in it.

Request round trip: ~45 ms → ~5–8 ms.

Screen.Recording.2026-10-13.at.3.42.05.PM.mov

Testing

  • cargo test -p zeron-engine --lib passes, plus a new test that every worktree is accepted, including detached ones (fails on the old code).
  • Checked live on macOS.

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@Sushants-Git Sushants-Git changed the title Workspace files: authorize a chat's folder with 2 concurrent git calls, not 6 Cmd+K opens with Recent Files: resolve a chat's folder with 2 concurrent git calls, not 6 Oct 13, 2026
@Sushants-Git Sushants-Git changed the title Cmd+K opens with Recent Files: resolve a chat's folder with 2 concurrent git calls, not 6 Cmd+K opens with Recent Files: 2 concurrent git calls instead of 6 Oct 13, 2026
@Sushants-Git Sushants-Git changed the title Cmd+K opens with Recent Files: 2 concurrent git calls instead of 6 Cmd+K: fix Recent Files flicker Oct 13, 2026
Every workspace-file request first checks the chat's folder in
resolve_target. That ran 6 git processes one after another (~37 ms),
so Recent Files arrived a frame or two after the palette was drawn.

- workspace_checkout: one `git worktree list` instead of refs(),
  which ran 4 commands to read one column. Detached worktrees, which
  refs() never listed, are now accepted.
- checkout_identity: one `git rev-parse` for both paths, falling back
  to two calls for a path with a newline in its name.
- resolve_target: for chat targets, the two calls run concurrently.

Request round trip: ~45 ms -> ~5-8 ms.

Fixes zeronsh#889
@Sushants-Git
Sushants-Git force-pushed the fix/cmdk-recent-files-late branch from 81190c4 to 4228ce0 Compare October 13, 2026 11:58
kopeng-mi added a commit to kopeng-mi/zeron that referenced this pull request Oct 14, 2026
… a checkout

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@wingleeio wingleeio left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Resolving the checkout identity in one rev-parse and alongside the authorization check removes the serialized git round-trips, and listing worktrees straight from git worktree list also accepts detached worktrees, which refs() missed. Nice test.

I pushed one commit (53ed0d3): worktree_paths now parses --porcelain -z, so a worktree whose path contains a newline can't inject an extra worktree <path> entry into the accepted checkouts (falls back to the newline form on Git < 2.36). The test covers it.

Ran cargo check -p zeron-engine --all-targets, the engine lib suite, and --test workspace_files merged with main — green.

@wingleeio
wingleeio merged commit 2a209cc into zeronsh:main Oct 14, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cmd+K flickers: Recent Files appears a frame or two late and pushes the menu down

2 participants