Skip to content

feat(subagents): wire v2 - identity, queued phase, budgets, artifacts, cost - #169

Merged
jkyberneees merged 1 commit into
mainfrom
feat/subagent-wire-v2
Aug 31, 2026
Merged

feat(subagents): wire v2 - identity, queued phase, budgets, artifacts, cost#169
jkyberneees merged 1 commit into
mainfrom
feat/subagent-wire-v2

Conversation

@jkyberneees

Copy link
Copy Markdown
Contributor

Implements the sub-agent wire additions from the bodek UX pass (P1-P6). Everything new is omitempty: old-client/new-client matrices degrade to current behavior. Full suite 31/31 green, vet + golangci-lint clean, -race clean on cmd/odek.

  • P1 identity: started state frames carry the clamped goal (2048), profile id, and the EFFECTIVE post-clamp max_risk (declared values ride queued frames; the child started record overwrites them).
  • P2 queued phase: delegate_tasks emits phase queued per accepted task before acquiring a concurrency slot; registry + stats treat queued as neither active nor done. Enabled a registry merge-on-rerecord fix - the old restore-old-into-new record made queued to started a no-op.
  • P3 budgets: budget_seconds / budget_iterations (0/absent = uncapped) on started and active frames.
  • P4 artifacts: framed result envelope adds cost_usd and full artifact refs; the terminal state frame + registry carry bounded {id, path, bytes} metadata.
  • P5 blocking model: deny-not-prompt confirmed in code and documented as final in docs/SUBAGENTS.md - no waiting_approval state will exist; clients treat error/timeout/cancelled as the only sticky outcomes.
  • P6 cost: cost_usd on state frames (cumulative) and the envelope (final), budget_cost_usd when a cost cap is enforced; all estimates use the exact /api/usage math over the child model resolved prices, omitted (never $0) when unconfigured. /api/usage gains subagents.cost_usd lifetime sub-total; totals semantics documented: parent-turn totals unchanged, sub-agent spend broken out, per-batch sums use final envelopes only (replay-safe).

…, and cost on the wire

Implements the bodek UX-pass wire spec (P1-P6). subagent_state frames and the registry now carry the clamped goal (2048), the profile id and effective post-clamp max_risk (declared while queued, effective from started), the enforced budget_seconds/budget_iterations/budget_cost_usd, cumulative-then-final cost_usd estimates computed with the exact /api/usage math, and terminal artifact metadata {id,path,bytes}; the framed result envelope adds cost_usd and the full artifact refs. delegate_tasks emits an explicit queued phase per accepted task before acquiring a concurrency slot so clients see accepted-but-not-spawned work; the registry gained a merge-on-recored semantic so queued -> started transitions actually overwrite the declared identity (the old restore-old-into-new record made any re-record a no-op). /api/usage exposes subagents.cost_usd as a lifetime sub-total - parent-turn totals are unchanged and documented as such in SUBAGENTS.md, which also carries the wire-field reference and closes the blocking-model question: deny-not-prompt is final, no waiting_approval state will exist.
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 31, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

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

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
odek 6e139be Commit Preview URL

Branch Preview URL
Aug 31 2026, 09:34 PM

@jkyberneees
jkyberneees merged commit 53c5bb8 into main Aug 31, 2026
10 checks passed
@jkyberneees
jkyberneees deleted the feat/subagent-wire-v2 branch August 31, 2026 21:38
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