Landing blocker for #61 and #63: the deployment checkout is 12 commits behind and `merge --ff-only` refuses while tracked paths are dirty. Discard is not available here (workspace policy: no `checkout`/`stash` on shared state), so the dirt is committed. - `agent/APPEND_SYSTEM.md`: the point-of-use / one-work-log / PR-link doctrine, already byte-identical to `origin/main` (`cmp` against the trunk blob: no difference). No new prose — the commit exists so the trunk merge can proceed. - `agent/config.yml` and `agent/managed-skills/**`: the machine-live tier the heartbeat owns (AGENTS.md § Live-sync tiers). `ALLOW_SECRETS=1` was used, deliberately and after auditing the staged diff by hand: the only credential-shaped strings in it are two copies of `AKIA0000000000000EXAMPLE` — the inert all-zero AWS example id — and they appear inside the two skill pages that teach that exact placeholder shape. This checkout is still running the pre-#61 hook; the merged gate (value-scoped placeholder filter, `71601f7`) exempts this value, so the refusal dies with this landing. No `--no-verify` was used: the gate ran and its verdict is recorded here. Refs #61
2.4 KiB
name, description
| name | description |
|---|---|
| omp-worktree-path-gotchas | Multi-worktree edits/tests land in the wrong checkout: bash persistent-cwd drift, phantom file reverts, which tree a tool really touched |
Purpose
Answer "why did my file/tests revert or behave differently than what I just wrote?" in repos with several worktrees (e.g. ~/.omp, ~/Projects/wt-*, ~/.omp/wt/*).
Failure modes and fixes
-
Bash tool persistent-cwd drift (the expensive one): the persistent shell keeps its cwd across calls; a call without an explicit
cwdruns in whatever the previous call left, which after interleaved work may be a DIFFERENT worktree. Result: reads/greps/appends hit tree A whilegit/batshit tree B — symptoms are "file keeps reverting to HEAD", duplicate test names at shifting line numbers, scenarioCALLS 0for scenarios that exist, mismatchedgrep -nvs tool-reported line numbers.- Diagnose:
pwdin the same call as the failing command;wc -l <file>in BOTH candidate worktrees; compare md5s. The file is not flapping — two files exist and commands alternate between them. - Fix/prevent: pass an explicit
cwdon EVERY bash call once two or more checkouts are in play; never trust a read taken without one as evidence about "the" file.
- Diagnose:
-
Symlinked or stale
gitstate:git statusin a worktree shows a clean tree while the disk file differs from what you intended — the corruption is already committed. Audit committed blobs (git log --oneline -- <file>; per-commitgit show <c>:<path> | grep -c <sentinel>) instead of re-reading the disk copy repeatedly. -
Same-name files across worktrees (
tests/behavior.batsexists in each): afind/greprooted above the worktrees mixes copies; anchor the search path to one worktree root.
Repair recipe for a corrupted-but-committed test file
- Inventory both versions:
grep -o '@test "[^"]*"' | sortandgrep -o 'case "[a-z]*":' | sort -u;commthe sets to find lost scenarios and duplicate tests. - Rebuild from the committed copy (
git show HEAD:<path> > <path>, no checkout), then re-apply only the true deltas: restore missing scenario blocks from the last clean base, dedupe imports, rename scratch-dir mkdtemp prefixes that collide with a test's own orphan-census glob (e.g.dankvoice-stage-matchingdankvoice-*). - Re-run the targeted tests, then the full suite single-process.