fix(desktop): show the Codex device sign-in code on connection-detail re-login - #3358
Conversation
jackwener
left a comment
There was a problem hiding this comment.
Automated Codex review on exact head dfe2323d669b2af8513c99d27a4060ea1be21334.
The bug still exists on current main: OAuthReloginNotice starts the shared OAuth flow but drops flow.stateHint, while the catalog path renders it for Codex. The JSX change correctly restores the required device code and excludes xAI.
P3 / simplification: the new 68-line test does not assert the repaired behavior. It only pins showsDeviceCode and bridge routing; deleting the <code>{deviceCode}</code> rendering would leave all four tests green. Moving the existing service mapping into a 44-line leaf module was done mainly to make that indirect test loadable, so the test creates an extra production seam without protecting the user-visible regression.
Prefer either:
- replace it with coverage that asserts the notice description actually contains Codex's
stateHintand not xAI's; or - if the repository has no honest component harness for this surface, delete the indirect test and keep the mapping in its existing owner, relying on focused human/UI verification rather than a misleading pin.
Required conclusions:
- Optimal for the actual problem: functionally yes, structurally a little overbuilt.
- Production code to delete: the extracted leaf module can be avoided if the indirect test is removed.
- Tests to delete/replace: replace or delete
oauth-relogin-device-code.test.tsas above. - Deeper refactor: no; the final structure should keep one service mapping and directly render
stateHintat the notice. - Ready to merge: product logic is sound and required
testis green, but independent human review is still missing; the test-quality cleanup is non-blocking. - Residual risk/gaps: no regression assertion currently fails when the rendered device code is removed.
This changes user-visible authentication behavior, so independent human review is required under CONTRIBUTING.md. No additional security, licensing, release, governance, or public-contract effect was identified.
5c86ccb to
b1e3eea
Compare
… re-login The connection detail sheet's re-login notice drives the same browser-assisted OAuth flow as the provider catalog panel, but never rendered the flow's stateHint. For Codex that hint is the 9-digit device user code the authorization page requires — the verification URL does not embed it — so a re-login started from the notice could never be completed. - OAuthLoginService gains showsDeviceCode: true for Codex, false for xAI, whose page needs no manual code (mirrors the catalog panel's !isXai guard). The mapping stays in use-connection-detail so the legacy AppShell closure gains no file and no dependency. - OAuthReloginNotice appends the sign-in code to the banner description while authorization is pending, reusing the catalog's deviceCode copy. Fixes apache#3357 Generated-by: Claude Code (Fable 5) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Replace stale Microsoft 1ES proxy resolutions with the canonical npm registry tarballs while preserving the exact package versions. Refresh their integrity metadata to npm-published SHA-512 digests so clean installs no longer depend on an unrelated proxy. Generated-by: Codex
b1e3eea to
881be43
Compare
PR AssessmentWhat problem does this PR solve?OpenAI Codex re-login from the connection-detail sheet starts device authorization but does not display the How does this PR solve the problem?The patch keeps
No new authorization state machine, persistence, or parallel source of truth is introduced. Is the problem correctly defined?Correct. The linked issue, current base implementation, and existing catalog flow agree on the root cause: the re-login path receives the required code but drops it at the rendering boundary. Principle-based assessment
Required conclusions
Review FindingsP1 BlockerNone. P2 Should Fix[P2 Should Fix] Add the required visual evidence for the untested UI change
SuggestionKeep the lockfile restoration independently reviewable
Verification
ConclusionMerge conditionally. Add the required UI evidence, then obtain the independent human approving review required by 点击展开中文PR 判断这个 PR 解决了什么问题?从连接详情页重新登录 OpenAI Codex 时,应用会启动设备授权,却不显示包含必需 9 位用户码的 这个 PR 如何解决这个问题?该补丁继续让
它没有新增授权状态机、持久化状态或并行事实源。 这个问题定义得对吗?Correct(正确)。 关联 Issue、当前 base 实现以及已有目录登录流程对根因的描述一致:重新登录路径已经拿到必需的设备码,却在渲染边界丢弃了它。 原则性判断
必答结论
Review FindingsP1 阻塞无。 P2 应该改[P2 应该改] 为没有自动化覆盖的 UI 改动补充仓库要求的视觉证据
建议保持 lockfile 恢复可被独立审查
验证
结论有条件合入。 补充要求的 UI 证据,然后获得 |
|
@YayoiNanoka thanks for the review. Added before/after screenshots to the description: before (en) shows the notice with no code while authorization is pending; after shows the code in both locales — On the lockfile commit: agreed it is independent. I kept it because |
Summary
The connection detail sheet's re-login notice (
OAuthReloginNotice) drives the same browser-assisted OAuth flow as the provider catalog panel, but never rendered the flow'sstateHint. For Codex that hint is the 9-character device user code the authorization page requires — the verification URL is the static device page and does not embed the code — so a re-login started from the notice could never be completed: the browser asked for a code the app never showed.OAuthLoginServicegains ashowsDeviceCodeflag:truefor Codex,falsefor xAI, whose authorization page needs no manual code (mirroring the catalog panel's existing!isXaiguard). The mapping stays inuse-connection-detail.tsso the legacy AppShell closure gains no file and no dependency under the renderer architecture ratchet.OAuthReloginNoticeappends the sign-in code to the banner description while authorization is pending, reusing the catalog panel'sdeviceCodecopy so both entry points speak the same words.The second commit re-applies #3381 (normalize locked npm registry sources). That fix was reverted on
mainby #3148's lockfile regeneration six hours after it merged, sonpm ciunderallow-remote=nonefails again onmain; it is included here so the branch installs cleanly. Happy to drop it if the maintainers prefer a separate PR.Fixes #3357
Verification
npm run lint,npm run format:check,npm run check:asf-headers— cleannpm run typecheck(desktop) — cleannpm run check:architecture -- --base <main>— passednpm --workspace @maka/desktop test— 1695 passed, 0 failednpx knip --workspace apps/desktop— cleanBefore (en) — no code while authorization is pending

After (en) —

Sign-in code: …shown in the bannerAfter (zh) —

登录码:…shown in the bannerAI use
Select exactly one:
Tool(s) and scope: Claude Code (Fable 5) performed the diagnosis, implementation, and verification. The human contributor reviewed and manually verified the result and authorized submission. Commits carry a Generated-by trailer.
Checklist
Does this PR entail a change in behavior?
🤖 Generated with Claude Code