Artifact dddbfb4a7c9c3a25268b8d69a1cb752ea8a67a6bae60e54da66edef528acf278:
- File docs/design/subscription-sign-in.md — part of check-in [fcc6715760] at 2026-11-22 13:22:47 on branch oauth-login — Subscription sign-in: OpenRouter, RPC login/logout/get_auth_status, docs, changelog, escape-safe provider errors (user: pi-c-agent, size: 1596) [annotate] [blame] [check-ins using]
Subscription sign-in
Status: implemented on the oauth-login branch (ticket 30); the credential seam awaits the owner's review
Tier: bundled (src/oauth.c, src/oauth_openai.c, src/oauth_openrouter.c). Clock: vendor. Record:
a picu_credential row of kind oauth. Default: on.
The seam
Core's credential store (cred.h) gains pic_cred_oauth_ops: a sign-in label per provider, a login
that returns what to seal, and a refresh. The composition root registers the bundled table; core
calls only through it, so core names no provider and links without the flows (tiers checks 4 and
5). It is a new seam, which keel sends to the owner. The lighter alternative, the flows
in core with the provider names behind an allowance, was refused: the allowance only shrinks.
Decisions
- Providers: OpenAI's Sign in with ChatGPT (OpenAI's published program for open-source agents, Pi a launch partner) and OpenRouter (documented PKCE for third-party apps). Pi's Anthropic sign-in is refused by Anthropic's terms (February 2026); Codex, Copilot, xAI, Meta and Kimi reuse first-party client ids with no published permission. None of them is built.
- Refresh runs under a lock file beside
pic.sqlite, not aBEGIN IMMEDIATEaround the network call, so other writers never wait on a token endpoint. The row is read again inside the lock. - RPC: Pi has no credential commands. pic's
loginandlogout, which used to refuse, now work, andget_auth_statusis pic's own. - The device-code poll (RFC 8628) is built and tested, but no provider pic signs in to offers it.