GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||
GeezerVison is showing github.com — fix(core): isolate ChatGPT account registrations by KomeijiReimu · Pull Request #56302 · anomalyco/opencode Conversation
|
|
The following comment was made by an LLM, it may be inaccurate: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The core fix looks right, but one TUI path now fails where it used to work. I couldn't confirm the fix end to end: OpenAI only returns the workspace denial on its live sign-in page, and testing that needs two real ChatGPT accounts. I read the code and ran the closest tests: core provider-chatgpt and integration (50 passed), the TUI integration dialog (15 passed) and the server fetch suite (13 passed). typecheck passes in core, plugin, tui, server, protocol and client.
A new connection now sends dynamic_agent_client, and a reauthorization uses that credential's own saved client ID. That matches the cause found in #56298. The new "no registered client ID" error shouldn't trap older accounts, because every ChatGPT credential is saved with a clientID.
Public API: the changes are additive and backwards compatible.
POST /api/integration/{integrationID}/connect/oauth takes a new optional credentialID in its body. The OpenAPI files and generated clients are updated to match.IntegrationOAuthMethodRegistration.authorize(answer) becomes authorize(answer, context?: { credential?: Credential.OAuth }). Existing plugins that take one argument keep working.integration.oauth.connect takes a new optional credentialID.Concerns:
provider-chatgpt.test.ts, mostly generic plugin-adapter tests (details inline).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| location, | ||
| dialog, | ||
| onConnected, | ||
| connection.method === "oauth" ? connection.id : undefined, |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This credentialID goes to selectMethod and is used with whichever OAuth method the user picks from the full list. OpenAI has three OAuth methods (Sign in with ChatGPT, Codex browser (legacy), Codex device code (legacy)). Connections only say method: "oauth", so the TUI can't tell which method the account was made with. If someone picks a Codex method to sign in again to an expired ChatGPT account (or the reverse), core now rejects it with "OAuth credential belongs to another method". Before this PR, that path worked and created a new credential.
Two options: show the credential's method ID on the connection and only send credentialID (or only show that method) when the methods match. Or have core and the plugin ignore the target when the method differs, instead of failing.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 9b73e65. After validating that the target exists, belongs to the integration and is OAuth, core treats a different OAuth method as a new connection without reusing its credential context. Same-method reauthorization still uses the selected registration. Added core completion, legacy-to-token-sharing URL and TUI method-selection regressions; the two cross-method tests fail before the fix and pass afterward.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| } | ||
| }) | ||
|
|
||
| describe("OAuth plugin authorization context", () => { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This block tests generic plugin-host and promise-adapter plumbing (passing context, single-argument compatibility) inside the ChatGPT provider tests, and it's large for what it checks. Please cut it down to the core cases: the ChatGPT authorize URL uses dynamic_agent_client when there's no target and the target's client ID when there is one. The credentialID checks can go in one small case in integration.test.ts.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Removed the 130-line generic adapter block and its import in 9b73e65. Provider authorization coverage is now ChatGPT-specific; target validation and the same/cross-method context contract live in compact integration-service tests. The existing single-argument OAuth case remains.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Start independent authorization when a saved credential uses another OAuth method, while retaining validation of invalid and foreign targets.
|
@opencode-agent Both review comments are addressed in 9b73e65. Please re-review the latest commit. Switching OAuth methods now starts an independent connection, and the generic adapter test block has been removed. Local |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Both concerns from my last review are fixed, and the new commit adds no problems I could find. I still couldn't confirm the actual fix, because OpenAI only returns the workspace denial on its live sign-in page and testing that needs two real ChatGPT accounts. On 9b73e65 I ran core provider-chatgpt and integration (49 passed) and the TUI integration dialog test (16 passed); typecheck passes in core and tui.
Fixed since last time:
dynamic_agent_client, which the new ChatGPT test checks.provider-chatgpt.test.ts. What's left is small and specific to the fix.Public API: no change since my last review, all additions and backwards compatible. The connect/oauth endpoint, OpenAPI files and generated clients take a new optional credentialID. Plugin OAuth authorize(answer) becomes authorize(answer, context?: { credential?: Credential.OAuth }), and existing plugins that take one argument keep working.
No remaining concerns.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks. I already re-reviewed
On that commit, the core |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Regenerate clients with the current generator and keep the retired website OpenAPI artifacts removed.
|
Merged current dev (fa1260d) in 582746c and resolved the generated-client conflicts using the current generator. Kept the retired website OpenAPI files deleted. All six affected package suites pass (8,874 passed, 36 skipped), as do |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Adapt web/desktop account targeting from anomalyco#63517 to this PR's credentialID API. Co-authored-by: iCodePoet <[email protected]>
|
Automated PR Cleanup Thank you for contributing to opencode. Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions. This PR was closed because it matched the following cleanup criteria:
PRs created within the last month are not affected by this cleanup. If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate. Thanks again for taking the time to contribute. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Could a maintainer reopen this PR? #56298 is still open, and two other users have reported the same problem there, including the exact error code on OpenCode 2.2.7. #63517 was closed as a duplicate of this PR five days before the automated cleanup closed this one. This PR now also covers reauthorizing a selected account in the web/desktop app, with regression tests. If the preferred approach is to fix the original Add account → Sign in with ChatGPT flow in #64945 instead, could you confirm that on #56298 so we can consolidate the work? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
openai: adding a second ChatGPT account fails with workspace scope denied
There was an error while loading. Please reload this page.