Repository navigation
Description
Problem
Delegated agent tool calls can time out without leaving the parent with a reliable, actionable outcome. The parent cannot tell whether a tool never started, ran but its result was not delivered, or is still running. A child may then end with a normal process status even though its work is explicitly incomplete.
Evidence from session
Session eebe7da6-8018-4ba9-8167-a0c1fbc1f80c:
- One child review encountered six
read_fileEdge result-callback timeouts and ended cancelled. - A second encountered seven
grepresult-callback timeouts and onegreprejected before execution because the server deadline had expired. - That second child was reported as
completed/finish_reason=normal, while its returned review said it was incomplete and still had an unverified lead.
The code has a callback timeout in crates/astra-turn-core/src/edge_ledger.rs and rejects expired requests before execution in crates/astra-cli/src/cli/stream/stream_render.rs. This confirms that at least one request never started. It does not establish the cause of the other callback timeouts (queueing, process execution, result transport, or server-side retention); those need correlated lifecycle evidence.
Expected behavior
Use the existing Edge request and child-run owners to give the parent one correlated, bounded outcome per delegated call:
- Distinguish rejected-before-start, running, succeeded, failed, cancelled, and outcome-unknown when execution may have started but its result is unavailable.
- Preserve and deliver partial child output and tool outcomes after a callback timeout; process termination must not be presented as successful task completion when the returned work is incomplete.
- Tell the model what stage failed, whether the tool started, what result is known, and whether retry is safe. Do not automatically repeat a call with an unknown side effect.
- Resolve late results through the existing canonical records, without unbounded scans, high-frequency polling, raising timeouts, or adding a parallel lifecycle state machine.
Acceptance criteria
- A deadline that expires before execution is reported as “not started”; a timeout after dispatch is represented as unknown until the canonical outcome is available.
- A delayed result can still be retrieved and associated with the original child and tool call; duplicate delivery does not create duplicate execution or completion.
- A child that exits normally with incomplete work is surfaced to the parent as a partial/incomplete result, distinct from process status.
- Regression coverage exercises pre-execution deadline expiry, delayed/failed result delivery after dispatch, late result retrieval, cancellation, and child exit with partial work.
- The solution reuses existing lifecycle, Edge ledger, and transcript/result owners and keeps lookup and retained output bounded.
Related issues
- feat(runtime): simplify task execution, interaction, and context recovery #1234 — task execution, interaction, and context recovery.
- fix: converge agent lifecycle, cancellation, capability and observability contracts #1199 — agent lifecycle, cancellation, capability, and observability convergence.
Root cause of the callback timeouts is not established from this session; investigate it before choosing an implementation.
Additional evidence: failed background shell tasks
The same session displayed 11 shells failed · Shift+↓ manage. A local workspace snapshot contained 11 failed shell records, each with an end time. Those records do not mean 11 shell processes were still running.
The recorded failures have different causes:
- Two compilation failures while implementing the change: an incorrect
implplacement and tests still expecting the previous return type. Later checks succeeded. - Two failures of the new MatrixOne integration test: its test event first omitted the required JournalEvent type, then used an event ID inconsistent with the canonical event identity. After fixing the test inputs, the same test passed.
- One compile failure caused by an
i32/u32mismatch in the test. The same test passed later. - Three Clippy failures for needless borrows, redundant struct field names, and a redundant closure. Later Clippy and
make lintsucceeded. - One formatting check failed; the later format check succeeded.
- One long-running test command reached a 300-second execution timeout. The model explicitly requested that timeout. Its terminal record reported execution started, outcome unknown, and cleanup unconfirmed. A later successful test does not establish when the original process exited.
- One separate review invocation failed before chat because Edge registration returned HTTP 401. The underlying credential or configuration cause is not established.
The session continued after the 11-task snapshot. A subsequent CLI test compile failed because a Result<ThinClient, ...> was passed where ThinClient was required; whether it was subsequently fixed is not established by this snapshot. Most of the above failures were real development or test-input errors, not evidence that the background executor falsely failed the commands.
System gaps exposed
- The footer counts retained historical
FailedandInterruptedshell rows as current attention, even when the model already observed the result and subsequent checks succeeded. Recent terminal task projections are persisted and restored. This makes the persistent failure count hard to distinguish from an unresolved problem. Seecrates/astra-cli/src/tui/status_line/line.rsandcrates/astra-cli/src/edge_tools/background_tasks.rs. - Backgrounding makes a process observable while it runs, but the selected execution deadline still terminates the long command; after timeout, the recorded cleanup outcome can be unknown. The parent and user need the actual deadline, execution progress, and accurate termination/cleanup facts so they can choose how to proceed. Do not infer that timeout implies test failure or that a later successful run proves cleanup.
- Retained task summaries can truncate long output before the actual compiler error. The complete output was available through
task_outputfor the two examined compilation failures during the session. The interface should make truncation explicit and keep the useful failure details accessible while retained, including after restoration where supported; do not claim that all output was permanently lost. - Authentication failure and normal compiler/test failures need their actual source information to reach the model; a generic failed count alone cannot explain which action would help.
Additional acceptance criteria
- Keep historical results inspectable while showing attention for failures or unknown outcomes that still need attention; observing or resolving a result must not leave a permanent misleading footer warning. Do not equate a later unrelated success with resolving an earlier unknown outcome.
- Make foreground/background behavior, the selected deadline, timeout, process exit, and cleanup confirmation clear to both the user and model. Preserve the same process when a task is promoted; avoid adding arbitrary deadlines, automatic reruns, or a separate task lifecycle.
- Expose useful error details from retained output, identify truncation or unavailable output accurately, and preserve bounded storage. Exercise long compiler output where the actual error appears after the preview.
- Cover the real user journey: an ordinary failed check is inspected and later corrected; an unresolved timed-out process stays distinguishable; restored historical failures remain inspectable without becoming indefinite current alarms; a real authentication error remains actionable.
Additional evidence: stale working directory after selecting a worktree
Session d22784b4-0c65-40bf-b67b-8ba134fc2306 selected a separate Git worktree while fixing a PR. The worktree enter result explicitly reported the selected path and said the session was now working there. In a later turn, the model supplied the original repository path as Bash workdir for four commands. All four were rejected before execution because the selected worktree was the effective workspace root. The next model attempt repeated the same four calls and received the same rejections: eight rejected calls across two rounds.
The runtime correctly recorded disposition=rejected and policy_denied, and reported that no command ran. The error names the actual selected root, but its generic advice to enter a worktree is misleading when the session is already in one. The tool's workspace change was communicated in the earlier result; the available evidence does not establish whether that fact was present in the model's later context or why the model repeated the calls.
The underlying boundary is in crates/astra-tools/src/shell_ops.rs (resolve_bash_workdir); the effective root is selected by crates/astra-cli/src/edge_tools/worktree.rs. A rejected workdir says nothing about whether the database, files, or command itself would have worked.
Additional acceptance criteria
- The model and user can reliably determine the currently selected workspace after worktree entry, exit, and session continuation, using the existing workspace owner. Errors identify both the requested directory and active root, state that nothing ran, and give an applicable next action: omit
workdiror use the active workspace when appropriate, or explicitly leave the selected worktree when the task requires the original repository. - Preserve the user's intended repository, revision, and authorization. Do not silently redirect a command from one checkout to another, automatically leave a worktree, or weaken workspace restrictions to avoid an error.
- A repeated batch of pre-execution rejections must carry clear, actionable facts into the next model turn, so the model can adjust its working directory or select the intended workspace. Investigate why the previous selected-root information did not prevent the second batch; do not assume a model-context omission without evidence.
- Exercise worktree entry, continuation into a later turn, incorrect original-repository
workdir, an environment-only command that can run from the active root, and explicit exit with the worktree kept. Confirm that rejected commands never start and that model-facing error details survive the normal context path.
Activity
[-][Bug]: Delegated tool result timeouts leave child task outcomes ambiguous[/-][+][Bug]: Make delegated tool and background task outcomes reliable and actionable[/+]MatrixAdventurer commentedon Nov 11, 2026
分级建议(仅评论,不改标签/不指派):建议严重级 s2(参照 matrixorigin severity 口径)——影响后台任务可见性与委派执行结果可靠性,不损坏数据、有人工补救路径。模块:crates/astra-cli(background_tasks 生命周期与 TUI status_line 汇总)。疑似重复:与 #1199、#1226、#1234 生命周期/后台执行主题相近但非同一缺陷,未发现完全重复。建议负责人:XuPeng-SH、loveRhythm1990(crates/astra-cli 近期主要提交者)。
本操作由LW授权的MOI智能体提交
XuPeng-SH commentedon Nov 15, 2026
已合并追踪至 #1302 的第 3 节。子任务未完成结果、迟到回执、后台任务与工作目录的剩余验收均已保留。
此关闭仅表示将追踪入口合并,不表示原问题已全部修复。原报告、讨论和尚未满足的验收条件继续作为新 issue 的证据与验收来源。