factory: reviewer verdict — structured output + review against the issue, not just the diff - #90
Merged
Merged
Conversation
…sue, not just the diff Port of toon-protocol/toon-meta#299 (toon-meta#275) to swap: - .sandcastle/review-verdict.ts: shared verdict channel — declares sandcastle.Output.object({ tag: "review", schema }) and does its own extraction (sandbox.run() in @ai-hero/sandcastle@0.12.0 ignores an output option); one resume() retry on a malformed verdict, then fail. - agent-implement-issue.ts: reviewer phase runs runReviewerWithVerdict; blocking verdicts post findings + needs:human on the opened PR, and auto-merge mode refuses to merge a blocking verdict (falls back to PR mode). - agent-review-pr.ts: resolves the Spec-axis issue from the PR body's Closes #n, materialises the PR head as a local branch (the workflow now checks out main), and posts blocking verdicts after sandbox close. - review-prompt.md: two-axis framing (Standards + Spec), target-issue context, WHAT YOU FIX vs WHAT IS BLOCKING, and the REQUIRED VERDICT structured-output contract; context-budget section unchanged and last. - agent-review.yml: checkout pins ref: main (sandcastle checks the PR head out in its own worktree; one branch cannot be in two worktrees); header documents the verdict contract. Forensics steps untouched. - main.ts: reviewer promptArgs gain ISSUE_NUMBER/ISSUE_TITLE so the prompt's placeholders resolve in the reserved autonomous loop. zod was already a devDependency (^3.25.0, v3 API) — no lockfile change. Part of toon-protocol/toon-meta#270 Part of toon-protocol/toon-meta#275 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Gives the factory reviewer a verdict channel and the missing Spec axis (toon-meta#275, epic toon-meta#270) — port of toon-protocol/toon-meta#299 to swap.
What changes
<review>{"verdict":"clean"|"blocking","blockingFindings":[{file,line,summary,why}]}</review>. The schema is declared assandcastle.Output.object({ tag: "review", schema }); extraction/validation is performed by the new.sandcastle/review-verdict.tsbecause — verified against the@ai-hero/sandcastle@0.12.0dist — the engine's structured-output surface exists only on top-levelrun(), and thesandbox.run()the runners use silently ignores anoutputoption. Extraction mirrors the engine's semantics exactly (last tag wins, fence-aware unwrap, JSON parse, zod schema validation).SandboxRunResult.resume()(the engine's own structured-output retry mechanism, exactly one iteration, with engine-style error feedback); if the verdict is still malformed the runner throws and the Actions job goes red — a missing verdict is never mistaken for a clean one.ISSUE_NUMBER/ISSUE_TITLEviapromptArgs; the standaloneagent:reviewrunner resolves the issue from the PR body'sCloses #n(no reference → Standards-only review). The prompt instructs the reviewer togh issue viewthe target FIRST and review the diff against its acceptance criteria.main.ts(the reserved autonomous loop) passes the new promptArgs too so the prompt's placeholders always resolve.COMMENT) andneeds:humanis applied — pure REST viagh api(porcelaingh pr editis broken in repos with a classic Project attached by the projectCards GraphQL deprecation). In auto-merge mode a blocking verdict refuses to merge and falls back to PR mode.main(git refuses one branch in two worktrees), and the runner materialises the PR head as a local branch so the engine'sworktree add -b … HEADfallback cannot silently review an empty diff.Forensics steps (toon-meta#278) and the ~200k context-budget prompt wording (toon-meta#273) are preserved.
zodwas already a devDependency here (^3.25.0, v3 API) — no lockfile change.Verification
SANDCASTLE_PR_NUMBER/SANDCASTLE_ISSUE_NUMBER) and nothing else.pnpm run gate:correctness(build + eslint 0/352 vs frozen 0/352 + typecheck 0 vs frozen 25),pnpm test(285 passed, 2 skipped),pnpm run gate:no-regression(26.3s vs 30.9s baseline).agent:reviewrun after merge, since this label→runner executes main's code.Part of toon-protocol/toon-meta#270
Part of toon-protocol/toon-meta#275
🤖 Generated with Claude Code