Repository navigation
Lead rules follow-up before step 4 (T284) - #139
Merged
Merged
Conversation
F-T284-5: a lead repairs only through round. F-T284-6: a lead verdict names a finished run of its task whose role gives that kind. F-T284-3: a held task takes no pr= or branch=. F-T284-1: while held, the sage may still triage ask or dismiss with a reason. F-T284-7: the lead spawn refusal names no --project. F-T284-2: a guard test that the hook tests call spawnSync and execFileSync only through bounded(). F-T284-4: a sage:lead with no bound lead slot starts no child; the hook tests give such leads a fixture slot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…T284 round 1) F-T284-9/8: a lead's child named by its run id (R<n>) is that run's helper; a team run ends, and backs one verdict of its round, only after its child stopped. F-T284-14: a move out of held gives one more repair round. F-T284-12/8: while repairing, a lead closes only the round's fix findings and leaves repairing after them. F-T284-10: no close of an ask finding. F-T284-11: a lead whose task is held or whose lead run ended starts no child. F-T284-13: the README says a lead started outside sage mode has no slot. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s (T284 round 2) F-T284-15: tasks.tsv gains hold and extra, written only by the state tool; a move out of a hold that round set gives one more round, once per hold; a hold by task set gives none. F-T284-16: round counts max_rounds plus extra, never decision text, and shows the real limit. F-T284-17: a round that fixed none of the last round's findings re-plans, also on the retry after a hold; the README says so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
F-T284-19: a move out of replan clears the round keys, so the first round of the new plan never compares with the old plan's findings and replans again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
README and the F-T284-19 test title: leaving replan clears the old round's findings, and the round number goes on, capped by max_rounds plus the extra rounds. The design page's state diagram and rules table: replan when the last round's fix findings are all still open, one more round after a hold by round. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
What this is
The owner's follow-up to PR #124 (lead build step 3). It must merge before step 4 (#119) adds the lead agent. It fixes the findings of PR #124's last review cycles. Each fix has a test; the table says which test fails on main (d6414fa).
Each finding and its test
round. While its task has an open medium or high finding triaged fix and the task is not repairing, the hook refuses the lead'sfinding closeand itsverdicton a new SHA (one that the task's ledger does not have).verdictneeds--run R<n>: a run of its task with status done, whose role gives that kind. code-reviewer gives review-clean, security-reviewer gives security-clean, ux-reviewer gives ux-clean, qa gives qa-pass and qa-fail, and the three reviewer roles give findings. checks-pass and checks-fail need no run. evidence-clean is not a lead's.task setrefusespr=andbranch=on a held task, as it refuses the other writes. The chief's state moves stay.scripts/sage.test.mjs)--project <session folder>. It namesrun add T<n> --role lead, and says that a lead starts only from a session opened in the project's folder or one of its worktrees.scripts/sage-hook.test.mjsand finds no static import of a rawspawnSync,execFileSyncorexecSyncfrom child_process, and no use of the raw calls outsidebounded(). The test also proves that the check finds each kind of violation.sage:leadwith no bound lead slot starts no child: "this lead holds no bound lead slot, so it starts no agent. Report to the sage."Test fixture change
Many older child-spawn tests use a lead id that no lead spawn bound. With F-T284-4, each of them needs a bound lead slot.
session()inscripts/sage-hook.test.mjsnow gives one: the first spawn by asage:leadid that no main result bound gets a fixture lead slot of its own project (through the hook's ownslotsFor). An id that a main result bound, or that stopped, keeps what the hook made of it.sendRawskips the fixture, for the tests of the rule itself.leadSessiongains a finished qa run (R4), for the lead's verdicts.T282: not folded in
setPr:setPrserves every caller, the chief too. The chief may legitimately give a PR to a second task: a task framed again, or the merge-check history tests (S1, F2, F-T273-8). The state tool cannot tell a lead from the chief, so the move would change the chief's behaviour. It is not small. I recommend keeping the check in the hook (as now), and asking the owner if the chief should lose that move too.--shamust be the head of its task's PR: this needs a network read of GitHub at every lead verdict, so I skipped it, as the brief allows.Repair round 1 (R921)
A detached worktree of f46692b with this branch's two test files gives 5 failures, exactly the 5 new tests below.
run add <T> --role <r>, then starts the child of role r with the nameR<n>. At that spawn the hook checks that R is a running run of the lead's task, in the task's current round, of the child's role, and records it in the child's slot. One run has one child: a second child of the same run is refused, also after the first one stopped. When that child stops (SubagentStop, a completed foreground result, or the main session's TaskStop), the hook notes the run as helped. A lead'srun doneof a team run (the implementer too) is refused until then. A lead'sverdictneeds--runof such a run: done, helped, of the task's current round, and in no earlier verdict row.run additself stays allowed, because the run's id must exist before the child can carry it; a run with no child can never end or back a verdict.task set state=buildingorbriefed) writes the decision row "held → : one more repair round".roundallowsmax_roundsplus one round for each such row, so the next round runs once, and the one after holds again.scripts/sage.test.mjs)roundtakes it.finding closeneeds a finding triaged fix: never one triaged ask.Test fixtures: the fixture leads now have a real logbook: a side project in each session's sage home, with a building task and a running lead run. The leads of the LEAD_DIR fixture get their tasks too.
leadSessiongives R2 and R4 their real children, and triages F-T1-1 (low) as fix. A new helper,helpRun, starts, binds and stops a run's child.Repair round 2 (R925)
A detached worktree of d563ef4 with this branch's
scripts/sage.test.mjsgives 6 failures: the 3 new tests below, and 3 older header tests (unknown-columns, F-R65-2, F-R65-3) that now expect the two new columns of tasks.tsv.holdis set toroundwhenroundholds the task, and is cleared at any move into or out of held.extracounts the extra rounds. A move out of a hold thatroundset adds one toextra, once for that hold. A hold bytask set(for example for a product question) adds nothing. Both columns are inADDED, so an older tasks.tsv still reads, and its next write adds them.roundcountsmax_roundsplusextra, never decision text: alogrow with the same words adds no round. The round message shows the real limit, for example "round 2 of 2".round. Next to that rule, it says that a retry whose last round's findings are still open goes to replan. To make that true,roundnow re-plans when the new round's fix keys still hold every key of the last round, not only when they are equal: a round that fixed none of the last round's findings re-plans, also when new findings join them.Repair round 3 (R929)
scripts/sage.test.mjs): it fails on f6a88ec, the only failure of that file there, and passes nowNot verified live
sage:leadagent in Claude Code: the agent file comes in step 4 (Lead build step 4: the sage:lead agent file and the docs (T181) #119). All tests use hook events and fakes.Checks
npm run build,npm run checkandnpm test(with fake ps, pgrep, kill and gh first on PATH) pass on the head commit.🤖 Generated with Claude Code