Skip to content

Fix misleading provider errors, interrupted runs, and unreliable agent tools #1286

Open

Description

@XuPeng-SH

Summary

Session ffd3089e-2d7b-4b15-b1df-f487c205efa9 exposed failures in provider error handling, repository search, and deferred tool use. Together they make ordinary failures misleading and can prevent the agent from progressing.

Observed against commit d3cf6783b. The findings below distinguish reproduced defects from unresolved hypotheses.

1. Responses rate limiting is reported as a stream transport failure

Evidence and impact

The session repeatedly returned [stream_transport] Model request failed: response_incomplete, including for a subsequent “hi”. Other models subsequently completed in the same session. A new Luna session also both succeeded and failed during investigation.

A request reconstructed from an isolated Astra diagnostic capture (messages and tool definitions) reproduced the same class of failure. The upstream stream sent:

  1. an error event with error.code = rate_limit_exceeded;
  2. a response.failed event carrying the same code.

The provider identified a token-per-minute quota limit. A short user message still sends the assembled context and tool definitions; repeatedly submitting a request larger than the available quota can therefore keep failing. Provider limits can be shared across sessions.

Evidence boundary: the original session's raw terminal events were not retained. The live reproduction proves that rate limiting can produce this exact misleading Astra error; it does not prove that every historical failure had the same upstream cause. The provider's reported wait duration was inconsistent with its stated per-minute quota and must not be treated as reliable without validation.

Root cause

  • Responses event parsing checks response.error.code and top-level code, but not the nested error.code on an error event. It returns immediately before processing the subsequent response.failed.
  • The provider error mapping omits the standard rate_limit_exceeded code.
  • Runtime mapping collapses unmapped provider failures into stream_transport / response_incomplete, losing the actionable reason.

Expected behavior

Classify provider limits as the existing rate-limit error, preserve safe structured diagnostic information and useful retry guidance, and give both the user and agent actionable feedback. Use bounded, cancellable retry only where appropriate; allow the user to continue or switch models. Do not blindly repeat tool side effects or invent a reliable retry deadline when the provider supplies inconsistent information. Unknown provider failures must remain distinguishable from actual transport interruptions.

2. Grep fallback corrupts a truncated file listing and can silently miss results

When rg is unavailable, the fallback enumerates files with find using a 120,000-byte output cap. enumerate_search_files splits the captured bytes into lines without propagating the cap. A partially captured path is then passed to grep as a full filename, producing a misleading “No such file or directory” error. Files beyond the cap are not searched, and incomplete enumeration can be reported as if the search were complete.

The session recorded 46 grep tool failures, including repeated truncated path fragments. A controlled listing of the affected large repository reproduced a partial path at the cap and the corresponding grep error. Exact historical filesystem ordering was not independently replayed.

Expected behavior: search candidate paths without treating partial records as complete and without silently losing files. Bound displayed results independently from enumeration, and explicitly report an incomplete search if a real execution limit prevents completeness. Preserve filtering semantics and avoid unnecessary allocations or subprocesses.

3. Deferred task-output capability is inconsistent across execution boundaries

The agent selected task_output in an earlier run, then repeatedly received deferred_tool_activation_invalid when invoking its richer arguments in a later run. Selecting it again made subsequent calls succeed. The failure gave insufficient actionable recovery guidance.

The exact point at which the activation or applicable schema became unavailable is not yet established; investigate run boundaries, restoration/compaction, provider binding, and resident versus selected schemas rather than assuming a single cause.

Expected behavior: the model should receive a coherent current tool contract and actionable errors. Prefer one canonical execution path and schema for core task output; if reselection is required, say so explicitly. Retain current capability and security checks.

Regression coverage and design constraints

  • Exercise real Responses SSE sequences containing a nested error followed by response.failed, standard rate limits, unknown codes, incomplete responses, and actual transport failures. Assert user/agent-visible classification and recovery, not just a parser helper.
  • Exercise a repository listing larger than the cap with a cut through a filename; verify both correct path handling and completeness or an explicit incomplete result.
  • Exercise task-output selection and use across a new run and compaction/restoration, including stale or removed capabilities and the actual recovery message.
  • Keep changes simple, efficient and robust. Extend existing error, tool and lifecycle owners instead of adding parallel state machines, persistence, compatibility layers, or recurring SQL traffic. Preserve relevant policy and sandbox boundaries.
  • Avoid exposing credentials, private prompts, raw logs, or provider account identifiers in tests or diagnostics.

4. A live long-running run was recovered as crashed and fenced

