You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(exec): under the orchestrator, a loop exec rewrites the PR body itself (gh api PATCH), so later sequant updates are dropped as "edited by hand" #1302
Found: the #1297 run on 2026-10-04 (PR #1300). In a quality-loop iteration, the exec phase rewrote the PR body itself:
gh api -X PATCH repos/{owner}/{repo}/pulls/1300 -F body=@/tmp/pr1300.md
Exec wrote that it did this "as QA suggested": the previous QA pass reported a missing mutation marker in the PR body. The new body ended with exec's own trailer, not sequant run's. isAutomatedPRBody then treated it as hand-edited, and the orchestrator logged PR #1300 body was edited by hand; not overwritten. Every later update was lost: the QA verdict note, the follow-ups checklist (#1249) and the "QA has not run" line (#1246).
Root cause: #1247's single-producer rule has a hole. The exec skill's PR Creation section, under SEQUANT_ORCHESTRATOR, says "Open no PR by any means: no gh pr create, and no GitHub MCP pull-request tool either." It doesn't forbid editing an existing PR's body or title (gh pr edit, gh api … PATCH …/pulls/N). QA's gap text points at the PR body ("add the markers to the PR body"), and a loop exec takes that as an instruction.
Producers of PR body content under the orchestrator: buildAutomatedPRBody, which should be the only one; exec's final message, which is its input; and now exec's direct edit, which shouldn't exist. The runner's hand edits are deliberate and out of scope.
AC
AC-1: Under SEQUANT_ORCHESTRATOR, the exec skill (all copies) forbids changing the PR's body or title by any means: gh pr edit, gh api PATCH on pulls/N, or an MCP tool. It says what to do instead: put the content in the final ## Summary, and the orchestrator carries it into the body. Evidence: a gate test scoped to the PR Creation section, mutation-verified
AC-3: Decide: should the orchestrator's update path reclaim a body whose last editor was a phase agent, not a human? If not, record "dropped: ". Evidence: the decision recorded on this issue
The PR body has two roles. Since #939 it is QA's evidence channel: §6i parses SEQUANT_MUTATION markers from $PR_BODY (qa/SKILL.md:2579). Since #1247 it is also an artifact only the orchestrator may write. When QA finds a gap, its gap text names the body as the place to fix it, so a loop exec edits the body.
The correct path already works.batch-executor.ts:1143-1212 rebuilds the body from the latest exec's ## Summary after every exec, including quality-loop iterations. Exec only needed to put the markers in its Summary. So AC-2 (QA's wording) matters as much as AC-1: QA's text is what prompted the edit.
For AC-3:isAutomatedPRBody (worktree-manager.ts:2120) decides ownership from the body's content, by looking for the trailer. Any writer who drops the trailer removes sequant's ownership. The check was written to protect PRs that exec opened before #1247. It can't tell a phase agent's edit from a person's edit. Reclaiming bodies last edited by an agent would need ownership recorded in state, for example a hash of the last body sequant wrote. The trailer check can't do that. Weigh this when making the AC-3 decision.
AC-3 input.isAutomatedPRBody decides ownership from the body's content (the trailer). Reclaiming a body last edited by an agent would need ownership recorded in state, for example a hash of the last body sequant wrote. Record the decision either way.
Phase rules (both exec and qa): run the full suite at most once, in the foreground, with timeout, and only after a WIP commit. Run targeted vitest files otherwise; CI runs the full suite. QA: this note applies to you too.
AC-1/AC-2: single line, Evidence: present. Evidence ("a gate test … mutation-verified") names no file or command. Tighten: the test must fail on today's main (neither section has the wording yet), so it is not vacuous.
AC-3: Evidence is a recorded decision, so the issue comment is the artifact.
⚠️ No ## Non-Goals section in the issue. Proposed: no change to isAutomatedPRBody or buildAutomatedPRBody; the runner's hand edits stay out of scope.
Scope Assessment
Metric
Value
Status
Feature count
1
✅
AC items
3
✅
Directory spread
3
✅
Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: exec forbids editing the PR body/title under the orchestrator
Verification: Unit Test (gate test on skill text) Scenario: Given exec/SKILL.md → When the "PR Creation and Verification" section (line ~977, scoped from that heading to the next ###) is read → Then it forbids gh pr edit, gh api … PATCH …/pulls/N and an MCP tool for body or title, and says to put the content in the final ## Summary. Assumptions: The existing #1247 sentence is the right home. Its last lines already say "put the AC table and every marker in the final ## Summary", so the edit is one added sentence, not a new section.
AC-2: QA names exec's final output, not the PR body, as the fix location
Verification: Unit Test (gate test on a delimited QA section) Scenario: Given qa/SKILL.md §6i → When a mutation-marker gap is reported under SEQUANT_ORCHESTRATOR → Then the gap text says "add the markers to exec's final ## Summary". Assumptions:qa/SKILL.md must not grow (#1249 AC-5). Pay for the new sentence by rewording an existing one.
AC-3: reclaim agent-edited bodies?
Verification: Manual (decision recorded) Recommendation: dropped: ownership is not derivable from the body.isAutomatedPRBody (worktree-manager.ts:2120) reads the trailer. It cannot tell an agent's edit from a person's. Reclaiming would need a hash of the last sequant-written body in state, and any reclaim would also overwrite a person's later edit, which is the case the check protects. AC-1 and AC-2 remove the cause on the producer side. Reopen only if a phase agent edits a body again after they land.
Sibling scan (every place a phase is told to write or fix the PR body)
Owner is the two skills, not a shared reference (_shared/references has no PR-body text; _shared and loop grep clean).
Under the orchestrator this contradicts the rule above. Reword to "Summary (PR body when exec opens it)" — in AC-1 scope, same file
exec/SKILL.md:839
"put this marker in the PR body"
Same: point at the final ## Summary under the orchestrator
exec/SKILL.md:1354,1363,1518
"paste … into the PR body", "Hook verdicts changed:"
Same class; give a single orchestrator clause
qa/SKILL.md:1413,1415
settle block "pasted into the PR body"
Same class
qa/SKILL.md:2579 and §6i Missing/Failed text
reads markers from $PR_BODY
Reading is fine (orchestrator builds it). AC-2 edit is the wording of the gap
Open question: the extra exec/qa sites (784, 839, 1354, 1363, 1518, qa 1413) are not in the ACs. Recommend fixing 784 and 839 (they directly teach the edit), and leaving the rest as a follow-up, since QA cannot grow.
Implementation Plan
Phase 1: skills (edit .claude/skills/*, then npm run sync:skills for templates/ and plugin/)
exec/SKILL.md:982: add "Do not change the PR's body or title by any means (gh pr edit, gh api PATCH on pulls/N, an MCP tool). To add or fix content, put it in the final ## Summary; the orchestrator carries it into the body, on every exec including loop iterations." Reword lines 784 and 839.
Phase 2: gate tests (new src/lib/__tests__/exec-pr-body-edit-skill.test.ts, modelled on qa-followup-ledger-skill.test.ts)
AC-1 test scoped to the exec section: asserts gh pr edit, PATCH, MCP, and ## Summary in that region. Run it over all three mirrors.
AC-2 test scoped to the §6i region: asserts the ## Summary phrase and absence of "add the markers to the PR body".
Mutation-verify both (delete the sentence, only that test fails, restore); put Mutation-verified: AC-N — … markers in exec's final ## Summary, failedTest starting with the test file path, no } in marker text.
Phase 3: record AC-3 decision as an issue comment.
Design Review
Where does this belong? In the two skill prompts. The producer side (exec), per "one producer per artifact", plus QA's wording, which prompted the edit.
Simplest correct approach? One forbidding sentence plus a pointer to the path that already works (batch-executor.ts:1143-1212 rebuilds from the latest Summary). Rejected: a consumer guard that reclaims bodies (AC-3), and a hook that blocks gh pr edit (broader, blocks the runner's own legitimate edits).
Senior reviewer challenge? "Why prose, not enforcement?" Answer: skills are the control surface for phase agents here; the gate tests pin the wording, and the orchestrator log line (edited by hand) already surfaces a recurrence.
Producers/consumers of the PR body: producers buildAutomatedPRBody (orchestrator), exec's Summary (input), exec direct edit (removed by AC-1), QA wording (AC-2), runner (out of scope). Consumers: isAutomatedPRBody, QA §6i $PR_BODY, ready-gate. Single producer afterward.
Feature Quality Planning
All standard checks pass. Notable items:
Mirror drift: edit .claude/skills first, then sync (check-skill-sync runs in CI).
Phase rules from the runner context: no PR body edits in this run itself; run full suite at most once, foreground, after a WIP commit.
Open Questions
Fix the other exec/qa "into the PR body" sites (784, 839 yes; 1354, 1363, 1518, qa 1413 no)? Recommendation: 784 and 839 only. Impact: the rest keep teaching a body paste, but QA cannot grow.
AC-3 as dropped? Recommendation: yes, reason above.
Recommended Workflow
Phases: exec → qa Quality Loop: disabled Reasoning: Small prompt-text fix with two gate tests; no UI, no security surface; testgen skipped (tests are pinned to skill wording, written in exec).
Exec still says to write into the PR body at exec/SKILL.md:1344, 1354, 1518 and 1524, and so does qa/SKILL.md:1413, with no orchestrator clause. Spec deliberately deferred these.
dropped: ownership is not derivable from the body.isAutomatedPRBody recognises sequant's bodies by their trailer, and it can't tell a phase agent's edit from a person's. To reclaim a body, sequant would have to store a hash of the last body it wrote in state, and any reclaim would also overwrite a person's later edit, which is the case the check protects. AC-1 and AC-2 remove the cause on the producer side. Reopen if a phase agent edits a body again after this lands.
Runner verification and follow-up ledger (PR #1310)
Mutation records missing for gate ACs AC-1 and AC-2: fixed in this PR. The runner re-ran both mutations, each failed exactly its own case, and the records are in the PR body.
Fixed in this PR (d3b675c): exec's settle-against-base block and its two hook-verdict-corpus lines now point at the final ## Summary under the orchestrator.
Dropped: exec :1344 is a "don't write X" rule, not a write, and QA :1413 describes where QA reads the settle block.
Activity
admarble commentedon Oct 4, 2026
Upstream cause (research note)
The PR body has two roles. Since #939 it is QA's evidence channel: §6i parses
SEQUANT_MUTATIONmarkers from$PR_BODY(qa/SKILL.md:2579). Since #1247 it is also an artifact only the orchestrator may write. When QA finds a gap, its gap text names the body as the place to fix it, so a loop exec edits the body.The correct path already works.
batch-executor.ts:1143-1212rebuilds the body from the latest exec's## Summaryafter every exec, including quality-loop iterations. Exec only needed to put the markers in its Summary. So AC-2 (QA's wording) matters as much as AC-1: QA's text is what prompted the edit.For AC-3:
isAutomatedPRBody(worktree-manager.ts:2120) decides ownership from the body's content, by looking for the trailer. Any writer who drops the trailer removes sequant's ownership. The check was written to protect PRs that exec opened before #1247. It can't tell a phase agent's edit from a person's edit. Reclaiming bodies last edited by an agent would need ownership recorded in state, for example a hash of the last body sequant wrote. The trailer check can't do that. Weigh this when making the AC-3 decision.admarble commentedon Oct 4, 2026
Runner context (before
sequant run)## Summary(batch-executor.ts, after decision(run): a sequant run where no qa ran still ends with a PR — draft+note, require qa, or unchanged (blocked by #1247) #1246/fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297). AC-2 matters as much as AC-1: QA's gap wording is what sent exec to the body. Spec: before choosing where AC-1/AC-2's text goes, list every place in the skills that tells a phase to write to, or fix, the PR body. That includes QA's §6i wording, its gap/finding templates and the follow-up ledger (feat(qa): enforce the follow-up ledger — every deferred item resolves to filed/fixed/dropped; sibling scans search the defect class #1249). If the owner turns out to be a shared reference, not two skills, say so.isAutomatedPRBodydecides ownership from the body's content (the trailer). Reclaiming a body last edited by an agent would need ownership recorded in state, for example a hash of the last body sequant wrote. Record the decision either way.gh pr edit,gh apiPATCH, MCP). Put the AC table and everySEQUANT_MUTATIONmarker inside exec's final## Summary. Keep}out of marker text (fix(qa): a SEQUANT_MUTATION marker whose text contains "}" parses to nothing — renderMutationMarker and the parser do not round-trip #1305).$N, bare or escaped. Write awk fields as$(N).qa/SKILL.mdmust not grow.timeout, and only after a WIP commit. Run targeted vitest files otherwise; CI runs the full suite. QA: this note applies to you too.admarble commentedon Oct 4, 2026
Complexity: Simple (3 ACs, 3 directories:
.claude/skills/{exec,qa}, mirrors,src/lib/__tests__)AC Quality Check
Evidence:present. Evidence ("a gate test … mutation-verified") names no file or command. Tighten: the test must fail on today'smain(neither section has the wording yet), so it is not vacuous.## Non-Goalssection in the issue. Proposed: no change toisAutomatedPRBodyorbuildAutomatedPRBody; the runner's hand edits stay out of scope.Scope Assessment
Verdict: ✅ SCOPE_OK
Acceptance Criteria
AC-1: exec forbids editing the PR body/title under the orchestrator
Verification: Unit Test (gate test on skill text)
Scenario: Given
exec/SKILL.md→ When the "PR Creation and Verification" section (line ~977, scoped from that heading to the next###) is read → Then it forbidsgh pr edit,gh api … PATCH …/pulls/Nand an MCP tool for body or title, and says to put the content in the final## Summary.Assumptions: The existing #1247 sentence is the right home. Its last lines already say "put the AC table and every marker in the final
## Summary", so the edit is one added sentence, not a new section.AC-2: QA names exec's final output, not the PR body, as the fix location
Verification: Unit Test (gate test on a delimited QA section)
Scenario: Given
qa/SKILL.md§6i → When a mutation-marker gap is reported underSEQUANT_ORCHESTRATOR→ Then the gap text says "add the markers to exec's final## Summary".Assumptions:
qa/SKILL.mdmust not grow (#1249 AC-5). Pay for the new sentence by rewording an existing one.AC-3: reclaim agent-edited bodies?
Verification: Manual (decision recorded)
Recommendation:
dropped: ownership is not derivable from the body.isAutomatedPRBody(worktree-manager.ts:2120) reads the trailer. It cannot tell an agent's edit from a person's. Reclaiming would need a hash of the last sequant-written body in state, and any reclaim would also overwrite a person's later edit, which is the case the check protects. AC-1 and AC-2 remove the cause on the producer side. Reopen only if a phase agent edits a body again after they land.Sibling scan (every place a phase is told to write or fix the PR body)
Owner is the two skills, not a shared reference (
_shared/referenceshas no PR-body text;_sharedandloopgrep clean).exec/SKILL.md:982exec/SKILL.md:784exec/SKILL.md:839## Summaryunder the orchestratorexec/SKILL.md:1354,1363,1518qa/SKILL.md:1413,1415qa/SKILL.md:2579and §6i Missing/Failed text$PR_BODYOpen question: the extra exec/qa sites (784, 839, 1354, 1363, 1518, qa 1413) are not in the ACs. Recommend fixing 784 and 839 (they directly teach the edit), and leaving the rest as a follow-up, since QA cannot grow.
Implementation Plan
Phase 1: skills (edit
.claude/skills/*, thennpm run sync:skillsfortemplates/andplugin/)exec/SKILL.md:982: add "Do not change the PR's body or title by any means (gh pr edit,gh apiPATCH onpulls/N, an MCP tool). To add or fix content, put it in the final## Summary; the orchestrator carries it into the body, on every exec including loop iterations." Reword lines 784 and 839.qa/SKILL.md§6i: gap text for Missing/Failed markers names "exec's final## Summary" underSEQUANT_ORCHESTRATOR; net line count ≤ before. Write awk fields as$(N)(investigation(skills): Claude Code may substitute positional $0 inside qa SKILL.md awk programs when /qa gets an argument #1289 lint).Phase 2: gate tests (new
src/lib/__tests__/exec-pr-body-edit-skill.test.ts, modelled onqa-followup-ledger-skill.test.ts)gh pr edit,PATCH, MCP, and## Summaryin that region. Run it over all three mirrors.## Summaryphrase and absence of "add the markers to the PR body".Mutation-verified: AC-N — …markers in exec's final## Summary,failedTeststarting with the test file path, no}in marker text.Phase 3: record AC-3 decision as an issue comment.
Design Review
batch-executor.ts:1143-1212rebuilds from the latest Summary). Rejected: a consumer guard that reclaims bodies (AC-3), and a hook that blocksgh pr edit(broader, blocks the runner's own legitimate edits).edited by hand) already surfaces a recurrence.buildAutomatedPRBody(orchestrator), exec's Summary (input), exec direct edit (removed by AC-1), QA wording (AC-2), runner (out of scope). Consumers:isAutomatedPRBody, QA §6i$PR_BODY, ready-gate. Single producer afterward.Feature Quality Planning
All standard checks pass. Notable items:
.claude/skillsfirst, then sync (check-skill-syncruns in CI).Open Questions
dropped? Recommendation: yes, reason above.Recommended Workflow
Phases: exec → qa
Quality Loop: disabled
Reasoning: Small prompt-text fix with two gate tests; no UI, no security surface; testgen skipped (tests are pinned to skill wording, written in exec).
Label Review
Current: bug. Recommended: bug, planned. Quality Loop: won't auto-enable.
admarble commentedon Oct 4, 2026
QA Verdict: AC_MET_BUT_NOT_A_PLUS
AC coverage: 2/3 met
Gaps:
SEQUANT_MUTATIONmarkers. It is only the stub## Summary / Automated PR for issue #1302 / Fixes #1302. So the very path this issue relies on (exec's Summary carried into the body) didn't deliver for this run. Either exec's final Summary left them out, or the carry-over from fix(run): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1297/fix(#1297): PR body falls back to the placeholder when exec writes no "## Summary" heading, dropping exec's mutation markers and AC table #1300 dropped them. The run log for this run isn't written yet, so I couldn't tell which.Suggestions:
exec/SKILL.md:1344,1354,1518and1524, and so doesqa/SKILL.md:1413, with no orchestrator clause. Spec deliberately deferred these.fix(#1302): settle blocks and hook-verdict changes go to exec's final…
admarble commentedon Oct 5, 2026
AC-3 decision (owner, 2026-10-04): dropped
dropped: ownership is not derivable from the body.
isAutomatedPRBodyrecognises sequant's bodies by their trailer, and it can't tell a phase agent's edit from a person's. To reclaim a body, sequant would have to store a hash of the last body it wrote in state, and any reclaim would also overwrite a person's later edit, which is the case the check protects. AC-1 and AC-2 remove the cause on the producer side. Reopen if a phase agent edits a body again after this lands.Runner verification and follow-up ledger (PR #1310)
## Summaryunder the orchestrator.:1344is a "don't write X" rule, not a write, and QA:1413describes where QA reads the settle block.## Summarythat 2.19.0's extractor parses, so the driver handedcreatePRsome other text.Commands run: all
lint:*scripts pass, the skill gate tests pass (327), and both mutation checks were re-run.