Ship ExecFlow: managed exec sessions with idle/hard timeouts, control channel, and structured logging
What feature would you like to see?
Codex today treats exec_command invocations as fire‑and‑forget processes. Long builds, daemons, or runaway sleep loops can outlive the agent, burn sandbox time, and force humans to intervene. We would like to land a first‑class “ExecFlow” supervisor that wraps every exec session with:
- deterministic lifecycles (idle watchdog + hard deadline with graceful Ctrl‑C → SIGKILL escalation);
- a structured session registry (running / grace / terminated) exposed via list_exec_sessions;
- a control plane (exec_control) for keepalives, manual stop, force‑kill, and regex watch rules;
- consistent incremental output APIs (tail ranges, smart compression, stop‑pattern handling);
- on-disk log spooling with SHA‑256 fingerprints so the agent can stream small payloads while retaining full histories.
Docs (~docs/exec_flow.md) and integration tests (async tests against the new SessionManager) are ready; the change largely lives inside codex-rs/core/ src/exec_command/.
The goals are to eliminate stranded processes, give interfaces better observability, and keep token usage predictable when commands emit large outputs. This is especially relevant for enterprise users running long CI flows or interactive shells inside Codex.
Are you interested in implementing this feature?
Yes — code and tests are prepared on a topic branch (feat/execflow-exec- supervisor-clean), but we will not open a PR until the team confirms the direction, surfaces any roadmap conflicts, or requests adjustments (e.g., API casing, telemetry expectations, rollout sequencing).
Additional information
Key artifacts available for review:
-
Architecture & UX overview: exec_flow.md
-
Runtime changes: codex-rs/core/src/exec_command/session_manager.rs, control.rs, responses_api.rs.
-
Protocol additions (types for session updates & control actions) generated via TS bindings.
-
Test coverage: async watchdog / stop-pattern / keepalive scenarios in the core test suite (cargo test -p codex-core already green).
-
No external dependencies added; the new logic reuses existing tokio, portable-pty, and hashing crates already in the workspace.
Happy to iterate on naming, telemetry shape, or staged rollout once we hear back.