Skip to content

fix(acp): drop untracked non-numeric responses to prevent grok handshake stall#6

Merged
justingray0 merged 1 commit into
mainfrom
fix/acp-drop-untracked-nonnumeric-responses
Jun 29, 2026
Merged

fix(acp): drop untracked non-numeric responses to prevent grok handshake stall#6
justingray0 merged 1 commit into
mainfrom
fix/acp-drop-untracked-nonnumeric-responses

Conversation

@justingray0

Copy link
Copy Markdown
Owner

Summary

The RpcClient and raw ext requests only ever mint numeric request ids, so a response whose id isn't a base-10 number cannot match anything we sent. Some agents — notably grok — emit unsolicited JSON-RPC responses with symbolic ids such as "skills-reload" immediately after initialize. Forwarding those to the RpcClient made it fail while resolving the id, which tore down its response loop. The subsequent authenticate and session/new responses were then never delivered and the handshake stalled until the caller timed out.

Changes

  • Add a forwardUntrackedResponse guard in the patched ACP protocol that only forwards responses whose id matches ^[0-9]+$; anything else is dropped with a debug log.
  • Apply the guard on both untracked-response paths (the exit-encoded path and the success/defect path).

Tests

  • New grok-skills-reload.test.ts: an in-memory fake grok peer answers initialize and then floods the stream with untracked skills-reload responses; the test asserts the initializeauthenticatesession/new handshake still completes.

🤖 Generated with Claude Code

…ake stall

The RpcClient and raw ext requests only ever mint numeric request ids, so a
response whose id is not a base-10 number cannot match anything we sent. Some
agents (notably grok) emit unsolicited JSON-RPC responses with symbolic ids
such as "skills-reload" right after `initialize`. Forwarding those to the
RpcClient made it fail while resolving the id, tearing down the response loop
so that subsequent `authenticate` and `session/new` responses were never
delivered and the handshake stalled until the caller timed out.

Route untracked responses through a `forwardUntrackedResponse` guard that only
forwards ids matching `^[0-9]+$` and otherwise drops them with a debug log.
Applies to both the exit-encoded and success/defect response paths.

Adds an in-memory regression test that floods the stream with
`skills-reload` responses after `initialize` and asserts the
initialize/authenticate/session handshake still completes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:S labels Jun 29, 2026
@justingray0 justingray0 merged commit f451c83 into main Jun 29, 2026
6 of 10 checks passed
@justingray0 justingray0 deleted the fix/acp-drop-untracked-nonnumeric-responses branch June 29, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant