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 (codex): exempt zero-round gates from the pre-dispatch budget pause

[._.]/ Adam Eivy8207ef515c43
diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.js
index d2cda7aaec..7dc41eef30 100644
--- a/server/services/pipeline/seriesAutopilot.js
+++ b/server/services/pipeline/seriesAutopilot.js
@@ -1124,8 +1124,14 @@ export async function startSeriesAutopilot(sId, options = {}) {
// complete a text-ready series even with the budget exhausted. The
// editorialHealthGate (#1316) is likewise exempt — it's a pure read +
// score with no LLM cost, so a budget-exhausted run can still produce its
- // readiness verdict (and pause on the findings, not the budget).
- if (step.kind !== 'editorialChecks' && step.kind !== 'editorialHealthGate') {
+ // readiness verdict (and pause on the findings, not the budget). A gate
+ // whose resolved rounds is 0 ("skip") is also exempt: runArcVerify /
+ // runEditorial short-circuit with no LLM spend, so "0 skips the gate" must
+ // hold even when the budget is exhausted (otherwise the run pauses on
+ // budget instead of skipping).
+ const zeroRoundSkip = (step.kind === 'verifyArc' && runOptions.maxArcVerifyRounds === 0)
+ || (step.kind === 'editorialReview' && runOptions.maxEditorialRounds === 0);
+ if (step.kind !== 'editorialChecks' && step.kind !== 'editorialHealthGate' && !zeroRoundSkip) {
const budget = await getDomainBudgetStatus('cos');
if (!budget.withinBudget) {
await persistMarker(sId, { status: 'paused', runId, currentStep: step.kind, lastError: `daily cos ${budget.exceeded} budget reached` });
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index 20effadaaf..faf9ffb879 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -550,6 +550,21 @@ describe('autopilot conductor', () => {
expect(arcSpies.verifyArc).not.toHaveBeenCalled();
});
+ it('a zero-round gate skips even when the budget is exhausted (no budget pause at that gate)', async () => {
+ budgetStatus = { withinBudget: false, exceeded: 'actions' };
+ const { seriesId } = await seedComplete();
+ // maxArcVerifyRounds:0 ⇒ runArcVerify short-circuits with no spend, so the
+ // budget gate must NOT pause at verifyArc — the run advances to the next
+ // non-exempt step (scriptVerify) and pauses there on budget instead.
+ await autopilot.startSeriesAutopilot(seriesId, { maxArcVerifyRounds: 0 });
+ await waitFor(runFinished(seriesId));
+ expect(arcSpies.verifyArc).not.toHaveBeenCalled();
+ const series = await seriesSvc.getSeries(seriesId);
+ expect(series.autopilot?.status).toBe('paused');
+ expect(series.autopilot?.currentStep).toBe('scriptVerify'); // not 'verifyArc'
+ expect(series.autopilot?.lastError).toMatch(/budget/);
+ });
+
it('maxEditorialRounds:0 skips the editorial-checks step too (no budget spend)', async () => {
checkRunnerSpies.runEditorialChecks.mockClear();
const { seriesId } = await seedComplete();