Skip to content

0.37.2: opening a sign-in link consumes nothing; 0.37.0 links open after an upgrade; the start names its state - #20

Merged
echarles merged 2 commits into
mainfrom
fix/link-opens-and-callback-state
Nov 17, 2026
Merged

echarles merged 2 commits into
mainfrom
fix/link-opens-and-callback-state

Conversation

@echarles

Copy link
Copy Markdown
Member

Fixes the two findings of Copilot's review of #19, in both SDKs, and adds what a host needs to push a Direct Sign-In whose redirect lands in another service.

  • Opening a link consumes nothing. open_link / openLink read the link's record with the state store's new optional get (a SHOULD of AuthorizationStateStore, read without consuming). take stays the callback's alone, so an opening paused between reading and writing back while complete consumed the sign-in can no longer restore the link. A store without get is still accepted (take then put, the old race, documented). The SDKs' in-memory stores (cli_host.MemoryStateStore, the demo kit, the TS test world) have get.
  • A link begun by 0.37.0 opens after an upgrade. Its record (the callback state's reference) is followed to the pending sign-in without consuming it. Mixed-version replicas are documented in the changelog: a 0.37.0 replica cannot read newer links, so roll every replica serving link pages first, or route link pages to upgraded ones.
  • DirectSignInStart.state (a secret, never in repr): with PAR or a link page the browser's URL carries no state; a host whose redirect URI is served elsewhere keys the callback by it.

Tests (both SDKs): an interleaved open/complete with a store paused between steps, a 0.37.0 link record, a store without get, the start's state. Python 1,607 passed; TypeScript 1,077 passed; ruff, mypy, tsc clean.

Version 0.37.2 (additive, agent-runtimes' >=0.37.0,<0.38 accepts it).

…after an upgrade, the start names its state

- open_link/openLink read the link's record with the state store's new optional get (a SHOULD); take stays the callback's alone, so an opening paused while complete consumed the sign-in no longer restores the link (Copilot's review of 0.37.1). A store without get is read by take then put.
- A link begun by 0.37.0 (its record the callback state's reference) is followed without consuming the state. Mixed versions documented in the changelog.
- DirectSignInStart.state: the request's state, a secret, for a host whose redirect lands in another service (with PAR or a link page the URL carries none).
Tests in both SDKs: an interleaved open and complete with a paused store, a 0.37.0 link, a store without get, the start's state.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 12:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Both implementations fail to restore legacy links in stores without get, causing subsequent openings to fail while sign-in is still pending and unexpired.

2 open issues
What changed in this PR

This 0.37.2 release updates Direct Sign-In in both SDKs to support non-consuming link reads, older link records, and callback routing across services.

Changes:

  • Adds optional state-store get support and resolves links created by 0.37.0.
  • Exposes the request’s secret state through DirectSignInStart.
  • Adds regression tests and updates versions, release notes, and integration guidance.
File Description
src/​reactor.ts Adds optional state-store get and updates the core plugin version.
src/​company/​index.ts Updates the company plugin version.
src/​auth.ts Adds non-consuming reads, legacy-link handling, and returned state.
src/​__tests__/​support/​world.mjs Adds get to the test state store.
src/​__tests__/​published-10.test.mjs Tests interleaving, legacy links, fallback stores, and returned state.
personal_agent_protocol/​reactor.py Documents optional state-store get and updates the core plugin version.
personal_agent_protocol/​company/​__init__.py Updates the company plugin version.
personal_agent_protocol/​cli_host.py Adds expiry-aware, non-consuming state reads.
personal_agent_protocol/​auth.py Adds non-consuming reads, legacy-link handling, and returned state.
personal_agent_protocol/​__version__.py Sets the Python SDK version to 0.37.2.
personal_agent_protocol/​__tests__/​test_published_10.py Adds matching Python regressions and state-redaction coverage.
package.json Sets the TypeScript package version to 0.37.2.
docs/​docs/​releases/​compatibility.mdx Records the release’s compatibility changes.
docs/​docs/​protocol/​conformance-report.mdx Updates the documented SDK version.
docs/​docs/​guides/​direct-sign-in.mdx Explains link reads and cross-service callback correlation.
docs/​docs/​concepts/​contribution-points.mdx Documents the optional state-store read capability.
CHANGELOG.md Describes the release and mixed-version rollout guidance.

Review effort: Balanced

Comment thread personal_agent_protocol/auth.py Outdated
Comment on lines 516 to 525
pending = await _peek(store, _link_reference(link))
if isinstance(pending, str):
# A link begun by 0.37.0, whose record names the callback state's reference: that
# state is followed, still never consumed, so a link left unexpired across an
# upgrade opens as before.
pending = await _peek(store, pending) if pending.startswith("direct:") else None
if not isinstance(pending, _PendingDirectSignIn) or clock.now() > pending.expires_at:
raise AuthorizationError(
"invalid_or_expired_state", "the sign-in link is unknown or has expired"
)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2bedac, both SDKs: when the store has no get, the 0.37.0 string record taken to read it is put back with the pending sign-in's expiry, so the link opens again until the sign-in completes (then complete drops it, or following it finds no state). Test: a 0.37.0 link in a store without get opens again until the sign-in completes (Python and TypeScript).

Comment thread src/auth.ts Outdated
Comment on lines 612 to 620
let pending = await peek(store, await linkReference(link));
if (typeof pending === "string") {
// A link begun by 0.37.0, whose record names the callback state's reference: that state is
// followed, still never consumed, so a link left unexpired across an upgrade opens as before.
pending = pending.startsWith("direct:") ? await peek(store, pending) : undefined;
}
if (!isPendingDirectSignIn(pending) || clock.now().getTime() > pending.expiresAt.getTime()) {
throw new AuthorizationError("invalid_or_expired_state", "The sign-in link is unknown or has expired");
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in a2bedac, both SDKs: when the store has no get, the 0.37.0 string record taken to read it is put back with the pending sign-in's expiry, so the link opens again until the sign-in completes (then complete drops it, or following it finds no state). Test: a 0.37.0 link in a store without get opens again until the sign-in completes (Python and TypeScript).

…mpletes (Copilot's review of #20): the string record taken to read it is put back with the sign-in's expiry. Tests in both SDKs
@echarles
echarles merged commit 1fed07e into main Nov 17, 2026
17 checks passed
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.

2 participants