fix(acpmux): queue automatic messages after the original steering window

Closed
TE
7d ago
+209-8

Automatic agent messages can keep a steer-capable turn open indefinitely while older prompts wait in its durable queue. Bound automatic steering to the first ten minutes of the original turn; after that, retain new agent messages in the normal queue and let existing work finish.

Leo asked: "Audit the last ~36 hours of Leo's agent fleet and remove the causes of the delays at the source."

agentSteerWindowMs defaults to 600000; zero queues automatic agent messages immediately. Human steering and explicit Send now remain available. Steer-only requests receive an explicit refusal when the window is closed. Budget deferral never takes the interrupt fallback. There is no new timer, forced completion, or task cancellation; the existing queue owns persistence and continuation. The age uses the persisted original turn start and the system clock.

Risk: normal. This bounds admission, not execution time; work already accepted must finish. Clock changes affect the wall-clock age calculation. Non-steering explicit interrupts keep their existing semantics.

Validation

Focused regression: cargo test -p acpmux --lib agent_steer_window -- --nocapture on hosted Linux or the supported fleet Rust lane. The fixture holds an active tool, accepts a fresh steer, ages the turn, mixes an older unsteered prompt with later steers (including interrupt fallback), then releases the tool normally. It checks order, prompt IDs, exactly-once delivery, one final result per turn, human/Send now behavior, and steer-only refusal.

Red/green exact-head receipts: pending.
Independent Claude Opus 5.5 exact-head review: pending.

Observed / Not run

Prepared regression and inspected all steering/queue paths at base 34e31e4df196d75a5dc57a16f430cbe3b863d717. No local Rust build or suite. Remote runtime checks and final exact-head review are pending.

Changelog

Fixed: Automatic agent messages no longer extend the same running turn indefinitely and starve queued prompts.
Agent session: agent session


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Automatic agent messages can no longer keep a turn open indefinitely. After 10 minutes from the original turn start, they enter the durable queue behind existing prompts, while current work finishes normally.

  • Human steering and explicit Send now remain available; steer-only requests are refused when the window has closed.
  • Set agentSteerWindowMs to change the window; 0 queues automatic messages immediately. Deferred messages do not use the interrupt fallback.