fix(workspace): require exact workdir match in saved_workspace_match_depth#185
Merged
Merged
Conversation
…depth Previously the workdir leg of saved_workspace_match_depth matched any cwd that was a subdirectory of the configured workdir. A workspace with a broad workdir (e.g. /Users/me/Projects) therefore captured every directory beneath it, causing the TUI to pre-select the wrong workspace and jackin load / jackin hardline to resolve the wrong workspace when run from an unrelated project directory. Change the workdir check to require an exact match (cwd == workdir). Mount sources retain prefix matching so that subdirectories of a mounted host path continue to be covered. This is the single unified function used by both the TUI pre-selection and the CLI context resolvers. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
donbeave
added a commit
that referenced
this pull request
Apr 26, 2026
Brings in main's fix(workspace) #185, fix(launch) #184, and a large documentation roadmap addition (#183 + several smaller PRs covering codebase readability, project structure gates, etc.). Adds the `isolation` field to MountConfig literals introduced by main in test fixtures inside `src/app/context.rs` and `src/workspace/resolve.rs` (2 + 3 sites, all `MountIsolation::Shared` since they're not testing isolation behavior). These literals predate this branch's `isolation`-field addition; main couldn't anticipate the new required field, so the merge picks them up unmodified and we backfill the field here. No conflicts in the merge itself. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com>
donbeave
added a commit
that referenced
this pull request
May 6, 2026
…depth (#185) Previously the workdir leg of saved_workspace_match_depth matched any cwd that was a subdirectory of the configured workdir. A workspace with a broad workdir (e.g. /Users/me/Projects) therefore captured every directory beneath it, causing the TUI to pre-select the wrong workspace and jackin load / jackin hardline to resolve the wrong workspace when run from an unrelated project directory. Change the workdir check to require an exact match (cwd == workdir). Mount sources retain prefix matching so that subdirectories of a mounted host path continue to be covered. This is the single unified function used by both the TUI pre-selection and the CLI context resolvers. Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com> Co-authored-by: Claude <noreply@anthropic.com>
donbeave
added a commit
that referenced
this pull request
May 7, 2026
…depth (#185) Previously the workdir leg of saved_workspace_match_depth matched any cwd that was a subdirectory of the configured workdir. A workspace with a broad workdir (e.g. /Users/me/Projects) therefore captured every directory beneath it, causing the TUI to pre-select the wrong workspace and jackin load / jackin hardline to resolve the wrong workspace when run from an unrelated project directory. Change the workdir check to require an exact match (cwd == workdir). Mount sources retain prefix matching so that subdirectories of a mounted host path continue to be covered. This is the single unified function used by both the TUI pre-selection and the CLI context resolvers. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com> Co-authored-by: Codex <codex@openai.com>
donbeave
added a commit
that referenced
this pull request
May 7, 2026
…depth (#185) Previously the workdir leg of saved_workspace_match_depth matched any cwd that was a subdirectory of the configured workdir. A workspace with a broad workdir (e.g. /Users/me/Projects) therefore captured every directory beneath it, causing the TUI to pre-select the wrong workspace and jackin load / jackin hardline to resolve the wrong workspace when run from an unrelated project directory. Change the workdir check to require an exact match (cwd == workdir). Mount sources retain prefix matching so that subdirectories of a mounted host path continue to be covered. This is the single unified function used by both the TUI pre-selection and the CLI context resolvers. Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com> Co-authored-by: Claude <noreply@anthropic.com>
donbeave
added a commit
that referenced
this pull request
May 7, 2026
…depth (#185) Previously the workdir leg of saved_workspace_match_depth matched any cwd that was a subdirectory of the configured workdir. A workspace with a broad workdir (e.g. /Users/me/Projects) therefore captured every directory beneath it, causing the TUI to pre-select the wrong workspace and jackin load / jackin hardline to resolve the wrong workspace when run from an unrelated project directory. Change the workdir check to require an exact match (cwd == workdir). Mount sources retain prefix matching so that subdirectories of a mounted host path continue to be covered. This is the single unified function used by both the TUI pre-selection and the CLI context resolvers. Signed-off-by: Alexey Zhokhov <alexey@zhokhov.com> Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
saved_workspace_match_depthpreviously matched anycwdthat was a subdirectory of the workspaceworkdir. A workspace with a broadworkdir(e.g./Users/me/Projects) would capture every unrelated directory beneath it.jackin consoleto pre-select the wrong workspace andjackin load/jackin hardlineto resolve the wrong workspace when run from an unrelated project directory.cwd == workdir). Mount sources retain prefix matching so subdirectories of mounted host paths continue to be covered. One function, consistent semantics across TUI and CLI.Test plan
cargo test— 961 tests passsaved_workspace_match_depth_rejects_workdir_prefix_only_match: confirms a workspace with a broad workdir is not matched when cwd is an unrelated sibling directory not covered by any mount source (mount src is created on disk so the test proves the exact-match logic, not a silent canonicalize failure)saved_workspace_match_depth_matches_exact_workdir: exact workdir still matchessaved_workspace_match_depth_matches_nested_path_under_mount_src: mount-source prefix match still workscontext.rsmirror the above at thefind_saved_workspace_for_cwdintegration layer🤖 Generated with Claude Code