Skip to content

Add Trae CN credits provider - #1014

Merged
Finesssee merged 3 commits into
mainfrom
port/trae-cn-provider
Oct 23, 2026
Merged

Finesssee merged 3 commits into
mainfrom
port/trae-cn-provider

Conversation

@Finesssee

@Finesssee Finesssee commented Oct 23, 2026 •

Copy link
Copy Markdown
Collaborator

Branch: port/trae-cn-provider
Head: e14540f49, which merges current main (including Soniox, #1002) into the original commit 21bc867a4
Upstream: CodexBar 0703a0c01 (steipete#4682)

Summary

  • Adds a Trae CN provider (disabled by default) that reads the credit allowance from api.trae.cn using the signed-in browser session or a pasted Cookie header.
  • Flow: POST /cloudide/api/v3/common/GetUserToken exchanges the cookies for a token, then POST /trae/api/v2/pay/user_current_entitlement_list reads the entitlements with Authorization: Cloud-IDE-JWT <token>. The token lives for one refresh and is sent only back to the same API origin.
  • Browser sessions are tried in browser order. The next session is tried only after Trae rejects the current one (401, 403, a redirect, or application code 1001).
  • The card shows credits used against the total as the gauge. The details list has a "Credits" section with Used, Total and Remaining. The plan name from the active plan entitlement is the login method.
  • Zero allowance: the card shows "No Trae CN credit allowance" and the details without a gauge.
  • Overspend clamps the gauge at 100% and keeps the true numbers in the details.
  • No reset or renewal date is inferred from pack timestamps, which matches upstream.
  • Error mapping: an expired or rejected session reports "session expired" with a sign-in hint; 429 reports rate limiting; 408 and 5xx report the service as unavailable; other HTTP failures name the status code. Response bodies are never echoed into errors.
  • Cookie-source options: auto (browser import), manual (pasted header), and off. A manual source never falls back to a browser session.
  • Adds the provider icon, the provider catalog entry, the docs section and the README row.

Divergences from upstream

  • Display strings are literal English. No locale keys were added, so the labels are not localized.
  • Cookie-name filtering is not applied: the whole api.trae.cn cookie header is forwarded, as upstream does.
  • Test-only base-URL override added for proof runs: TRAE_CN_BASE_URL (see Proof override). Production always uses https://api.trae.cn.
  • Cookie-source plumbing (browser import, manual header, off) follows the Claude Platform provider in this repo.

Checks

On the merge with main (e14540f49). Soniox and Trae CN together make 113 providers, so COUNT in spec.rs and test_provider_id_all are now 113. The pi icon keeps main's #4d9abf brand color.

  • cargo test --manifest-path rust/Cargo.toml: 5422 passed, 0 failed, 2 ignored; plus 1 passed in a second target.
  • cargo test --manifest-path apps/desktop-tauri/src-tauri/Cargo.toml: 810 passed, 0 failed.
  • cargo clippy on both manifests with -D warnings: clean. cargo fmt --all -- --check: clean.
  • pnpm exec vitest run (Node v22.22.0): 164 files, 1630 tests passed. pnpm run build not run.

Earlier, on 21bc867a4 before the merge:

  • cargo fmt --all -- --check: clean.
  • cargo fmt --all: clean.
  • Focused cargo test traecn (rust manifest): 22 passed, 0 failed.
  • cargo build --manifest-path rust/Cargo.toml --example fake_grok_acp: passed.
  • cargo test --manifest-path rust/Cargo.toml (full): lib 5301 passed, 0 failed, 2 ignored; bin 1 passed, 0 failed.
  • cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings: clean.
  • The Tauri manifest was not touched by this branch, so its suite and clippy were not run.
  • Registry snapshot (registry_matches_snapshot): four new lines for TraeCn, from the branch's earlier snapshot regeneration; passes in the full lib run.
  • Frontend (pnpm test, pnpm run build): not re-run for the override commit, which changes no frontend file. Counts from the earlier draft (1617 tests) are not re-verified here.
  • Local Node is v22.22.0; CI pins 24.18.0. Not re-run on 24.18.0.

Proof override (TRAE_CN_BASE_URL)

  • TRAE_CN_BASE_URL replaces the API origin (default https://api.trae.cn). It is read once when the provider is constructed. The two POST paths are appended as before.
  • Policy, copied from the Sub2API base URL check (providers/sub2api/mod.rs, validated_sub2api_base_url): https:// is accepted; http:// only for a loopback host (127.0.0.1, localhost, [::1]). Userinfo, query, fragment, and encoded host delimiters are rejected. A rejected or blank value is ignored with a warning and production is used.
  • No frontend invoke(...) commands were added, so no proof router handler is needed.
  • Documented in docs/PROVIDERS.md (Trae CN section). Trae CN is cookie-based and has no API key hint, so none was changed.
  • Unit tests: base_url_override_accepts_https_and_loopback_http, base_url_override_rejects_remote_plain_http_and_unsafe_forms, base_url_override_falls_back_to_production_when_unset_or_invalid in rust/src/providers/traecn/tests.rs.

Desktop proof (fake server, isolated home)

Run on Windows 11 from a fresh debug build of integ/p083 at 512c66790, which contains this branch's 21bc867a4 together with the other p083 branches. A fake Trae server ran on 127.0.0.1:18102 with TRAE_CN_BASE_URL=http://127.0.0.1:18102. APPDATA, LOCALAPPDATA, USERPROFILE, HOME and CODEXBAR_CONFIG were isolated under %TEMP%\p083-traecn. The app ran in proof mode on the second display and never took focus. The fixtures are synthetic.

  • No cookie: with no browser session and no pasted header, the card shows "Sign in at trae.cn in a supported browser, or paste its Cookie header." The fake server got no requests. PASS.
  • Pasted cookie: after set_manual_cookie(traecn, <synthetic>) and a refresh, the fake log shows GetUserToken 200 and user_current_entitlement_list 200. The card shows plan "Proof Pro", "Credits 80% left", and CREDITS Used 2,000, Total 10,000, Remaining 8,000. PASS.
  • Expired session (fake answers with the session-expired code): the card shows "Trae CN session expired. Sign in at trae.cn or paste a fresh Cookie header." No stale numbers remain. PASS.
  • The integration tray menu dump lists Trae CN in the Providers submenu (113 entries). PASS.

Screenshots (local): %TEMP%\p083-traecn\shots\panel.png, panel-after-cookie.png, panel-expired.png. Not covered: a real trae.cn account and the browser cookie import path. The icon's contrast against the light theme was not measured.

Factory Agent added 3 commits October 23, 2026 16:14
Port the Trae CN credit allowance from upstream CodexBar (0703a0c,
steipete#4682). The signed-in api.trae.cn browser session exchanges its cookies
for a token at GetUserToken, reads the current entitlement list with
that token, and shows credits used against the total, the remaining
credits and the plan name. Browser sessions are tried in order and only
move on after Trae rejects one. Zero allowance shows details without a
gauge. No reset date is inferred.
Keep both Soniox and Trae CN (113 providers), keep pi at #4d9abf.
@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
📥 Commits

Reviewing files that changed from the base of the PR and between 4fa0d82 and e14540f.

⛔ Files ignored due to path filters: 1
  • apps/desktop-tauri/src/components/providers/icons/ProviderIcon-traecn.svg is excluded by !**/*.svg
📒 Files selected for processing: 14
  • README.md
  • apps/desktop-tauri/src-tauri/src/commands/provider_settings.rs
  • apps/desktop-tauri/src/components/providers/providerIcons.ts
  • apps/desktop-tauri/src/test/providerCatalog.ts
  • docs/PROVIDERS.md
  • rust/src/core/provider/id.rs
  • rust/src/core/provider/spec.rs
  • rust/src/core/provider_factory.rs
  • rust/src/core/provider_registry_snapshot.txt
  • rust/src/core/token_accounts.rs
  • rust/src/providers/mod.rs
  • rust/src/providers/traecn/mod.rs
  • rust/src/providers/traecn/tests.rs
  • rust/src/settings/provider_accessors.rs

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

📝 Walkthrough

Trae CN is added as a registered provider. It retrieves credit and plan details through cookie-authenticated requests, and is listed in the desktop provider catalog and documentation.

Changes: Trae CN provider

Layer / File(s) Summary
Register provider and cookie settings
rust/src/core/provider/*, rust/src/core/provider_factory.rs, rust/src/core/provider_registry_snapshot.txt, rust/src/core/token_accounts.rs, rust/src/providers/mod.rs, rust/src/settings/provider_accessors.rs, apps/desktop-tauri/src-tauri/src/commands/provider_settings.rs
The provider registry, factory, and cookie-source settings recognize TraeCn. The provider is marked as having no token-account support, no pace capability, and no cost CLI extension.
Implement cookie-based credit retrieval
rust/src/providers/traecn/*
TraeCnProvider resolves manual or browser cookies, requests a token and entitlements, validates the response, and reports credit usage and plan details. Tests cover response parsing, cookie selection, HTTP errors, and API-origin validation.
Add desktop provider presentation and docs
apps/desktop-tauri/src/components/providers/providerIcons.ts, apps/desktop-tauri/src/test/providerCatalog.ts, README.md, docs/PROVIDERS.md
The desktop icon and test catalog include Trae CN. The README and provider guide document its cookie options, request flow, and displayed credit information.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant CookieSettings
  participant BrowserCookies
  participant TraeCnProvider
  participant TraeCnAPI
  CookieSettings->>TraeCnProvider: Provide cookie mode or manual cookie
  TraeCnProvider->>BrowserCookies: Resolve browser sessions when needed
  BrowserCookies-->>TraeCnProvider: Return session cookies
  TraeCnProvider->>TraeCnAPI: Exchange cookie for token
  TraeCnAPI-->>TraeCnProvider: Return token
  TraeCnProvider->>TraeCnAPI: Request entitlements with token
  TraeCnAPI-->>TraeCnProvider: Return entitlement data
  TraeCnProvider-->>CookieSettings: Provide credit usage details
Loading

Possibly related PRs

  • nesszer/Win-CodexBar#1002: Adds the preceding provider registry entry and establishes the registry count and final-entry pattern that this change updates.
Merge Risk: ⚪ Minimal · up to e1454

No actionable issue remains from the reviewed integration. The Trae CN provider is ready for normal merge checks.

Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

Failed Failed checks: 1 error · 1 inconclusive

Check name Status Explanation Resolution
Provider Data Stays Siloed Error The pull request adds provider-specific branching in shared code outside the allowed paths. In rust/src/core/token_accounts.rs, ProviderId::TraeCn is added to a provider-ID match. In `rust/src/set… Remove the ProviderId::TraeCn match arms from shared modules, or replace them with a provider capability or metadata abstraction that does not match specific provider IDs. Keep Trae CN-specific behavior in rust/src/providers/traecn/ and…
Ui Changes Include Windows Proof Inconclusive The PR changes visible UI: it adds the Trae CN provider icon, catalog entry, and cookie-source options under apps/desktop-tauri. The visible PR description lists Linux/Rust and frontend checks but doe… Provide the complete PR description, including any screenshots or a proof note from a fresh Windows build.
Passed Passed checks: 6 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add Trae CN credits provider" accurately summarizes the main change. The changeset adds a new Trae CN credits provider across the Rust backend, Tauri desktop UI, docs, and settings. It foll…
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.
Secrets Handled Safely Passed No secret reaches a changed log or user error path. The Trae CN code sends cookies and the short-lived token only in HTTP headers; errors use fixed text or status codes, and the only tracing calls log…
No Unapproved Dependencies Passed The pull request adds no Cargo.toml or package.json changes, no npm or yarn lockfile, and no pnpm packageManager change. The authoritative diff contains only provider code, tests, documentation, regis…
Full details: Title check

Explanation

The title "Add Trae CN credits provider" accurately summarizes the main change. The changeset adds a new Trae CN credits provider across the Rust backend, Tauri desktop UI, docs, and settings. It follows the imperative style of the example titles. It does not include a JIRA key or prefix because the requirements do not call for one.

Full details: Secrets Handled Safely

Explanation

No secret reaches a changed log or user error path. The Trae CN code sends cookies and the short-lived token only in HTTP headers; errors use fixed text or status codes, and the only tracing calls log a fixed override warning or a browser-cookie error that contains no cookie value. Tests use synthetic credentials and fixed non-secret assertions, with no snapshots or credential-file writes. Manual cookie persistence uses the existing Settings/secure_file path, and the PR does not delete or overwrite another application's credentials.

Full details: No Unapproved Dependencies

Explanation

The pull request adds no Cargo.toml or package.json changes, no npm or yarn lockfile, and no pnpm packageManager change. The authoritative diff contains only provider code, tests, documentation, registry files, and the provider icon.

Full details: Provider Data Stays Siloed

Explanation

The pull request adds provider-specific branching in shared code outside the allowed paths. In rust/src/core/token_accounts.rs, ProviderId::TraeCn is added to a provider-ID match. In rust/src/settings/provider_accessors.rs, ProviderId::TraeCn is added to the default cookie-source match. These changes match the explicit cross-provider branching failure condition. The Trae CN provider itself keeps its plan value in its own ProviderFetchResult; no separate cross-provider data leak was found.

Resolution

Remove the ProviderId::TraeCn match arms from shared modules, or replace them with a provider capability or metadata abstraction that does not match specific provider IDs. Keep Trae CN-specific behavior in rust/src/providers/traecn/ and provider construction in rust/src/core/provider_factory.rs.

Full details: Ui Changes Include Windows Proof

Explanation

The PR changes visible UI: it adds the Trae CN provider icon, catalog entry, and cookie-source options under apps/desktop-tauri. The visible PR description lists Linux/Rust and frontend checks but does not show screenshots or a fresh Windows-build proof note. However, the supplied description is explicitly truncated, so the required evidence may be in the omitted text.

Resolution

Provide the complete PR description, including any screenshots or a proof note from a fresh Windows build.

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pre-merge checks failed. Please resolve the failing checks before merging.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

@coderabbitai On the two pre-merge checks:

  • Provider Data Stays Siloed: the ProviderId::TraeCn arms are in the exhaustive per-provider matches that every provider must be listed in: pace_capability, limit_reset_policy and cost_cli_extension_for in core/provider_factory.rs, and TokenAccountSupport::for_provider in core/token_accounts.rs. They are exhaustive on purpose, so adding a variant fails to compile until the provider declares its value there (AGENTS.md: "a match arm in instantiate and in pace_capability ... Both matches are exhaustive"). Trae CN joins the existing UNSUPPORTED / DEFAULT / None groups next to Soniox and Claude Platform. It reads no other provider's data, and all of its fetch, parse and auth logic is in rust/src/providers/traecn/. No change.
  • Ui Changes Include Windows Proof: the body now has the desktop proof from a fresh Windows build, with a fake server and an isolated home: the no-cookie, pasted-cookie and expired-session card states, plus the tray menu entry.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
fd -a '^AGENTS\.md$'
cat AGENTS.md
ast-grep outline rust/src/core/provider_factory.rs
ast-grep outline rust/src/core/token_accounts.rs --match 'for_provider|TokenAccountSupport'
ast-grep outline rust/src/providers/traecn/mod.rs
rg -n -C 8 'TraeCn|fn (pace_capability|limit_reset_policy|cost_cli_extension_for|instantiate)' rust/src/core/provider_factory.rs
rg -n -C 8 'TraeCn|fn for_provider' rust/src/core/token_accounts.rs
sed -n '1,260p' rust/src/providers/traecn/mod.rs
sed -n '261,510p' rust/src/providers/traecn/mod.rs
gh pr view 1014 --repo nesszer/Win-CodexBar --json body --jq .body

Length of output: 58506


@Finesssee Thanks for the clarification. I checked the source and the updated PR body.

  • Provider Data Stays Siloed: My concern does not apply. The TraeCn arms declare capabilities in the existing exhaustive matches. They do not mix provider data. Trae CN fetch, parsing, and authentication logic stays in its provider module. This matches AGENTS.md and the supplied provider-registration guidance. No code change is needed.
  • UI Changes Include Windows Proof: The PR body now records the fresh Windows build, isolated environment, three card states, and tray-menu dump. However, the screenshots are listed only as local %TEMP% paths. Please attach those screenshots to the PR and include the CUA window/native verification results, or explain why CUA was unavailable and provide equivalent manual proof. The tray-menu dump verifies the entry, not its rendered pixels.

The remaining gap is attached Windows proof, not a confirmed UI defect. The stated limits on real-account and browser-import coverage are clear.


🧠 Learnings used
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: docs/PROVIDERS.md:0-0
Timestamp: 2026-10-21T10:39:31.222Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Code conventions
- **New provider:** (1) a `ProviderId` variant with its metadata methods (`cli_name`, `display_name`, ...), (2) a provider module that implements `Provider`, (3) a match arm in `instantiate` and in `pace_capability` in `core/provider_factory.rs`. Both matches are exhaustive, so a missing arm doesn't compile. Never add a second factory in the shell or the CLI. See [docs/PROVIDERS.md](docs/PROVIDERS.md#add-a-provider).

AGENTS.md: # Repository Guidelines
## Docs index
| Need | File |
| --- | --- |
| Adding a provider, windows, pace rules, provider notes | `docs/PROVIDERS.md` |

Source excerpt:
# Providers

## Cookie-backed providers

### LithosAI prepaid balance

LithosAI is disabled by default and has no billing API key. It reads the
signed-in console at `https://console.lithosai.cloud` with both session cookies,
`__Host-console_session` and `__Host-console_csrf`; the CSRF value is echoed as
`X-Console-Csrf`. A header missing either cookie never sends a request.
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: docs/PROVIDERS.md:0-0
Timestamp: 2026-10-21T10:39:31.222Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Code conventions
- **New provider:** (1) a `ProviderId` variant with its metadata methods (`cli_name`, `display_name`, ...), (2) a provider module that implements `Provider`, (3) a match arm in `instantiate` and in `pace_capability` in `core/provider_factory.rs`. Both matches are exhaustive, so a missing arm doesn't compile. Never add a second factory in the shell or the CLI. See [docs/PROVIDERS.md](docs/PROVIDERS.md#add-a-provider).

AGENTS.md: # Repository Guidelines
## Docs index
| Need | File |
| --- | --- |
| Adding a provider, windows, pace rules, provider notes | `docs/PROVIDERS.md` |

Source excerpt:
# Providers

## Add a provider

Rules:

- Keep identity, plan and email per provider. Never show one provider's account data on another provider's card or page.
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: docs/PROVIDERS.md:0-0
Timestamp: 2026-10-21T10:39:31.222Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Code conventions
- **New provider:** (1) a `ProviderId` variant with its metadata methods (`cli_name`, `display_name`, ...), (2) a provider module that implements `Provider`, (3) a match arm in `instantiate` and in `pace_capability` in `core/provider_factory.rs`. Both matches are exhaustive, so a missing arm doesn't compile. Never add a second factory in the shell or the CLI. See [docs/PROVIDERS.md](docs/PROVIDERS.md#add-a-provider).

AGENTS.md: # Repository Guidelines
## Docs index
| Need | File |
| --- | --- |
| Adding a provider, windows, pace rules, provider notes | `docs/PROVIDERS.md` |

Source excerpt:
# Providers

## Add a provider

Both matches are exhaustive, so a missing arm doesn't compile. A test checks that every id can be built.
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: docs/WINDOWS_PROOF.md:0-0
Timestamp: 2026-10-21T08:08:55.014Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Architecture and data flow
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) has the full picture. The rules that matter on every change:

- **Proof harness.** `CODEXBAR_PROOF_MODE` (for example `settings:menu`) opens one surface and turns off blur-dismiss for automation. `CODEXBAR_SEED_USAGE_JSON=<abs-path>` seeds synthetic bridge-shaped `ProviderUsageSnapshot` data into the provider cache at launch, pinned against refresh eviction. A malformed seed file logs a warning and is skipped. See [docs/WINDOWS_PROOF.md](docs/WINDOWS_PROOF.md#proof-mode).

AGENTS.md: # Repository Guidelines
## Testing & QA
### UI validation with CUA ([trycua/cua](https://github.com/trycua/cua))
[docs/WINDOWS_PROOF.md](docs/WINDOWS_PROOF.md) has the cua-driver install command (driver usually at `%LOCALAPPDATA%\Programs\Cua\cua-driver\bin\cua-driver.exe`), the CDP target URLs, the cua-driver session rules and the post-install checklist.

AGENTS.md: # Repository Guidelines
## Testing & QA
### Browser proof (`pnpm proof:check`)
The React surfaces also run in a plain browser over mocked IPC (`apps/desktop-tauri/proof.html`, fixtures in `src/proof/`). `pnpm proof:check`, run from `apps/desktop-tauri`, drives Chrome, Edge or Chromium over CDP through `scripts/proof-scenarios.json`. It prints PASS or FAIL for each scenario and saves screenshots. It runs on any OS, so subagents and CI can use it without a Windows desktop. Details: `docs/WINDOWS_PROOF.md` section 5.

AGENTS.md: # Repository Guidelines
## Docs index
| Need | File |
| --- | --- |
| Proof mode, seeding, CDP, cua-driver | `docs/WINDOWS_PROOF.md` |

Source excerpt:
# Proving UI changes on Windows

## Proof mode

### Seed usage data

A file the app can't read or parse logs a warning, and the app starts without the seed. A normal refresh doesn't replace seeded data while the cache holds every provider the refresh asks for. A forced refresh, such as **Refresh All**, fetches live data.
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: docs/PROVIDERS.md:0-0
Timestamp: 2026-10-21T10:39:31.222Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Code conventions
- **New provider:** (1) a `ProviderId` variant with its metadata methods (`cli_name`, `display_name`, ...), (2) a provider module that implements `Provider`, (3) a match arm in `instantiate` and in `pace_capability` in `core/provider_factory.rs`. Both matches are exhaustive, so a missing arm doesn't compile. Never add a second factory in the shell or the CLI. See [docs/PROVIDERS.md](docs/PROVIDERS.md#add-a-provider).

AGENTS.md: # Repository Guidelines
## Docs index
| Need | File |
| --- | --- |
| Adding a provider, windows, pace rules, provider notes | `docs/PROVIDERS.md` |

Source excerpt:
# Providers

## Add a provider

Rules:

- Keep parsing, auth and display choices inside the provider module. Shared code has no `if provider == X` branches. When shared code needs a provider-specific answer, add a typed field or a trait method with a default, as `menu_bar_pace_lane` and `reset_regenerates` below do.

You are interacting with an AI system.

@Finesssee

Copy link
Copy Markdown
Collaborator Author

@coderabbitai On the Windows proof check: the screenshots stay on the proof machine and are not uploaded. They come from runs with isolated homes, and this PR flow has no image upload step. The PR body records what each one shows: a fresh debug build of the integration tree that contains this branch, the three card states (no cookie fails closed with the sign-in hint, synthetic cookie shows "Proof Pro" and Credits 80% left with Used 2,000 / Total 10,000 / Remaining 8,000, and an expired session shows the expired message with no stale numbers), and the tray-menu dump listing Trae CN in the Providers submenu.

The change adds no new window, frame, theme or float-bar behavior. Trae CN uses the existing provider card and the existing Providers submenu, so the native checks that matter here are the card states and the menu entry, which the run covers. Tray menu pixels are not covered; the dump proves the entry, as you said.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

@Finesssee I couldn't produce a complete response to this request. Please try again.


📝 I couldn't check this conversation for new learnings, so no new learning was saved.


🧠 Learnings used
Learnt from: CR
Repo: nesszer/Win-CodexBar PR: 0
File: docs/WINDOWS_PROOF.md:0-0
Timestamp: 2026-10-21T08:08:55.014Z
Learning: Applicability reference:
AGENTS.md: # Repository Guidelines
## Architecture and data flow
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) has the full picture. The rules that matter on every change:

- **Proof harness.** `CODEXBAR_PROOF_MODE` (for example `settings:menu`) opens one surface and turns off blur-dismiss for automation. `CODEXBAR_SEED_USAGE_JSON=<abs-path>` seeds synthetic bridge-shaped `ProviderUsageSnapshot` data into the provider cache at launch, pinned against refresh eviction. A malformed seed file logs a warning and is skipped. See [docs/WINDOWS_PROOF.md](docs/WINDOWS_PROOF.md#proof-mode).

AGENTS.md: # Repository Guidelines
## Testing & QA
### UI validation with CUA ([trycua/cua](https://github.com/trycua/cua))
[docs/WINDOWS_PROOF.md](docs/WINDOWS_PROOF.md) has the cua-driver install command (driver usually at `%LOCALAPPDATA%\Programs\Cua\cua-driver\bin\cua-driver.exe`), the CDP target URLs, the cua-driver session rules and the post-install checklist.

AGENTS.md: # Repository Guidelines
## Testing & QA
### Browser proof (`pnpm proof:check`)
The React surfaces also run in a plain browser over mocked IPC (`apps/desktop-tauri/proof.html`, fixtures in `src/proof/`). `pnpm proof:check`, run from `apps/desktop-tauri`, drives Chrome, Edge or Chromium over CDP through `scripts/proof-scenarios.json`. It prints PASS or FAIL for each scenario and saves screenshots. It runs on any OS, so subagents and CI can use it without a Windows desktop. Details: `docs/WINDOWS_PROOF.md` section 5.

AGENTS.md: # Repository Guidelines
## Docs index
| Need | File |
| --- | --- |
| Proof mode, seeding, CDP, cua-driver | `docs/WINDOWS_PROOF.md` |

Source excerpt:
# Proving UI changes on Windows

## Proof mode

### Seed usage data

A file the app can't read or parse logs a warning, and the app starts without the seed. A normal refresh doesn't replace seeded data while the cache holds every provider the refresh asks for. A forced refresh, such as **Refresh All**, fetches live data.

You are interacting with an AI system.

@Finesssee
Finesssee merged commit 2ce961b into main Oct 23, 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.

1 participant