Repository navigation
fix(synthesize): report a mid-run change to a watched repo file as observed - #224
Conversation
…served assertRepoUntouched blamed the synthesis harness for any change to a fingerprinted in-repo file, so a concurrent editor in a shared workspace aborted the run with the wrong cause. Name the observation instead, list concurrent writers as a possible cause, and keep the harness attribution only when the repo file now equals the staging copy. Closes kunchenguid#199 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; the earlier fallback issue is fixed. Reviews (3) · Last reviewed commit: "no-mistakes(document): fix: rewrap jsdoc..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6a93b45da5
ℹ️ 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".
| return ( | ||
| fs.readFileSync(path.join(workspace.root, staged), "utf8") === | ||
| fs.readFileSync(path.join(repo.root, file), "utf8") |
There was a problem hiding this comment.
Keep staging and fingerprint in the same snapshot
When another process edits a staged skill after the fingerprint is captured but before withFallthrough rebuilds the workspace, prepareWorkspace copies that concurrent edit into staging. This equality check then marks the skill as wroteThrough and emits the “harness cannot be trusted” hint even if the harness never touched the repository, recreating the false accusation this change is intended to remove. Preserve the fingerprinted originals in the rebuilt workspace or verify the fingerprint before copying live skill contents.
AGENTS.md reference: AGENTS.md:L30-L32
Useful? React with 👍 / 👎.
| try { | ||
| return ( | ||
| fs.readFileSync(path.join(workspace.root, staged), "utf8") === | ||
| fs.readFileSync(path.join(repo.root, file), "utf8") |
There was a problem hiding this comment.
Resolve absolute watched paths before reading them
When project memoryFiles contains an absolute path inside the repository, which resolveMemoryPath accepts, file is absolute but path.join(repo.root, file) prefixes the repository again rather than reading the watched file. The read therefore normally throws and matchesStaging returns false, so even matching repository and staging copies fall through to the generic concurrent-process wording. Resolve absolute keys the same way repoFingerprint does.
Useful? React with 👍 / 👎.
|
Speaking as Kun's firstmate: thanks @jadhavgaurav, this is the right shape for #199. The abort stays, and the harness is only blamed when the repo file matches the staging copy. I reviewed the diff and approved CI for this fork, so the checks are running now. This is waiting on you. Codex left two findings on
A regression test for each would be great. CI and the no-mistakes check also need to be green. contract-class: restore. The unconfigured run still aborts the same way; only the error now names what was observed, which Failure is loud and named already promises. VISION per-rule (main
|
…g copy A skill another process edits after the fingerprint but before the workspace is rebuilt was copied into staging, so the later equality check named the harness for a change it did not make. Point each staged skill's fingerprint at the text its staging copy was built from. An absolute in-repo memory path was read as repo.root joined with the absolute path, so a real write-through got the softer wording. Resolve fingerprint keys the same way repoFingerprint does. Closes kunchenguid#199 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
|
Thanks. Both findings are fixed in fd7ec5b, with a regression test each. Greptile then raised a P1 on that commit (below); ea983f1 fixes it and the head is now 2b60f7e, which adds only a comment rewrap from the pipeline.
With only the src change of each follow-up reverted, the tests for the findings fail and the control passes. |
…ding The fingerprint is re-pointed at the rebuilt staging copy so a concurrent edit made before the first harness runs is not blamed on it. A candidate after the first runs behind a harness that may have written to the repository, and rebuilding over that write would hide it. Check the repository first on every attempt after the first. Closes kunchenguid#199 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
|
Speaking as Kun's firstmate: thanks @jadhavgaurav, this looks good. I reviewed This is waiting on you for one last thing: live evidence. So far everything ran against the fake acpx. Could you run a real synthesis with a real harness and, while it's running, edit a staged skill in the repo from another shell? Please post what the run prints. The useful cases are an edit after the workspace is built (it should abort and name the change as observed, without blaming the harness) and, if you can manage it, an edit that lands before the rebuild (the run should treat it as the starting text and carry on). If you can't get the timing, just say so and we'll work out next steps. Once that's posted, this is ready to merge. contract-class: restore. The unconfigured run still aborts the same way on a mid-run change; only the error now names what was observed, which "Failure is loud and named" already promises. VISION per-rule (main
|
|
Live run against a real harness, on head Setup
Case (a): edit after the workspace is built Command (synthesis pinned so the trigger is unambiguous): The script edited the skill the moment the first synthesis edit prompt process ( backpass output after the edit turn finished: Afterwards Case (b): edit before the rebuild The fingerprint is taken before Command: The script edited the skill as soon as the first backpass output: The staged copy was rebuilt from the edited text (first seen at 08:09:57.249, right after the probe session closed), no abort, no harness blame, exit 0, and the run produced a proposal. The repo skill still held the appended line at the end of the run. Not shown
|
|
Speaking as Kun's firstmate: thanks @jadhavgaurav for the careful live runs. Case (a) aborted and named the file as changed in the repository without blaming the harness, and case (b) took the pre-rebuild edit as the starting text and produced a normal proposal, which is exactly what this PR promises. Being upfront about what you couldn't exercise is appreciated. Head contract-class: restore. The unconfigured run still aborts the same way on a mid-run change; only the error now names what was observed, which "Failure is loud and named" already promises. VISION per-rule (main
|
|
Speaking as Kun's firstmate: this is merged. Thank you @jadhavgaurav — really appreciate you taking the time on this. |
* fix(acpx): treat a model the adapter turns down as model-unavailable (kunchenguid#219) When the Claude ACP adapter rejects the requested model after session/new, acpx prints `Failed session/set_config_option for model "<id>": Invalid value for config option model` and exits 1. classifyAcpxFailure did not recognize that line, so openSession reported "has no session support" and an analysis pass with an effort stopped with "its acpx adapter does not support sessions - upgrade acpx or omit the effort override", although sessions worked and acpx was current. Seen with acpx 0.19.6, claude-agent-acp 0.81.2 and a Claude Code build whose advertised model list predates the pinned model. The classifier now reads that line as model-unavailable, the verdict kunchenguid#185 gave "does not support this model": a pinned pass names the model, and an auto-picked one falls through to the next candidate. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * chore(main): release backpass 0.1.37 (kunchenguid#222) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(workspace): keep VCS internals and binary files out of the staging copy (kunchenguid#220) * fix(workspace): keep VCS internals and binary files out of the staging copy prepareWorkspace walked every skill directory whole, so a skill checked out with its own .git, or one that ships compiled tools, was copied into .backpass/synthesis/ and read into `originals` as utf-8 text. On a 1.7 GB user skills directory (one skill carried a 173 MB object store and six ~82 MB executables) synthesis exhausted Node's 4 GB heap while building the staging copy, before the edit turn opened, and the process died with exit 134. The walk now prunes `.git`, `.hg` and `.svn` without descending into them, and a file whose first 8,000 bytes hold a NUL (git's own binary test) is not staged. Both are named in `unstageable` with their reason, so nothing is dropped silently. A binary read as utf-8 was never a faithful original, and no text edit applies to it. Supporting text files such as notes.txt are still copied whole. Fixes kunchenguid#75. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * no-mistakes(ci): Fixed ci-1 in src/workspace.js. The invariant is that nothing synthesis writes is silently dropped. measureWorkspace now passes a collector to its walkFiles call, so VCS entries (.git, .hg, .svn, directories or a .git file) that the walk prunes are reported in `stray`. The reason is a new named constant, STRAY_VCS: "synthesis wrote version-control internals, which are never carried or applied". Staging never copies a VCS entry, so any one found at measure time was written during synthesis. Pruning in walkFiles is unchanged: those entries are still never descended into or copied. Paths are named the way other stray notes are, mapped back to the logical repo path. To do that I pulled the existing mapping lookup and logical-path code into two small local helpers, `mappingFor` and `logicalFor`, which the normal stray loop now uses too. Binary files, confinement reasons and the other stray rules are untouched, and I added no tests. Checks: eslint and tsc are clean and prettier --write was applied. I ran test/workspace.test.js, test/synthesize.test.js and test/synthesis-cli.test.js: the same 46 tests fail before and after the change (compared by name). The ones I looked at fail with EPERM on fs.symlink, the Windows host limit noted in the intent. A one-off script confirmed the behaviour: prepareWorkspace still reports `.agents/skills/foo/.git` as unstageable, measureWorkspace shows no stray before a write, and after writing `.agents/skills/foo/.git/config` and a root `.git` file it reports both in `stray` with STRAY_VCS and zero changes --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> * chore(main): release backpass 0.1.38 (kunchenguid#223) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: run first Claude analysis call alone before fan-out (kunchenguid#226) * fix(analyze): run the first Claude analysis call alone before the fan-out At --jobs above 1 the first wave of analysis calls each starts with its own short-lived 'sessions new' helper. When Claude's OAuth token is due, one helper takes .oauth_refresh.lock and exits before the refresh ends, so every parallel session then fails with 'another Claude Code process is refreshing it' and the run dies before analysing anything. With the claude agent, run transcripts one at a time until one has made a model call (a skipped trivial session made none), so a due refresh finishes inside a single long-lived process, then fan out. Other agents keep the full fan-out. This is not a retry: nothing is re-run. Closes kunchenguid#203 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> * no-mistakes(review): Fix warm-up to detect model-call attempts, not failure vs skip * no-mistakes(document): Fix no-useless-assignment lint error in analyze.js warm-up loop * no-mistakes(review): Fix outcome overwrite when writeEvidence throws after model call succeeds * no-mistakes(document): Format new warmup test file; no stale docs found * no-mistakes(ci): Addressed the Greptile finding (ci-1) in test/analyze-claude-warmup.test.js: the existing warm-up tests never exercised a failed first model call, so `err.modelCallAttempted` had no coverage. Added a new test case plus a corresponding branch in the fake acpx fixture: a session id starting with "fail" now returns unparseable text after the fake prompt call (a genuine model-call attempt that fails analysis afterward, not a blank/empty-output case, since a pinned agent turns empty-output into a fatal UserError that would abort the whole run). The new test asserts the failing first call still runs alone (new/prompt/failed, nothing else starts), counts as attempted/failed, and the remaining calls then run together (overlapping prompts) and succeed. Ran `pnpm run check` (lint, format:check, typecheck, full test suite — 956 tests) with zero failures --------- Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> * chore(main): release backpass 0.1.39 (kunchenguid#228) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: deduplicate symlinked skills in the analysis index (kunchenguid#231) * fix(skills): dedupe the analysis index by realpath List each shared skill file once in analysis prompts while preserving every loaded entry for per-copy budget accounting. Keep distinct same-name skills visible. Closes kunchenguid#202 * no-mistakes(document): Document realpath-deduplicated skill analysis indexing * chore(main): release backpass 0.1.40 (kunchenguid#232) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix(synthesize): report a mid-run change to a watched repo file as observed (kunchenguid#224) * fix(synthesize): report a mid-run change to a watched repo file as observed assertRepoUntouched blamed the synthesis harness for any change to a fingerprinted in-repo file, so a concurrent editor in a shared workspace aborted the run with the wrong cause. Name the observation instead, list concurrent writers as a possible cause, and keep the harness attribution only when the repo file now equals the staging copy. Closes kunchenguid#199 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> * fix(synthesize): keep the fingerprint in step with the rebuilt staging copy A skill another process edits after the fingerprint but before the workspace is rebuilt was copied into staging, so the later equality check named the harness for a change it did not make. Point each staged skill's fingerprint at the text its staging copy was built from. An absolute in-repo memory path was read as repo.root joined with the absolute path, so a real write-through got the softer wording. Resolve fingerprint keys the same way repoFingerprint does. Closes kunchenguid#199 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> * fix(synthesize): report a write by an earlier candidate before rebuilding The fingerprint is re-pointed at the rebuilt staging copy so a concurrent edit made before the first harness runs is not blamed on it. A candidate after the first runs behind a harness that may have written to the repository, and rebuilding over that write would hide it. Check the repository first on every attempt after the first. Closes kunchenguid#199 Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> * no-mistakes(document): fix: rewrap jsdoc comment, clean lint/format/typecheck --------- Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> --------- Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com> Co-authored-by: Daniel Martinez Morales <4965968+dmmdea@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Gaurav Vijay Jadhav <gaurav.vjadhav01@gmail.com> Co-authored-by: FocalFactotum <305704917+FocalFactotum@users.noreply.github.com>
Intent
Fix issue #199: when a concurrent process edits a watched in-repo memory or skill file during synthesis, assertRepoUntouched (src/synthesize.js) reports "synthesis changed X in the repository directly instead of the staging copy" and says the harness cannot be trusted. Name what was observed ("X changed in the repository during synthesis"), mention concurrent editors as a possible cause, and keep attributing to the harness only when the repo file now equals the staging copy. The abort itself stays. Closes
#199.What Changed
assertRepoUntouched(src/synthesize.js) now reports a changed watched file as "X changed in the repository during synthesis" instead of asserting the synthesis harness wrote it directly.assertRepoUntouchednow takes the workspace object instead of just its root path, so it can compare the repository file against the corresponding staged file to determine the match.test/synthesize.test.jsfor the new observed-change wording and the staging-copy comparison logic.rebaseFingerprint(src/workspace.js) points each staged skill's fingerprint at the text the rebuilt staging copy was built from, so a skill another process edits after the fingerprint but before the workspace is rebuilt is no longer read as a harness write-through.repoFilePath(src/workspace.js) resolves a fingerprint key the wayrepoFingerprintdoes, so a memory file configured by absolute in-repo path is read from that path and a real write-through to it keeps the stronger wording.synthesizeProposalchecks the repository against the fingerprint before rebuilding the workspace on every attempt after the first, so a direct write by a candidate that then fell through is reported instead of being absorbed by the rebase.Risk Assessment
✅ Low: The change is a narrowly scoped, well-reasoned fix for two concretely reported races/bugs in synthesis fingerprinting, with regression tests that exercise real observable behavior and correctly reproduce each failure mode; no scope creep, no new subsystems, and existing abort semantics are preserved.
Testing
pnpm run check(eslint, prettier, tsc, 957 tests) passes on ea983f1; the head 2b60f7e adds only a pipeline comment rewrap on top.test/synthesize.test.js: a skill edited by another process between the fingerprint and the workspace rebuild is not blamed on the harness; an edit after the rebuild is still reported even when an earlier one was absorbed; a write-through to a memory file configured by absolute path is still attributed to the harness; a direct write by a candidate that then falls through is reported, not absorbed by the next rebuild.src/change of each follow-up reverted (saved patch,git apply -R), the first and third tests fail (first follow-up) and the fourth fails (second follow-up); the second is a control that passes either way.Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
node --test test/synthesize.test.js-> "a change to a watched repo file during synthesis is reported as observed, not blamed on the harness" passes at HEADnode --test test/synthesize.test.js-> "a repo file that now equals the staging copy is still attributed to the harness" passes at HEADnode --test test/synthesize.test.js-> "a direct write by a candidate that then falls through is reported, not absorbed by the next rebuild" passes at HEAD; the same test fails at base commit 212562…node --test test/synthesize.test.js-> "a skill another process edits after the fingerprint but before staging is rebuilt is not blamed on the harness" and "an edit after the staging rebuild is stil…node --test test/synthesize.test.js-> "a write-through to a memory file configured by absolute path is still attributed to the harness" passes at HEAD; fails at base commitnode --test test/synthesize.test.js (27/27 pass at target commit ea983f1)node --test test/synthesize.test.js against src/synthesize.js and src/workspace.js reverted to base commit 2125624 to confirm the new regression tests fail pre-fixgit checkout HEAD -- src/synthesize.js src/workspace.js to restore the worktree to the target commit (verified clean via git status)✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.
Issues
Closes #199