Skip to content

fix(agent-adapters): robustness fixes to pi + claude ACP adapters#134

Closed
NathanFlurry wants to merge 1 commit into
mainfrom
stack/fix-agent-adapters-robustness-fixes-to-pi-claude-acp-adapters-ynqmoovv
Closed

fix(agent-adapters): robustness fixes to pi + claude ACP adapters#134
NathanFlurry wants to merge 1 commit into
mainfrom
stack/fix-agent-adapters-robustness-fixes-to-pi-claude-acp-adapters-ynqmoovv

Conversation

@NathanFlurry

Copy link
Copy Markdown
Member

Five verified fixes to the Pi and Claude ACP agent adapters (found via a
multi-agent review of all adapters), each with a unit test:

  • claude: the tool-permission handler no longer auto-resolves on a 2s timer
    (fail-open: the guest's tool ran without host consent, and a real reject
    arriving after 2s was discarded). The host's requestPermission handler is now
    authoritative; an unanswered request fails via the bounded ACP method timeout.
  • claude: partial tool-input (input_json_delta) is now attributed by the
    streaming content-block index, not Map insertion order — a text/thinking block
    before a tool_use no longer mis-attributes or drops live rawInput.
  • claude: a dead query reader now marks the session closed in consume()'s
    finally, so the next prompt() fails fast instead of hanging to the ACP timeout.
  • pi: the live session subscription is stored and torn down on session replace
    and on conn.closed (no SDK close hook exists); editSnapshots is cleared per
    turn + on cancel so it can't grow unbounded.
  • pi + claude: a failed session/update write is logged to stderr (the
    onAgentStderr channel) instead of being silently swallowed, while keeping the
    emit chain alive.

Tests: registry/agent/{claude,pi}/tests/adapter.test.mjs (claude 6, pi 4; pi
test infra added). No auto-resolve-on-timeout remains in any adapter.

Five verified fixes to the Pi and Claude ACP agent adapters (found via a
multi-agent review of all adapters), each with a unit test:

- claude: the tool-permission handler no longer auto-resolves on a 2s timer
  (fail-open: the guest's tool ran without host consent, and a real reject
  arriving after 2s was discarded). The host's requestPermission handler is now
  authoritative; an unanswered request fails via the bounded ACP method timeout.
- claude: partial tool-input (input_json_delta) is now attributed by the
  streaming content-block index, not Map insertion order — a text/thinking block
  before a tool_use no longer mis-attributes or drops live rawInput.
- claude: a dead query reader now marks the session closed in consume()'s
  finally, so the next prompt() fails fast instead of hanging to the ACP timeout.
- pi: the live session subscription is stored and torn down on session replace
  and on conn.closed (no SDK close hook exists); editSnapshots is cleared per
  turn + on cancel so it can't grow unbounded.
- pi + claude: a failed session/update write is logged to stderr (the
  onAgentStderr channel) instead of being silently swallowed, while keeping the
  emit chain alive.

Tests: registry/agent/{claude,pi}/tests/adapter.test.mjs (claude 6, pi 4; pi
test infra added). No auto-resolve-on-timeout remains in any adapter.
@NathanFlurry

Copy link
Copy Markdown
Member Author

Stack for rivet-dev/secure-exec

Get stack: forklift get 134
Push local edits: forklift submit
Merge when ready: forklift merge 134

@railway-app railway-app Bot temporarily deployed to secure-exec / secure-exec-pr-134 June 26, 2026 19:58 Destroyed
@railway-app railway-app Bot temporarily deployed to rivet-frontend / secure-exec-pr-134 June 26, 2026 19:58 Destroyed
@railway-app

railway-app Bot commented Jun 26, 2026

Copy link
Copy Markdown

🚅 Deployed to the secure-exec-pr-134 environment in rivet-frontend

Service Status Web Updated (UTC)
secure-exec 😴 Sleeping (View Logs) Jun 26, 2026 at 8:05 pm

🚅 Deployed to the secure-exec-pr-134 environment in secure-exec

Service Status Web Updated (UTC)
secure-exec 😴 Sleeping (View Logs) Web Jun 26, 2026 at 8:04 pm

@NathanFlurry

Copy link
Copy Markdown
Member Author

Superseded by #136 (clean re-extraction onto current main).

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