Repository navigation
Description
Problem
Long-running agent work can continue while its user-visible progress, tool execution, Work scheduling, and observability diverge. A user can see Message delivery is unknown after the Server has already completed the last run, while unrelated work is blocked and historical shell handles remain unavailable. The model needs reliable facts and communication, not more instructions to guess what happened.
This issue tracks the combined journey and the concrete failures below. Related areas have been discussed in #1234, #1281, #1290 and #1296; this report adds the current evidence and should reuse their existing owners rather than create parallel implementations.
Observed environment and evidence
- Local debug CLI + Server on macOS; the Server reported build
cba30c550982dce75c94e023d8d5ce12d047c75a, matching the checkout when inspected. The CLI reported version0.2.14; its exact build SHA was not independently verified. Kimi K3, bypass mode. The task was a real multi-hour development/QA workflow with background builds and tests. - One run lasted about 2 h 46 min and recorded 309 model rounds and 478 tool requests. Three progress messages and a question about the Go proxy were accepted and applied. One prompt released a foreground wait and the next model round started about two seconds later. Automatic compaction occurred multiple times.
- After a later user cancellation, the session continued and the final run completed. Subsequently the TUI showed
Message delivery is unknown,Message needs attention,Tasks 1/10, and5 shells unavailable. - The Server health check was successful and its latest run was completed; there was no active run in the returned run list. The message text was absent from the complete bounded transcript and the examined recent run events, and no corresponding later intent submission appeared in the local Server access log. This supports that delivery was not observed; it does not establish whether the request failed before transmission or an acknowledgement was lost. The exact client-side trigger and intent identity still need verification.
- The QA workflow's BVT container later exited with code 1 and its container state recorded OOM. That is an environment/workload observation, not proof that Astra caused the OOM. The five unavailable shell handles were not matched to those containers, and unavailable does not prove that any process is still running or has exited.
Confirmed and observed failures
1. A terminal blocked Work item prevents independent ready work
An item was settled as blocked because a capability was unavailable. Even after its dependency edge to the following task was removed, run_next_work_item repeatedly returned needs_recovery for the blocked item. The model had to supersede that item and change the graph before it could execute the other task.
The foreground selector checks every previously started, undelivered item before looking for a ready task. This conflates a genuinely in-flight or unsettled attempt with an attempt already settled as blocked, so a local blocker becomes a global scheduling blocker.
Expected: Keep the existing execution and delivery facts; preserve the blocker and prevent dependent tasks from being incorrectly declared ready, but permit genuinely independent ready tasks to proceed. Do not bypass an in-flight or genuinely unknown outcome or erase the failed/blocked evidence merely to advance.
2. Shell path policy rejects valid operations because it loses command and namespace semantics
docker exec <container> cat /etc/launch/cn.tomlwas rejected before execution as a read of a sensitive host path, although the argument was a path inside the container.- A multi-line script contained the read-only existence check
test ! -e "$src/.git/objects/info/alternates"; the entire script was rejected as a write to Git runtime state. The script also contained legitimate work, but that does not make thetestoperand a write.
The shell sensitivity scan and compound tokenization infer access from a limited parsing of shell text. In these examples the actual command/read boundary or container namespace was not preserved. Both calls were correctly reported as not executed, but the reported permission-boundary diagnosis gave the model no direct way to distinguish a genuine restriction from a misclassification.
Expected: Authorized operations should not be rejected because text in a different execution namespace looks like a host path or a read is classified as a write. Preserve the actual sandbox and credential boundaries, including mounted host paths; do not introduce a blanket Docker exemption, command whitelist, or parser special cases tied only to these examples.
3. Message ownership does not converge into a usable next turn
The TUI retained a message as unknown even though the latest Server run had already completed and the Server was reachable. The current root-message recovery view offers copy/discard; it does not establish to the user whether this particular message was received, applied, returned, or never dispatched. The UI can therefore leave a normal question stranded after the task ends.
The client marks unconfirmed delivery when submission or acknowledgement cannot be settled; the actual reason in this incident is not proven. A genuinely ambiguous submission must remain distinct from a confirmed unsent input.
Expected: Use the existing intent identity and authoritative run/disposition facts to reconcile lost acknowledgements and terminal runs. If the Server can establish the input was returned or never admitted, preserve it for the next turn without requiring a stop/resume ritual. If the outcome is genuinely unknown, present that fact accurately and offer an actionable recovery path; never blindly duplicate a potentially applied side-effecting instruction. A normal status question should be answerable while existing authorized work continues.
4. Long waits and progress updates do not form a reliable user-facing feedback loop
Across the session, 116 task_output calls included 46 waits of at least 30 seconds; 20 reached their observation deadlines, including 16 of approximately five minutes. Several calls explicitly selected wake_on_output=false. These durations include overlapping waits and do not establish that all waiting was wasted. The tool supports releasing the wait when user input arrives, and the observed prompt above did so promptly.
However, from the retained event slice beginning before the first progress question, the only completed ordinary assistant text was the final response; the trace contains reasoning_done events but not enough content to establish what the TUI displayed live. Thus accepted/applied input is not evidence that a clear progress answer was delivered. One progress message also caused an unstarted read-only log inspection to be marked superseded; a similar inspection ran 11 seconds later.
Expected: Let the model use the existing task status/output, event-driven wait, and message channel to explain progress and continue useful work. Preserve safe interruption and prevent stale side effects, but avoid needless cancellation/reconstruction for harmless observations. Do not add a natural-language status classifier, force short polling, or claim that every waiting task needs a model wakeup.
5. Tool and Work contracts impose avoidable correction rounds
settle_work_itemrejected a blocked outcome becauseunavailable_capabilitieswas paired withdependency_blocked; the visible schema did not encode that cross-field relationship. The model corrected the call and succeeded on the next attempt.- A
skillcall in the same provider batch asrun_next_work_itemwas rejected by the coordinator-transition rule; it succeeded when retried in a later round. - A background-task response suggested using
task_output, but aninvoke_toolcall was rejected because the deferred target had not been selected; tool selection followed and observation succeeded.
These were recovered and should not be represented as an indefinite loop. The issue is the mismatch between what the model can reasonably infer from the exposed tool surface and the runtime's execution constraints. Simplify existing contracts, ordering, and error feedback so an authorized model can act directly; do not add parallel control paths.
6. Delivery summaries and the user-requested progress artifact lost important scope
The final answer said categories C1–C9 were complete and cited 63 passing probes, whereas the QA artifact described first-round, limited-scope probes and listed important untested scenarios. The final answer separately stated that full UT/BVT remained incomplete, but the unqualified category summary could still imply broader acceptance than the evidence supports.
During the following long run, UT/BVT were started and failures/OOM were observed, while the requested progress document still said the final UT/BVT had not been run. The last response acknowledged that updating the document remained future work.
Expected: Carry scope qualifiers, source, execution time and current status into user-visible progress and requested artifacts. Distinguish first-round sampling from complete coverage, running from never started, and observed failure from attributed product defect. Give the model enough accurate current evidence to do this, rather than adding a separate verdict engine or rigid task-specific completion rules.
7. Diagnostics lose early events and display unknown usage as zero
- The local turn-event buffer recorded
dropped_events_before: 545for the long run. The 1,000-event ring evicts old events before its flush. Separate step events retain some additional observations, but no single reviewed journal is complete. - The two long runs' terminal
qualified_usagewas empty.journal digestreports partial coverage, whilejournal treedisplayedtokens=0/34162. The tree's terminal aggregation converts missing lanes to zero. Other projections use different scopes, so the recorded numbers cannot establish total billable usage or prompt-cache rate. - Cancellation produced two interruption entries under the same session turn, one reporting zero completed tools/no checkpoint and another reporting 117/with checkpoint. Their producer scope was not recorded, so it is not possible to determine from those entries alone whether these represent different execution layers or conflicting views of one outcome. The Server did record cancellation and the session did continue.
Expected: Preserve or explicitly signal incomplete observation and producer identity using existing event ownership. Report unknown as unknown, distinguish qualified totals from observed lower bounds, and never equate a partial trace with zero usage, complete billing, or confirmed cleanup. Bounded storage is required; a bounded buffer must not silently make downstream tools appear authoritative. Do not add per-token SQL or another persistent projection.
8. Unavailable background handles are not actionable enough
The TUI displayed five unavailable shell tasks. In the current task projection, a stale handle without a known terminal result becomes unavailable: it does not mean failed, exited, or still running. Old and current work need to be distinguishable, with whatever retained output and control capabilities actually exist. Do not delete or claim to have stopped a process merely to clear the UI.
Acceptance criteria
- Exercise a blocked-but-settled Work item and an independent ready item through the public Work flow; preserve the blocker, dependency constraints, and in-flight/unknown ownership. Continue without superseding the blocked item solely to make progress.
- Exercise legitimate compound-shell read checks and container-internal paths together with genuine host credential reads, sensitive writes, mounted paths, redirects, and rejected commands. Correctly state whether execution started, and retain the existing security boundaries on supported platforms.
- Cover message submission racing run completion, accepted/applied/returned input, lost acknowledgement, Server unavailable then recovered, and confirmed-unsent input. Preserve message identity and text; do not duplicate side effects. The user can continue a completed session without unexplained persistent
unknownor manual cancel/resume. - Run a long background command with observable output and an interactive user question; verify that status and answer can be delivered while the same process continues, with responsive cancellation and without per-session polling or repeated model wakeups for every output chunk.
- Verify Work/deferred-tool contracts using real provider batches and unhappy paths, including conditional settlement fields and coordination with a sibling tool; error feedback is precise and a successful correction does not require duplicate execution.
- Verify that requested progress artifacts and final answers distinguish limited samples, failed/running/unexecuted work, and uncertainty. Do not classify a workload OOM or failed test as an Astra defect without causal evidence.
- Exercise a long turn that exceeds bounded observation retention and an interrupted/cancelled turn. Consumers expose missing event/usage coverage and producer identity; unknown usage never renders as a measured zero or a complete cache rate.
- Cover stale background handles alongside actual running and completed tasks. The user and model can tell what can still be observed or controlled; old records do not masquerade as current activity and history remains bounded.
Design constraints
Start with existing owners for Work, run/intent lifecycle, task handles, policy, and observability. Prefer removing duplicated coordination and aligning facts across the existing path. Keep the model free to decide how to proceed with clear tools, messages, and errors. Avoid new state machines, compatibility layers, SQL load, unbounded buffers, fixed sleeps, hard-coded behavioral rules, or wider access to user-local resources. Preserve the MOI gate contract. Validate cross-platform behavior and the relevant public journeys; use targeted tests that exercise real behavior and failures rather than mirroring implementation.
Activity
fix(runtime): preserve progress and interrupted task context (#1422)