Repository navigation
0.37.2: opening a sign-in link consumes nothing; 0.37.0 links open after an upgrade; the start names its state - #20
Conversation
…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.
There was a problem hiding this comment.
🟡 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
getsupport and resolves links created by 0.37.0. - Exposes the request’s secret
statethroughDirectSignInStart. - 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
| 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" | ||
| ) |
There was a problem hiding this comment.
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).
| 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"); | ||
| } |
There was a problem hiding this comment.
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

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.
open_link/openLinkread the link's record with the state store's new optionalget(a SHOULD ofAuthorizationStateStore, read without consuming).takestays the callback's alone, so an opening paused between reading and writing back whilecompleteconsumed the sign-in can no longer restore the link. A store withoutgetis still accepted (take then put, the old race, documented). The SDKs' in-memory stores (cli_host.MemoryStateStore, the demo kit, the TS test world) haveget.DirectSignInStart.state(a secret, never in repr): with PAR or a link page the browser's URL carries nostate; 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.38accepts it).