Skip to content

fix(acp): keep sessions usable after provider failures - #72

Open
yan-ad wants to merge 1 commit into
Blankeos:mainfrom
yan-ad:fix/acp-provider-error-recovery
Open

yan-ad wants to merge 1 commit into
Blankeos:mainfrom
yan-ad:fix/acp-provider-error-recovery

Conversation

@yan-ad

@yan-ad yan-ad commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Problem

Provider errors such as No tool output found for function call call_119 are currently returned from session/prompt as an ACP internal error. That ends the interaction as a protocol failure instead of reporting a failed turn that the user can recover from.

Changes

  • Report provider stream failures through an agent message and return end_turn, keeping the session available for another prompt.
  • Mark unfinished tool calls as failed, notify the client, and persist their error results without changing completed tools.
  • Finalize pending tool results on cancellation or stream failure so persisted history does not leave running tools behind.
  • Keep genuine notification and persistence failures as errors.
  • Reserve original Responses call IDs before renaming duplicates, preventing generated suffixes from colliding with IDs already in history.

Regression coverage

Tests cover failures before any tool runs and while a tool is pending, including client-visible notifications, persisted results, preservation of completed tools, and a successful next turn on the same connection. A serializer regression covers ID suffix collisions with out-of-order concurrent outputs.

Validation

On this branch against current upstream main:

  • cargo test acp::service:: -- --test-threads=1 — 58 passed
  • cargo test aisdk::providers::openai::tests:: -- --test-threads=1 — 53 passed
  • cargo fmt --check
  • git diff HEAD^ --check
  • bash scripts/check-aisdk-boundary.sh

Also synced and pushed to yan-ad/crabcode:yan-flavor as b802f87; the flavor branch passed 72 ACP tests, 53 OpenAI tests, and all 8 ACP stdio tests. This PR contains only the fix, not the unrelated flavor changes.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant