Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Sources/CodexBarCLI/CLIUsageCommand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,13 @@ extension CodexBarCLI {
{
return false
}
if provider == .alibabatokenplan,
settings?.alibabaTokenPlan?.cookieSource == .manual
{
Comment on lines +697 to +699

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

// The Alibaba/Qwen Token Plan fetch is plain URLSession + cookies; only browser
// cookie auto-import needs macOS, so a manual cookie header works off macOS too.
return false
}
#if os(Linux)
if provider == .cursor,
settings?.cursor?.cookieSource != .off
Expand Down
30 changes: 30 additions & 0 deletions TestsLinux/AlibabaTokenPlanLinuxTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#if os(Linux)
import Foundation
import Testing
@testable import CodexBarCLI
@testable import CodexBarCore

struct AlibabaTokenPlanLinuxTests {
@Test
func `manual cookie source does not require macOS web support`() {
// The Alibaba/Qwen Token Plan fetch is plain URLSession + cookies, so a manually
// configured cookie header must be usable off macOS (matches qoder/commandcode).
#expect(!CodexBarCLI.sourceModeRequiresWebSupport(
.web,
provider: .alibabatokenplan,
settings: ProviderSettingsSnapshot.make(
alibabaTokenPlan: .init(
cookieSource: .manual,
manualCookieHeader: "login_qwencloud_ticket=t"))))
}

@Test
func `auto cookie source still requires web support off macOS`() {
#expect(CodexBarCLI.sourceModeRequiresWebSupport(
.web,
provider: .alibabatokenplan,
settings: ProviderSettingsSnapshot.make(
alibabaTokenPlan: .init(cookieSource: .auto, manualCookieHeader: nil))))
}
}
#endif