Skip to content

feat(workflows): fold_usage verification cost ledger (V6, #2494) - #2520

Merged
flora131 merged 2 commits into
mainfrom
verifier/cost-ledger
Aug 19, 2026
Merged

feat(workflows): fold_usage verification cost ledger (V6, #2494)#2520
flora131 merged 2 commits into
mainfrom
verifier/cost-ledger

Conversation

@flora131

@flora131 flora131 commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

Slice V6 of the LLM-as-a-Verifier adoption program (specs/2026-08-17-tournament-soft-selection.md §5.3): the fold_usage verification cost ledger — plus the planned V2⋈V3 reconciliation merge.

Merge commit (first parent of this branch's delta): origin/verifier/adversarial-mean-veto merged into the stack line, resolving the planned parallel edit of the adversarial runner — V2's graded semantics (criteria × verifier fan-out, decide_verification sole accept path, re-ask, demoted reducer) wired through V3's prompt plumbing (build_scoring_prompt + warm_first_fan_out), proven by the adversarial + prompt-layout + tournament suites post-merge.

V6 proper (131 source lines):

  • packages/workflows/builtin/verification-usage.ts (new): fold_usage(results)UsageTotals {calls, input, output, cacheRead, cacheWrite, cost, turns, cacheHitRate} — pure fold over modelAttempts[].usage including retried attempts; absent fields count 0; importable without tournament code (the B-track consumes it in B3)
  • Consumers: tournament comparisons.json gains a usage block per phase (attempts/ring/pivots/reducer) + total; adversarial verification-summary-<round>.json gains a usage block; writes happen once per phase so durable replay re-emits checkpointed writes

Goal/ralph usage blocks are V10's (Q4). Base: verifier/tournament-runner (V5, #2517). Stack: V1 → V3 → V4 → V5 → V6.

Evidence

Produced by an implement→review→repair goal run (approved turn 1; completion/evidence/risk reviewers all complete; remaining_work: none):

  • npm run check — green (includes the coding-agent tsgo erasableSyntaxOnly pass)
  • npx vitest --run --project unit -t "usage-fold" — green: absent-usage zeros, retries summed, hit-rate derivation, empty set all-zero
  • Post-merge: tournament + adversarial + prompt-layout suites all green (the reconciliation proof)
  • Size: 131 changed source lines for the V6 delta (< 500; merge commit separate)
  • CHANGELOG: packages/workflows/CHANGELOG.md under ## [Unreleased] ### Added

Spec contract: specs/2026-08-17-tournament-soft-selection.md §5.3 (Q4: goal/ralph blocks deferred to V10 — noted on #2494).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Comment thread packages/workflows/builtin/adversarial-verification-runner.ts Fixed
Comment thread packages/workflows/builtin/adversarial-verification-runner.ts Fixed
Comment thread packages/workflows/builtin/adversarial-verification-runner.ts Fixed
Declare finalDecision, scoreTablePath, and reviewReportPath without
placeholder values that GitHub Code Quality flagged as dead stores.
Every loop path assigns them before return.

Assistant-model: Grok 4.6
@flora131
flora131 marked this pull request as ready for review August 19, 2026 16:53
@flora131
flora131 changed the base branch from verifier/tournament-runner to main August 19, 2026 17:01
@flora131
flora131 merged commit 2419fb6 into main Aug 19, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant