fix: allow Alibaba/Qwen Token Plan usage on Linux with a manual cookie#2356
Conversation
sourceModeRequiresWebSupport blanket-rejects web-source providers off macOS, but carries per-provider escape hatches for opencodego, commandcode, cursor, and qoder when their cookie source is manual - the fetch is plain URLSession + cookies, only browser auto-import needs macOS. alibabatokenplan was missing this exemption, so codexbar usage --provider alibaba-token-plan failed on Linux even with a manually configured cookie header. Add the same exemption. Part of steipete#2328.
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix: allow Alibaba/Qwen Token Plan usage on Linux with a manual cookie This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f2194445d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if provider == .alibabatokenplan, | ||
| settings?.alibabaTokenPlan?.cookieSource == .manual | ||
| { |
There was a problem hiding this comment.
Honor environment-provided Alibaba cookies
When users supply the supported ALIBABA_TOKEN_PLAN_COOKIE override instead of saving cookieSource: manual in config, this gate still returns true on Linux and rejects the request before AlibabaTokenPlanWebFetchStrategy.isAvailable can accept the env cookie. Include AlibabaTokenPlanSettingsReader.cookieHeader(environment:) != nil in this exemption so env-only manual cookies are not still reported as macOS-only.
Useful? React with 👍 / 👎.
Summary
sourceModeRequiresWebSupportblanket-rejects web-source providers off macOS, but it already carries per-provider escape hatches foropencodego,commandcode,cursor, andqoderwhen their cookie source is manual — those fetches are plainURLSession+ cookies, and only browser cookie auto-import actually needs macOS.alibabatokenplan(Alibaba / Qwen Cloud Token Plan) was missing this exemption, so on Linux:…even with
cookieSource: "manual"+ a configured cookie header.AlibabaTokenPlanProviderSettingsalready conforms toProviderCookieSettings, so the same exemption applies cleanly.This is the "Blocker on Linux" from #2328 (the full Qwen Cloud Personal API variant is a separate, larger follow-up).
Fix
Placed alongside the existing
commandcode/qoderexemptions (not#if os(Linux)-gated, since a manual cookie works on any platform; onlycursor's app-auth path is Linux-specific). No effect on macOS (already supports web). Only.manualis exempted —.auto/.offstill require web support.Test
TestsLinux/AlibabaTokenPlanLinuxTests.swift:cookieSource == .manual→ does not require web support (reachable on Linux)cookieSource == .auto→ still requires web support (unchanged)Proof (real run)
Runs on CI in the
build-linux-cli"Swift Test (Linux only)" step. Local red→green inswift:6.3.3:Before the fix (exemption removed) — manual cookie is still gated:
After the fix — both pass:
Build clean,
swiftlint --strict0 violations,swiftformat --lintclean.Small and self-contained — happy to adjust or close if not wanted.