The main run d6d41c30-e1f7-46f8-9804-a418b8611d05 ran for roughly 2h23m (about 450 model rounds and 1,298 tool starts). Its final durable status is failed / crash_recovery. At 12:09:22 local time the recovery sweeper reported reconciling one orphaned run; within the following second the run-control watcher observed a different execution identity and the still-live streaming executor was closed after durable lease fencing. The server process serving this instance had been running since before the run started; there is no evidence of a server-process restart at this time.

This demonstrates an unexpected interruption and misleading “recovered from crash” user-visible outcome. It does not prove that the lease was incorrectly stolen or establish why the original owner stopped renewing: a legitimate loss of authority, renewal failure, process scheduling, or another race must be distinguished from a false recovery claim.

Investigate the actual lease/heartbeat lifecycle, durable ownership and sweep claim around the interruption, using existing authoritative state and timeline. Recovery must not take ownership from a live valid owner; an owner that genuinely loses authority must be fenced safely. Preserve progress and give the user a usable continuation rather than requiring them to reconstruct the run. Diagnose the reason without increasing per-session SQL load or introducing a parallel ownership state machine.

5. Repeated tool failures were not turned into useful progress feedback

During the main run, the same grep search pattern for GetCDCShowOutputResultSet produced 38 tool failures over more than 30 minutes while other work continued. The truncated-file-list bug in section 2 supplied a false missing-path explanation. Several StallDetected records in that period reported severity=healthy, with no injected feedback.

This is evidence that the combined tool feedback and observation did not help the agent converge on the real failure. It is not proof the entire run was stalled, nor that a fixed retry count or forced termination is appropriate. Once the search bug is fixed, assess whether the existing tool feedback/observation owner gives the model enough context to notice repeated identical failures and choose an alternative without sacrificing normal parallel exploration or adding a separate control state machine.

6. Background task observability and long-running command outcomes need investigation

  • Two task_output calls returned “not found in retained history; it may have expired or never existed.” The available event history does not establish whether either referenced ID had actually been created, expired, belonged to another executor, or was invented. Do not report confirmed data loss without resolving that evidence.
  • One git push timed out after the model explicitly supplied a 180-second execution timeout. The result correctly reported that execution started and side effects might have happened. The agent subsequently inspected the remote, then pushed successfully. The timeout was not proven to be an executor default bug. Ensure the existing yield, polling, cancellation and terminal-result interfaces allow long commands to be observed and continued as appropriate, and preserve the distinction between an observation timeout and an actual execution timeout.
  • Some long test results were truncated and referred the model to task_output while retained. Confirm the result handle stays usable for its documented lifetime, recent relevant tasks are easy to find, and tests do not confuse an unavailable result with proof of success or failure. Avoid treating all non-zero test exits, missing handles, or real test failures as infrastructure failures.
  • Related existing tracking: feat(runtime): simplify task execution, interaction, and context recovery #1234 and [Bug]: Make delegated tool and background task outcomes reliable and actionable #1261. This issue records the concrete evidence from this session; reconcile implementation work with those owners rather than building a second task registry.

7. Chat Completions stream failures need separate attribution

Two Kimi requests ended with invalid JSON in SSE events, followed by a capability-aware recovery attempt. The recorded errors mention an incomplete JSON string and a syntax error. The available logs do not contain enough raw framing evidence to decide whether the provider emitted malformed events or Astra framed valid chunks incorrectly; do not conflate these with the independently reproduced Responses rate-limit mapping bug.

Exercise valid SSE with arbitrary chunk boundaries and malformed terminal frames, retain safe structured failure context, and verify that any recovery neither loses partial progress nor duplicates tools or side effects.

Additional acceptance criteria

  • Cover a long, actively renewed run while the recovery sweeper operates, lease renewal loss and real orphan recovery. Assert authoritative ownership, fencing, user-visible state, and continuation; avoid reproducing the incident merely by extending lease TTLs.
  • Cover repeated failed observations interleaved with real progress and verify actionable feedback without false loop termination.
  • Cover completed, failed, expired, unknown and cross-owner task handles, including truncation and cancellable wait/timeout behavior. Preserve the semantics of explicitly requested process timeouts.
  • Verify interrupted work can continue with accurate progress and evidence. Separate provider failure, model decisions, executor failures, and actual test failures in observability and user-facing summaries.

Activity

  1. changed the title [-]Fix misleading Responses rate-limit errors and unreliable agent tool recovery[/-] [+]Fix misleading provider errors, interrupted runs, and unreliable agent tools[/+] on Nov 13, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions