Skip to content

Fix synthetic auth before replayed user echo - #989

Open
apexphere wants to merge 1 commit into
agentclientprotocol:mainfrom
apexphere:agent/fix-synthetic-auth-before-user-echo
Open

Fix synthetic auth before replayed user echo#989
apexphere wants to merge 1 commit into
agentclientprotocol:mainfrom
apexphere:agent/fix-synthetic-auth-before-user-echo

Conversation

@apexphere

Copy link
Copy Markdown

Fixes #988.

What changed

When the SDK's synthetic login assistant frame arrives before the replayed user echo, bind the first unsettled queued turn before reporting auth_required. This lets the existing failure path terminalize the prompt Promise instead of only publishing a session-scoped failure.

Adds an upstream-only deterministic regression with a paused synthetic SDK stream. It proves the auth frame was consumed before checking the Promise, then cancels for cleanup and verifies no active turn, queued turn, pending orphan count, or orphan map entry remains.

Root cause

activeTurn was established only by the replayed user echo. The synthetic auth branch could run first and call the failure helper with no active turn, leaving the queued prompt pending indefinitely.

Impact

ACP clients receive a terminal authentication-required outcome for the submitted prompt regardless of whether the SDK replays the user echo before or after its synthetic auth frame.

Validation

  • Reproducer fails on adapter 0.55.0 / Claude Agent SDK 0.3.198.
  • Reproducer fails on adapter 0.66.0 / Claude Agent SDK 0.3.220 before this patch.
  • npm test -- --run src/tests/acp-agent.test.ts: 375 passed, 9 skipped.
  • npm run check: ESLint and Prettier passed.

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.

Synthetic auth before replayed user echo leaves prompt pending

1 participant