Repository navigation
Conversation
…#2706) link_claude_skill_dirs prefers the gbrain-rendered SKILL.md (garrytan#2569) but installed every other runtime asset from the source checkout, so SKILL.md was served from ~/.gstack/render/claude while sections/ was served from the tracked tree. The rendered section files — the only copies carrying the injected "Save Results to Brain" blocks — were generated and never read. Six skills lost their brain-write step on a gbrain install: ship, office-hours, and all four plan-*-review. The comment above the call asserted the opposite ("section reads resolve there too"). That holds only for the absolute Read directives; the Section index and the carved-skill footer route via relative sections/<name>.md refs, which resolve through the installed dir. Comment corrected to say why the asset overlay is required. Pass the render dir into _link_skill_runtime_assets and overlay per FILE, not per directory: render dirs carry only the generated *.md, so a directory-level repoint would drop manifest.json and other checkout-only assets. bin/gstack-relink had the same split — it repoints SKILL.md and never touched runtime assets — so `gstack-config gbrain-refresh`, which calls relink to "repoint installed skills at the render", left every rendered section unreachable. Same per-file overlay added there, including a guard that rebuilds a still-symlinked sections/ as a real directory rather than linking children through it into the tracked checkout. Tests: new test/render-sections-provenance.test.ts pins the delivery side (what the installed dir actually serves) for both install paths; the generator side was already pinned by gen-skill-docs-out-dir.test.ts. Both behavior tests verified RED on v1.71.0.0 (394db32) before the fix. The no-render case is pinned unchanged. setup-sections-linking.test.ts:34 previously matched the two-arg shape and so locked the bug in — updated to require the render arg. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01NyCDYEW1GsdhZq9r8i5kRV
|
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 |
Contributor
|
Thank you, @jonahberg. Your fix is folded into v1.91.19.0 (#3025), which is now merged, and you're credited as a co-author on the release commit and in the CHANGELOG. Closing this PR because the change is on main now. |
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.
Fixes #2706.
Why (in your own words)
On a gbrain install,
/ship,/office-hoursand the fourplan-*-reviewskills silently stopped saving anything to the brain. The blocks were being generated correctly — they just never reached the agent.#2569 moved the brain-aware render out of the tracked checkout and made the installers prefer the rendered
SKILL.md. Runtime assets kept coming from the checkout, so an installed skill ended up served from two different trees:SKILL.mdfrom~/.gstack/render/claude,sections/from the source. The rendered section files are the only copies carrying the injected Save Results to Brain block, so that block was written to disk and then never read.The comment above the call says the opposite — "the rendered file's section-base paths point into the render dir, so section reads resolve there too". That's true of the absolute
Readdirectives, but the Section index and the carved-skill footer route via relativesections/<name>.mdrefs, and those resolve through the installed dir. So the render preference has to cover runtime assets too, not justSKILL.md.gstack-config gbrain-refreshdoesn't heal it either: it callsgstack-relinkto "repoint installed skills at the render", and relink only ever repointedSKILL.md. That's the path someone hits when they install gbrain after gstack, and it's why re-running refresh looks successful while changing nothing.Live evidence
Before — on a real v1.71.0.0 install with gbrain: every diverging section file is served from the checkout, i.e. without its block.
The content that never arrives:
Red on unpatched main — new tests run against a clean
394db32worktree, before the fix:The one that passes on main is the control: the no-render path must stay byte-identical for installs without gbrain.
Green after the fix:
No regressions in the surrounding area — every suite that touches linking, relink, render isolation, team mode and uninstall:
Full free suite, branch vs clean main on the same machine: 19 failures on this branch, 22 on
upstream/main— the failures are identical pre-existing local-environment ones (bun-polyfill,findPort,bump/DRIFT REPAIR,gstack-gbrain-sync,browsenode --check), caused bynodehere being a Bun shim at~/.bun/bin/noderather than real Node. My diff touches no file any of those suites exercise.Scope
setup(_link_skill_runtime_assetstakes the render dir and overlays per file; corrected the comment whose premise caused this),bin/gstack-relink(same overlay, sogbrain-refreshactually repoints),test/setup-sections-linking.test.ts(its:34assertion matched the two-arg shape and so pinned the bug in place), plus the newtest/render-sections-provenance.test.ts.394db32worktree, and the 126-test surrounding-area run._link_or_copy's copy path — the overlay routes through the same helper, but I have no Windows box); the paid/eval tiers; ShellCheck (not installed locally —bash -npasses on both scripts, and CI gatessetupat--severity=error).Design note
The overlay is per file, not per directory. Render dirs carry only the generated
*.md, so repointing the wholesections/symlink at the render would dropmanifest.jsonand the*.tmplfiles that exist only in the checkout.In relink there's one sharp edge worth flagging: on an existing install
sections/is already a symlink into the checkout, so linking children through it would write into the tracked install and dirty it. The helper drops that symlink and rebuilds a real directory first; a test asserts the checkout is byte-unchanged afterwards.Related but distinct from #2692 (which is the absolute refs pointing at the deleted
claude.tmp.$$dir). On this install both routes toship/sections/adversarial.mdfail — 9 dead tmp refs and 9 relative refs into un-rendered content in the same file. #2692 repairs the absolute route; this repairs the relative one. They compose.If you'd rather remove the two-tree split at the source than overlay it, the alternative in #2706 stands: have
gen-skill-docs --out-diremit the fullsections/payload so the whole directory can be linked from the render dir. Happy to redo it that way.Liveness proof
Checklist
GSTACK PRtyped live into a real surface (not edited onto the image)