Skip to content

Add command code support#857

Merged
steipete merged 4 commits intosteipete:mainfrom
sixhobbits:add-command-code-support
May 10, 2026
Merged

Add command code support#857
steipete merged 4 commits intosteipete:mainfrom
sixhobbits:add-command-code-support

Conversation

@sixhobbits
Copy link
Copy Markdown
Contributor

Might be slop because I'm not a macos dev and I don't have XCode so my agent had to do a bunch of workarounds to build this locally and test it

But it works for me

CleanShot 2026-05-07 at 12 22 12@2x image image

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fbb353304

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +50 to +51
return CommandCodeCookieOverride(
name: self.supportedSessionCookieNames[0],
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 Use the secure cookie name for bare tokens

When a bare session token is provided, this now picks supportedSessionCookieNames[0], which is __Host-better-auth.session_token; the added CommandCodeUsageFetcherTests.cookie header accepts bare token and uses secure name expects __Secure-better-auth.session_token, so the new test suite fails and bare-token manual setup will send the wrong cookie name for the documented production variant. Choose the intended production cookie name explicitly instead of depending on the array order.

Useful? React with 👍 / 👎.

@steipete steipete force-pushed the add-command-code-support branch from 7fbb353 to b435292 Compare May 10, 2026 05:35
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b435292bb6

ℹ️ 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".

Comment on lines +90 to +94
} else {
let names = httpCookies.map(\.name).joined(separator: ", ")
log("No known session name in \(label); sending all domain cookies (\(names))")
}
sessions.append(session)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Skip cookie sets without a Command Code session token

This loop appends every domain cookie bundle even when session.sessionCookie is missing, and importSession() later returns sessions.first, so a non-authenticated profile can be chosen ahead of a valid one. In multi-profile or multi-browser setups, auto mode can consistently send a cookie header that lacks better-auth.session_token, producing invalidCredentials even though another discovered session is valid.

Useful? React with 👍 / 👎.

Comment on lines +24 to +28
async let creditsResult = self.fetchCredits(cookieHeader: cookieHeader, session: session)
async let subscriptionResult = self.fetchSubscription(cookieHeader: cookieHeader, session: session)

let credits = try await creditsResult
let subscription = try await subscriptionResult
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 Don’t fail usage fetch when subscriptions call errors

The subscription request is treated as a hard dependency via try await subscriptionResult, so any transient failure on /internal/billing/subscriptions aborts the whole provider fetch, even if credits were fetched successfully. Because credits are enough to show remaining balance (and parseSubscription already models missing subscription data as optional), this turns partial backend outages into full Command Code outages for users.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner

@steipete steipete left a comment

Choose a reason for hiding this comment

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

Thanks @sixhobbits. I rebased this onto current main, kept the newer Crof/Venice provider entries, fixed the Command Code bare-token cookie default, updated provider-order coverage, and verified local/CI checks.

@steipete steipete merged commit 1620116 into steipete:main May 10, 2026
4 checks passed
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