Skip to content

fix: handle large JSON-RPC lines#1

Open
carlosflorencio wants to merge 4 commits into
mainfrom
fix/large-jsonrpc-lines
Open

fix: handle large JSON-RPC lines#1
carlosflorencio wants to merge 4 commits into
mainfrom
fix/large-jsonrpc-lines

Conversation

@carlosflorencio

@carlosflorencio carlosflorencio commented Jun 25, 2026

Copy link
Copy Markdown
Member

Summary

  • replace the Scanner-based JSON-RPC receive loop with a chunked line reader
  • raise the per-frame line cap to 64 MiB and return a clear error if exceeded
  • add a regression test for an 11 MiB single-line session/update notification

Validation

  • go test ./...

Summary by cubic

Fixes JSON-RPC receive to handle very large single-line frames by switching to chunked reading and raising the per-line limit to 64 MiB, with a clear error when exceeded. Adds a configurable inbound notification queue and improves disconnect/legacy compatibility.

  • Bug Fixes

    • Replaced Scanner-based receive loop with a chunked line reader; cap is now 64 MiB per line and oversize frames return a clear error.
    • Added a regression test for an 11 MiB single-line session/update notification.
  • New Features

    • Added acp.WithMaxQueuedNotifications(n) to configure inbound notification queue capacity; supported by NewClientSideConnection and NewAgentSideConnection. Exposes ErrNotificationQueueOverflow when the queue overflows. README updated.
    • Introduced ErrPeerDisconnected; request errors now wrap it so errors.Is(err, ErrPeerDisconnected) works.
    • Restored read-only parsing of legacy models on session responses and added legacy model-selection client helpers: LegacyAgentMethodSessionSetModel, UnstableSetSessionModelRequest/Response, and ClientSideConnection.UnstableSetSessionModel.

Written for commit e37105a. Summary will update on new commits.

Review in cubic

carlosflorencio and others added 4 commits June 9, 2026 16:40
Pre-v0.13.5 agents (e.g. auggie 0.29.x) still emit the top-level "models"
field on session/new and session/load responses. Upstream v0.13.5 removed
that field; this restores read-only parsing so downstream consumers can
fall back to it when the new SessionConfigOption(category="model") surface
is absent. Write-side helpers (UnstableSetSessionModel etc.) are NOT
restored — agents that only support legacy selection are expected to be
read-only from this SDK's perspective for now.
Restores the pre-v0.13.5 UnstableSetSessionModelRequest /
UnstableSetSessionModelResponse types and a
ClientSideConnection.UnstableSetSessionModel helper, plus a
LegacyAgentMethodSessionSetModel = "session/set_model" constant.

Companion to the LegacyModels read-side shim already in this file:
together they let consumers continue to talk to agents (e.g.
auggie 0.29.x) that haven't migrated from the unstable
session/set_model surface to the stable
session/set_config_option(category="model") surface.

The constant is named with a Legacy prefix so the upstream
constants_gen.go can stay untouched (no regeneration noise on
future schema bumps).
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