Repository navigation
Description
Is there an existing issue for the same bug?
- I have checked the existing issues.
Version and environment (optional)
Astra 0.2.10 (MOI-bundled CLI) + hosted Server with UC login; macOS arm64. The decision rule cited below is unchanged in 0.2.11 / main @ 2873a95.
Actual behavior
Six one-shot astra chat runs in one day:
- Three runs delivered the full final answer (including a successful
submit_task_resolutiontool call) yet printedTurn finished partially (execution_incomplete)and exited 5. - Two of those three also printed:
Admission settlement · status not_dispatched · reason {"kind":"not_dispatched","reason":"no_offering"} · classifier result unavailable · reconciled decision unavailable
- The affected runs contained a deliberately failing command (TDD red phase: test intentionally fails, then the fix makes it pass) or a failing
git pushthat was then recovered (fork created, push succeeded, PR opened). - Another run that also contained a deliberately failing test (red phase, later green) exited 0 with no "partially" line — so "any failed tool call ⇒ incomplete" is not the rule.
Expected behavior
When the run reached its terminal state, the full final answer was delivered, and settlement (submit_task_resolution) succeeded, a one-shot invocation should exit 0 — or at worst use a distinct, documented "completed with uncovered calls" code — instead of reporting execution_incomplete and exit 5. Automation wrapping astra chat currently cannot distinguish "answer delivered, turn settled" from "turn genuinely incomplete".
Steps to reproduce
- Run a one-shot task that intentionally includes a failing command later recovered within the same run (TDD red→green, or a failing
git pushfollowed by creating a fork, pushing, and opening a PR). - Observe the final answer fully delivered and
submit_task_resolutionsucceeding. - The CLI still prints
Turn finished partially (execution_incomplete). Inspect partial output before continuing.and exits 5. - A comparable run whose only deliberate failure is a plain failing test may exit 0 with no "partially" line.
Additional information
What the code actually does (main @ 2873a95):
- Exit 5 is decided by canonical tool-ledger closure, not by failed tool calls.
build_stream_result(crates/astra-cli/src/cli/chat_stream/sse_loop/agentic_sse_loop.rs:264-278) synthesizesexecution_incompleteiff the canonical aggregate is not complete for the logical tool-call count; completeness requiresconsistent && unresolved == 0 && attempted == tool_calls_count(crates/astra-turn-core/src/tool_ledger_receipt.rs:61-66). Failed-but-terminated calls close the ledger (thefailedclass is terminal), which explains why one red-phase run exited 0. The exit-5 runs must have had at least one call with no canonical terminal class; the exact call-level reason needs the server's ledger receipts and was not confirmed locally. - Once
final_state == "interrupted",compute_exit_codealways returnsExitCode::Partial(crates/astra-cli/src/cli/command_router.rs:3271-3273), regardless of a fully delivered answer. - The
Admission settlement · status not_dispatched · reason {"kind":"not_dispatched","reason":"no_offering"}line appears unrelated to the exit code: it is the Work-admission classifier report when no judgment offering is configured (WorkAdmissionUnavailableReason::NoJudgmentOffering,crates/runtime/src/server/server_loop_host.rs:2213-2260), rendered bycrates/astra-cli/src/explain_analyze_report.rs:1680.
This looks like intentional fail-closed design ("tool execution did not produce a complete canonical terminal aggregate"), so filing as an enhancement question rather than a bug.
Proposal:
- When the server terminal is authoritative, the final answer is delivered, and the ledger closes except for
attempted < tool_calls_count(calls that never received a terminal class), report success with a warning naming the uncovered calls, or introduce a distinct exit code meaning "completed with uncovered calls" instead ofexecution_incomplete/exit 5. - Alternatively, keep exit 5 but have the interruption payload (and
--jsonoutput) carry the uncovered-call inventory plus adelivered_answer: truemarker, so superseded/recovered failures are distinguishable from genuinely incomplete execution.
Activity
XuPeng-SH commentedon Oct 20, 2026
Keep the execution ledger fail-closed: a delivered final answer is not proof that every logical tool call has a canonical terminal result. The valuable follow-up is to reproduce the missing-receipt case and expose the exact uncovered calls in human and JSON diagnostics while retaining the incomplete exit status. Do not return success based only on answer delivery or assume that a later successful call retroactively closes an earlier unknown call.