native workflow structured-reply policy

Merged
TE
2d ago
+536-0

Leo-ask: ask-6ef2624788

go do all those/help out where you can + examine how you can improve yourself and your available options and capabilities and speed

Adds the Rust policy foundation for native workflows from teamleaderleo/leo-workspace#624 and workstreams/cmux-next-nightly-train.md §3.2–3.3. Structured final replies validate against JSON schema, receive one correction request, then fail on another mismatch. Recovery nudges once, requests one permitted route/harness restart, then fails. Permission, usage-limit and capacity waits retain the same activity without authorizing a bypass.

State survives serialization and rejects duplicate or stale incarnation events. Schema compilation explicitly refuses external resource retrieval. The daemon/runtime integration follows in a separate PR; this library owns no transport, timers, credentials or execution engine. The caller must persist state and returned action atomically before dispatch and reconcile unacknowledged actions by stable identity.

Prior art: #33563 owns the separate journal foundation; its owner requested this isolated policy seam. #33596 overlaps only Cargo.lock. Preserves merged #33365 and #33406 after merging the current base.

Validation: all 14 behavioral tests passed in fleet run 41623299863 for exact head 419365c356a26e0a5f31a5b64b914d816c071b11 (snapshot 22303706e3da313ac666667610d5043740ceab91, matching tree 28a6c126430a01bf8789c5a14c6c7c181e326c53, exit 0). Command: cargo test -p acpmux workflow_reply::tests --lib. Coverage includes schema correction, invalid schemas/external references, persisted budgets, generation fencing, escalation and protected waits. Formatting and diff checks pass. Independent Astra high review returned SHIP at that head with no findings.

Changelog

none

šŸ¤– Generated with Codex

Agent session: agent session