Skip to content

Never hand Codex an unsupported Web source mode - #512

Closed
Dreamkeeper wants to merge 1 commit into
nesszer:mainfrom
Dreamkeeper:fix/codex-unsupported-web-source-mode
Closed

Dreamkeeper wants to merge 1 commit into
nesszer:mainfrom
Dreamkeeper:fix/codex-unsupported-web-source-mode

Conversation

@Dreamkeeper

@Dreamkeeper Dreamkeeper commented Sep 16, 2026 •

Copy link
Copy Markdown

Summary

On Windows 11 with the released 0.60.3 build, the tray panel showed this for Codex on every refresh:

Source mode 'Web' not supported for this provider

while codexbar-cli.exe usage -p codex worked fine (OAuth, supported_sources: ["auto","oauth","cli"]).

Since the 0.54 port CodexProvider::fetch_usage rejects SourceMode::Web outright, but the desktop shell can still produce it: the default cookie source is "manual", and build_fetch_context maps manual + a stored cookie to SourceMode::Web for every provider with a cookie domain. Pasting a chatgpt.com Cookie header for Codex (the Codex cookie section still offers it) therefore breaks all Codex refreshes, even though the provider never reads that cookie.

Fix

  • Add the inverse of the existing Cli remap in build_fetch_context: if the resolved mode is Web and the provider does not list Web in available_sources(), fall back to the configured usage source (or Auto).
  • Two new tests: a pasted Codex cookie with default settings resolves to Auto, and an explicit oauth usage source is preserved.

Local verification

  • Reproduced on the released build; confirmed the cause by decrypting manual_cookies.json / settings.json (Codex entry present, no cookie_source override).
  • Removing the Codex cookie (or setting the Codex cookie source to Off) makes the tray refresh succeed again, matching the code path this patch guards.

Checks

cargo fmt --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml --all -- --check
cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml fetch_context
# 25 passed; 0 failed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed refresh failures for providers that don’t support web-based sources when manual cookies are present.
    • Provider source selection now falls back to a supported configured source or automatic selection.
    • Preserved explicit supported sources, such as OAuth, during refreshes.

Since the 0.54 port the Codex provider only supports Auto/OAuth/CLI and
rejects SourceMode::Web outright. The desktop shell's default cookie source
is "manual", so pasting a chatgpt.com Cookie header for Codex mapped the
provider to Web and every refresh failed with
"Source mode 'Web' not supported for this provider".

Add the inverse of the existing Cli remap in build_fetch_context: if the
resolved mode is Web and the provider does not advertise Web in
available_sources(), fall back to the configured usage source (or Auto).

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 500b732b-0f27-4a4f-a5f7-66fe6a6fdd99

📥 Commits

Reviewing files that changed from the base of the PR and between 2634b66 and 0a8a0f6.

📒 Files selected for processing (2)
  • apps/desktop-tauri/src-tauri/src/commands/providers.rs
  • apps/desktop-tauri/src-tauri/src/commands/tests.rs

Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Codex source-mode handling

Layer / File(s) Summary
Source-mode fallback and regression coverage
apps/desktop-tauri/src-tauri/src/commands/providers.rs, apps/desktop-tauri/src-tauri/src/commands/tests.rs
When a provider does not support Web, build_fetch_context selects the configured supported source or SourceMode::Auto. Tests cover Codex manual cookies and explicit OAuth usage.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: finesssee

Merge Risk: ⚪ Minimal · up to 0a8a0

The source-mode fallback prevents unsupported Web mode from reaching Codex while preserving supported explicit configuration. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preventing Codex from receiving the unsupported Web source mode.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Finesssee

Copy link
Copy Markdown
Collaborator

Thermo-nuclear code-quality review

Reviewed head 0a8a0f6 against main using the full thermo-nuclear maintainability rubric.

No high-confidence thermo findings. The change is a small, localized source-mode guard with focused tests and does not add structural, abstraction, boundary, orchestration, or file-size regression.

@Finesssee

Copy link
Copy Markdown
Collaborator

This fix was preserved unchanged and merged through maintainer-owned PR #541, which passed the required CircleCI gate. Closing this fork PR as superseded by #541.

@Finesssee Finesssee closed this Sep 18, 2026
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.

2 participants