workflow: execute durable local agent and machine activities

Merged
TE
2d ago
+2357-8

Workflow agent() and machine() calls reserve durable child identities before effects, reattach interrupted work, and preserve the exact final assistant reply or complete machine output. Parallel activities enqueue independently and receive distinct session names. A fallback after a stalled daemon retry reserves its own prompt identity before admission.

Agent replies get one schema correction; inactivity nudges once, then restarts on a configured permitted harness or route, then fails. Account, capacity and permission waits keep the existing recovery path. Exact child ownership prevents cancelling logical siblings, and waiting for a machine task cannot delay daemon shutdown. Uncertain machine launches fail closed.

This executor replaces one seam of #33755 and builds on the merged journal, reply policy, lifecycle and cancellation foundations. QuickJS, remote agent placement and public CLI/tool wiring remain separate PRs. CI placement stays refused here and is tracked in #33778. At 2,357 added lines this is one coupled executor state machine, its authenticated activity RPC, complete-output adapter and regression tests. The independent seams—QuickJS engine, CLI/tool wiring, remote placement and CI adapter—stay in their own PRs; splitting these handlers from their recovery tests would leave neither independently useful.

Validation: exact-head fleet run https://github.com/manaflow-ai/cmux/actions/runs/41662804193 passed at 46beb0d5c95d851ce9b590f42c3fae4fcbf8b4d6: the route-nudge crash regression fails with the persisted cancellation target omitted, the source is restored, then formatting, all 83 workflow tests, 15 background-task tests and strict acpmux all-targets clippy pass. Static prepush checks pass. The separate protocol IR check reports inherited drift for two MCP connect methods; its registry, source and committed spec are unchanged from the merged base, and all other protocol tests pass. The separate clippy job fails only the inherited indexing panic count: all emitted diagnostics were compared against this diff, with zero hits on added lines; strict all-targets clippy passes in the focused run.

Independent review: Opus 5.5 medium SHIP at 46beb0d5c95d851ce9b590f42c3fae4fcbf8b4d6: https://github.com/manaflow-ai/cmux/pull/33779#issuecomment-6607927226.

Follow-up: complete machine output is retained in its spool but still collected and serialized whole in memory; #33851 tracks reading it in pages. Additional review follow-ups are #33976 (coalescing detached lock waits), #33977 (explicit-null placement semantics), and #33978 (validating an alternate before recording Restart). #33841’s route-nudge crash boundary is covered here. Signing, notarizing and publishing credentials remain outside the workflow runtime.

Leo-ask: ask-6ef2624788
Leo asked: “go do all those/help out where you can + examine how you can improve yourself and your available options and capabilities and speed”. Design: teamleaderleo/leo-workspace#624 §3.2–3.3.

🤖 Generated with Codex

Agent session: agent session