fix(claude-ops): spell both sides of the $HOME exclusion the same way - #1983
Conversation
The exclusion keeping $HOME out of project context compared `pwd -W`'s native path against $HOME exactly as the environment carried it. Those are one directory in two spellings, and an MSYS mount alias has no drive letter for the normalizer to reconcile, so `/tmp/x` never matched the `C:/...` reported for it. The exclusion silently failed, $HOME became PROJECT_ROOT, and $HOME/.claude/settings.json was read as the project map — duplicating the user map, which is the one outcome the block exists to prevent. Both sides now go through `pwd -W` before normalization. Normalizing harder was not an option: the two inputs disagreed before the normalizer saw them. The existing test case already covered this and was already red; it is green now. Its comment records that the case is load-bearing only on Git Bash — on a POSIX runner both spellings agree, so it passes there whether or not the exclusion works, which is why CI never caught this. Closes #1982 Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Claude finished @kyle-sexton's task in 2m 40s —— View job Claude finished @kyle-sexton's taskTodo list
ReviewThe fix is correct and the reasoning in the code/CHANGELOG holds up. Traced through Test coverage gap (worth flagging, not blocking): confirmed via Minor nit: Everything else checks out: CHANGELOG entry follows the existing (dateless) |
|
Claude finished @kyle-sexton's task in 44s —— View job Security review complete
Scope: the 4 files changed in this PR — No security issues found. Notes from the review (informational, not findings):
No |
|
Claude has reviewed this PR 2 times. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1414ac415
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Review found the inverse failure in the first fix: an exported `cd` function that returns success WITHOUT changing directory makes `$HOME` resolve to the cwd, so every corroborated non-git project compares equal to $HOME and loses both its project settings and its currentProject marker. Reproduced. `builtin cd` / `builtin pwd` on both sides, which is the discipline this script already applies to its own directory resolution and to `source` — the header's environment-trust boundary note covers what that does and does not defend. `cwd_native` gets the same treatment for the same reason. Adds the regression test, which fails without the builtin prefix. Unlike the $HOME-exclusion case it sits beside, this one is load-bearing on every platform: the failure is the shadow being honoured, not a path-spelling mismatch. Its fixture derives projectPath through `pwd -W` like the non-git-project case above it, since a record built from the MSYS path could never match what the script resolves and the case would report `false` either way. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
Claude finished @kyle-sexton's task in 1m 24s —— View job Security review completeTodo list
Scope: all 4 files changed in this PR — No security issues found.77b90a8 fixes a real trust-boundary gap, and fixes it completely. The prior commit's The fix now routes every The new regression test at Other notes (informational, not findings):
|
|
Claude finished @kyle-sexton's task in 2m 50s —— View job Code review (post-77b90a8)Todo list
This lane covers correctness/architecture/tests/maintainability; security aspects of the CorrectnessTraced both fixes end-to-end against the diff at
Test coverageManually traced the new case at
This case is POSIX-runnable and load-bearing on every platform (unlike the adjacent Maintainability / CHANGELOG
CaveatSandboxed No correctness issues found. The fix is symmetric, the shadow-hardening is complete across the file, and the new regression test is a real (not just documentary) safety net. |
…-reduction Resolves the version-line collisions this branch's 16-plugin lib bump has with three PRs that landed on main first (#1974 guardrails, #1981 session-flow, #1983 claude-ops). - guardrails: main released 0.19.1 (#1974's PowerShell sink fixes), so the shared-lib entry re-heads as 0.19.2. - claude-ops: main released 0.27.2 (#1983's $HOME spelling fix, which also escaped the manifest's em-dashes), so the shared-lib entry re-heads as 0.27.3 and the manifest keeps main's escaped description. - Both changelogs keep BOTH entries, each under its own version. Gates: sync-hook-utils.sh --check (all 16 copies match) and --check-bump origin/main (lib changed and every carrying plugin bumped) both pass. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
fleet-state.shexcludes$HOMEfrom project context, because that directory isUSER scope and reading
$HOME/.claude/settings.jsonas the project mapduplicates the user map. The exclusion did not hold.
It compared the native path
pwd -Wreports against$HOMEexactly as theenvironment carried it — one directory, two spellings. An MSYS mount alias has no
drive letter for the normalizer to reconcile, so
$HOME=/tmp/xnever equalled theC:/Users/…/Temp/xreported for the same place.PROJECT_ROOTwas then set to$HOMEand the duplication happened silently.Both sides now go through
pwd -Wbefore normalization. Normalizing harder couldnot have fixed it: the two inputs disagreed before the normalizer saw them.
Changes
fleet-state.sh: derive the$HOMEside of the comparison throughpwd -W(falling back to
pwd, then to$HOME), with the reasoning recorded at the site.fleet-state.test.sh: record that the existing case is load-bearing only onGit Bash — on a POSIX runner both spellings already agree, so it passes there
whether or not the exclusion works.
claude-ops0.27.1 → 0.27.2 with a matching CHANGELOG entry.Closes #1982
Why CI never caught it
plugin-gateruns onubuntu-24.04, where$HOMEandpwdagree, so the casepasses regardless. It was found by a local full-suite sweep and split out of
#1972, which flagged it as a different root cause from that ticket's two ruff
failures.
Related
churn with a separate root cause and are not touched here.
Test plan
currentProjectwasfalse, is nownullfleet-state.test.sh— 34 cases, 0 failed (was 34 / 1 failed)shellcheck -xon the changed script — cleanscripts/check-shell-portability.sh— no unexcused GNU-only constructsscripts/check-changelog-parity.sh --check-bump— PASSscripts/validate-plugins.sh— PASSmarkdownlint-cli2on the CHANGELOG — 0 issues