Skip to content

fix(v2): enforce initialization lifecycle - #235

Open
benbrandt wants to merge 1 commit into
mainfrom
fix/v2-lifecycle
Open

fix(v2): enforce initialization lifecycle#235
benbrandt wants to merge 1 commit into
mainfrom
fix/v2-lifecycle

Conversation

@benbrandt

@benbrandt benbrandt commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • require initialize to be the first protocol message and allow it exactly once per experimental v2 connection, including the standalone batch form
  • queue built-in, extension, and compatibility traffic while initialization is in flight, and reject queued work when negotiation or the connection fails
  • expose the validated initialize exchange through one initialized promise on connection handles and handler contexts while preserving onConnect timing
  • require v2 agents to register an initialize handler, preserve peer initialization during direct teardown, and close persistent clients after terminal negotiation failures

Verification

  • npm run generate
  • npm run check (40 files, 886 tests)
  • npx vitest run src/v2/acp.test.ts (23 tests)
  • direct lifecycle stress runs for immediate close, rejected callbacks, and throwing batch mappers
  • git diff --check

Base automatically changed from fix/v2-method-contracts to main August 14, 2026 00:13
@benbrandt benbrandt changed the title fix(v2): enforce connection lifecycle fix(v2): enforce initialization lifecycle Aug 14, 2026
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