Repository navigation
Description
Parent
#840 — useful reviewer and trustworthy CI evidence gate.
Related work: #865 stage-aware convergence reserve, #868 calibration/economics.
Verified gap
model_stages.json is currently reconstructed from model-lane receipts plus follow-up results. It is not the authoritative lifecycle of every provider call, and reporter/re-distillation/continuation activity can be omitted or ambiguously classified. The current global max_model_calls budget also treats primary investigation, retries, refutation, reconsideration, and final synthesis as one undifferentiated pool.
The product needs the model equivalent of TaskLedger before provider/cache economics or protected final-lead capacity can be trusted.
Outcome
Introduce one append-only ModelStageLedger / call lifecycle for every model/provider invocation:
planned
→ queued
→ provider_wait/backpressure
→ running
→ terminal
Each call records at least:
RevisionIdentity
call_id
programme/lane
stage = routing | primary | challenge | proof_arbitration |
receipt_reconsideration | final_lead | retry | fallback
provider / model / endpoint / service tier
queue_ms / request_ms / ttft_ms? / generation_ms?
fresh_input / cache_write / cache_read / output / reasoning? tokens
prefix/cache identity
retry/fallback provenance
terminal status / HTTP class
price basis + estimated direct cost when available
Stage budgeting and #868 calibration derive from this ledger rather than from inferred lane/file presence.
Scope
- Emit lifecycle events around every existing provider call path, including preflight, primary specialists, proof planner, refuter/challenge, reporter, reporter re-distillation, lane continuation/reconsideration, retries, and fallbacks.
- Preserve provider-specific cache/token fields but normalize them into one additive receipt surface.
- Record unavailable metrics as absent, not zero.
- Compute stage-aware call consumption from explicit stage identity.
- Make the ledger work with model-off and missing price tables.
- Keep prompt contents/secrets out of telemetry; persist digests/section identities rather than raw private context where possible.
- Allow review: reserve model calls for challenge, proof reconsideration, and one authoritative final judgment #865 to protect final-lead/reconsideration/retry reserves from primary fanout.
Acceptance
- Every network model call in a run maps to exactly one model-stage lifecycle.
- Reporter, re-distillation, continuation, retry and fallback calls cannot disappear from cost/time accounting.
- Queue/backpressure time is distinct from provider request duration.
- Cache read/write/fresh token classes remain separate.
- A missing provider metric does not serialize as a misleading zero.
- Primary calls cannot spend a protected final-lead reserve once review: reserve model calls for challenge, proof reconsideration, and one authoritative final judgment #865 consumes this ledger.
- Model-off produces an empty/explicit no-model ledger without breaking run accounting.
- Same recorded calls replay to the same stage/cost summary.
- Raw prompts and credentials are absent from aggregate telemetry.
Proof
- Full call-path fixture covering primary, retry, fallback, challenge, reporter, continuation and final lead.
- Backpressure/timeout/missing-token-usage/missing-price fixtures.
- Cache hit/write/read accounting fixture.
- Model-off fixture.
- Forged/missing-call verifier negatives.
- Full provider/model orchestration/calibration/CLI/workspace/fmt/Clippy/policy/exact-head gate.
Non-goals
- No provider selection policy in this issue.
- No named-model hardcoding into correctness.
- No final ReviewJudgment semantics; review: reserve model calls for challenge, proof reconsideration, and one authoritative final judgment #865 owns editorial authority.
- No repository learning yet.
Dependency/order
Depends on #923. Land before #865 becomes authoritative and before #868 becomes a promotion/learning input.
Rollback
Keep the stage ledger in shadow while retaining current call scheduling. Do not let inferred model_stages.json remain the long-term authority.
Activity
EffortlessSteven commentedon Aug 24, 2026
PR-sized decomposition — #945 C5.1–C5.3
No model-selection policy in this train. #865 consumes stage budgets; #868/#938 consume the measured projections.
EffortlessSteven commentedon Aug 24, 2026
Concrete PR decomposition
No inferred lane/file presence remains authoritative. Reporter, redistillation, continuation, reconsideration, retry/fallback and final lead must all be ledgered. Missing provider metrics remain absent, not zero; raw prompts/secrets stay out.