fix: scope /sync-gbrain's forced dream cycle to resolve_symbol_edges - #2783
Open
liutiming wants to merge 3 commits into
Open
fix: scope /sync-gbrain's forced dream cycle to resolve_symbol_edges#2783liutiming wants to merge 3 commits into
liutiming wants to merge 3 commits into
Conversation
`gbrain dream --dream` (and --full's auto-dream) invoked the full multi-phase overnight maintenance cycle (extract_atoms, synthesize, drift, skillopt, ...) when all this stage actually needs is the resolve_symbol_edges phase that builds the call graph (code-callers/code-callees). That's minutes of unnecessary work on every forced/auto dream and effectively bolts a second maintenance engine onto gbrain's own `autopilot`, which already owns full-cycle scheduling. Pin `gbrain dream --phase resolve_symbol_edges` on both the source-scoped invocation and the no-source fallback (verified against gbrain's own arg parser that --source and --phase compose independently). Updates the dry-run preview text and --help docs to match, and adds argv-recording tests against a fake gbrain binary whose strict allowlist fails the test if any full-cycle `dream` invocation (bare `dream`, or `dream --source <id>` without --phase) is ever spawned. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KKBKETdxHdkM83Maw1JFeo
|
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 |
The two existing #2860-class argv tests only exercised the explicit --dream flag. Add a third exercising the --full auto-chain path (cycle never built -> runDream), with a strict-allowlist fake gbrain that fails on any dream invocation missing --phase resolve_symbol_edges. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018px2ZBEeBDAGyzqwme4Dxp
sync-gbrain/SKILL.md.tmpl still described the dream cycle as bare `gbrain dream --source <id>`, pre-dating the phase-scoping fix. Update the --full, --dream, and D2-prompt prose to name the pinned --phase resolve_symbol_edges invocation, and regenerate SKILL.md. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018px2ZBEeBDAGyzqwme4Dxp
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
gstack-gbrain-sync --dream(and--full's auto-dream) was invoking gbrain's full multi-phase overnight maintenance cycle (extract_atoms,synthesize,drift,skillopt, ...) when this stage only needsresolve_symbol_edges— the phase that actually builds the call graph consumed bygbrain code-callers/code-callees.gbrain dream --phase resolve_symbol_edgeson both the source-scoped invocation and the no-source fallback (verified empirically that--sourceand--phasecompose independently in gbrain's arg parser).--dry-runpreview text and--helpdocs to match.gbrainbinary with a strict command allowlist that fails the test if any unscopeddreaminvocation (baredream, ordream --source <id>without--phase) is ever spawned — the source-scoped--dreampath, the no-source-id fallback, and (added in review follow-up) the--fullauto-chain path (cycle never built ->runDream), which is the OTHER trigger for this spawn and wasn't covered by the first two.sync-gbrain/SKILL.mdfromsync-gbrain/SKILL.md.tmpl(added in review follow-up) — the skill docs previously described the dream cycle as baregbrain dream --source <id>, pre-dating this fix; the--full,--dream, and D2-prompt prose now name the pinned--phase resolve_symbol_edgesinvocation.dreamcycle we invoke.Evidence
bun test test/gstack-gbrain-sync.test.ts test/gbrain-dream-stage.test.ts test/gbrain-cycle-completed.test.ts test/gbrain-sync-skip.test.ts— 87 pass / 0 fail (real bun footer, not truncated).bun test test/catalog-budget.test.ts test/context-budget-ratchet.test.ts test/gen-skill-docs.test.ts— 427 pass / 0 fail (skill-doc regeneration mechanism + budget ratchets, since this PR touches a.tmpl+ generatedSKILL.mdpair).bun run gen:skill-docs— regeneratedsync-gbrain/SKILL.mdfrom the edited.tmpl;git statusshows only the two intended files changed, no stray drift.test/e2e-tier-alignment.test.ts— unaffected, 3 pass.Disclosure: unrelated full-suite red in this environment
A full
bun run testpass in this shared dev box surfaced pre-existing failures in unrelated areas (repo-mode slug caching,gstack-learnings-search, alias-install byte-parity, skill-census) — none of these touchgbrain-sync,dream, or any file this PR changes. One contributing factor: this dev checkout has.claude/skills/gstacksymlinked live back to the working tree (per CLAUDE.md's "Dev symlink awareness" section), so a full test run's own skill-doc regeneration mutated allSKILL.mdfiles in place mid-run (prefix flipped) before I reverted that side effect — that alone explains the skill-census/alias-parity failures. I did not attempt to fix any of this; it's out of scope for this change and flagged here per the "don't claim unrelated without proof" project convention. The targeted test runs above are clean and used real bun summary footers.Test plan
bun test test/gstack-gbrain-sync.test.ts test/gbrain-dream-stage.test.ts test/gbrain-cycle-completed.test.ts test/gbrain-sync-skip.test.tsbun test test/catalog-budget.test.ts test/context-budget-ratchet.test.ts test/gen-skill-docs.test.tsbun run gen:skill-docs(regenerated SKILL.md, verified no stray diffs)🤖 Generated with Claude Code