sc-308937: Fix disabled Allow Access button in Codex OAuth flow - #161
Conversation
📝 WalkthroughWalkthroughA new default authorization scope behavior is implemented in the OAuth provider, automatically using "openid" as the default scope when client requests omit the scope parameter. Test coverage validates this default behavior. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/auth/oauth.test.ts (1)
358-386: Nice regression test; consider asserting the parsed scope exactly.
toContain("scope=openid")can pass even if extra scopes are appended. Parsinglocationas a URL and assertingsearchParams.get("scope") === "openid"will make this test stricter and future-proof.Suggested assertion update
const location = res.headers.get("location"); expect(location).toBeDefined(); - expect(location).toContain("scope=openid"); + const redirectUrl = new URL(location!); + expect(redirectUrl.searchParams.get("scope")).toBe("openid");🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/auth/oauth.test.ts` around lines 358 - 386, Update the assertion in the test "GET /authorize defaults scope to openid when client omits scope" to parse the returned location as a URL and assert the exact scope value; specifically, replace the loose expect(location).toContain("scope=openid") check with constructing a new URL(location) and asserting url.searchParams.get("scope") === "openid" (use the existing location variable and the test's URL base such that the parsed URL is valid) to ensure the scope equals exactly "openid".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/auth/oauth.test.ts`:
- Around line 358-386: Update the assertion in the test "GET /authorize defaults
scope to openid when client omits scope" to parse the returned location as a URL
and assert the exact scope value; specifically, replace the loose
expect(location).toContain("scope=openid") check with constructing a new
URL(location) and asserting url.searchParams.get("scope") === "openid" (use the
existing location variable and the test's URL base such that the parsed URL is
valid) to ensure the scope equals exactly "openid".
Summary
Problem
Codex CLI OAuth flow can omit the scope query parameter. Our authorize proxy forwarded no scope upstream, which left the Shortcut auth page with a disabled Allow Access button.
Verification
Summary by CodeRabbit
New Features
openidscope when no scope is explicitly specified, ensuring consistent identity authentication behavior.Tests