fix(refinery): add Merge Bookkeeping section binding metadata to close#10
Open
eric-jones wants to merge 1 commit into
Open
fix(refinery): add Merge Bookkeeping section binding metadata to close#10eric-jones wants to merge 1 commit into
eric-jones wants to merge 1 commit into
Conversation
a1c7d73 to
bbf1c97
Compare
7833908 to
ba91ee3
Compare
The refinery prompt had no "Merge Flow" quick reference paralleling its "Rejection Flow" section. On a no-remote test rig (no `origin` configured), the LLM refinery agent saw the formula's `merge-push` step assumed a remote (`git fetch origin`, `git push origin $TARGET`) and bypassed it entirely — using `git merge --ff-only temp` from the refinery's worktree and then running only `gc bd close $WORK --reason "Merged to main at <sha>. No remote; no push step."`. The `gc bd update --set-metadata merged_sha=... merged_target=...` write that gastownhall#1886 chained into the close was skipped along with everything else in the merge-push step. Closed work beads ended up with `merged_sha=null` and `merged_target=null`, losing the forensic breadcrumb tying a closed bead to its merge commit. Reproduced on validate-l5-20260510-v4 (gascity local/integration 4d656c14): the cleanly-merged second L5c bead `vl2vr-le9` closed with `metadata.merged_sha=null` and `metadata.merged_target=null` even though main HEAD shows the merge commit `055fa36`. The refinery agent's transcript shows it ran `git merge --ff-only gc-nux-03afa35551bd` followed directly by `gc bd close vl2vr-le9 --reason="Merged...; No remote; no push step."` — no metadata write between the merge and the close. This walks back the validation note on stg-a1st, which was filed as fixed by gastownhall#1886 but only proven for L5a / L5b (where every merge was a merge-commit, exercising the chained close). The L5c-shape case (one FF merge + one rejection in the same iteration, on a no-remote rig) exposed that the chain isn't sufficient when the LLM bypasses the formula's merge-push flow upstream of the chain. ## What changed - `examples/gastown/packs/gastown/agents/refinery/prompt.template.md` — added a new "Merge Bookkeeping" section after "Merge Strategy". Names two non-negotiable obligations on every merge: (a) `merged_sha` / `merged_target` MUST be written via `gc bd update --set-metadata` before `gc bd close`, regardless of remote presence or merge shape; (b) use `git update-ref refs/heads/$TARGET <sha>` (per the formula), not `git checkout $TARGET; git merge --ff-only temp`. Explicitly states that on rigs without a remote, the metadata write and the close still run — the local merge happened, the bead records it. - `examples/gastown/gastown_test.go` — `TestRefineryPromptMergeBookkeepingBindsMetadataToClose` asserts the new section's load-bearing phrases are present, in order. Surface: refinery merge metadata via `gc bd update --set-metadata` (canonical bd CLI), shown in canonical agent prompt template; not direct Dolt edits. Fixes: stg-a1st (FF-shape merge + no-remote rig regression) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Upstream-PR: gastownhall#1935
ba91ee3 to
a02594d
Compare
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.
Fork-PR for review. Upstream: gastownhall#1935 (OPEN). Verification gap (substring-only tests); follow-up bead gc-rm0ha.49 schedules L5c rerun.