Skip to content

feat(subagents): add optional budgets and runtime limits - #1044

Closed
KB (KB-syntheticsciences) wants to merge 12 commits into
mainfrom
codex/subagent-contracts
Closed

KB (KB-syntheticsciences) wants to merge 12 commits into
mainfrom
codex/subagent-contracts

Conversation

@KB-syntheticsciences

@KB-syntheticsciences KB (KB-syntheticsciences) commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

What does this PR do, and why?

Add opt-in bounded runs for delegated subagents. Users choose a model policy, shared conversation allowances for paid calls or subscription tokens, and assignment deadlines. The main agent stays outside these limits. Bounded runs remain off by default.

The runtime reserves each request before dispatch, returns definite rejection reservations, retains uncertain outcomes and stops work at its deadline. Input estimates count text, images, PDF pages and offered tool schemas without treating encoded media bytes as text. Worker reports retain partial output, command evidence, usage and the actual stop reason. A user can increase an allowance and continue the same worker; the lead assesses whether its result meets the objective.

Cancellation, background delivery, inheritance, explicit CLI model selection, retries, nesting and recovery preserve the assignment contract. Database connections finalize their statements before closing so Windows can release the files. ADR 0002 explains why runtime limits are independent of optional harness guidance and documents the trusted local API boundary: these controls do not isolate untrusted same-user code with control API or ledger-file access.

Linked issue

ROADMAP.md item 14 — worker contracts and limits.

How did you verify it?

  • All five workflows pass at 96b00f33: Deep CI, Fast CI, browser E2E, runtime compatibility and secret scanning.
  • Deep CI: 5,418 backend passed, 67 skipped, 0 failed. Native ownership: macOS 130 passed/12 skipped; Windows 208 passed/26 skipped; no failures.
  • Fast CI: 2,847 affected backend passed/5 skipped; workspace 1,286, shared UI 394, SDK 31 and docs 10 passed. Browser E2E: 109 passed/1 skipped.
  • Local focused tests: 150 passed across nine files. The response adds 31 regressions for request rejection, media/schema estimates and deadline/stop ordering. Regressions were observed failing before their fixes. Independent targeted review found no remaining actionable findings.
  • All seven local typecheck tasks, docs validation, formatting and staged secret scan pass. The single-platform native build and version smoke pass with the exact response commit embedded.
  • The full local run remains recorded as 5,414 passed, 66 skipped and five failures. The Modal timing failure also reproduces on the unmodified base. Storage and terminal failures pass with disk-backed temporary storage and a plain test-process shell; the authority-poll and project-cancellation cases pass in isolation. No product code or assertions were changed to force these diagnostics to pass, and the failed full run is not labelled green.
  • Earlier paid-provider/browser acceptance remains evidence for the earlier native build. Current-commit browser coverage is the E2E workflow above; no fresh paid canary is claimed for this response.

Checklist

  • Current-commit CI fully green
  • Current-commit native build and smoke complete
  • SDK regenerated for the original API changes; this response does not change the API
  • CHANGELOG Unreleased and usage docs updated
  • No package version bumps
  • Install scripts unchanged

Keep this PR as a draft for reviewer approval. The protected-main packaged rehearsal remains an integration gate; it does not publish packages. No merge or release is authorized by this preparation.

Use USD allowances for priced local proxies. Reacquire returned grants through ancestor capacity, expose that capacity to continuation controls, and retain accounting in model-facing handoffs and compacted receipts.

Add regressions for these cases and for cross-process allocation and reservation races.
The admission guard priced all input and output at the highest rate across every speed, rejecting Standard calls before dispatch. Share normal context pricing, bound input and output separately, and reserve replay growth before the final handoff.

Pass the selected speed through physical-call admission and expose each worker grant and estimated rejection minimum. Add Standard, Fast, replay-growth and actual Task regressions.
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
openscience Ready Ready Preview Nov 4, 2026 2:28pm UTC

Request Review

Release definite request rejections without releasing ambiguous accepted work.
Estimate text, images, PDF pages and offered tool schemas consistently before
preparation and physical dispatch; keep JSON tool output counted as text.
Preserve deadline stops through stream cleanup and late reservation failures.
Document mandatory runtime guards and the trusted local approval boundary.

This branch was successfully deployed

1 active deployment
Preview — 96b00f33 Deployed Nov 4, 2026 by vercel[bot]
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