Skip to content

fix: align ACP v2 runtime and connection hooks with v1 - #217

Merged
PsiACE merged 2 commits into
mainfrom
fix/v2-align-runtime-and-hooks
Nov 30, 2026
Merged

PsiACE merged 2 commits into
mainfrom
fix/v2-align-runtime-and-hooks

Conversation

@PsiACE

@PsiACE PsiACE commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

Aligns ACP v2 runtime behavior and connection hooks with v1 conventions while conforming to the ACP v2 schema-v2.0.0-beta.4 draft.

Summary

  • Match v1 extension calling convention in v2: ext_method / ext_notification prepend _ on send and strip _ on receive, while keeping v2 inherited-stub semantics (-32601 / ignored).
  • Start background receive loops only after on_connect succeeds across v1 and v2 connections so hook failures do not leak receive tasks, make Connection.start_listening() / main_loop() idempotent against duplicate readers, and align v2.AgentSideConnection with v1's public listening parameter and listen() method.
  • Align v2 initialization and AgentProtocolRouter with the beta.4 draft:
    • Reject pre-initialization requests immediately (-32600) and ignore pre-initialization notifications, including while the first initialize is in flight; fail fast on agent sends before first success while allowing callbacks during repeat initialize.
    • Allow v2 clients to retry a remotely rejected first initialize on the same connection and repeat initialize before the first non-initialize request (restoring prior state on remote RequestError, closing on incompatible responses).
    • In AgentProtocolRouter, cache per-version attached handlers across retries, allow same-version repeats and downgrades (deactivating superseded v2 wrappers after a successful downgrade), and reject upward version switches with -32600.
  • Forward model_extra fields for custom v2 modes according to the handler signature, remove unused router aliases, and export acp.__version__.

Verification

  • make gen-check
  • make check
  • make test (704 passed, 1 skipped, 0 warnings)
  • NO_MKDOCS_2_WARNING=true make docs-test

@PsiACE
PsiACE force-pushed the fix/v2-align-runtime-and-hooks branch from 4cab7b3 to b2d82fd Compare November 29, 2026 06:36
@PsiACE
PsiACE force-pushed the fix/v2-align-runtime-and-hooks branch from b2d82fd to a882555 Compare November 29, 2026 07:23
@PsiACE
PsiACE merged commit d5560c3 into main Nov 30, 2026
9 checks passed
@PsiACE
PsiACE deleted the fix/v2-align-runtime-and-hooks branch November 30, 2026 09:54
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