Repository navigation
Advance the gbrain worktree at the end of every sync, after its commit (#2516 follow-up) - #4179
extremenelson wants to merge 5 commits into
Conversation
…garrytan#2516) gstack-brain-sync --once moved ~/.gstack-brain-worktree forward at the start of the drain, before the drain's own commit, and at most once per 24h. gbrain therefore always indexed a snapshot that was missing the artifacts gstack had just published, often for more than a day. The advance now runs from the EXIT trap, after the commit and any merge from the remote, whenever the worktree is behind. An interrupted drain (INT/TERM) skips it. An advance that leaves the worktree behind (an error, or a refusal such as local changes) warns and records ~/.gstack/.brain-worktree-advance-failed, which holds further attempts for 24h so the warning does not repeat at every skill start; a successful advance clears it. gstack-brain-uninstall removes the new stamp along with the old .brain-worktree-last-advance. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…arrytan#2516) Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…oice is needed The auth status of gh and glab only feeds the "which git host?" choice, which runs when there is no --remote, no existing remote and no --host. init still asked both CLIs every time, and `glab auth status` with no glab config blocks for ~30s on some machines. Every `init --remote` paid that wait, including each test that sets up an artifacts repo, which pushed those tests past their 30s timeout. The checks now run inside the branch that makes the choice. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
|
Thanks @extremenelson, the before/after makes this clear. On main at 119ed92 the brain-worktree advance runs near the start of the drain and at most once per 24 hours, so gbrain misses what that drain just committed. We're picking this up for a crew rewrite on current main, crediting you as co-author. It touches |
|
Following up: we're taking this. Advancing the brain worktree before the drain's own commit leaves gbrain a drain behind on every new learning and plan. It will be rebuilt on current main with you credited as co-author, and this PR will be closed with a link when it lands, after November 21. |
|
Thank you for this. We're picking up the idea. A maintainer agent working through a batch of fixes (our tracking thread GSTA-804) will first reproduce the problem on current main. If it reproduces, the agent rebuilds the fix on main with you credited as co-author, because we don't merge outside branches directly, and we'll close this PR with a link when it lands. If it no longer reproduces, we'll close this and say what changed. |
…west timeline rows (#4685) `/sync-gbrain` and `gstack-decision-search --semantic` now find a brain host's artifacts source through `GSTACK_BRAIN_SOURCE_ID`, planning skills read their product and brand digests from current gbrain, and the brain gets each sync's newest artifacts and timeline rows. Why: five outside reports (#4443, #4327, #4265, #4179, #4362), each reproduced on main by a test that fails before this change and passes after it. Nothing to do unless your artifacts source lives outside `~/.gstack-brain-worktree`; then set `GSTACK_BRAIN_SOURCE_ID` to its id. Co-authored-by: Barack-zero-to-one <[email protected]> Co-authored-by: exGeni <[email protected]> Co-authored-by: atharva081106 <[email protected]> Co-authored-by: extremenelson <[email protected]> Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=testing Review-Finding: p1v/outside-voice#2 reader=outside-voice
|
Thank you! We rebuilt the worktree-advance fix on current main in #4685, which is now merged, with you credited as co-author. Every drain now advances the brain worktree after its own commit, and the advance is skipped on drains that refuse a publish. The |
Why (in your own words)
gbrain indexes
~/.gstack-brain-worktree, a detached worktree of~/.gstack. Since #2516 the drain advanced that worktree, but at the start ofgstack-brain-sync --once, before the drain's own commit, and at most once per 24h (~/.gstack/.brain-worktree-last-advance). So the brain was always missing what gstack had just published: a new learning or plan reached gbrain only after a later drain, a day or more afterwards. I hit this on my own machine, where the worktree kept lagging~/.gstackand I had togit checkout --detachit by hand to get new artifacts into search.This PR moves the advance to the drain's EXIT trap, after its commit and any merge from the remote, and drops the 24h window: every drain that finds the worktree behind advances it. An interrupted drain (INT/TERM) skips it. A failed or refused advance (for example a dirty worktree) warns once and holds retries for 24h via
~/.gstack/.brain-worktree-advance-failed, so the warning does not repeat at every skill start; a successful advance clears the hold. The no-force-remove guarantees of--advance-onlyare unchanged.A second, smaller fix rides along:
gstack-artifacts-initaskedgh auth statusandglab auth statuson every run, but only the "which git host?" choice uses the answers. Without a glab config,glab auth statuscan block for ~30s, so everyinit --remotepaid that wait, and the brain-sync tests that set up an artifacts repo sat right on their 30s timeout (most ofbrain-sync.test.tstimed out on my machine, onmainas well). The checks now run only inside the branch that makes the choice.Live evidence
Before/after with the same script: a fresh
HOME,gstack-artifacts-init --remote <bare repo>, a detached brain worktree, one queued learning, onegstack-brain-sync --once.The glab wait, traced with a timestamped
PS4onmain, and timed directly:Tests (macOS, Bun):
Scope
bin/gstack-brain-sync(advance moved to the EXIT trap, 24h throttle replaced by a 24h hold after a failure),bin/gstack-artifacts-init(auth checks only where the host choice is made),bin/gstack-brain-uninstall(removes the new stamp), comments inbin/gstack-gbrain-source-wireup,docs/gbrain-sync.md, tests, changelog fragment.~/.claude/skills/gstackand running a drain against my real~/.gstack(worktree and parent on the same commit, no failure stamp).bun run testsuite; paid evals (eval:bg:pr). I ran only the brain-sync, wireup, artifacts-init, egress, migration and decision suites listed above.Liveness proof (required for external contributors)
Checklist
GSTACK PRtyped live into a real surface) or PR author is@garrytan(owner exemption)🤖 Generated with Claude Code