Skip to content

[codex] Add runtime circuit breaker for pre-claim exits#191

Merged
saltbo merged 2 commits into
mainfrom
codex/runtime-circuit-breaker-preclaim
May 19, 2026
Merged

[codex] Add runtime circuit breaker for pre-claim exits#191
saltbo merged 2 commits into
mainfrom
codex/runtime-circuit-breaker-preclaim

Conversation

@saltbo
Copy link
Copy Markdown
Owner

@saltbo saltbo commented May 19, 2026

Summary

  • add a daemon runtime circuit breaker that opens when the same task fails to enter the workflow 3 times before claim
  • skip release attempts for todo tasks in RuntimePool.finalize() and orphan session reaping; only release tasks that are actually in_progress
  • pause dispatch per runtime while the circuit is open, then allow one half-open probe after cooldown
  • log pre-claim runtime failures with the captured reason when available

Root Cause

Worker agents claim tasks themselves. When a spawned runtime session exited before claim, the task stayed todo, but daemon cleanup still attempted releaseTask. That produced repeated 409s and allowed the same task/runtime pair to keep spawning sessions.

Validation

  • pre-commit passed: biome, typecheck, full vitest suite (101 files, 2312 tests)
  • targeted runtime tests passed: runtimePool-coverage, runtimePool-finalize, runtime-circuit-breaker

Notes

  • I did not run the daemon smoke test because it requires refreshing/installing the local ak CLI, and the request explicitly said not to install ak locally.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 19, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
agent-kanban aaaceb9 May 19 2026, 03:38 PM

@saltbo saltbo marked this pull request as ready for review May 19, 2026 18:56
@saltbo saltbo merged commit a843a6f into main May 19, 2026
2 checks passed
@saltbo saltbo deleted the codex/runtime-circuit-breaker-preclaim branch May 19, 2026 18:58
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