Skip to content

v1.91.126.0 fix(brain-sync): hold case-colliding artifact paths instead of reporting ok (#3220) - #3254

Merged
capy-ai[bot] merged 10 commits into
mainfrom
fix/3220-case-collision-hold
Oct 17, 2026
Merged

capy-ai[bot] merged 10 commits into
mainfrom
fix/3220-case-collision-hold

Conversation

@garrytan

Copy link
Copy Markdown
Owner

Fixes #3220. Lands the case-collision detector from #3223 by @Kkkkkuro, as his own narrowed version in #3245 (both of his commits cherry-picked with his authorship), and changes what it does on a collision: brain-sync now holds the colliding paths instead of halting the whole sync. The writer-lease system from #3223 is not part of this PR.

The bug

gstack files per-project state under projects/<slug>/, and slugs keep letter case. When the artifacts repo tracks two spellings of one project (projects/Example_Workspace/ and projects/Example_workspace/, for example from a case-sensitive Linux producer), a Mac or Windows checkout stores them as one file. Before this PR, a write there was staged under the other spelling, pushed, and the sync reported ok. One spelling then stayed modified forever, and other machines read the wrong bucket. Reproduced on a real case-insensitive mount (ciopfs), main 521fd42:

STATUS ok | pushed 2 file(s)
 M projects/Example_Workspace/learnings.jsonl
remote projects/Example_workspace/learnings.jsonl: {"key":"a"} {"key":"b"} {"key":"c","insight":"new on mac"}

The same scenario on this branch:

STATUS collision 1 Example_Workspace,Example_workspace | pushed 1 file(s); 1 file(s) held because their path differs only by letter case ...
remote projects/Example_workspace/learnings.jsonl: {"key":"a"} {"key":"b"}
ARTIFACTS_SYNC: attention: case-collision held=1 names=Example_Workspace,Example_workspace. ... Repair: https://github.com/garrytan/gstack/blob/main/docs/troubleshooting.md#artifact-case-collision. See the paths: <bin> --status

What changes

From #3245 (Kkkkkuro), kept as backstops. After git add, brain-sync checks that exactly the requested paths and bytes reached the index. Before any push (drain start, normal push, merge retry), it refuses a tree that adds a new casefold alias relative to origin/<branch>. Historical aliases stay historical.

Hold, not halt. Before staging, bin/gstack-brain-sync-index.py --hold compares each queued path's prefixes (NFC + casefold) with the index and the batch. A colliding path is never staged, and its queue record stays. Everything else syncs, and the status is collision (or held when the secret scan also holds files), never ok. When exactly one spelling is tracked and the write uses it, that spelling keeps syncing and only the new alias waits. That covers two genuinely different Linux projects MyApp and myapp once one of them is synced. When neither spelling is tracked, both wait.

Telling the user. The status file gains case_held and case_names, both clamped to [A-Za-z0-9._?,-] because repo paths are untrusted. Skill start prints one ARTIFACTS_SYNC: attention: case-collision ... line (a new row in the sync status table) naming the colliding names and the repair anchor. It never blocks and never prints STOP. gstack-doctor warns the same way. --publish-removals now runs the outgoing check before it pushes.

Hot path. The outgoing check's verdict is cached by HEAD's target plus every ref's id (.brain-case-check, removed by gstack-brain-uninstall). On a 3,000-file artifacts repo, the empty-queue --once that skill start runs went from 92 ms to about 110 ms (it was 165 ms uncached). gstack-slug is untouched and still runs about 55 ms on both main and this branch. Nothing new requires python3: without python3 the drain behaves exactly as on main, and slug resolution and skill start never call the helper.

Docs. docs/troubleshooting.md#artifact-case-collision documents the manual repair: pick the spelling, fold the dropped spelling's tracked and held JSONL files (other files are listed for a hand decision), git rm --cached the other spelling, then skip the stale records and re-enqueue. I ran it end to end on Linux and on the case-insensitive mount, and it ended with one spelling, all lines kept, a clean git status and no attention line. docs/gbrain-sync-errors.md and docs/gbrain-sync.md list the new row and status. No result code was added: these attention lines use the brain-sync status table contract, not the workflow (CODE) contract.

Tests

  • #3220: a write into a tracked case-colliding project is held... and a tracked spelling keeps syncing while only the new case alias is held fail on main and on fix(brain-sync): verify staged content and reject new casefold collisions #3245 alone, and pass here.
  • publish-removals refuses... and the cached outgoing verdict is re-checked when the remote baseline moves fail on the first hold commit and pass here.
  • Negative control: without a collision, the status carries empty case fields and skill start prints no case line.
  • fix(brain-sync): verify staged content and reject new casefold collisions #3245's cases were updated to the hold behavior. The skill-start status-table fixture gained the case-collision row. The doctor test covers collision and a historical collision.
  • test/brain-sync.test.ts and test/gstack-skill-start.test.ts are already excluded from the Windows subset (POSIX spawns). test/gstack-doctor.test.ts stays Windows-curated.

Out of scope: the writer-lease system, slug normalization or migration, and automatic repair of existing collisions.

Credit: @Kkkkkuro found and fixed the core of this in #3223 and #3245. The follow-up commits carry Co-authored-by for him.

Open in Capy

Kkkkkuro and others added 6 commits October 17, 2026 16:55
Refuse missing or unrelated staged paths and stale indexed content without consuming the queue or resetting the index.
Check component prefixes in requested/index and outgoing trees, including retained commits and fetch/merge retries. Preserve historical aliases, local commits, index, and queue on refusal.
#3220)

Builds on Kkkkkuro's staged-index and casefold checks (#3245, from #3223).
A queued path whose spelling differs only by letter case from another path
in the index or the batch is held before staging: it stays queued, every
other file keeps syncing, and the status is "collision" rather than "ok".
An established spelling keeps syncing; only the new alias waits.

Skill start prints one ARTIFACTS_SYNC attention line naming the colliding
names and the repair anchor (docs/troubleshooting.md#artifact-case-collision);
gstack-doctor warns the same way. The outgoing check is cached by HEAD so
the empty-queue drain at every skill boundary stays near main's cost.
gstack-slug and skill start's slug path are unchanged.

Co-authored-by: Kkkkkuro <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
- Windows: write the held-path list with LF and strip CR from helper output,
  so CRLF cannot let a held path through or blank case_names.
- --publish-removals runs the outgoing case check before it pushes.
- The cached outgoing verdict is keyed by every ref, not HEAD alone, so a
  moved remote baseline is re-checked.
- The repair snippet folds only JSONL logs and lists snapshots and other
  files for a manual decision.

Co-authored-by: Kkkkkuro <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
- The repair loop also folds the dropped spelling's untracked (held) files
  and says to check for leftovers before removing the folder on Linux.
- The cached outgoing verdict also keys on HEAD's symbolic target.
- The outgoing check no longer needs a temp file, so a failed mktemp can
  no longer skip it.

Co-authored-by: Kkkkkuro <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

E2E Evals: ✅ PASS

[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 108/108 · behavior 0/0 · judge 24/24 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 8m39s · cost $90.94 known + 54 of 132 trial(s) cost unknown

121 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $90.94 rule/judge cost | reconcile exit: 0

Profile: pr / mode dependents; selected behaviors: 108, judges: 24. Deferred to scheduled/release coverage: 138 behaviors and 0 changed prompt files. Deferred checks did not run and receive no PR-pass credit.

Derived dependents (scripts/pr-dependencies.ts):

  • bin/gstack-brain-sync: 246 case(s), 24 judge(s)
  • bin/gstack-brain-uninstall: 230 case(s), 24 judge(s)
  • bin/gstack-doctor: 246 case(s), 24 judge(s)
Rule and judge shards
Shard Automated result Manual/unscored Executed Reused Status Cost
e2e/skill-e2e-workflow 4/4 0 4 0 ✅ $3.23
e2e-deploy/skill-e2e-deploy--land-and-deploy-workflow 1/1 0 1 0 ✅ $1.4
e2e-safety-codex-consult/skill-e2e-safety-codex-consult 1/1 0 1 0 ✅ $0.82
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-stale-before 1/1 0 1 0 ✅ $1.22
e2e-review-attribution/skill-e2e-review-attribution 3/3 0 3 0 ✅ $0.93
e2e/skill-e2e-shared-libs--shared-libs-review-lifecycle 1/1 0 1 0 ✅ $2.64
e2e-qa-workflow/skill-e2e-qa-workflow--qa-quick 1/1 0 1 0 ✅ $1.44
e2e/skill-e2e-shared-libs-paths--shared-libs-review-prior-coverage 1/1 0 1 0 ✅ $2.72
e2e/skill-e2e-ship-skip 1/1 0 1 0 ✅ $0.56
e2e-qa-callers/skill-e2e-qa-callers--review-exploratory-small-cli 1/1 0 1 0 ✅ $1.87
e2e/skill-e2e-test-value 3/3 0 3 0 ✅ $2.41
e2e-qa-workflow/skill-e2e-qa-workflow--qa-only-no-fix 1/1 0 1 0 ✅ $1.66
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-plan-checks 1/1 0 1 0 ✅ $1.85
e2e/skill-e2e-shared-libs--shared-libs-review-revalidation 1/1 0 1 0 ✅ $5.06
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-recovery 1/1 0 1 0 ✅ $0.97
e2e-review/skill-e2e-review 2/2 0 2 0 ✅ $1.19
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-failure 1/1 0 1 0 ✅ $1.9
e2e-skillify/skill-e2e-skillify 3/3 0 3 0 ✅ $2.59
e2e/skill-e2e-shared-libs-paths--shared-libs-review-path-eligibility 1/1 0 1 0 ✅ $4.07
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-current 1/1 0 1 0 ✅ $3.3
llm-judge/skill-llm-eval 24/24 0 24 0 ✅ $1.44
e2e/skill-e2e-coverage-audit 2/2 0 2 0 ✅ $0.86
e2e-deploy/skill-e2e-deploy--setup-deploy-workflow 1/1 0 1 0 ✅ $0.34
e2e-review-army/skill-e2e-review-army--review-army-perf-n-plus-one 1/1 0 1 0 ✅ $0.94
e2e/skill-e2e-shared-libs-paths--shared-libs-review-index-flags 1/1 0 1 0 ✅ $2.56
e2e/skill-e2e-investigate-owned-completion 1/1 0 1 0 ✅ $0.23
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-late-result 1/1 0 1 0 ✅ $0.93
e2e-review-army/skill-e2e-review-army--review-army-json-findings 1/1 0 1 0 ✅ $0.2
e2e-deploy/skill-e2e-deploy--benchmark-workflow 1/1 0 1 0 ✅ $0.58
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-small-cli 1/1 0 1 0 ✅ $1.86
e2e-learnings/skill-e2e-learnings 1/1 0 1 0 ✅ $0.24
e2e-deploy/skill-e2e-deploy--land-and-deploy-review-gate 1/1 0 1 0 ✅ $1.19
e2e-review-army/skill-e2e-review-army--review-army-migration-safety 1/1 0 1 0 ✅ $1.01
e2e/skill-e2e-shared-libs--shared-libs-read-only 1/1 0 1 0 ✅ $1.08
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-stale-after 1/1 0 1 0 ✅ $1.11
e2e-deploy/skill-e2e-deploy--land-and-deploy-first-run 1/1 0 1 0 ✅ $0.8
e2e-docsync-spawned/skill-e2e-docsync-spawned 1/1 0 1 0 ✅ $1.16
e2e-qa-functional-fix/skill-e2e-qa-functional-fix 2/2 0 2 0 ✅ $3.14
e2e/skill-e2e-plan--plan-review-report 1/1 0 1 0 ✅ $1.05
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-unavailable 1/1 0 1 0 ✅ $1.86
e2e-retro/skill-e2e-retro 1/1 0 1 0 ✅ $1.11
e2e-qa-functional/skill-e2e-qa-functional 2/2 0 2 0 ✅ $2.17
e2e-qa-callers/skill-e2e-qa-callers--ship-exploratory-late-input 1/1 0 1 0 ✅ $2.11
e2e-cso/skill-e2e-cso 1/1 0 1 0 ✅ $1.35
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-store 1/1 0 1 0 ✅ $3.71
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-completion 1/1 0 1 0 ✅ $3.42
e2e-design/skill-e2e-design--design-review-detector-shim-dom 1/1 0 1 0 ✅ $0.6
e2e/skill-e2e-shared-libs--shared-libs-unsupported-git 1/1 0 1 0 ✅ $0.65
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-missing-asset 1/1 0 1 0 ✅ $1.29
e2e-review-army/skill-e2e-review-army--review-army-quality-score 1/1 0 1 0 ✅ $0.39
e2e-safety-ship-evidence/skill-e2e-safety-ship-evidence 1/1 0 1 0 ✅ $0.61
e2e-hermetic/skill-e2e-hermetic-canary 2/2 0 2 0 ✅ $0.03
e2e-design/skill-e2e-design--design-review-plugin-handoff 1/1 0 1 0 ✅ $0.52
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-missing-marker 1/1 0 1 0 ✅ $0.5
e2e-browse/skill-e2e-bws 6/6 0 6 0 ✅ $0.85
e2e-third-party-actions/skill-e2e-third-party-actions 5/5 0 5 0 ✅ $1.21
e2e-plan-tune/skill-e2e-plan-tune 1/1 0 1 0 ✅ $0.45
e2e-session-intelligence/skill-e2e-session-intelligence 4/4 0 4 0 ✅ $0.74
e2e-safety-pair-agent/skill-e2e-safety-pair-agent 1/1 0 1 0 ✅ $0.35
e2e-design/skill-e2e-design--design-review-detector-shim 1/1 0 1 0 ✅ $0.36
e2e-qa-workflow/skill-e2e-qa-workflow--qa-bootstrap 1/1 0 1 0 ✅ $0.22
e2e-triage/skill-e2e-triage 1/1 0 1 0 ✅ $0.45
e2e/skill-e2e-ship-hook-consent 2/2 0 2 0 ✅ $0.68
e2e-review-army/skill-e2e-review-army--review-army-delivery-audit 1/1 0 1 0 ✅ $0.3
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-timeout-unsettled 1/1 0 1 0 ✅ $0.55
e2e/skill-e2e-ship-hook-refresh 1/1 0 1 0 ✅ $0.25
e2e/skill-e2e-investigate-owned-termination 2/2 0 2 0 ✅ $0.51
e2e-ship-docsync/skill-e2e-ship-docsync--ship-docsync-launch-failure 1/1 0 1 0 ✅ $0.47
e2e-deploy/skill-e2e-deploy--canary-workflow 1/1 0 1 0 ✅ $0.34
e2e-design/skill-e2e-design--plan-design-review-no-ui-scope 1/1 0 1 0 ✅ $0.34
Fail-closed reconciliation
8s  test/skill-e2e-qa-callers.test.ts#ship-exploratory-small-cli
  slice 12  passed            166s  test/skill-e2e-shared-libs-paths.test.ts#shared-libs-review-index-flags
  slice 12  passed            132s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-late-result
  slice 12  passed             84s  test/skill-e2e-deploy.test.ts#benchmark-workflow
  slice 12  passed            128s  test/skill-e2e-review-army.test.ts#review-army-perf-n-plus-one
  slice 12  passed             29s  test/skill-e2e-plan-ceo-plan-mode.test.ts
  slice 12  passed             36s  test/skill-e2e-investigate-owned-completion.test.ts
  slice 12  passed             25s  test/skill-e2e-review-army.test.ts#review-army-json-findings
  slice 13  passed            105s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-missing-asset
  slice 13  passed            109s  test/skill-e2e-plan-devex-plan-mode.test.ts
  slice 13  passed             91s  test/skill-e2e-safety-ship-evidence.test.ts
  slice 13  passed             69s  test/skill-e2e-design.test.ts#design-review-detector-shim-dom
  slice 13  passed            116s  test/skill-e2e-shared-libs.test.ts#shared-libs-unsupported-git
  slice 13  passed             53s  test/skill-e2e-office-hours-auto-mode.test.ts
  slice 13  passed             66s  test/skill-e2e-design.test.ts#design-review-plugin-handoff
  slice 13  passed             55s  test/skill-e2e-bws.test.ts
  slice 13  passed             63s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-missing-marker
  slice 13  passed             49s  test/skill-e2e-review-army.test.ts#review-army-quality-score
  slice 13  passed              7s  test/skill-e2e-hermetic-canary.test.ts
  slice 14  passed             76s  test/skill-e2e-third-party-actions.test.ts
  slice 14  passed             47s  test/skill-e2e-plan-tune.test.ts
  slice 14  passed             42s  test/skill-e2e-triage.test.ts
  slice 14  passed             72s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-timeout-unsettled
  slice 14  passed             49s  test/skill-e2e-ask-user-question-format-compliance.test.ts
  slice 14  passed             44s  test/skill-e2e-ship-docsync.test.ts#ship-docsync-launch-failure
  slice 14  passed             46s  test/skill-e2e-session-intelligence.test.ts
  slice 14  passed             50s  test/skill-e2e-ship-hook-consent.test.ts
  slice 14  passed             33s  test/skill-e2e-investigate-owned-termination.test.ts
  slice 14  passed             42s  test/skill-e2e-design.test.ts#design-review-detector-shim
  slice 14  passed             43s  test/skill-e2e-deploy.test.ts#canary-workflow
  slice 14  passed             39s  test/skill-e2e-ship-hook-refresh.test.ts
  slice 14  passed             47s  test/skill-e2e-design.test.ts#plan-design-review-no-ui-scope
  slice 14  passed             27s  test/skill-e2e-review-army.test.ts#review-army-delivery-audit
  slice 14  passed             47s  test/skill-e2e-safety-pair-agent.test.ts
  slice 14  passed             36s  test/skill-e2e-qa-workflow.test.ts#qa-bootstrap
  slice 15  passed             26s  test/skill-e2e-learnings.test.ts
  slice 15  passed             24s  test/skill-e2e-diagram.test.ts
[test:paid] collector final outcomes: 121 executed, 0 reused; 121 passed, 0 failed, 0 manual accepted (unscored; no score-cache credit) (121 attempt records from 70 collectors; every record counts)
[test:paid] deselected testcases, zero credit (312):
[test:paid]    298  sibling case of a case shard (its own shard runs it)
[test:paid]      8  periodic-tier case (this lane runs gate)
[test:paid]      6  Bun hook placeholder of a skipped describe block (not a test)
[test:paid] VERDICT GREEN — lane gate/pr, attempt 1
  rule 108/108 · behavior 0/0 · judge 24/24 · quarantined 0 (0 failing the lane)
  SKIPPED 0 · INFRA 0 · INCOMPLETE 0 · unattributed 0 · ACTION REQUIRED 0
  wall 8m39s · cost $90.94 known + 54 of 132 trial(s) cost unknown
[test:paid] report: every planned shard accounted and passed

Sliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry.

garrytan and others added 4 commits October 17, 2026 17:49
The retry merge commits with the ambient identity. CI and Ubicloud runners
have none under the test HOME, so the merge failed before the outgoing case
check ran and the drain reported push_failed instead of error.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@github-actions github-actions Bot changed the title fix(brain-sync): hold case-colliding artifact paths instead of reporting ok (#3220) v1.91.126.0 fix(brain-sync): hold case-colliding artifact paths instead of reporting ok (#3220) Oct 17, 2026
@capy-ai
capy-ai Bot merged commit 4e4f295 into main Oct 17, 2026
69 checks passed
garrytan added a commit that referenced this pull request Oct 19, 2026
… todo; drop host-renders-prune

The 2026-10-19 weekly recording put test/brain-sync.test.ts at 89s (#3254's
case-collision suite) and test/setup-codex-scope.test.ts at 64s, over the 60s
ceiling; test/host-renders-prune.test.ts fell to 57s, so its entry is stale.
Both new entries carry the existing TODOS.md split todo.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
capy-ai Bot added a commit that referenced this pull request Oct 19, 2026
* test(seed): refresh the free-suite duration seeds from the weekly recording

* test(seed): allowlist brain-sync and setup-codex-scope with the split todo; drop host-renders-prune

The 2026-10-19 weekly recording put test/brain-sync.test.ts at 89s (#3254's
case-collision suite) and test/setup-codex-scope.test.ts at 64s, over the 60s
ceiling; test/host-renders-prune.test.ts fell to 57s, so its entry is stale.
Both new entries carry the existing TODOS.md split todo.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* test(seed): classify the seed allowlist as free-only so editing it selects no paid case

Only test/free-seed-ratchet.test.ts reads scripts/free-test-seed-allowlist.json,
but eval selection derived all 246 gate cases from it, so #3289's allowlist
repair paid for a full gate. The new free-fixtures case shows seed data and the
allowlist select nothing, with a negative control: design/src/evolve.ts still
selects its derived dependents. Non-behavioral HARNESS_VERSION decision.

Gate integrity: scripts/test-pr-profile.ts FREE_ONLY_PR_FILES gains one entry.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

* chore: stamp v1.91.147.0

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: garrytan <[email protected]>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

brain-sync: case-colliding project metadata can remain dirty after successful push on macOS

2 participants