Skip to content

feat(openai): register and reuse SIWC OAuth clients [SIWC 5/6] - #9

Open
stevenlee-oai wants to merge 1 commit into
dev/stevenlee/siwc-status-endpointsfrom
dev/stevenlee/siwc-dynamic-client
Open

stevenlee-oai wants to merge 1 commit into
dev/stevenlee/siwc-status-endpointsfrom
dev/stevenlee/siwc-dynamic-client

Conversation

@stevenlee-oai

@stevenlee-oai stevenlee-oai commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

What Problem This Solves

Sign in with ChatGPT needs authorization-time client registration instead of a client ID baked into OpenClaw.

User Impact

New accounts start with dynamic_agent_client; OpenClaw saves the returned client ID with the credential and reuses it for authorization, token exchange, and refresh. Reconnect defaults to the saved registration. Choose Connect a different ChatGPT account or workspace for a fresh registration; reconnect rejects an unexpected identity change.

Requires OpenAI enablement of the dynamic-agent flow. Real registration, inference, and refresh against OpenAI remain unverified.

Why This Change Was Made

The callback validates the registered client ID and uses it as the verified ID-token audience. New registrations request openid email profile resource.invoke chatgpt.tokens.use.direct offline_access. Reconnect retains the issued client ID and other requested permissions, translating only the obsolete preview sharing-scope spelling. Older static registrations keep their narrower permissions. Requested scopes remain separate from the actual granted scopes persisted by the provider layer.

Credential candidates come from the host: same-provider profiles for CLI/setup, or only the current person's selected owned credential for personal login. Metadata uses the existing credential store. No static test registration, client secret, new configuration, or database schema is added.

Review layer 5/6, based on #8. Related: openclaw/openclaw#148567. The diff contains only this layer; the parent's callback transport and model-routing behavior are preserved.

Evidence

  • 83 focused tests pass across setup/provider policy, real loopback OAuth callbacks with signed fixture identities, Responses streaming, and both credential stores. They verify documented request scopes, saved-client reuse, reduced grants, refresh omission/rotation, and persistence after database reopen.
  • New grant/scope assertions fail against the previous implementation. Independent correctness, maintainability, and test review found no material in-scope issue.
  • Scoped core lint, formatting, boundary/assertion guards, and six doctor contract/closure tests pass. Broader typechecking and plugin lint retain existing parent-stack errors; isolated autoreview could not bootstrap its CLI.
  • OpenAI registration/consent, inference, and refresh still need end-to-end validation. No live-flow video is claimed.

This layer owns registration/reconnect and requested-scope handling. Actual grant parsing and storage belong to layer 2; the temporary managed-Codex header belongs to layer 3.

@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch from 5f9c988 to 3bbe7e7 Compare September 22, 2026 00:38
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 05c2a9c to b0a2c78 Compare September 22, 2026 00:38
@stevenlee-oai stevenlee-oai changed the title feat(openai): register and reuse SIWC OAuth clients [SIWC 5/5] feat(openai): register and reuse SIWC OAuth clients [SIWC 5/6] Sep 22, 2026
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch 2 times, most recently from 1c326a2 to 3c4e3a1 Compare September 22, 2026 21:58
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 90944eb to 575680a Compare September 22, 2026 21:58
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch from 3c4e3a1 to f76be61 Compare September 22, 2026 22:24
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 575680a to 90d165a Compare September 22, 2026 22:24
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch from f76be61 to 3f995f8 Compare September 22, 2026 23:08
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 13abbc4 to 0314699 Compare September 22, 2026 23:27
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch from 3f995f8 to 62337b5 Compare September 22, 2026 23:31
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 0314699 to d629a95 Compare September 22, 2026 23:49
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch 2 times, most recently from 6263b84 to 842f944 Compare September 23, 2026 18:14
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from d629a95 to 11a8af3 Compare September 23, 2026 18:14
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch from 842f944 to f0149dc Compare September 23, 2026 19:16
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 11a8af3 to 745abef Compare September 23, 2026 19:16
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-dynamic-client branch from f0149dc to eef42f7 Compare September 23, 2026 21:59
@stevenlee-oai
stevenlee-oai force-pushed the dev/stevenlee/siwc-status-endpoints branch from 745abef to 3b915bb Compare September 23, 2026 21:59
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