Repository navigation
Resolve native chat workspaces from catalog snapshots - #26428
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review. 📝 WalkthroughWalkthroughWorkspace path lookups now use known-worktree catalog snapshots and a shared store selector. Native chat and file-list components use catalog-based worktree paths. Tests cover host matching, detected worktrees, snapshot paths, remote file-list requests, and shared workspace fixtures. Priority: ⬇️ Low Merge Risk: 🟡 Moderate · up to When the same worktree ID exists on different hosts, quick-open and native-chat mentions can request files using a path from the wrong host. Qualify the lookup before merging. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
53fb7543-39bc-49dc-9f75-93b04c9872ed
📒 Files selected for processing (16)
src/renderer/src/components/native-chat/native-chat-attachment-upload.test.tssrc/renderer/src/components/native-chat/native-chat-attachment-upload.tssrc/renderer/src/components/native-chat/native-chat-file-link.test.tssrc/renderer/src/components/native-chat/native-chat-file-link.tssrc/renderer/src/components/native-chat/native-chat-image-runtime-context.test.tssrc/renderer/src/components/native-chat/native-chat-image-runtime-context.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-tab-directory.test.tssrc/renderer/src/components/native-chat/native-chat-workspace-test-fixtures.tssrc/renderer/src/components/native-chat/use-native-chat-mention-files.tssrc/renderer/src/components/quick-open-file-list.react.test.tsxsrc/renderer/src/components/quick-open-file-list.tssrc/renderer/src/lib/workspace-directory.test.tssrc/renderer/src/lib/workspace-directory.tssrc/renderer/src/store/selectors.ts
💤 Files with no reviewable changes (1)
- src/renderer/src/components/native-chat/native-chat-image-runtime-context.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
fddeb42 to
56dd38e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
603cdeb7-de58-47ba-9d50-8c61abe53bbd
📒 Files selected for processing (13)
src/renderer/src/components/native-chat/native-chat-file-link.test.tssrc/renderer/src/components/native-chat/native-chat-file-link.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.test.tssrc/renderer/src/components/native-chat/native-chat-session-option-discovery.tssrc/renderer/src/components/native-chat/native-chat-tab-directory.test.tssrc/renderer/src/components/native-chat/native-chat-workspace-test-fixtures.tssrc/renderer/src/components/native-chat/use-native-chat-mention-files.tssrc/renderer/src/components/native-chat/use-native-chat-skills.test.tssrc/renderer/src/components/quick-open-file-list.tssrc/renderer/src/lib/workspace-directory.test.tssrc/renderer/src/lib/workspace-directory.tssrc/renderer/src/store/selectors.test.tssrc/renderer/src/store/selectors.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
- Stop falling through to folder-path parsing once the catalog is loaded. The fallthrough let a folder workspace on another host resolve to a local path. - Look up model discovery settings by the worktree's runtime owner instead of the agent tab's, so a session's model list matches the worktree it runs in.
1c50443 to
7e8606f
Compare
Problem
Native chat finds a workspace's folder by calling a getter that reads the live app store at call time. If the store changes during a lookup, the folder can come from a newer snapshot than the rest of the data. Workspaces that exist only in the detected list can also fail to resolve.
Solution
Native chat now reads workspace lists from one snapshot passed into each call and takes the folder path from that same snapshot. Detected-only workspaces resolve too. File links, attachments, mentions, image context, and model discovery share one lookup helper.
What Changed
getKnownWorktreeByIdfrom native chat state shapes. Lookups usefindKnownWorktreeByIdon the supplied snapshot.lib/workspace-directory.tsresolves from a catalog snapshot: visible rows, detected rows, folder workspaces, and the floating path.getSettingsForWorktreeRuntimeOwnerfor the worktree.useKnownWorktreeByIdselector.Before: in some timing cases, chat file links, attachments, or mentions could resolve a different path, or none for detected-only workspaces. After: they resolve from one consistent snapshot.
Why
A getter closes over whichever store state was live when it was created, so it cannot guarantee one consistent view. Passing the snapshot in fixes that at the source. TODO: list the alternatives considered.
Linked Issue
No GitHub issue is linked. This is a partial fix for STA-9590 based on the branch name, so it does not close the full work.
Visual Proof
N/A: no intended visual change. The same paths are shown; only the data source changed.
Testing
Automated tests added or updated:
native-chat-attachment-upload.test.tsnative-chat-file-link.test.tsnative-chat-image-runtime-context.test.tsnative-chat-session-option-discovery.test.ts(new)native-chat-tab-directory.test.tsworkspace-directory.test.ts(new)quick-open-file-list.react.test.tsxTODO: record test run results and the platforms tested.
AI Disclosure
TODO
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance.
TODO: confirm these. SSH host IDs are kept in the lookup, and a test covers the
ssh:box-1case.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)