v1.29.0.0 feat: worktree-aware gbrain code sources via path-hash IDs and CWD pin#1382
Merged
Conversation
Conductor sibling worktrees of the same repo no longer collide on a shared gstack-code-<slug> source ID. /sync-gbrain now derives a path-hashed source ID per worktree, runs gbrain sources attach to write .gbrain-source in the worktree root, and removes the legacy unsuffixed source on first new-format sync to prevent orphan accumulation. Bug fixes surfaced by /codex during /ship: - Silent attach failure now treated as stage failure (no more ok:true while pin is missing → unqualified code-def hits wrong source). - Startup preamble checks .gbrain-source in the cwd worktree, not global state, so an unsynced worktree no longer claims "indexed" because a sibling synced. - Code stage no longer skipped on remote-MCP (Path 4); the early-exit was in the SKILL template, not the orchestrator. - Source registration routes through lib/gbrain-sources.ts only; deleted the near-duplicate ensureSourceRegisteredSync from the orchestrator. Requires gbrain v0.30.0+ (uses sources attach). Phase 0 spike report: ~/.gstack/projects/garrytan-gstack/2026-05-08-gbrain-split-engine-spike.md Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
E2E Evals: ✅ PASS58/58 tests passed | $7.58 total cost | 12 parallel runners
12x ubicloud-standard-2 (Docker: pre-baked toolchain + deps) | wall clock ≈ slowest suite |
gonnabe88
pushed a commit
to gonnabe88/gstack
that referenced
this pull request
May 9, 2026
…and CWD pin (garrytan#1382) * feat: worktree-aware gbrain code sources via path-hash IDs and CWD pin Conductor sibling worktrees of the same repo no longer collide on a shared gstack-code-<slug> source ID. /sync-gbrain now derives a path-hashed source ID per worktree, runs gbrain sources attach to write .gbrain-source in the worktree root, and removes the legacy unsuffixed source on first new-format sync to prevent orphan accumulation. Bug fixes surfaced by /codex during /ship: - Silent attach failure now treated as stage failure (no more ok:true while pin is missing → unqualified code-def hits wrong source). - Startup preamble checks .gbrain-source in the cwd worktree, not global state, so an unsynced worktree no longer claims "indexed" because a sibling synced. - Code stage no longer skipped on remote-MCP (Path 4); the early-exit was in the SKILL template, not the orchestrator. - Source registration routes through lib/gbrain-sources.ts only; deleted the near-duplicate ensureSourceRegisteredSync from the orchestrator. Requires gbrain v0.30.0+ (uses sources attach). Phase 0 spike report: ~/.gstack/projects/garrytan-gstack/2026-05-08-gbrain-split-engine-spike.md Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore: bump version and changelog (v1.29.0.0) Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <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
Conductor sibling worktrees of the same repo no longer collide on a shared
gstack-code-<slug>source ID./sync-gbrainderives a path-hashed source IDper worktree, runs
gbrain sources attachto write.gbrain-sourcein theworktree root (kubectl-style CWD context), and removes the legacy unsuffixed
source on first new-format sync.
Bug fixes (surfaced by
/codexadversarial review during/ship):lib/gbrain-sources.tsonly (deleted the orchestrator's near-duplicate)Requires gbrain v0.30.0+. Spike report:
~/.gstack/projects/garrytan-gstack/2026-05-08-gbrain-split-engine-spike.md.Test Coverage
Pre-Landing Review
No critical issues found in the diff (no SQL/data safety, no LLM trust boundary, no auth surfaces touched). All 3 codex adversarial findings auto-fixed before commit:
ok:falsewith reason.gbrain-sourcein cwd, not global stategstack-code-<slug>source removed on first new-format syncPlan Completion
All applicable items DONE:
--dbabsent,sources attachis the routing primitive)ensureSourceRegisteredSyncduplicate (Codex Feedback #12)gbrain sources attachstep.gbrain-sourcein.gitignore⏭️ Codex #14 detect-layer extension, #15 schema migration, tests #24-28: N/A — original plan was architected for Option A (per-worktree HTTP serve + project-scoped MCP namespace) which the spike invalidated. Option B (CLI via Bash) doesn't have the surfaces those tests covered.
TODOS
No TODO items completed in this PR.
Test plan
bun test test/gstack-gbrain-sync.test.ts test/gbrain-sources.test.ts test/gen-skill-docs.test.ts→ 408 pass / 0 failbun build --target=bun bin/gstack-gbrain-sync.tssucceedsgen:skill-docs --host all --dry-runreports 0 STALEgbrain sources attachwrites.gbrain-sourcein worktree,git check-ignorematches the new entry/sync-gbrain --fullin this worktree — full reindex of 53K LOC takes ~25-35 min; user runs when convenient🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.