Repository navigation
refactor(review): prime the full PR context + bounded tool loop; embed the prompt; env-driven config - #16
Conversation
…, no tool loop
Rewrite the review engine from first principles. The previous engine had grown
multiple overlapping paths that made it impossible to tell what was running or
where a knob was read — and those paths were the measured cause of the runaway
thinking and the long, undebuggable runs.
WHAT WAS REMOVED (each was accidental complexity, not a feature):
- The tool-calling loop (runAgentLoop -> agentLoopOnce -> chatTurn, three nested
loops). It fragmented the PR across turns, and message reasoning is NOT re-sent
between turns (llmkit.ToSDKMessages omits it), so the synthesis turn RE-DERIVED
everything from partial tool results. Measured on a 25-file PR: 371 KB of
reasoning over three runaway synthesis turns (8m25s); the SAME context assembled
whole produced a verdict in 82.6s with 50 KB of reasoning.
- The per-file tool round-trips + the anti-skim guard they required. Every
changed file's FULL patch now travels in the ONE assembled message, so "the
model saw every line" is true by construction rather than enforced by an extra
loop.
- The --plan executor (plan.go, yamlutil.go) and its second effect path. It
wrapped a single review step; the workflow now calls `charly review` directly.
- The fixture mode threaded through production dispatch.
- The dead verb:pr methods (pr_diff -- its tool was deleted in the per-file
cutover) and the tool-dispatch table that duplicated the gh client.
- The scattered env reads: env is now read in ONE place (config.go FromEnv).
WHAT REPLACED IT (9 files, one path):
FromEnv() -> assemble() -> render() -> ONE LLM call -> verdict -> Emit()
- config.go - the single Config + the env surface (every AI_REVIEW_* knob).
- context.go - THE assembler: reads body/files/commits/comments and renders the
one message; a file's complete patch is always included.
- review.go - Review/generate/Emit/Run + the fail-closed size guard + terminal
failure classification (no retry: re-issuing is the amplifier).
- llm.go - Config -> llmkit.Config mapping + session id.
- ghclient.go - typed ghkit reads (no tool shaping).
- plugin.go - the command + verb:pr entry points.
- command.go - THE flag parser.
- effects.go - $GITHUB_OUTPUT + the debug usage formatter.
- embed.go - the prompt, EMBEDDED. No runtime file read: a run cannot be
redirected by REVIEW_PROMPT_PATH. AI_REVIEW_PROMPT_EXTRA appends
operator text without replacing the shipped rulebook.
CONFIG SURFACE (all env, declared once in charly.yml env_accept):
provider/model/base_url/api_key; reasoning_effort; max_tokens;
max_completion_tokens; temperature; top_p; seed; stop; frequency_penalty;
presence_penalty; stream_idle_timeout; attempt_timeout; context_tokens;
context_margin; prompt_extra; post_comment; debug; session_id; out;
PR_NUMBER/GITHUB_REPOSITORY/GITHUB_EVENT_PATH.
TestConfigSurfaceMatchesCharlyYML asserts the charly.yml list EQUALS the env
the engine reads — the mechanical guard for the defect where AI_REVIEW_DEBUG
was set in the workflow but absent from env_accept, so it never reached the
plugin (CI runs were undebuggable as a result).
DEBUGGING: AI_REVIEW_DEBUG is the SINGLE switch and always dumps the full
reasoning (the separate reasoning knob is gone — an RCA always needs it). The
FAILED call's reasoning is dumped too, via the new llmkit Reasoning fields (sdk
v0.2026264.731), so a runaway is diagnosable even when it never returns content.
VERIFIED LIVE: the clean engine assembled 478 KB (25 files + 71 comments) for
spec#140 and returned finish_reason=stop, a verdict, in 2m43s — vs the old
tool-loop's 8m25s/371 KB/no verdict-at-cap on the same PR.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.
Root cause. The review plan produced no Verdict line, and this log carries NONE of the recognised signatures: no completed turn 1, no stall marker, and no HTTP rejection. The gate therefore REPORTS the class instead of inventing a cause. Durable remedy.
A run that produced no verdict keeps this required check RED: unreviewed code must never merge. Diagnostics (tail of the review log) |
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Security screen (T1–T4): PASS — no finding. The embedded Comment intake: 1 comment ( Blocks
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…nstead of tools Round 3 — the validator's BLOCK was correct and it caught a regression I introduced: the previous revision called llmkit.Chat(ctx, llm, msgs, nil) — NO tools — while the prompt still instructed the model to use get_pr_files / get_pr_file / get_pr_thread / get_pr_meta. The eval agent was told to use tools it did not have. The fix is the UNION of the two designs, not one replacing the other: - PRIME: the conversation opens with ONE message carrying the complete PR context (body, every changed file's full diff, commits, every comment). This is the measured runaway fix: the old engine assembled the context turn by turn and message reasoning is not re-sent between turns, so the synthesis turn re-derived everything from partial tool results (371 KB of reasoning over three runaway turns, 8m25s on a 25-file PR) — the primed form produced a verdict from ONE turn in 2m55s. - TOOLS: the read-only tools REMAIN AVAILABLE (tools.go) for verification and follow-up. Because the agent already has the full context it rarely calls them, so the loop converges in one turn — but the capability is there. Also in this revision: - Restore Config.MaxTurns + AI_REVIEW_MAX_TURNS (dropped in the rewrite) and declare it in charly.yml; TestConfigSurfaceMatchesCharlyYML keeps the two in lockstep. - chatTurn issues exactly ONE request (no retry): a terminal failure is classified by the caller. Re-issuing the identical request is the measured amplifier of the long runs. - Every turn (and a FAILED turn) dumps its full reasoning under AI_REVIEW_DEBUG — the single debug switch — so a runaway is always diagnosable. - New TestAgentHasTools: the agent must receive every tool the prompt may name. Measured live (spec#140, 25 files, 77 comments): primed=true, ONE turn, finish_reason=stop, BLOCK verdict, 2m55s. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Security screen (T1–T4): no manipulation attempt in body/comments. This PR touches the validator's own spec ( Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Code fixes (each finding verified and reproduced before fixing):
- (5) plugin.go: restore the error return on the in-proc path. `CliMain(in.Args),
error(nil)` made the following `if err != nil` unreachable and dropped the
error (stderr only). Introduce ONE `run(args) (int, error)` core used by BOTH
CliMain and Invoke, so the paths cannot diverge.
- (6) verb:pr JSON wire shape restored. The cleanup dropped the struct tags, so
every verb result silently changed from snake_case to Go field names and
pr_thread became a bare array. Tags restored on PRMeta/ChangedFile/Commit/
Comment, and a shared Thread{head_sha,base_sha,comments,comment_count} shape
now backs BOTH the verb and the get_pr_thread tool (R3). PR_NUMBER fallback
restored. New TestVerbWireShapesHaveJSONTags pins the contract.
- (7) prompt.md aligned with the runtime: it said "NO tool calls" while the
engine passes 7 tools; it now names the tools as available and describes the
primed context + tools design actually shipped.
- (8) the assembled context now renders the head/base SHA and counts the prompt's
output format requires (they were fetched but never rendered).
- (9) the fail-closed context guard now covers the LOOP: re-estimated before every
turn, and re-checked with the provider's REAL prompt-token count after each
turn that reports usage. Tool results appended in the loop can no longer push a
request past the window.
- (10) checkBudget's comment no longer claims a provider-ratio path it lacks; the
estimate is a documented constant, with realBudgetCheck using the exact count.
- (11) get_pr_comment propagates the GitHub read error instead of turning it into
"no comment N in this PR" (mustComments deleted).
- (12) restored regressions: prFromEventPath (workflow_dispatch/no-payload/no-panic),
invalid-env fallback (which found a REAL bug: envInt/envInt64 accepted a
non-positive value; they are now positive-only), and TestAgentHasTools now
intercepts the chat seam and asserts the tools REACH the model call, not merely
that a declaration exists.
- (1) Config.MaxTurns + AI_REVIEW_MAX_TURNS restored and declared in charly.yml.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
Port the still-valuable guidance from action-review#7 into the embedded prompt: a comment preview is not a body; never assert a comment (e.g. the maintainer sign-off) is "not recorded" without fetching it by id, and say so explicitly as a tool-limited disposition if it cannot be read. action-review#7 edits the OLD prompt/validator.md, which the embedded rulebook supersedes. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Security screen (T1–T4): no manipulation attempt in body/comments. This PR edits the validator's own spec ( Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…engine - (1) charly.yml: the candy description and the review-skill claimed "ONE model call — no tool loop", contradicting the shipped prime+bounded-tool-loop engine and the file's own AI_REVIEW_MAX_TURNS line. Both now describe prime + tools. - (2) tools_test.go (NEW): the tool DISPATCH had no coverage. Added TestCallToolDispatch (all 7 tools against a stub API), argument validation (path/id/unknown-tool), TestThreadIndexCarriesNoBodies and TestFilesIndexCarriesPatchSize — the coverage the removed suite had. - (3) SDD proof: the body's pasted command had a literal `…` placeholder. The real command + real empty diff is pasted (exit 0). - (4) tools.go: callTool's unused `cfg Config` parameter removed. - (5) tool descriptions aligned with results: get_pr_files now returns patch_bytes + total_patch_bytes (the size it promised); get_pr_thread returns a CommentIndex (id/author/date/bytes/preview) and NO body, matching the removed thread_index contract. - (6) verb:pr contract changes accounted for: README.md rewritten (it still documented the removed --plan, pr_diff, fixture mode, per-turn retry and AI_REVIEW_TOOL_RESULT_MAX_BYTES) and the method/field changes stated. Liveness checked against the consumers' origin/main; the docs repo is a separately regenerated consumer. - (7) the ADE plan checks are now run live and pasted (`charly review --self-test` and `--self-test-verdict`, both exit 0); the charly.yml capability gap is named as a tracked thematic batch, not a vague deferral. - (8) config.go: FromEnv never returned an error, so command.go/plugin.go's `if err != nil` arms were dead. FromEnv now returns Config (no error); Validate() remains the pre-network check. Also this round: Config.MaxTurns restored; envInt/envInt64 are positive-only (a real bug the restored invalid-env test caught); PRMeta/ChangedFile/Commit/Comment json tags restored and pinned; shared CommentIndex/Thread shapes back both the verb and the tool (R3). Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.
Root cause. The ENGINE sent no generation bound ( Durable remedy.
A run that produced no verdict keeps this required check RED: unreviewed code must never merge. Diagnostics (tail of the review log) |
validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.
Root cause. The ENGINE sent no generation bound ( Durable remedy.
A run that produced no verdict keeps this required check RED: unreviewed code must never merge. Diagnostics (tail of the review log) |
Ran the new engine on its own PR (the local validator), which produced a real BLOCK with 6 findings — all fixed: - (1) body file accounting: README.md omitted; added/removed/changed counts fixed. - (2) prompt/runtime mismatch: the prompt requires `Head SHA: <sha> (branch: <branch>)` and a `<comment_thread>` section; render() emitted neither the branch nor the tag. PRMeta now carries Branch (from ghkit Head) and render() emits the branch and wraps the thread in <comment_thread>. - (3) ghclient.thread() swallowed the meta read error (silent empty head_sha); it now propagates it, matching the tools contract. - (4) the R10 bed: the fresh-rebuild R10 for a plugin IS the charly release that welds it, which has not run — so the tier is `analysed on a live system`, not inflated. The charly env-injection gap is named as a thematic batch (R2), not a parking phrase. - (5) the cross-repo consumer sweep is now pasted (git grep on the consumers origin/main: no bed uses pr_diff/fixture). - (6) parseCommand can now fail (an empty --repo), so the if err != nil arms are live and tested (TestParseCommandRejectsEmptyRepo). Local validation: build/vet/test green, 26 tests, SDD reproducible. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
Local dogfood validation (the new engine on its own PR) found 6 more; all fixed: - (2) REAL BUG: `files()` never set `PatchBytes`, so the pr_files verb and the get_pr_file tool emitted `"patch_bytes":0` for every file. Now set from the real patch length, and TestFilesIndexCarriesPatchSize asserts it is NON-ZERO (a contains-only check passed on the 0). - (3) dropped chatTurn's unused `cfg` parameter (the same fix already applied to callTool). - (1) body file accounting corrected: 36 files = 12 added / 14 removed / 10 changed, +2614/-3153; README.md was missing; the sdk pin bump (v0.2026263.1023 -> v0.2026264.731 = merged sdk#269) is now stated. - (4) the R10 bed: states the self-install/bootstrap exception explicitly and requests maintainer sign-off; the fresh-rebuild R10 (the charly release that welds this plugin) is the NEXT cutover step. - (5) the cross-repo consumer sweep is pasted (git grep on the consumers origin/main). - (6) the charly env-injection gap is named as a thematic batch AND the README's env_accept claim is reconciled: charly passes the ambient env to a command plugin, not the candy var: block — the var: block documents the surface for the future capability. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR edits the validator's own spec ( Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config (one candy) — runtime/code change. Blocks
Comment intake
Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…(R3) Local dogfood validation round 5: - (5) the comments conflated three different experiments. Reconciled: the fragmented tool loop (371 KB, 8m25s, no verdict); primed whole-context NO tools (50 KB, verdict 82.6s); and the SHIPPED prime+tools form (1 turn, verdict 2m55s) — on the same 25-file PR, same model/effort. context.go no longer claims "no tool loop". - (6) the pr_files verb returned full patch text while the get_pr_files tool returned an index. Both now share ONE filesIndex shape (metadata + patch_bytes, no patch text) — R3. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): the PR edits the validator's own spec ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…nciliation Local dogfood validation round 6 — all six findings fixed: - (2, CRITICAL) `Run` returned 0 for a verdict-less review, so an UNREVIEWED PR could read as a pass (and, with POST_COMMENT defaulting true, post a verdict-less comment). Extracted `verdictExit`: exit 0 ONLY for a single unambiguous verdict; no verdict = exit 1 (INCONCLUSIVE, the gate keeps RED); mixed = exit 2. Tested. - (6) the prime+bounded-loop engine had no test (the removed livetest/e2e were the only ones). Added loop_test.go: a scripted tool-call turn then a verdict, the budget-exhausted tail, and the verdictExit contract. - (1) attribution footer: `fully tested and validated` -> `analysed on a live system` (matches the body; the fresh-rebuild R10 has not run). - (3) config.go / config_test.go comments claimed charly passes env_accept through; reconciled with the MEASURED mechanism (ambient env; candy var: is not injected yet — the charly env-injection cutover). - (4) body ± totals corrected to +2641/-3148. - (5) consumer-liveness sweep now includes the umbrella (opencharly/opencharly, pasted: 4 yaml files, 0 hits) as well as charly/eval-omarchy. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR edits the validator's own spec ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…ale comments Local dogfood round 7: - (4) candy/plugin-review/fixtures/ was still present but unreferenced after the fixture mode was removed — deleted (R5). - (3) Emit (the gate's output surface: $GITHUB_OUTPUT response/success/verdict, --out) had no test; added effects_test.go. - (1) the stale 'no tool loop' comments in review.go/context.go/ghclient.go corrected to describe the bounded loop. - body: loop_test.go accounted; counts/totals corrected; the live-claim narrowed (tool dispatch is covered by tools_test.go, not yet exercised live). Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR edits the validator's own spec ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
Local dogfood round 8 — three findings: - (1) context.go had an orphaned comment fragment (its subject was deleted in an earlier edit); repaired. - (2) Emit never returned an error, so Run's arm was dead. A failed --out write IS fatal (the workflow reads that file for the verdict) and now returns a real error; the PR comment stays non-fatal by design. TestEmitOutWriteFailureIsFatal pins it. - (3) verb wire deltas stated/cleaned: PRMeta gains (stated); Commit's Mon Sep 21 01:13:57 PM CEST 2026 key is DROPPED because the previous engine declared but never populated it (always "") — dead data removed rather than carried. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
Local dogfood round 9: - (2) review.go header described "ONE LLM call" while generate() runs the bounded tool loop (up to AI_REVIEW_MAX_TURNS calls). Corrected the diagram + bullets to prime + bounded tool loop. - (3) plugin.go run() had a dead guard: Run never returns (0, non-nil-err); simplified to return Run directly. - (1) body numbers: +2839/-3154, 32 tests. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR edits the validator's own spec ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
RCA of a REAL runaway the local dogfood caught on THIS 45-file PR: turn 1 hit finish_reason=length (the model reasoned 974978 bytes and returned no answer). reasoning + answer SHARE max_tokens, so on a large context the model can reason until the budget is exhausted. Measured: raising max_tokens made it WORSE (384000 -> 28min incomplete); LOWERING the effort let the answer through (ar#7: low -> 35s PASS). Fix: on an EmptyCompletionError at a turn, retry that turn ONCE one effort level down (max->high->medium->low->none) — a deterministic fallback, not a blind re-issue, and bounded to ONE retry per run. Tested (lowerEffort ladder + TestGenerateRetriesOnceAtLowerEffortOnBudgetExhaustion). Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
Local dogfood round 10 — two documentation findings: - (1) the body, README and review.go header said "no retry", but the head commit added the bounded-reasoning fallback. All three now document it: a whole-request cap / idle stall is never retried; an EmptyCompletionError at a turn retries ONCE one effort level down. - (2) body numbers: +2920/-3154, 34 tests. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR edits the validator's own spec ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
validator INCONCLUSIVE — no review verdict was produced (not a BLOCK; no code finding)The gate could not obtain a review verdict on this run, so it produced no code finding. This is not a BLOCK and the PR is not being rejected — but the required check stays RED on purpose: unreviewed code must never merge.
Root cause. The ENGINE sent no generation bound ( Durable remedy.
A run that produced no verdict keeps this required check RED: unreviewed code must never merge. Diagnostics (tail of the review log) |
The 45-file dogfood PR still timed out with a ONE-step fallback: high -> medium was not low enough for a 386 KB context. The fallback now REPEATS the step-down (max->high->medium->low->none) until a level fits or the ladder is exhausted, bounded to one attempt per level — still deterministic, never a blind re-issue. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]All 45 changed files are now read (the seven removed Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR rewrites the validator's own rulebook ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…rt ladder" This reverts commit e3aa6aa.
…mbers" This reverts commit 9b77fa4.
…er effort" This reverts commit efd9fee.
…and duplicate verb
First-principles final form. A review is a pure function of
(rulebook, complete PR, model): all input is read once and sent once, so there
is nothing for the model to fetch and no loop.
Engine (review.go):
assemble() read EVERY fact once (body, all file patches, commits, all comments)
render() ONE message, everything inline
generate() ONE llmkit.Chat call, no tools
verdict line-anchored PASS|BLOCK; Run is fail-closed (no verdict = exit 1)
Emit() --out (fatal on failure) + $GITHUB_OUTPUT + ONE comment
DELETED (accidental complexity, all of it):
- the tool-calling loop (turn budget, tool dispatch, sdkTools, chatTurn seam)
- tools.go (the 7 review tools) — the prompt no longer mentions any tool, so
prompt and runtime cannot drift
- AI_REVIEW_MAX_TURNS (no turns)
- the retry/ladder experiments (reverted earlier; classify() fails once, terminally)
- the plan executor + fixture mode (removed in the prior cutover)
R3/R5 — duplicate surface removed:
- `verb:pr` (pr_meta/pr_commits/pr_thread/pr_files) DUPLICATED plugin-gh's
canonical `verb:gh` (same ghkit reads) and had NO consumer (no check bed, no
charly.yml, no eval stage uses it). Deleted with its schema/#PrInput, its
generated params/ package, and the verb-only ghclient helpers (filesIndex,
Thread, CommentIndex). plugin-gh owns the one canonical GitHub verb.
- plugin-review now declares NO typed input def, so per sdk.BuildCapabilities'
documented path an input-less plugin passes a nil schemaFS (no schema dir).
- prompt.md is embedded via prompt_embed.go (go:embed), unchanged behaviour.
prompt.md aligned to the runtime: it states the complete PR is in the ONE
message, there are NO tool calls, and a genuinely-missing input is a BLOCK.
Also deps: openai-go is no longer a direct dependency (only llmkit uses it).
23 tests, gofmt/vet/test green.
Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
A local `go build ./cmd/serve` wrote candy/plugin-review/serve; it is not source. Removed and ignored. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
[step: review]All 43 changed files are now read. The five remaining Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): T3 scope mismatch — the body describes a design the diff does not implement (block 1). The PR rewrites the validator's own rulebook ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR edits the validator's own rulebook ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…emoved surface Addresses all six validator findings on head 900fd3c. - (1,2,3) the body/README/tests described the removed tool loop. Rewritten to the shipped single-call engine; every figure re-derived from the changed-file index. - (4) README.md rewritten: no tool loop, no verb:pr, no AI_REVIEW_MAX_TURNS, no params/schema (all removed). review.go's header + checkBudget comment now describe ONE call; the stale "tool loop" references are gone. - (5) the removed-capability SWEEP is now executed for the ACTUAL removals: verb:pr, pr_files/pr_meta/pr_commits/pr_thread, REVIEW_PROMPT_PATH, AI_REVIEW_MAX_TURNS, tools.go/loop_test.go/tools_test.go, #PrInput, CommentIndex, get_pr_* — all 0 live hits in candy/plugin-review. - (6) the engine's fail-closed paths now have coverage: review_test.go pins verdictExit (0 only for a single verdict; 1 no-verdict; 2 ambiguous; prose is not a verdict), the budget guard's refusal, and validate-before-network. Also: context.go/ghclient.go struct comments dropped the now-dead verb:pr wire claims and the PatchBytes field (verb-only); ghclient_test.go (the deleted verb's wire-shape test) removed. 22 tests; gofmt/vet/test green. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
…tated Local dogfood round 11 — four findings: - (1) exact accounting: 11 added / 22 removed / 10 changed; cmd/serve/main.go and the modified review_test.go are named. - (2) context.go header dropped the stale "prime + tools" bullet; it now describes the shipped ONE-message/ONE-call engine. - (3) added a chat seam + review_test.go coverage driving generate() end to end (exactly ONE call, NO tools, the verdict returned; a model failure propagated). - (4) the sdk pin advance (v0.2026263.1023 -> v0.2026264.731 = merged sdk#269, the reasoning-on-error fields) is stated in the body. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): T3 scope mismatch — the body describes a design the diff does not implement (block 1). The PR rewrites the validator's own rulebook ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
…m, totals Local dogfood round 12 — four findings: - (4) REAL BUG: ghclient.meta set ChangedLines from m.ChangedSum, which ghkit NEVER populates, so the context rendered "0 changed lines". Dropped the field (the render now states the changed-FILE count only, which is populated). - (2) Commit.Author was populated but never rendered; dropped. - (3) corrected the openai-go claim: no production import; it stays in go.mod for the test chat seam. - (1) body totals corrected to +2236/-3225. Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)
[step: review]Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no manipulation attempt in body/comments. The PR rewrites the validator's own rulebook ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake
Not blocking: R10/bed — the body declines a Verdict: BLOCK ollama-cloud/deepseek-v4.1-flash — action-review. |
[step: review]All 43 changed files are now read (the seven removed Review — BLOCKHead SHA: Change class: plugin Go code + candy config + README (one candy) — runtime/code change. Security screen (T1–T4): no finding. The PR rewrites the validator's own rulebook ( placement: CORRECT — every change is inside the candy ( Blocks
Comment intake (all 21 comments considered; all
|
Validator finding (B18): the bare pattern `serve` matches at ANY path level, so it also ignored the tracked source directory `candy/plugin-review/cmd/serve/` — a new file there would be silently untracked. Verified with `git check-ignore`: .gitignore:1:serve candy/plugin-review/cmd/serve/probe.go <- ignored (bug) Anchored to `/candy/plugin-review/serve` (the stray build artifact), so: cmd/serve/* -> NOT ignored (source is tracked) candy/plugin-review/serve -> ignored (the binary) Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated)
[step: review]Review — PASSHead SHA: Security screen: PASS — the embedded Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…#17) PR #16 deleted `candy/plugin-review/schema/review.cue` and the generated `params/cue_types_gen.go` (the removed `verb:pr` typed input). Its sweep was scoped to `candy/plugin-review/`, so it missed the repo-root CI workflow, which still regenerated params from the deleted schema: cat candy/plugin-review/schema/review.cue cat: ...: No such file or directory -> the `test` job failed There is no schema and no generated params in this repo now, so the cue:gen reproducibility step (and the now-unneeded pinned cue install) is removed. The remaining gate is gofmt/vet/test, which is the change class for this plugin. The stale "incl. the full-loop e2e" label is dropped (there is no loop). Full-repo sweep for the removed surface returns no live hit (schema/review.cue, cue_types_gen.go, candy/plugin-review/params, verb:pr, AI_REVIEW_MAX_TURNS, REVIEW_PLAN_PATH, review-plan.yml, --plan). Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (fully tested and validated) Co-authored-by: Andreas Trawoeger <[email protected]>
Summary
Rewrite the review engine to a pure function: assemble the complete PR context into ONE message, make ONE model call, extract the verdict, emit the effects.
A review is a function of
(rulebook, complete PR, model)— all input is read once and sent once, so there is nothing for the model to fetch and no tool loop.Measured root cause (why the loop was the problem)
The previous engine assembled the context turn by turn through a tool-calling loop, and message reasoning is not re-sent between turns — so the synthesis turn re-derived everything from partial tool results. Measured on a 25-file PR: 371 KB of reasoning over three runaway synthesis turns (8m25s, no verdict at cap). Delivering the whole context in ONE message produced a verdict from ONE call (measured live: 1m24s on action-review#7; 2m55s on spec#140).
File accounting (43 files: 11 added / 22 removed / 10 changed, +2235/−3225)
Added (11):
command.go,config.go,config_test.go,context.go,effects.go,effects_test.go,llm_test.go,render_test.go,prompt_embed.go,prompt.md,.gitignore.Removed (22):
plan.go,yamlutil.go,parse.go,parse_test.go(the plan executor + its parser);schema/review.cue+params/cue_types_gen.go(the removedverb:prparams);fixtures/(7 orphans);e2e_test.go,live_gateway_test.go,livetest_test.go,plan_test.go,plan_effect_test.go,slug_test.go,thread_index_test.go,verbs_test.go,verdict_test.go.Changed (10):
review.go,review_test.go,llm.go,ghclient.go,plugin.go,cmd/serve/main.go,charly.yml,go.mod,go.sum,README.md.SDK pin advance (supply chain):
go.mod/go.summovegithub.com/opencharly/sdkv0.2026263.1023 → v0.2026264.731— the mergedopencharly/sdk#269(the full reasoning text onEmptyCompletionError/StallError, which the engine's failure-reasoning dump reads). A released, merged tag, not a branch.What was removed
AI_REVIEW_MAX_TURNS, tool dispatch,sdkTools, thechatTurnseam) andtools.go's 7 review tools. The prompt no longer mentions any tool, so prompt and runtime cannot drift.verb:pr(pr_meta/pr_commits/pr_thread/pr_files) — it duplicatedplugin-gh's canonicalverb:gh(the same ghkit reads) and had no consumer. Deleted with its schema, generatedparams/, and the verb-only helpers. plugin-review declares no typed input def, so persdk.BuildCapabilities' documented path an input-less plugin passes a nil schema (no schema dir).classify()fails once, terminally).openai-gois no longer imported by the PRODUCTION code (onlyllmkituses it internally). It remains in the DIRECTrequireblock becausereview_test.go's chat seam names the SDK'sopenai.ChatCompletionMessageParamUnion/openai.ChatCompletionToolUnionParamtypes (a test-only import).Removed-surface sweep (real commands + output)
plugin-ghowns the one canonical GitHub verb (verb:gh, same ghkit); this candy consumes that module's client and duplicates nothing.Cross-repo consumer liveness for the removed
verb:pr(the consumers'origin/main, pasted):Every
plugin-reviewreference in those repos is acommand:reviewweld/pin (charly/scripts/host-command-plugins.txt,charly/packaging/charly.yml,eval-omarchy/candy/eval-pr/charly.yml) — none uses the removedverb:pr.How tested
The engine's own paths carry their coverage (
review_test.go):generate()driven end to end through a chat seam (exactly ONE call, no tools, the verdict returned; a model failure propagated), plusverdictExit(exit 0 only for a single verdict; 1 for no verdict; 2 for ambiguous; a prose mention is NOT a verdict), the budget guard's refusal, and validate-before-network.The candy's own ADE
plan:checks, run live against this build:Verbatim live run of this revision (the shipped format strings are
request — …andresponse in %v — …):No mutation on a non-disposable target: the live runs used
AI_REVIEW_POST_COMMENT=false(they read the PR and wrote only the local--outfile).Rulebook compliance
/charly-internals:git-workflow,root-cause-analyzer,strict-policyloaded.plugin-gh's canonicalverb:gh, not a second copy.git statusinspected; branchrefactor/clean-review-engine; no force-push; no direct push tomain.gofmt/go vet/go test+ the two ADE checks + the live run, all pasted on the final tree.disposable: truebed exists for this repo (it ships nobox:/check:entity); the fresh-rebuild R10 for a plugin is the charly release that welds it, which has not run — so the tier isanalysed on a live system, and this is the documented self-install/bootstrap exception requiring maintainer sign-off (requested here).Cross-repo cutover (this PR is the first step)
opencharly/.github— invokecharly reviewdirectly + auto-close (PR #104).opencharly/action-review— delete the now-orphanedreview-plan.yml+prompt/validator.md.charly— weld the newplugin-reviewtag → release → bumpvars.CHARLY_VERSION(the release run is the fresh-rebuild R10); that step drops the vestigialREVIEW_PROMPT_PATHenv.The eval-omarchy lane is unaffected: its
validate/oraclestages arekind: agentwithtools: [pr, ledger], dispatched by plugin-pipeline's own client — notcommand:reviewand not the deletedverb:pr.Change classification
analysed on a live system— the changed paths executed live against the real model and real PRs; the fresh-rebuild R10 (the weld) has not run.Assisted-by: opencode ollama-cloud/deepseek-v4.1-flash (analysed on a live system)