Skip to content

[Enhancement]: One-shot chat exits 5 with execution_incomplete even when the final answer was delivered and settlement succeeded #988

Open

Description

@endlesschasey-ai

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_resolution tool call) yet printed Turn 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 push that 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

  1. Run a one-shot task that intentionally includes a failing command later recovered within the same run (TDD red→green, or a failing git push followed by creating a fork, pushing, and opening a PR).
  2. Observe the final answer fully delivered and submit_task_resolution succeeding.
  3. The CLI still prints Turn finished partially (execution_incomplete). Inspect partial output before continuing. and exits 5.
  4. 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) synthesizes execution_incomplete iff the canonical aggregate is not complete for the logical tool-call count; completeness requires consistent && unresolved == 0 && attempted == tool_calls_count (crates/astra-turn-core/src/tool_ledger_receipt.rs:61-66). Failed-but-terminated calls close the ledger (the failed class 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_code always returns ExitCode::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 by crates/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:

  1. 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 of execution_incomplete/exit 5.
  2. Alternatively, keep exit 5 but have the interruption payload (and --json output) carry the uncovered-call inventory plus a delivered_answer: true marker, so superseded/recovered failures are distinguishable from genuinely incomplete execution.

Activity

  1. XuPeng-SH commented on Oct 20, 2026

    @XuPeng-SH
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/question

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions