Skip to content

provider: t3.chat#1091

Merged
steipete merged 9 commits into
steipete:mainfrom
Quicksaver:provider/t3-chat
May 21, 2026
Merged

provider: t3.chat#1091
steipete merged 9 commits into
steipete:mainfrom
Quicksaver:provider/t3-chat

Conversation

@Quicksaver
Copy link
Copy Markdown
Contributor

Summary

Adds T3 Chat as a new disabled-by-default web/cookie provider.

The provider reads T3 Chat customer usage from the web app’s getCustomerData tRPC endpoint, parses its JSONL response format, and maps usage into CodexBar’s existing provider model:

  • usageFourHourPercentage -> Base usage window
  • usageMonthPercentage / usagePeriodPercentage -> Overage usage window
  • subscription tier/product -> provider identity/login method

Details

  • Adds T3 Chat provider descriptor, settings store, implementation, logging category, registry wiring, widget/menu/debug integration, docs, and provider icon.
  • Supports automatic browser cookie import for t3.chat / www.t3.chat.
  • Supports manual paste of either a raw Cookie header or a full browser cURL capture.
  • For full cURL captures, forwards relevant browser fingerprint headers like User-Agent, Referer, X-Deployment-Id, and x-client-context.
  • Handles T3’s line-delimited tRPC JSON response by recursively locating the customer data payload.
  • Surfaces auth failures distinctly:
    • 401 / 403 -> invalid or expired session
    • Vercel 429 challenge -> asks user to paste the full browser cURL request instead of only cookies

Most T3-specific logic is isolated under the T3 Chat provider folders, with only small registry/settings/menu/widget/docs touch points.

Testing

  • swift test --filter T3ChatUsageFetcherTests
  • swift test --filter ProviderIconResourcesTests
  • swift test
  • make check

Confirmation

Screenshot 2026-05-21 at 16 21 02 Screenshot 2026-05-21 at 16 21 15

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: e0783ff147

ℹ️ 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 thread Sources/CodexBarCore/Providers/T3Chat/T3ChatUsageFetcher.swift Outdated
Quicksaver and others added 9 commits May 22, 2026 00:03
- Wire T3 Chat into provider registries and UI
- Add fetcher, settings, icon, and tests
- Document the new provider and update parser hash
- Normalize T3 Chat cookie source copy and fields
- Parse broader cURL header formats in usage fetcher
- Tighten web fetch availability and update tests
- Assert the T3 Chat usage request sets the customization referer
- Swap the SVG for a full-size provider mark
- Preserve currentColor styling for theme matching
- Parse cookie headers from full curl captures
- Add coverage for long-form header extraction
- Use subscription period end for overage reset\n- Cover billing reset being ignored in parser tests
- Use subscription period end for overage reset timing
- Stop falling back to billing reset when subscription data is missing
- Add tests for billing reset and subscription-based overage reset
@steipete steipete force-pushed the provider/t3-chat branch from f8846b1 to 750d0b9 Compare May 21, 2026 23:16
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 @Quicksaver, this is a good fit now.

I rebased the branch, added one maintainer fix so manual mode preserves full T3 Chat cURL captures end-to-end, and verified the provider through the real CLI web path against a live browser session.

Proof:

  • make check
  • swift test --filter T3ChatUsageFetcherTests
  • swift test --filter ProviderIconResourcesTests
  • codex-review --mode branch
  • swift run CodexBarCLI usage --provider t3chat --source web --format json --pretty --web-timeout 20
  • ./Scripts/compile_and_run.sh

@steipete steipete merged commit 4bf5ccb into steipete:main May 21, 2026
1 check passed
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: 750d0b97c5

ℹ️ 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 +42 to +48
for source in sources where !source.records.isEmpty {
let cookies = BrowserCookieClient.makeHTTPCookies(source.records, origin: query.origin)
guard !cookies.isEmpty else { continue }
let names = cookies.map(\.name).joined(separator: ", ")
log("\(source.label) cookies: \(names)")
let header = cookies.map { "\($0.name)=\($0.value)" }.joined(separator: "; ")
return SessionInfo(cookieHeader: header, sourceLabel: source.label)
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 Skip non-session cookie sets when auto-importing T3 cookies

The importer returns the very first non-empty cookie set it sees, without checking that it actually contains an authenticated T3 session. In practice, a browser/profile can have only anonymous cookies (or stale auth) for t3.chat; this short-circuits the search and prevents trying later profiles/browsers that may have a valid login, so auto mode can consistently fail with invalidCredentials even when the user is signed in elsewhere.

Useful? React with 👍 / 👎.

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