Repository navigation
Open
Description
Problem
Long-running CLI sessions can finish or be cancelled without the execution, durable state, session admission, and TUI converging. Users see stale live agents, cannot reliably stop or resume work, lose access to partial child results, and encounter tool capabilities that are advertised but rejected at execution. Investigations of sessions 90695e88-95d7-4610-a93d-52a0b03b6045 and ef5939aa-bf3b-469c-b24b-97c31a3f7efa exposed related failures across the shared agent backbone and CLI Edge boundary.
Observed failures
- A completed session continued to show
1 agent · 1 live; in the other session a new request receivedsession_execution_slot_occupiedafter the parent and children had reached terminal statuses. - After Ctrl+C the CLI could not confirm cancellation; the durable run became cancelled about four minutes later and the stale streaming executor exited about seven minutes after cancellation. A single model-call span lasted about 26m43s. During the cancellation window the CLI sent 185 repeated DELETE requests in roughly ten seconds.
- Budget exhaustion cancelled a child that had performed 25 tool calls; another child with 40 tool calls ended as
crash_recovery. Its exact ownership-loss cause is not established, and the classification alone does not establish a process crash. On continuation the execution budget expanded from 24 to 60 rounds despite validation-retry and search-fanout signals. Another run reached 117 rounds. - Terminal summaries recorded zero tool calls for runs with 25, 40, and 70 observed calls. Cancelled/failed child transcript queries returned no items, leaving Ctrl+G unable to reconstruct their work and allowing the assistant to report no progress.
- One session recorded 82
wire_assemblycompaction audits; request-preparation spans totalled approximately 74 minutes across concurrent work. The other session exhibited a separate long model-call stall; compaction is not established as its cause. - Typed completion windows rejected ordinary observation commands, and a child ended with
typed completion action did not settle the obligation, preventing delivery of otherwise useful work. - On Unix, the CLI projects
run_in_backgroundin the Bash schema based on platform support, but execution also requiresASTRA_ALLOW_ENVIRONMENT_BACKGROUND_TASKS=1. The model can therefore request an advertised capability and receiveenvironment-lifetime background tasks are not authorized ... no process was started. Foreground cleanup guidance can recommend the same unavailable mode. The pre-spawn rejection is classified through generic text handling, rather than carrying a specific capability/policy failure and recovery action. - Multiple agents hit
rg: command not found. A compoundcd … && make …receives the generic 30-second default based on its first word, whereasmakealone receives 120 seconds. Shell pipelines can also return a successful outer tool status while test output contains a failing test, obscuring verification results. - An already-authorized task required the user to ask to continue; a subsequent greeting prompted another request for permission to continue. Separately, the assistant fabricated a knowledge cutoff and attributed it to system information, then retracted it when challenged.
Code-level causes and boundaries to investigate
- Terminal transition, executor exit, session admission, recovery lease release, and UI projection can diverge. Commit
4dad45f8fadds atomic recovery lease retirement for one path; verify deployed versions and all other paths rather than assuming this resolves the whole incident. - Cancellation, provider I/O, tool execution, durable fencing, and user-visible settlement lack a timely end-to-end convergence guarantee. Identify the precise blocking point for the long model-call cancellation before attributing it to a particular provider or component.
- Budget renewal, multi-agent fan-in, progress detection and typed completion must preserve useful work and avoid both premature child cancellation and unproductive continuation.
- C0 lifecycle, event/journal facts, transcript and TUI projections need consistent identities, partial results, terminal accounting and replay.
- Capability projection, admission, execution and recovery guidance should use the same resolved authorization, with structured non-retryable reasons and an appropriate foreground path for bounded builds. Preserve the existing security and process-ownership boundaries.
- Make tool execution and verification outcomes explicit, and ensure model-facing environment and timeout information reflects the actual executor.
Acceptance criteria
- A terminal run/child releases its exact eligible ownership and the session can accept a subsequent turn; the TUI no longer displays stale live agents after authoritative reconciliation.
- Cancellation reaches in-flight model/tool work, reports accepted versus fully settled accurately, and converges within a bounded tested interval without high-frequency request storms.
- Budget exhaustion and recovery preserve child progress and actionable continuation; repeated low-yield work does not renew capacity indefinitely.
- Cancelled/failed runs retain accurate partial tool counts, usage and replayable child activity, including Ctrl+G views after reconnect.
- Unavailable managed-background capabilities are not advertised as currently available, and rejection/guidance is structured and consistent with actual authorization. Cover authorized and unauthorized Unix paths end to end.
- Long foreground builds have accurate timeout guidance; verification outcomes cannot silently treat a failing command as successful.
- Add regression coverage at the owning layers for lifecycle/lease races, cancellation during provider I/O, parent/child settlement, projection/replay and capability projection. Include a user-journey test joining these boundaries.
- Exercise follow-up intent and model self-knowledge failure cases in the appropriate behavioral evaluation suite.
Related open issues
- Bug: run cancellation does not reach active MCP calls and can leave ownership unsettled #1016 — cancellation of active MCP calls and ownership settlement.
- [Bug]: Orphaned run holds session after one-shot client stream drop (stream_transport); no reclaim until manual session cancel #987 — orphaned runs blocking session admission.
- [Bug]: Stopping the CLI mid tool call: completed call shown as failed, session unresumable, checkout held #916 — stopping CLI during a tool call and resuming the session.
- [web] History/replay loses run timeline (tool calls, sub-agents, usage) #462 — history/replay losing timeline, tools and usage.
This issue tracks the cross-cutting user journey and invariants; reuse or link the related issues for their narrower fixes.
Metadata
Metadata
Assignees
Labels
No labels
Activity
fix(runtime): bound execution and preserve cancellation progress
fix(runtime): bound execution and preserve cancellation progress (#1200)