Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

address review (claude): correct estimate framing — editorial fixes under-count, LLM proxy

[._.]/ Adam Eivyc03b9b0e9a41
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index 43ea07aeee..dcf327d4a4 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -55,7 +55,7 @@
- **[issue-1573] Series Autopilot now flags editorial checks that errored instead of reporting a silent "clean" run.** Each editorial check runs inside a boundary guard so one bad check (a malformed prompt, a provider timeout, a missing context) can't abort the whole pass — but a check that *threw* produced no findings, and the autopilot's per-pass broadcast always reported "0 blocking" and completed as if everything had run. A check that errored every run looked clean until someone inspected the raw per-check results. The editorial-checks round frame now carries an **errored count + the failing check ids**, and a run that finished with any errored check is qualified on the terminal summary and the persisted status banner (a caution, not "production-ready") so the partial failure is visible — the dimension that errored was never actually evaluated. The standalone "run editorial checks" panel surfaces the same errored aggregate on its completion frame. (`server/services/pipeline/seriesAutopilot.js`, `server/services/pipeline/editorial/checkRunner.js`, `server/services/pipeline/series.js`, `client/src/components/pipeline/AutopilotPanel.jsx`)
- **[issue-1574] Series Autopilot now retries a failed beats/text child run before giving up, instead of marking it attempted and silently skipping it.** When the autopilot delegates to a child runner (volume beats or per-issue text/scripts), the child can finish with its target stage still empty because the underlying LLM call failed. Previously the work was marked *attempted* before the result was inspected, so the resolver skipped it on the next pass — a failed beats run wasn't caught until a downstream stage tripped over the empty `idea`, and a failed text run only paused after the fact. The autopilot now **verifies the child actually produced its output** (every issue in the volume has a beat sheet / the issue's required script stages landed) and, on a miss, **retries the child once** (skip-existing, so the retry only fills the gap) before marking the work attempted. Each attempt is budget-gated and bills one action like any other step; if the output is still missing after the retry the run emits an escalation frame and **pauses for review with the missing stages as residual findings** rather than marching on toward a "done" with no script. A per-run **`maxChildRetries`** option tunes the retry budget (0 restores the legacy single-attempt behavior). (`server/services/pipeline/seriesAutopilot.js`)
- **[issue-1575] Series Autopilot can now run a subset of editorial checks for a single run, without touching the global enabled set.** The editorial-checks pass always ran *every* enabled check, so piloting one new check — or skipping an expensive one for a single run — meant toggling checks globally and remembering to flip them back. The autopilot start payload now accepts an optional **`editorialCheckIds`** array; when present, that run's editorial-checks pass evaluates only those check ids (unknown or disabled ids are ignored), and the same subset drives the budget gate so billing and execution agree on the set. Absent or empty falls back to the full enabled set (the unchanged default). The dry-run plan also names the subset (e.g. *"per-run subset of 2 editorial check(s)"*) instead of implying the whole enabled set will run. (`server/services/pipeline/seriesAutopilot.js`, `server/routes/pipeline/autopilot.js`)
-- **[issue-1576] The Series Autopilot dry-run plan now estimates its budget cost, so a large series on a small daily cap can be spotted before it burns through text generation and never reaches editorial.** The dry-run plan enumerated the steps it *would* run but gave no sense of how much of the daily CoS action budget they'd consume. Each planned step now carries an estimated **cos-action count** — the same unit the daily cap gates on (`recordDomainUsage('cos', …)`) — computed as an upper bound: convergence loops (arc verify, beat continuity, editorial review) counted at their max rounds (verify + resolve per round), per-item steps at one action per issue, and the pure gates that bill nothing (editorial health gate, canon verify) shown as zero-cost. The editorial-checks pass — which bills a single action but fans out to one LLM call per *issue × enabled LLM check* — additionally carries that **LLM-call estimate** (e.g. *"~18 LLM call(s)"* for a 9-issue series with 2 LLM checks). The plan panel shows each step's `≈N act` and an **Est. budget** footer totalling the run's actions and editorial-check LLM calls, on both the start and the terminal dry-run frame. (`server/services/pipeline/seriesAutopilot.js`, `client/src/components/pipeline/AutopilotPanel.jsx`)
+- **[issue-1576] The Series Autopilot dry-run plan now estimates its budget cost, so a large series on a small daily cap can be spotted before it burns through text generation and never reaches editorial.** The dry-run plan enumerated the steps it *would* run but gave no sense of how much of the daily CoS action budget they'd consume. Each planned step now carries an estimated **cos-action count** — the same unit the daily cap gates on (`recordDomainUsage('cos', …)`) — leaning toward the high end: convergence loops (arc verify, beat continuity, editorial review) counted at their max rounds (verify + resolve per round), per-item steps at one action per issue, and the pure gates that bill nothing (editorial health gate, canon verify) shown as zero-cost. (The editorial review's per-comment auto-fixes bill extra and scale with the findings, which isn't knowable at plan time, so a heavy editorial pass can exceed its estimate.) The editorial-checks pass — which bills a single action but fans out to many LLM calls whose count depends on manuscript chunking — additionally carries a rough **LLM-call proxy** (*issues × enabled LLM checks*, e.g. *"~18 LLM call(s)"* for a 9-issue series with 2 LLM checks). The plan panel shows each step's `≈N act` and an **Est. budget** footer totalling the run's actions and editorial-check LLM calls, on both the start and the terminal dry-run frame. (`server/services/pipeline/seriesAutopilot.js`, `client/src/components/pipeline/AutopilotPanel.jsx`)
## Providers
diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.js
index eecc805384..7e159e46c7 100644
--- a/server/services/pipeline/seriesAutopilot.js
+++ b/server/services/pipeline/seriesAutopilot.js
@@ -211,21 +211,26 @@ const roundsNote = (rounds) => (rounds === 0 ? 'skipped (0 rounds)' : `up to ${r
// `estActions`: the number of cos actions it bills via recordDomainUsage('cos',
// { actions }), i.e. the unit the daily budget cap gates on. Surfacing it lets a
// user see, before starting, whether a large series will exhaust the cap on
-// text/verify and never reach editorial. Estimates are UPPER BOUNDS — convergence
-// loops counted at their max rounds (they usually converge sooner), per-item
-// steps at one action per item (retries excluded). A few steps cost nothing
-// against the cap (editorialHealthGate, canonVerify) and carry estActions: 0.
+// text/verify and never reach editorial. Estimates are approximate and lean
+// toward the high end — convergence loops counted at their max rounds (they
+// usually converge sooner), per-item steps at one action per item (retries
+// excluded). A few steps cost nothing against the cap (editorialHealthGate,
+// canonVerify) and carry estActions: 0. One known UNDER-count: the editorial
+// review's per-comment auto-fixes each bill an extra action and scale with the
+// number of blocking findings, which isn't knowable at plan time — so a heavy
+// editorial pass can exceed its estimate.
//
// A bounded verify→resolve convergence loop (arc, beat-continuity, editorial)
-// bills one action per verify plus one per resolve; the final round never
-// resolves (it converges or pauses). Upper bound: rounds verifies + (rounds-1)
-// resolves.
+// bills one action per verify plus (roughly) one per resolve; the final round
+// never resolves (it converges or pauses). Estimate: rounds verifies +
+// (rounds-1) resolves.
const convergenceLoopActions = (rounds) => (rounds <= 0 ? 0 : 2 * rounds - 1);
// Sum a dry-run plan's per-step estimates into run totals. `estActions` is the
// budget-relevant total (cos daily-cap units); `estLlmCalls` aggregates the
-// check-pass fan-out (editorialChecks bills a single cos action but issues one
-// LLM call per issue×check). Pure — safe to call at broadcast time and in tests.
+// check-pass fan-out (editorialChecks bills a single cos action but issues many
+// LLM calls — see the rough proxy at its plan.push). Pure — safe to call at
+// broadcast time and in tests.
function summarizePlanCost(plan) {
return (Array.isArray(plan) ? plan : []).reduce(
(acc, step) => ({
@@ -1442,9 +1447,12 @@ function buildDryRunPlan(series, issues, options, costContext = {}) {
// the full enabled set runs.
const editorialSubset = editorialSubsetIds(options);
// The checks pass bills a single cos action (only when an LLM check runs) but
- // fans out to one LLM call per issue × enabled LLM check — surface that fan-out
- // as estLlmCalls so a large series's check cost is visible. When the caller
- // didn't resolve the enabled-check count, assume one LLM check runs.
+ // fans out to many LLM calls. The real call count depends on how each check
+ // chunks the stitched manuscript by provider context window, so it isn't
+ // knowable at plan time — `issues × enabled LLM checks` is a rough proxy that
+ // scales with both series size and check count, surfaced so a large series's
+ // check cost is visible. When the caller didn't resolve the enabled-check
+ // count, assume one LLM check runs.
const llmCheckCount = Number.isInteger(costContext?.editorialLlmCheckCount)
? costContext.editorialLlmCheckCount
: 1;