Skip to content

Surface budget-gated orchestrator wake-ups instead of stalling silently (#34) - #58

Merged
currentbits merged 1 commit into
mainfrom
coder/budget-exhaustion-kills-orchestration-si-2b6a87
Aug 15, 2026
Merged

currentbits merged 1 commit into
mainfrom
coder/budget-exhaustion-kills-orchestration-si-2b6a87

Conversation

@currentbits

Copy link
Copy Markdown
Owner

Why

When an orchestration worker finished, its wake-up run for the orchestrator went through startRun, which is gated by assertUnderDailyBudget. If the daily cap had been reached, flushOrchNotices swallowed the rejection and appended a plain event message to the transcript — no reason, no status change, and not even a renderer push. The orchestration just stopped advancing, and an unattended fan-out looked like it was still working (issue #34).

What changed

electron/runner.js — the undeliverable-wake-up path now:

  • records the rejection reason in the event text (Not delivered: Daily budget reached ($X of $Y)…),
  • lands the orchestrator thread as failed — the existing visible-failure channel: Sidebar.tsx:274 renders the Failed badge and retryTurn.ts:65 arms the Retry turn button on the last event card,
  • pushes the change (pushDetail + pushThreadsChanged); the old code saved to the store but never pushed, so the event sat unseen until some unrelated refresh.

A thread that has a live run racing in after the active-guard keeps its own status — only a genuinely idle orchestrator is marked failed.

electron/notify.js — shouldNotify now also fires for a thread landing failed with no run of its own. The old gate required the previous status to be working/waiting, so a stalled orchestrator (previously done) never got a desktop notification. Threads never seen before (no previous status) stay quiet, so a pre-existing failure does not notify at boot.

Scope

The issue also notes there is no per-orchestration or per-thread ceiling for a fan-out, only the global daily cap. That is not in this PR — it needs settings plus per-orchestration accounting and is worth its own change. This PR does the issue's stated minimum: make the gate rejection visible.

Verification

  • node --test electron/test/runner.test.js — 28/28 pass, including a new test that drives a worker to done with the cap tripped mid-flight and asserts the orchestrator lands failed with the reason in the transcript. It fails on a stashed runner.js, so it actually covers the fix.

  • node --test electron/test/notify.test.js — 7/7 pass, with a new case for the background-failure transition.

  • npm run typecheck — clean.

  • npm run test:electron — 708/717. The 9 failures are all in orch-server.test.js and reproduce identically on a clean tree; they are pre-existing and unrelated to this change.

  • PR created by the Claude Code agent

A worker-finished wake-up rejected by the daily-budget gate only left a
quiet event in the transcript: the orchestration stopped advancing and
nothing said so. The undeliverable path now records the rejection reason,
lands the orchestrator "failed" (sidebar badge + Retry turn), and pushes
the change to the renderer.

shouldNotify also fires for a thread landing "failed" with no run of its
own, so the desktop notification reaches an unattended fan-out.

Co-Authored-By: Claude Opus 5 <[email protected]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@currentbits
currentbits merged commit 10498b1 into main Aug 15, 2026
1 check passed
@currentbits
currentbits deleted the coder/budget-exhaustion-kills-orchestration-si-2b6a87 branch October 3, 2026 16:07
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