Skip to content

fix: remove legacy proxy surfaces#61

Merged
awsl233777 merged 5 commits intomainfrom
fix/remove-legacy-proxy-surfaces
Apr 2, 2026
Merged

fix: remove legacy proxy surfaces#61
awsl233777 merged 5 commits intomainfrom
fix/remove-legacy-proxy-surfaces

Conversation

@ymkiux
Copy link
Copy Markdown
Collaborator

@ymkiux ymkiux commented Apr 1, 2026

Summary

  • remove legacy builtin proxy and auth management surfaces from the web UI and CLI help
  • sanitize config reads to drop legacy codexmate-proxy provider blocks from config.toml
  • keep removed proxy commands unavailable while preserving cleanup safeguards and e2e coverage

Tests

  • npm run test:e2e
  • Skipped: npm run test:unit (known pre-existing Windows failures in tests/unit/web-run-host.test.mjs)

Summary by CodeRabbit

  • Removed Features

    • Built-in proxy ("codexmate-proxy") behaviors, related CLI subcommands, and Codex auth import/switch/delete flows removed from CLI and Web UI.
  • Documentation

    • README, help text and architecture diagram updated to remove proxy/auth references and related commands.
  • Bug Fixes / Reliability

    • Config/CLI hardened to sanitize removed provider entries; reserved-provider handling made case-insensitive and messages standardized.
  • Tests / CI

    • E2E auth/proxy tests removed; tests and CI workflow expectations updated to reflect proxy/auth absence.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

@coderabbitai re-review !Stop making breaking changes, do a proper review!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

📝 Walkthrough

Walkthrough

This PR removes the built-in proxy (codexmate-proxy) and Codex auth-profile management across README, CLI, Web UI, and E2E tests; sanitizes persisted configs to drop the removed provider; ensures auth-profile storage exists; and updates workflow/test/CLI messaging and guards.

Changes

Cohort / File(s) Summary
Documentation
README.md
Deleted built-in proxy/auth bullets, architecture node/edge, and command-reference rows for codexmate proxy and codexmate auth.
CLI Core
cli.js
Case-insensitive builtin provider checks; added auth-profile storage prep; sanitize/remove persisted codexmate-proxy from configs and config file; hardened template trimming; disabled/removed builtin proxy behavior and subcommands; updated help and reserved-provider messages; block manual codexmate-proxy add.
Web UI
web-ui/app.js, web-ui/index.html
Removed Codex auth upload/management UI and all builtin-proxy UI/state/workflow code; removed proxy status polling/handlers; simplified provider normalization/display (no local↔codexmate-proxy remapping).
E2E Tests & Harness
tests/e2e/test-auth-proxy.js, tests/e2e/test-setup.js, tests/e2e/run.js
Removed auth-proxy E2E test file and its harness invocation; adjusted setup stdin payload and added CLI help assertion that proxy/auth commands/phrases are gone.
Unit Tests
tests/unit/coderabbit-workflows.test.mjs
Updated assertions for workflow comment pagination and commit-count gating; expect @coderabbitai re-review and ASCII punctuation; assert absence of full-width exclamation.
CI Workflow
.github/workflows/coderabbit-review.yml
Destructure owner/repo from context.repo, paginate comments, gate re-review by embedded commit-count marker, and emit a multi-line re-review comment body.

Sequence Diagram(s)

sequenceDiagram
    participant CLI
    participant WebUI as Web UI
    participant LocalAPI as Local HTTP API
    participant MCP as MCP Server
    participant Core as Core Services

    Note over CLI,WebUI: Prior flow included builtin proxy & auth management
    CLI->>LocalAPI: config / proxy control requests
    WebUI->>LocalAPI: provider/auth/proxy requests
    LocalAPI->>MCP: relay/proxy requests
    MCP->>Core: service ops
    MCP-->>LocalAPI: proxy/auth callbacks
    LocalAPI-->>CLI: proxy status & responses

    Note over CLI,WebUI: New flow removes builtin proxy/auth control paths
    CLI->>LocalAPI: config/start/status requests (proxy ops -> removed/error)
    WebUI->>LocalAPI: provider/auth requests (no proxy-status polling)
    LocalAPI->>MCP: relay requests
    MCP->>Core: service ops
    MCP-->>LocalAPI: responses (no builtin proxy callbacks)
    LocalAPI-->>CLI: responses
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

Poem

🐰 Hop, hop, the proxy hops away,
Docs trimmed neat to clear the way,
CLI sheds commands and UI breathes light,
Tests adapt, configs set aright,
A rabbit winks — simpler feels bright!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 13.16% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: remove legacy proxy surfaces' accurately describes the primary change across the PR—removing builtin proxy and auth UI/CLI surfaces from web UI, CLI, README, and tests.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remove-legacy-proxy-surfaces

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ast-grep (0.42.0)
web-ui/app.js

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

@github-actions[bot] Understood — I'll conduct a proper re-review focused strictly on correctness, safety, and quality within the existing design. I will not suggest any refactors, API changes, interface changes, or anything that would introduce breaking changes.


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
✅ Actions performed

Full review triggered.

coderabbitai[bot]
coderabbitai bot previously requested changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli.js`:
- Around line 5948-5954: The CLI stubs (applyBuiltinProxyProvider and
ensureBuiltinProxyForCodexDefault) block only CLI wrappers but other entry
points still start the proxy; update the API handlers that dispatch
"proxy-start", "proxy-stop", and "proxy-save-config" and the exported
createMcpTools surfaces (codexmate.proxy.start, codexmate.proxy.stop,
codexmate.proxy.provider.apply) to return the same removal error object
{"error":"该功能已移除"} immediately instead of performing any action; locate the
proxy-start/stop/save-config dispatch functions and the createMcpTools
implementation and add an early return/error throw that mirrors
applyBuiltinProxyProvider/ensureBuiltinProxyForCodexDefault so the feature is
uniformly unavailable.
- Around line 5576-5671: The removePersistedBuiltinProxyProviderFromConfig
function currently deletes the provider block but doesn't update top-level
fields (model_provider/model), leaving stale references; fix it by updating the
same config/content pass: after determining providerSegmentVariants (and before
writing), remove rebuilt.model_providers[BUILTIN_PROXY_PROVIDER_NAME] and if
rebuilt.model_provider === BUILTIN_PROXY_PROVIDER_NAME or rebuilt.model ===
BUILTIN_PROXY_PROVIDER_NAME (or points to the removed provider via legacy
segments), set those top-level fields to the same fallback selection logic you
use for sanitized reads (choose the next available provider or delete the
field), and ensure writeConfig writes the updated TOML; reference symbols:
removePersistedBuiltinProxyProviderFromConfig, BUILTIN_PROXY_PROVIDER_NAME,
providerSegmentVariants, providerSegments, rebuilt, readConfig, writeConfig.

In `@tests/e2e/test-setup.js`:
- Around line 55-59: The test currently calls runSync(node, [cliPath], { env })
which exercises the no-arg behavior; change it to call the actual help
entrypoint instead (e.g., runSync(node, [cliPath, '--help'], { env }) or
runSync(node, [cliPath, 'help'], { env }) depending on the CLI) so helpResult
reflects the real help renderer; update the runSync invocation that produces
helpResult and keep subsequent assertions against helpResult.stdout as-is to
ensure the removed entries are not exposed.

In `@web-ui/app.js`:
- Around line 574-576: The backend is doing a case-sensitive check for the
builtin proxy name, causing mismatches with the UI's case-insensitive filter;
update isBuiltinProxyProvider (and any other occurrences around the noted
blocks) to compare in a case-insensitive way by normalizing the input and
BUILTIN_PROXY_PROVIDER_NAME with .toLowerCase() (e.g., replace
providerName.trim() === BUILTIN_PROXY_PROVIDER_NAME with
providerName.trim().toLowerCase() ===
BUILTIN_PROXY_PROVIDER_NAME.toLowerCase()), so variants like "CODEXMATE-PROXY"
are correctly recognized and blocked (also ensure related checks used by
runHealthCheck() use the same normalized comparison).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ac62347d-7aa7-402e-b4ec-3e06fe91d230

📥 Commits

Reviewing files that changed from the base of the PR and between ad8aba5 and df0a28f.

📒 Files selected for processing (6)
  • README.md
  • cli.js
  • tests/e2e/test-auth-proxy.js
  • tests/e2e/test-setup.js
  • web-ui/app.js
  • web-ui/index.html
💤 Files with no reviewable changes (1)
  • README.md
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
🔇 Additional comments (16)
web-ui/index.html (3)

435-435: The bridge hint now points users at the remaining editable surface.

This keeps the bridge guidance intact while making it clear that edits only happen from Codex mode.


520-523: Read-only providers are now clearly distinguished as system entries.

The 系统 badge plus the simplified subtitle fits the legacy-surface removal and keeps non-editable providers easy to recognize.


1833-1833: The OpenClaw empty-state copy now matches the removed proxy/auth flows.

This avoids pointing users at configuration paths that no longer exist in the product.

tests/e2e/test-auth-proxy.js (6)

50-50: The initial proxy assertion now validates the contract without assuming startup state.

This makes the test more deterministic while still checking that proxy-status returns the expected shape.


105-113: Auth-profile storage is now pinned to the .codex location.

These assertions guard both the intended write path and the regression back to the legacy ~/.codexmate/... location.


154-168: The legacy provider block is injected through config.toml directly.

That exercises the cleanup path without reviving the removed built-in provider workflow.


169-178: Proxy startup is now validated through the surviving runtime surface.

Checking listenUrl here keeps the e2e flow aligned with the post-removal API.


180-188: This covers both hidden-provider behavior and on-disk cleanup.

Asserting the provider stays out of list and the TOML section is physically removed gives solid end-to-end coverage of the sanitizer.


191-199: The removed enable flow is still checked for a clean rejection.

Keeping this assertion protects the “unavailable by design” behavior instead of letting the old surface reappear silently.

web-ui/app.js (1)

728-731: Nice bootstrap split.

Keeping the auth-profile refresh outside the main init block avoids holding the shell in loading state for secondary startup work.

cli.js (6)

929-941: Good first-run auth profile guard.

Pre-creating AUTH_PROFILES_DIR before registry/profile access removes the ENOENT edge case on fresh installs without changing the profile format.

Also applies to: 999-1000, 1089-1090, 1135-1135, 1184-1184


3188-3214: Read-path sanitization is in the right place.

Filtering codexmate-proxy from both persisted and virtual config loads keeps status/list/setup flows from resurfacing the removed provider.

Also applies to: 3219-3250


3346-3347: Nice defensive normalization around provider/model selection.

Restricting trims to strings and basing wizard/switch defaults on sanitized config avoids legacy or non-string values leaking into interactive flows.

Also applies to: 7595-7596, 7882-7882


3424-3424: Reserved-name errors are now consistent.

The codexmate-proxy wording is aligned across add/update/delete paths, which makes the removed-provider rule clearer.

Also applies to: 3502-3502, 3520-3520, 3550-3550, 8049-8049


5555-5574: The residual proxy helpers are easier to reason about now.

Keeping the listen URL and provider-block shape in one place reduces drift while the legacy proxy cleanup paths still need to understand that config.


12767-12767: The codex wrapper help is explicit.

Surfacing the queued follow-up flags directly in the usage line makes the passthrough behavior easier to discover.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cli.js (1)

3415-3425: ⚠️ Potential issue | 🟠 Major

Reserve codexmate-proxy on the CLI add/setup path too.

This guard only protects addProviderToConfig(). cmdAdd() still accepts codexmate-proxy, so codexmate add codexmate-proxy ... (and the setup flow that delegates to it) can recreate the removed provider and then have it disappear again on the next sanitized read.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 3415 - 3425, The cmdAdd flow still allows creating the
reserved provider; update cmdAdd (and any setup flow that calls it) to perform
the same validation as addProviderToConfig by rejecting names where
isBuiltinProxyProvider(name) is true unless allowManaged is explicitly true,
returning the same error message ('codexmate-proxy 为保留名称,不可手动添加'); ensure the
same validations (isValidProviderName, isReservedProviderNameForCreation) are
applied in cmdAdd so the CLI and addProviderToConfig behave consistently and the
setup path cannot recreate the reserved provider.
♻️ Duplicate comments (3)
tests/e2e/test-auth-proxy.js (1)

154-189: ⚠️ Potential issue | 🟠 Major

Exercise a mixed-case legacy proxy name in this cleanup test.

The new coverage only seeds/asserts lowercase codexmate-proxy, but the cleanup helper removes the legacy provider by exact key. A persisted [model_providers."CodexMate-Proxy"] block would evade both the exact-name .some(...) check and the case-sensitive table regex here, while web-ui/app.js still hides that name case-insensitively at Line 576. That means this e2e can pass while a hidden legacy proxy remains in config.toml.

🧪 Suggested test adjustment
-    fs.appendFileSync(configTomlPath, [
+    const legacyProxyName = 'CodexMate-Proxy';
+    fs.appendFileSync(configTomlPath, [
         '',
-        '[model_providers.codexmate-proxy]',
-        'name = "codexmate-proxy"',
+        `[model_providers."${legacyProxyName}"]`,
+        `name = "${legacyProxyName}"`,
         `base_url = "http://127.0.0.1:${proxyPort}/v1"`,
         'wire_api = "responses"',
         'requires_openai_auth = false',
@@
     const providerList = await api('list');
     assert(
-        !providerList.providers.some((item) => item && item.name === 'codexmate-proxy'),
+        !providerList.providers.some((item) =>
+            String(item && item.name ? item.name : '').trim().toLowerCase() === 'codexmate-proxy'
+        ),
         'provider list should not expose removed builtin proxy provider'
     );
     const configTomlAfterList = fs.readFileSync(configTomlPath, 'utf-8');
     assert(
-        !/^\s*\[\s*model_providers\s*\.\s*(?:"codexmate-proxy"|'codexmate-proxy'|codexmate-proxy)\s*\]\s*$/m.test(configTomlAfterList),
+        !/^\s*\[\s*model_providers\s*\.\s*(?:"codexmate-proxy"|'codexmate-proxy'|codexmate-proxy)\s*\]\s*$/mi.test(configTomlAfterList),
         'provider list read should physically remove legacy codexmate-proxy block from config.toml'
     );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/test-auth-proxy.js` around lines 154 - 189, The test seeds only
lowercase "codexmate-proxy" but the cleanup is case-sensitive, so update the
seeded config block and assertions to exercise mixed-case legacy names and
perform case-insensitive checks: when appending to configTomlPath include a
variant like "CodexMate-Proxy"; change the provider-list assertion that checks
providerList.providers.some(...) to compare item.name.toLowerCase() ===
'codexmate-proxy'; and change the config.toml regex test to use a
case-insensitive match (or normalize the file string to lower-case before
testing) so legacy table names with mixed case are detected and removed.
cli.js (2)

5948-5954: ⚠️ Potential issue | 🟠 Major

The proxy is still startable outside these CLI stubs.

applyBuiltinProxyProvider() and cmdProxy() now fail fast, but /api still dispatches proxy-start / proxy-save-config, and createMcpTools() still exposes codexmate.proxy.start/stop/provider.apply. The removed proxy remains programmatically available unless those shared entry points return the same 该功能已移除 error too.

Also applies to: 10789-10792

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5948 - 5954, API and programmatic entry points still
allow starting the removed proxy; update the shared interfaces so all callers
return the same "该功能已移除" error: modify the /api handlers that dispatch
"proxy-start" and "proxy-save-config" to short-circuit and return that error,
update cmdProxy to return/throw the same error, and change createMcpTools so
codexmate.proxy.start, codexmate.proxy.stop and codexmate.proxy.provider.apply
all return { error: '该功能已移除' } (or throw an equivalent error) so the proxy
cannot be started programmatically through any exposed surface.

5576-5671: ⚠️ Potential issue | 🟠 Major

Persisted cleanup still leaves stale model_provider / model pointers.

This helper removes the [model_providers.codexmate-proxy] block, but it never rewrites the top-level selection, and the early return once the section is already gone means the file can keep model_provider = "codexmate-proxy" indefinitely. Raw readConfig() callers like cmdUseModel() will still consume that stale provider.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5576 - 5671, The function
removePersistedBuiltinProxyProviderFromConfig() currently bails out if the
[model_providers.codexmate-proxy] block is missing, leaving top-level
model_provider/model pointers stale; modify it to always inspect and, when
removing the provider (or when provider block already absent), also remove or
rewrite any top-level references (e.g., config.model_provider, config.model)
that point to BUILTIN_PROXY_PROVIDER_NAME so callers like
cmdUseModel()/readConfig() don't keep consuming a removed provider. Concretely:
after reading config (and even if model_providers[BUILTIN_PROXY_PROVIDER_NAME]
is falsy), check and delete any top-level keys (config.model_provider,
config.model, etc.) whose value === BUILTIN_PROXY_PROVIDER_NAME, then proceed to
rebuild/write updatedContent (using writeConfig) so the TOML output no longer
contains stale references; ensure this logic is applied both in the branch that
edits raw file ranges and in the fallback rebuilt branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@cli.js`:
- Around line 3415-3425: The cmdAdd flow still allows creating the reserved
provider; update cmdAdd (and any setup flow that calls it) to perform the same
validation as addProviderToConfig by rejecting names where
isBuiltinProxyProvider(name) is true unless allowManaged is explicitly true,
returning the same error message ('codexmate-proxy 为保留名称,不可手动添加'); ensure the
same validations (isValidProviderName, isReservedProviderNameForCreation) are
applied in cmdAdd so the CLI and addProviderToConfig behave consistently and the
setup path cannot recreate the reserved provider.

---

Duplicate comments:
In `@cli.js`:
- Around line 5948-5954: API and programmatic entry points still allow starting
the removed proxy; update the shared interfaces so all callers return the same
"该功能已移除" error: modify the /api handlers that dispatch "proxy-start" and
"proxy-save-config" to short-circuit and return that error, update cmdProxy to
return/throw the same error, and change createMcpTools so codexmate.proxy.start,
codexmate.proxy.stop and codexmate.proxy.provider.apply all return { error:
'该功能已移除' } (or throw an equivalent error) so the proxy cannot be started
programmatically through any exposed surface.
- Around line 5576-5671: The function
removePersistedBuiltinProxyProviderFromConfig() currently bails out if the
[model_providers.codexmate-proxy] block is missing, leaving top-level
model_provider/model pointers stale; modify it to always inspect and, when
removing the provider (or when provider block already absent), also remove or
rewrite any top-level references (e.g., config.model_provider, config.model)
that point to BUILTIN_PROXY_PROVIDER_NAME so callers like
cmdUseModel()/readConfig() don't keep consuming a removed provider. Concretely:
after reading config (and even if model_providers[BUILTIN_PROXY_PROVIDER_NAME]
is falsy), check and delete any top-level keys (config.model_provider,
config.model, etc.) whose value === BUILTIN_PROXY_PROVIDER_NAME, then proceed to
rebuild/write updatedContent (using writeConfig) so the TOML output no longer
contains stale references; ensure this logic is applied both in the branch that
edits raw file ranges and in the fallback rebuilt branch.

In `@tests/e2e/test-auth-proxy.js`:
- Around line 154-189: The test seeds only lowercase "codexmate-proxy" but the
cleanup is case-sensitive, so update the seeded config block and assertions to
exercise mixed-case legacy names and perform case-insensitive checks: when
appending to configTomlPath include a variant like "CodexMate-Proxy"; change the
provider-list assertion that checks providerList.providers.some(...) to compare
item.name.toLowerCase() === 'codexmate-proxy'; and change the config.toml regex
test to use a case-insensitive match (or normalize the file string to lower-case
before testing) so legacy table names with mixed case are detected and removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cc2c68df-d52c-43e1-b9f9-9b8210e20645

📥 Commits

Reviewing files that changed from the base of the PR and between ad8aba5 and df0a28f.

📒 Files selected for processing (6)
  • README.md
  • cli.js
  • tests/e2e/test-auth-proxy.js
  • tests/e2e/test-setup.js
  • web-ui/app.js
  • web-ui/index.html
💤 Files with no reviewable changes (1)
  • README.md
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
🔇 Additional comments (4)
tests/e2e/test-setup.js (1)

55-59: LGTM! Correctly verifies removed proxy/auth CLI entries.

The assertions properly validate that the help output no longer exposes codexmate proxy, codexmate auth, or 内建代理, aligning with the PR's goal of removing legacy proxy surfaces.

web-ui/index.html (3)

435-436: LGTM! Hint text correctly updated for proxy/auth removal.

The hint now only mentions "模板" (templates) as editable in Codex mode, consistent with the removal of authentication and proxy management features.


520-524: LGTM! Provider card UI correctly simplified.

  • Badge text changed from "内建" to "系统" for read-only providers.
  • Subtitle now consistently shows the URL (or placeholder), removing the special handling for legacy proxy descriptions.

Both changes align with the removal of built-in proxy surfaces.


1833-1834: LGTM! Empty-state hint updated for new architecture.

The hint now correctly indicates that missing providers may come from "环境变量或外部配置" instead of the removed "内置 provider 或 auth profiles".

Copy link
Copy Markdown
Collaborator Author

@ymkiux ymkiux left a comment

Choose a reason for hiding this comment

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

This issue was automatically fixed by @coderabbitai.

Copy link
Copy Markdown
Collaborator Author

@ymkiux ymkiux left a comment

Choose a reason for hiding this comment

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

This issue was automatically fixed by coderabbitai

@ymkiux
Copy link
Copy Markdown
Collaborator Author

ymkiux commented Apr 1, 2026

@coderabbitai Autofix

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 2 file(s) based on 2 unresolved review comments.

Files modified:

  • cli.js
  • tests/e2e/test-setup.js

Commit: 3d1a2c8a74e71522c6c5f90af6b2b4e09a5b87a2

The changes have been pushed to the fix/remove-legacy-proxy-surfaces branch.

Time taken: 3m 51s

Fixed 2 file(s) based on 2 unresolved review comments.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

@coderabbitai re-review !Stop making breaking changes, do a proper review!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

@github-actions[bot] — Understood, and my apologies for any prior suggestions that introduced breaking changes. I will conduct a strict, focused review of PR #61 adhering to the absolute constraint:

  • No breaking changes — no refactors, no API/interface/behavior alterations.
  • Feedback limited to correctness, safety, and quality only, within the existing design.

Triggering a full re-review now.


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Collaborator Author

@ymkiux ymkiux left a comment

Choose a reason for hiding this comment

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

This issue was automatically fixed by coderabbitai

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
cli.js (2)

5576-5671: ⚠️ Potential issue | 🟠 Major

Cleanup still leaves config.toml internally inconsistent.

This helper removes the codexmate-proxy provider block, but it still never rewrites top-level model_provider / model, and Line 5588 stops cleanup completely once the section is already gone. After any sanitized read, later plain readConfig() callers like cmdUseModel() can still read model_provider = "codexmate-proxy" and keep persisting state against a removed provider. Please apply the same fallback selection here before writing the file back.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5576 - 5671,
removePersistedBuiltinProxyProviderFromConfig currently deletes the provider
TOML section but does not update top-level model_provider/model fields, leaving
config.toml internally inconsistent and causing callers like
cmdUseModel/readConfig to keep referencing BUILTIN_PROXY_PROVIDER_NAME; after
you build the rebuilt object (rebuilt.model_providers), run the same fallback
selection logic used elsewhere (the sanitized read) to choose a new top-level
model_provider and model (or remove those keys) when the builtin provider was
removed, update rebuilt.model_provider and rebuilt.model accordingly (or delete
them if no fallback), then continue with toml.stringify/marker preservation and
writeConfig as before to ensure the file is consistent.

5948-5954: ⚠️ Potential issue | 🟠 Major

Removed proxy is still reachable through API/MCP entry points.

Line 5949 only blocks the CLI wrapper. /api still routes proxy-save-config, proxy-start, and proxy-stop to the live implementations, and the MCP catalog still exposes codexmate.proxy.start/stop/provider.apply, so the removed proxy can still be configured and started programmatically. Those entry points should return the same 该功能已移除 error too.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5948 - 5954, The CLI-only removal left runtime endpoints
still enabling the proxy; update the API/MCP handlers for proxy-save-config,
proxy-start, and proxy-stop as well as the MCP catalog entries
codexmate.proxy.start, codexmate.proxy.stop, and provider.apply to return the
same { error: '该功能已移除' } response; locate where those routes/handlers call
applyBuiltinProxyProvider or ensureBuiltinProxyForCodexDefault (or where the MCP
action handlers are registered) and change them to short-circuit and return the
identical error object so the proxy cannot be configured or started
programmatically.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@cli.js`:
- Around line 5576-5671: removePersistedBuiltinProxyProviderFromConfig currently
deletes the provider TOML section but does not update top-level
model_provider/model fields, leaving config.toml internally inconsistent and
causing callers like cmdUseModel/readConfig to keep referencing
BUILTIN_PROXY_PROVIDER_NAME; after you build the rebuilt object
(rebuilt.model_providers), run the same fallback selection logic used elsewhere
(the sanitized read) to choose a new top-level model_provider and model (or
remove those keys) when the builtin provider was removed, update
rebuilt.model_provider and rebuilt.model accordingly (or delete them if no
fallback), then continue with toml.stringify/marker preservation and writeConfig
as before to ensure the file is consistent.
- Around line 5948-5954: The CLI-only removal left runtime endpoints still
enabling the proxy; update the API/MCP handlers for proxy-save-config,
proxy-start, and proxy-stop as well as the MCP catalog entries
codexmate.proxy.start, codexmate.proxy.stop, and provider.apply to return the
same { error: '该功能已移除' } response; locate where those routes/handlers call
applyBuiltinProxyProvider or ensureBuiltinProxyForCodexDefault (or where the MCP
action handlers are registered) and change them to short-circuit and return the
identical error object so the proxy cannot be configured or started
programmatically.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3356273a-fd61-4ff7-8ec0-dfe710470d27

📥 Commits

Reviewing files that changed from the base of the PR and between df0a28f and 3d1a2c8.

📒 Files selected for processing (2)
  • cli.js
  • tests/e2e/test-setup.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/test-setup.js
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.

coderabbitai[bot]
coderabbitai bot previously requested changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (2)
cli.js (2)

5576-5590: ⚠️ Potential issue | 🟠 Major

Persisted proxy cleanup can still leave config.toml inconsistent.

Line 5588 exits as soon as the exact model_providers.codexmate-proxy key is gone, and neither write path rewrites top-level model_provider / model. After one cleanup pass the file can still keep model_provider = "codexmate-proxy" indefinitely; mixed-case legacy keys also bypass cleanup now that matching is case-insensitive elsewhere. Raw readers like cmdUseModel() and getConfigTemplate() will then continue from an invalid provider state.

Also applies to: 5649-5665

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5576 - 5590,
removePersistedBuiltinProxyProviderFromConfig currently only deletes
model_providers[BUILTIN_PROXY_PROVIDER_NAME] and returns early, leaving
top-level fields like model_provider/model untouched (and legacy mixed-case keys
unhandled), which causes cmdUseModel() and getConfigTemplate() to read an
invalid provider; update removePersistedBuiltinProxyProviderFromConfig (and the
analogous cleanup code around the 5649-5665 region) to: locate and remove any
case-variant keys for the builtin provider under model_providers, rewrite the
config object to clear or normalize top-level model_provider and model fields
when the provider is removed, and persist the modified config back to
CONFIG_FILE (ensuring both success and error paths write the corrected TOML) so
the file is consistent for raw readers like cmdUseModel() and
getConfigTemplate().

5948-5953: ⚠️ Potential issue | 🟠 Major

The removed proxy is still reachable through /api and MCP.

These CLI stubs only close the CLI entry points. /api still runs proxy-start at Line 10270, and createMcpTools() still exposes codexmate.proxy.start at Line 12518, so the builtin proxy can still be launched programmatically after this PR.

Also applies to: 10789-10792

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5948 - 5953, The CLI stubs (applyBuiltinProxyProvider
and ensureBuiltinProxyForCodexDefault) were changed but other entry points still
start the builtin proxy; locate and modify the code paths that call the proxy,
specifically where "proxy-start" is invoked by the API startup and where
createMcpTools() exposes codexmate.proxy.start, and short-circuit them to return
the same removed-feature error (or remove the export) so the builtin proxy
cannot be launched programmatically; update the proxy-start invocation to check
these stubs (applyBuiltinProxyProvider / ensureBuiltinProxyForCodexDefault) and
propagate their { error: '该功能已移除' } response, and remove/replace the
codexmate.proxy.start export in createMcpTools() to prevent external launches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli.js`:
- Around line 3423-3425: The cmdAdd() path does not enforce the same
reserved-name guard as addProviderToConfig(), allowing users to re-add the
built-in proxy "codexmate-proxy"; update cmdAdd() to call
isBuiltinProxyProvider(name) (same check used in addProviderToConfig()) and
reject the add unless allowManaged is true, returning the same error
object/message used elsewhere; specifically modify the cmdAdd handler to perform
the isBuiltinProxyProvider(name) && !allowManaged check before creating or
persisting a provider so the CLI cannot recreate reserved entries.

In `@tests/e2e/test-auth-proxy.js`:
- Around line 180-189: The test currently dereferences providerList.providers
directly after calling api('list'), which will throw if api returns an error
object; before calling .some(...) assert the response shape by checking that
providerList is an object and providerList.providers is an array (e.g.,
assert(providerList && Array.isArray(providerList.providers), 'expected
api("list") to return { providers: [...] } but got: ' +
JSON.stringify(providerList))), then proceed to assert no provider named
'codexmate-proxy' and the config.toml content checks; use the existing
providerList variable and api('list') call so you only add the defensive
assertion prior to the .some(...) call.

---

Duplicate comments:
In `@cli.js`:
- Around line 5576-5590: removePersistedBuiltinProxyProviderFromConfig currently
only deletes model_providers[BUILTIN_PROXY_PROVIDER_NAME] and returns early,
leaving top-level fields like model_provider/model untouched (and legacy
mixed-case keys unhandled), which causes cmdUseModel() and getConfigTemplate()
to read an invalid provider; update
removePersistedBuiltinProxyProviderFromConfig (and the analogous cleanup code
around the 5649-5665 region) to: locate and remove any case-variant keys for the
builtin provider under model_providers, rewrite the config object to clear or
normalize top-level model_provider and model fields when the provider is
removed, and persist the modified config back to CONFIG_FILE (ensuring both
success and error paths write the corrected TOML) so the file is consistent for
raw readers like cmdUseModel() and getConfigTemplate().
- Around line 5948-5953: The CLI stubs (applyBuiltinProxyProvider and
ensureBuiltinProxyForCodexDefault) were changed but other entry points still
start the builtin proxy; locate and modify the code paths that call the proxy,
specifically where "proxy-start" is invoked by the API startup and where
createMcpTools() exposes codexmate.proxy.start, and short-circuit them to return
the same removed-feature error (or remove the export) so the builtin proxy
cannot be launched programmatically; update the proxy-start invocation to check
these stubs (applyBuiltinProxyProvider / ensureBuiltinProxyForCodexDefault) and
propagate their { error: '该功能已移除' } response, and remove/replace the
codexmate.proxy.start export in createMcpTools() to prevent external launches.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8090f03e-c4a4-4113-b468-7282533171cd

📥 Commits

Reviewing files that changed from the base of the PR and between ad8aba5 and 3d1a2c8.

📒 Files selected for processing (6)
  • README.md
  • cli.js
  • tests/e2e/test-auth-proxy.js
  • tests/e2e/test-setup.js
  • web-ui/app.js
  • web-ui/index.html
💤 Files with no reviewable changes (1)
  • README.md
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
🔇 Additional comments (6)
tests/e2e/test-setup.js (2)

164-164: No actionable issue in this segment.


55-60: Help regression coverage is correctly targeted.

Switching to explicit --help and asserting removed proxy/auth entries are absent is the right guard for this PR scope.

web-ui/index.html (3)

434-436: Bridge hint text update is consistent with feature removal.

This copy now matches the reduced Codex-only editable scope without changing runtime behavior.


520-523: Provider card display change is safe and coherent.

The “系统” badge wording and URL fallback keep the card readable while preserving existing null-safe rendering.


1832-1834: OpenClaw empty-state hint now reflects current source of truth.

The revised message correctly points users to environment/external configuration after built-in surface removal.

web-ui/app.js (1)

567-576: No action required. The backend status endpoint already sanitizes the removed builtin proxy provider through readConfigOrVirtualDefault(), which applies sanitizeRemovedBuiltinProxyProvider() before returning the config. The UI will never receive codexmate-proxy from the status path, so the hidden-selection boot scenario cannot occur.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

@coderabbitai re-review !Stop making breaking changes, do a proper review!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

@github-actions[bot] — Acknowledged. I sincerely apologize for any prior suggestions in this PR that introduced breaking changes. I will now conduct a proper re-review of PR #61 under the following strict constraints:

  • 🚫 No breaking changes — zero refactors, no API/interface/behavior alterations of any kind.
  • Feedback limited exclusively to correctness, safety, and quality within the existing design as-is.

Triggering a full re-review now.


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
✅ Actions performed

Full review triggered.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
cli.js (2)

10271-10279: ⚠️ Potential issue | 🟠 Major

The removed proxy runtime is still reachable through /api and MCP.

cmdProxy() and applyBuiltinProxyProvider() now return 该功能已移除, but these API actions and MCP tools still call saveBuiltinProxySettings(), startBuiltinProxyRuntime(), and stopBuiltinProxyRuntime() directly. So the builtin proxy can still be configured and launched programmatically even after this PR “removes” it.

Also applies to: 12522-12547

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 10271 - 10279, The CLI still calls
saveBuiltinProxySettings, startBuiltinProxyRuntime, and stopBuiltinProxyRuntime
for the 'proxy-save-config'/'proxy-start'/'proxy-stop' commands allowing the
removed builtin proxy to be configured; update the command dispatch so these
cases short-circuit and return the same "该功能已移除" response (or throw a consistent
error) instead of invoking
saveBuiltinProxySettings/startBuiltinProxyRuntime/stopBuiltinProxyRuntime, and
make the same change where MCP tooling or handlers call them (e.g. in
applyBuiltinProxyProvider and cmdProxy) to ensure all programmatic entry points
uniformly return the removed-feature message and never call the runtime/config
functions.

3188-3213: ⚠️ Potential issue | 🟠 Major

Builtin-proxy cleanup still does not fully converge.

After the Line 255 change made reserved-name detection case-insensitive, these cleanup paths still only match the exact lowercase key/value, and removePersistedBuiltinProxyProviderFromConfig() stops as soon as the provider block is already gone. That means configs like [model_providers.CODEXMATE-PROXY] / model_provider = "CODEXMATE-PROXY" bypass cleanup entirely, and files that already lost the section but still keep model_provider = "codexmate-proxy" never get rewritten. readConfigOrVirtualDefault() hides part of this in memory, but direct readConfig() callers such as cmdUseModel() on Line 7937 still see the stale removed provider.

Also applies to: 5576-5671

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 3188 - 3213, sanitizeRemovedBuiltinProxyProvider
currently only matches BUILTIN_PROXY_PROVIDER_NAME in exact case which misses
differently-cased persisted keys and values; update this function (and the
related removePersistedBuiltinProxyProviderFromConfig logic and callers like
cmdUseModel/readConfigOrVirtualDefault if they repeat the check) to perform
case-insensitive detection and removal: detect the actual provider key in
safeConfig.model_providers by comparing key.toLowerCase() to
BUILTIN_PROXY_PROVIDER_NAME.toLowerCase(), delete that actual key from
nextProviders, and treat safeConfig.model_provider equality case-insensitively
(using .toLowerCase()) when deciding to replace model_provider and model (use
readCurrentModels to compute fallbackModel as you do now). Ensure the code
rewrites the config even when the section key differed by case so stale
model_provider values like "CODEXMATE-PROXY" are normalized/removed.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@cli.js`:
- Around line 10271-10279: The CLI still calls saveBuiltinProxySettings,
startBuiltinProxyRuntime, and stopBuiltinProxyRuntime for the
'proxy-save-config'/'proxy-start'/'proxy-stop' commands allowing the removed
builtin proxy to be configured; update the command dispatch so these cases
short-circuit and return the same "该功能已移除" response (or throw a consistent
error) instead of invoking
saveBuiltinProxySettings/startBuiltinProxyRuntime/stopBuiltinProxyRuntime, and
make the same change where MCP tooling or handlers call them (e.g. in
applyBuiltinProxyProvider and cmdProxy) to ensure all programmatic entry points
uniformly return the removed-feature message and never call the runtime/config
functions.
- Around line 3188-3213: sanitizeRemovedBuiltinProxyProvider currently only
matches BUILTIN_PROXY_PROVIDER_NAME in exact case which misses differently-cased
persisted keys and values; update this function (and the related
removePersistedBuiltinProxyProviderFromConfig logic and callers like
cmdUseModel/readConfigOrVirtualDefault if they repeat the check) to perform
case-insensitive detection and removal: detect the actual provider key in
safeConfig.model_providers by comparing key.toLowerCase() to
BUILTIN_PROXY_PROVIDER_NAME.toLowerCase(), delete that actual key from
nextProviders, and treat safeConfig.model_provider equality case-insensitively
(using .toLowerCase()) when deciding to replace model_provider and model (use
readCurrentModels to compute fallbackModel as you do now). Ensure the code
rewrites the config even when the section key differed by case so stale
model_provider values like "CODEXMATE-PROXY" are normalized/removed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d58c4520-f011-45e7-8a00-1e8fd7810612

📥 Commits

Reviewing files that changed from the base of the PR and between 3d1a2c8 and a599163.

📒 Files selected for processing (3)
  • cli.js
  • tests/e2e/test-auth-proxy.js
  • tests/e2e/test-setup.js
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/e2e/test-setup.js
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
🔇 Additional comments (6)
tests/e2e/test-auth-proxy.js (6)

180-193: Past review concern addressed.

The response shape assertion now properly validates providerList && Array.isArray(providerList.providers) before calling .some(), with an informative error message that surfaces providerList.error if present. The regex check for TOML block removal is correctly structured with multiline mode and handles quoted/unquoted variants.


49-50: LGTM!

The relaxed assertion correctly validates the response structure (boolean running field) with proper null-safety via short-circuit evaluation. This aligns with the intent to check response shape rather than asserting the proxy is already running.


105-113: LGTM!

Good defensive filesystem assertions verifying auth profiles are stored in the correct ~/.codex/auth-profiles/ directory and not written to the legacy ~/.codexmate/codex/auth-profiles/ path.


154-167: LGTM!

Good test setup that injects a legacy codexmate-proxy provider block into config.toml to verify the sanitization logic removes it. The TOML block is well-formed and correctly uses the dynamic proxy port.


169-178: LGTM!

Proper proxy-start assertions with informative error messages. The listenUrl check correctly uses String(proxyPort) for safe comparison.


195-204: LGTM!

Correctly validates that the removed proxy-enable-codex-default command returns an error containing the expected removal message. The type check typeof enableRes.error === 'string' ensures safe string method invocation.

@ymkiux
Copy link
Copy Markdown
Collaborator Author

ymkiux commented Apr 1, 2026

@coderabbitai 如果我直接合并会带来回归性异常吗

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 1, 2026

Tip

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

@ymkiux 根据 PR #61 的变更内容,以下是回归风险评估:


✅ 低风险区域

  • README.md / web-ui/:纯文档和 UI 元素删除,不涉及逻辑,无回归风险。
  • isBuiltinProxyProvider():改为大小写不敏感匹配,只会更健壮,不会破坏已有逻辑。
  • ensureAuthProfileStoragePrepared():目录预建操作,幂等,无副作用风险。

⚠️ 需关注的点

  1. 配置文件自动迁移(高优先级)
    readConfigOrVirtualDefault 在读取 config.toml 前会调用 removePersistedBuiltinProxyProviderFromConfig(),并对读出的配置执行 sanitizeRemovedBuiltinProxyProvider()
    → 若现有用户的 config.tomlmodel_provider 指向 codexmate-proxy合并后首次运行将自动重写其配置(按 provider-current-models.json 选取 fallback)。这是有意为之,但属于不可逆的文件写入,如果 fallback 选取逻辑有缺陷,用户 provider 设置将被静默覆盖。

  2. cmdProxy() 直接抛出异常
    → 任何调用 proxy 子命令的脚本或集成将立即报错(该功能已移除)。e2e 测试已覆盖此路径并期望该错误,但外部调用方(如用户的自动化脚本)会产生回归。

  3. cmdStart() 不再自动启动内建代理
    → 依赖 start 命令隐式拉起代理的用户,合并后行为发生变化。

  4. 单元测试未运行
    npm run test:unit 因已知 Windows 问题被跳过,CLI 内部函数(如 sanitizeRemovedBuiltinProxyProvidergetConfigTemplate 参数硬化)缺乏单元级回归验证


📋 总结

场景 风险等级 说明
全新安装用户 🟢 无风险 无历史配置需迁移
使用 codexmate-proxy 的存量用户 🟡 中等 配置将被自动迁移,不可逆
依赖 proxy/auth CLI 命令的脚本 🔴 回归 命令已移除,调用直接报错
Web UI 用户 🟢 无风险 仅为 UI 删减

e2e 测试已覆盖核心路径,主流程合并是安全的。若你的用户群中存在通过脚本调用 codexmate proxy 或依赖自动代理启动的场景,建议在发版说明中明确提示该行为变更。


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.

coderabbitai[bot]
coderabbitai bot previously requested changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cli.js (1)

3336-3348: ⚠️ Potential issue | 🟠 Major

Template reads still bypass the proxy sanitization path.

getConfigTemplate() still reads raw config.toml instead of going through the sanitized config flow. If an older file still contains [model_providers.codexmate-proxy], this path can re-surface the removed provider in the template editor/MCP response and write it back unchanged.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 3336 - 3348, getConfigTemplate currently reads
CONFIG_FILE directly via fs.readFileSync, bypassing the app's sanitization and
allowing removed providers (e.g., [model_providers.codexmate-proxy]) to
reappear; fix by replacing the direct file read with the canonical sanitized
config loader/sanitizer used elsewhere (i.e., call the existing
config-loading/sanitization function instead of fs.readFileSync) and then pass
that sanitized content into normalizeTopLevelConfigWithTemplate so removed proxy
providers are never returned or written back.
♻️ Duplicate comments (3)
cli.js (2)

5948-5954: ⚠️ Potential issue | 🟠 Major

The removed proxy is still reachable outside the CLI wrappers.

These stubs only block the direct CLI commands. In the same file, createWebServer() still handles proxy-save-config / proxy-start / proxy-stop, and createMcpTools() still exposes codexmate.proxy.start / codexmate.proxy.stop, so callers can still manage or launch the removed proxy programmatically.

Also applies to: 10793-10796

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5948 - 5954, The CLI stubs block only direct commands
but the removed proxy remains reachable via programmatic handlers; update
createWebServer() to remove or disable handling for "proxy-save-config",
"proxy-start", and "proxy-stop" routes/actions and update createMcpTools() to
remove or return an explicit error for the exposed methods codexmate.proxy.start
and codexmate.proxy.stop (and any other proxy-related entries) so callers cannot
programmatically manage the removed proxy; ensure the handlers and exported
method entries reference the same error message as
applyBuiltinProxyProvider/ensureBuiltinProxyForCodexDefault to keep behavior
consistent.

5576-5671: ⚠️ Potential issue | 🟠 Major

Persisted cleanup still leaves stale top-level provider/model fields.

removePersistedBuiltinProxyProviderFromConfig() deletes the provider block, but it never rewrites top-level model_provider / model, and it returns early once the block is already gone. That lets model_provider = "codexmate-proxy" survive indefinitely, which still leaks into direct readConfig() callers such as cmdUseModel().

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5576 - 5671, The function
removePersistedBuiltinProxyProviderFromConfig currently returns early if the
provider block is missing, leaving top-level model_provider/model fields
pointing to BUILTIN_PROXY_PROVIDER_NAME intact; change the early-return logic so
that if config.model_providers[BUILTIN_PROXY_PROVIDER_NAME] is missing you still
check and remove top-level fields (config.model_provider and config.model) when
they equal BUILTIN_PROXY_PROVIDER_NAME, then rebuild and write the TOML (using
readConfig(), writeConfig(), toml.stringify()) to persist the cleaned config;
ensure you reference BUILTIN_PROXY_PROVIDER_NAME when comparing and delete the
keys from the rebuilt object before calling writeConfig so callers like
cmdUseModel() no longer see the stale values.
tests/e2e/test-setup.js (1)

55-59: ⚠️ Potential issue | 🟡 Minor

Exercise the explicit help path here.

runSync(node, [cliPath], ...) only checks the no-arg behavior. That can drift from the real help renderer, so these assertions can still pass while the actual help output re-exposes removed entries.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/e2e/test-setup.js` around lines 55 - 59, The test currently invokes
runSync(node, [cliPath], { env }) which only exercises no-arg behavior; update
the test to call the explicit help path (e.g., runSync(node, [cliPath,
'--help'], { env }) or runSync(node, [cliPath, 'help'], { env })) so helpResult
reflects the real help renderer, then keep the same assertions on
helpResult.status and helpResult.stdout to ensure removed entries like
'codexmate proxy', 'codexmate auth', and '内建代理' are not present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web-ui/app.js`:
- Around line 728-731: When a refresh fails, clear the cached auth list so
providerPillState() can't read stale status: in the error paths of
loadCodexAuthProfiles() (and in any catch around await
this.loadCodexAuthProfiles() shown in the diff), set this.codexAuthProfiles = []
(or null) before returning/propagating the error so the UI will stop showing
`local` as 已登录; update any catch blocks inside loadCodexAuthProfiles() and the
outer catch around await this.loadCodexAuthProfiles() to ensure
codexAuthProfiles is reset on failure.

---

Outside diff comments:
In `@cli.js`:
- Around line 3336-3348: getConfigTemplate currently reads CONFIG_FILE directly
via fs.readFileSync, bypassing the app's sanitization and allowing removed
providers (e.g., [model_providers.codexmate-proxy]) to reappear; fix by
replacing the direct file read with the canonical sanitized config
loader/sanitizer used elsewhere (i.e., call the existing
config-loading/sanitization function instead of fs.readFileSync) and then pass
that sanitized content into normalizeTopLevelConfigWithTemplate so removed proxy
providers are never returned or written back.

---

Duplicate comments:
In `@cli.js`:
- Around line 5948-5954: The CLI stubs block only direct commands but the
removed proxy remains reachable via programmatic handlers; update
createWebServer() to remove or disable handling for "proxy-save-config",
"proxy-start", and "proxy-stop" routes/actions and update createMcpTools() to
remove or return an explicit error for the exposed methods codexmate.proxy.start
and codexmate.proxy.stop (and any other proxy-related entries) so callers cannot
programmatically manage the removed proxy; ensure the handlers and exported
method entries reference the same error message as
applyBuiltinProxyProvider/ensureBuiltinProxyForCodexDefault to keep behavior
consistent.
- Around line 5576-5671: The function
removePersistedBuiltinProxyProviderFromConfig currently returns early if the
provider block is missing, leaving top-level model_provider/model fields
pointing to BUILTIN_PROXY_PROVIDER_NAME intact; change the early-return logic so
that if config.model_providers[BUILTIN_PROXY_PROVIDER_NAME] is missing you still
check and remove top-level fields (config.model_provider and config.model) when
they equal BUILTIN_PROXY_PROVIDER_NAME, then rebuild and write the TOML (using
readConfig(), writeConfig(), toml.stringify()) to persist the cleaned config;
ensure you reference BUILTIN_PROXY_PROVIDER_NAME when comparing and delete the
keys from the rebuilt object before calling writeConfig so callers like
cmdUseModel() no longer see the stale values.

In `@tests/e2e/test-setup.js`:
- Around line 55-59: The test currently invokes runSync(node, [cliPath], { env
}) which only exercises no-arg behavior; update the test to call the explicit
help path (e.g., runSync(node, [cliPath, '--help'], { env }) or runSync(node,
[cliPath, 'help'], { env })) so helpResult reflects the real help renderer, then
keep the same assertions on helpResult.status and helpResult.stdout to ensure
removed entries like 'codexmate proxy', 'codexmate auth', and '内建代理' are not
present.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5d721380-265d-447a-a237-5431122f8744

📥 Commits

Reviewing files that changed from the base of the PR and between ad8aba5 and a599163.

📒 Files selected for processing (6)
  • README.md
  • cli.js
  • tests/e2e/test-auth-proxy.js
  • tests/e2e/test-setup.js
  • web-ui/app.js
  • web-ui/index.html
💤 Files with no reviewable changes (1)
  • README.md
📜 Review details
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
🔇 Additional comments (9)
web-ui/app.js (1)

567-576: Proxy-specific UI helpers are now aligned with the removal.

Only local remains special-cased, and legacy codexmate-proxy entries stay hidden from the visible provider list. That keeps the removed surface from leaking back into the UI.

Also applies to: 3811-3869

web-ui/index.html (4)

434-436: LGTM!

The bridge hint text correctly removes the legacy auth/proxy reference while preserving the template editing note. The computed property activeProviderBridgeHint from config-mode.computed.mjs properly provides the mode-specific prefix.


519-521: LGTM!

The badge terminology change from "内建" to "系统" appropriately reflects the removal of the built-in proxy concept while still clearly indicating read-only provider status.


522-524: LGTM!

The card subtitle simplification correctly removes the conditional proxy description logic, now consistently displaying the provider URL with an appropriate fallback message.


1832-1834: LGTM!

The empty state hint correctly removes references to built-in providers and auth profiles, replacing them with the more accurate "环境变量或外部配置" which reflects the actual configuration sources.

tests/e2e/test-auth-proxy.js (4)

49-50: Reasonable contract check before the explicit proxy start.

This keeps the precondition here scoped to the proxy-status response shape and leaves the running-state verification to the later proxy-start flow.


105-113: Good regression guard on the new auth-profile storage path.

This pins the uploaded profile and registry under ~/.codex/auth-profiles and makes sure the removed legacy tree stays untouched.


154-193: Nice cleanup-safeguard coverage.

Seeding a persisted codexmate-proxy block and then asserting list removes it from both the returned provider set and config.toml exercises the exact cleanup path this PR is protecting.


195-204: Good lock-down of the removed proxy command.

Checking for the explicit removal error keeps this surface unavailable while the rest of the proxy e2e flow still runs through the supported path.

Comment on lines 728 to +731
try {
await Promise.all([
this.loadCodexAuthProfiles(),
this.loadProxyStatus()
]);
await this.loadCodexAuthProfiles();
} catch (e) {
// 认证/代理状态加载失败不阻塞主界面
// 认证状态加载失败不阻塞主界面
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clear stale auth state when this refresh fails.

providerPillState() uses codexAuthProfiles to decide whether local is shown as 已登录. After this new loadAll() refresh path runs once successfully, any later list-auth-profiles failure will leave the old array in place, so the UI can keep showing a stale logged-in state. Please reset codexAuthProfiles in the error paths of loadCodexAuthProfiles() so a failed refresh does not preserve cached auth status.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web-ui/app.js` around lines 728 - 731, When a refresh fails, clear the cached
auth list so providerPillState() can't read stale status: in the error paths of
loadCodexAuthProfiles() (and in any catch around await
this.loadCodexAuthProfiles() shown in the diff), set this.codexAuthProfiles = []
(or null) before returning/propagating the error so the UI will stop showing
`local` as 已登录; update any catch blocks inside loadCodexAuthProfiles() and the
outer catch around await this.loadCodexAuthProfiles() to ensure
codexAuthProfiles is reset on failure.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

@coderabbitai re-review !Stop making breaking changes, do a proper review!

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

@github-actions[bot] — Understood. I will conduct a strict re-review of PR #61 with the following absolute constraints:

  • 🚫 No breaking changes — no refactors, no API/interface/behavior alterations.
  • Feedback limited exclusively to correctness, safety, and quality within the existing design.

Triggering a full re-review now.


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
✅ Actions performed

Full review triggered.

coderabbitai[bot]
coderabbitai bot previously requested changes Apr 2, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/coderabbit-review.yml:
- Around line 39-46: The loop parsing markerRegex currently trusts any comment;
restrict it to only workflow-authored comments by checking the comment author
before accepting the marker. In the for loop over comments (where markerRegex
and previousCommitCount are used), add a guard that ensures comment.user?.login
=== 'github-actions[bot]' (or another specific workflow bot login your workflows
use) and/or comment.user?.type === 'Bot' before running match; only then parse
match and set previousCommitCount. This ensures only comments created by the
workflow actor are considered.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e435e015-104e-491e-bc35-3ec3da77ad8a

📥 Commits

Reviewing files that changed from the base of the PR and between a599163 and 01af830.

📒 Files selected for processing (4)
  • .github/workflows/coderabbit-review.yml
  • tests/e2e/run.js
  • tests/e2e/test-auth-proxy.js
  • tests/unit/coderabbit-workflows.test.mjs
💤 Files with no reviewable changes (2)
  • tests/e2e/run.js
  • tests/e2e/test-auth-proxy.js
📜 Review details
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
📚 Learning: 2026-03-31T12:37:50.988Z
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Applied to files:

  • tests/unit/coderabbit-workflows.test.mjs
  • .github/workflows/coderabbit-review.yml
📚 Learning: 2026-03-30T04:47:15.339Z
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Applied to files:

  • tests/unit/coderabbit-workflows.test.mjs
  • .github/workflows/coderabbit-review.yml
📚 Learning: 2026-03-29T02:42:32.761Z
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.

Applied to files:

  • .github/workflows/coderabbit-review.yml
🔇 Additional comments (1)
tests/unit/coderabbit-workflows.test.mjs (1)

21-31: Good coverage for the new re-review gating behavior.

These assertions correctly lock in commit-count gating and the ASCII-safe command/message expectations.

Comment on lines +39 to +46
for (const comment of comments.slice().reverse()) {
const match = comment.body?.match(markerRegex);
if (!match) {
continue;
}

previousCommitCount = Number(match[1]);
break;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Filter marker parsing to workflow-authored comments only.

The skip gate currently trusts any PR comment containing the marker, so a non-workflow comment can spoof previousCommitCount and suppress the re-review trigger.

Proposed hardening patch
             let previousCommitCount = null;
             for (const comment of comments.slice().reverse()) {
+              if (comment.user?.login !== "github-actions[bot]") {
+                continue;
+              }
               const match = comment.body?.match(markerRegex);
               if (!match) {
                 continue;
               }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coderabbit-review.yml around lines 39 - 46, The loop
parsing markerRegex currently trusts any comment; restrict it to only
workflow-authored comments by checking the comment author before accepting the
marker. In the for loop over comments (where markerRegex and previousCommitCount
are used), add a guard that ensures comment.user?.login ===
'github-actions[bot]' (or another specific workflow bot login your workflows
use) and/or comment.user?.type === 'Bot' before running match; only then parse
match and set previousCommitCount. This ensures only comments created by the
workflow actor are considered.

@ymkiux
Copy link
Copy Markdown
Collaborator Author

ymkiux commented Apr 2, 2026

@coderabbitai 如果我直接合并会带来回归性异常吗

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Tip

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

@ymkiux 根据 PR #61 的变更内容,以下是回归风险评估(与此前分析一致):


✅ 低风险区域

  • README.md / web-ui/:纯文档与 UI 元素删除,无逻辑影响。
  • isBuiltinProxyProvider():改为大小写不敏感匹配,更健壮,无破坏性。
  • ensureAuthProfileStoragePrepared():幂等的目录预建操作,无副作用。

⚠️ 需关注的点

  1. 配置文件自动迁移(不可逆)
    readConfigOrVirtualDefault 读取 config.toml 前会调用 removePersistedBuiltinProxyProviderFromConfig(),并对读出配置执行 sanitizeRemovedBuiltinProxyProvider()
    → 若存量用户的 config.tomlmodel_provider 指向 codexmate-proxy合并后首次运行将自动重写其配置,按 provider-current-models.json 选取 fallback。该写入不可逆,若 fallback 逻辑存在缺陷,用户配置将被静默覆盖。

  2. cmdProxy() 直接抛出异常
    → 任何调用 proxy 子命令的外部脚本或自动化集成,合并后将立即收到 该功能已移除 错误。

  3. cmdStart() 不再自动启动内建代理
    → 依赖 start 命令隐式拉起代理的用户,行为发生变化。

  4. 单元测试未运行
    npm run test:unit 因已知 Windows 问题被跳过,sanitizeRemovedBuiltinProxyProvidergetConfigTemplate 等核心函数缺乏单元级验证。


📋 总体风险矩阵

场景 风险等级 说明
全新安装用户 🟢 无风险 无历史配置需迁移
使用 codexmate-proxy 的存量用户 🟡 中等 配置将被自动迁移,不可逆
依赖 proxy/auth CLI 命令的脚本 🔴 回归 命令已移除,调用直接报错
Web UI 用户 🟢 无风险 仅为 UI 删减

结论:e2e 测试已覆盖核心路径,对于全新安装未使用内建代理的用户,直接合并是安全的。若你的用户中存在通过脚本调用 codexmate proxy 或依赖自动代理启动的场景,建议在发版说明(Release Notes)中明确说明该行为变更,以便用户提前知悉。


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.

coderabbitai[bot]
coderabbitai bot previously requested changes Apr 2, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (4)
.github/workflows/coderabbit-review.yml (1)

39-46: ⚠️ Potential issue | 🟠 Major

Restrict marker parsing to workflow-authored bot comments.

At Line 39, the parser trusts any PR comment body containing the marker. A user comment can spoof previousCommitCount and suppress the re-review trigger.

Proposed hardening patch
             let previousCommitCount = null;
             for (const comment of comments.slice().reverse()) {
+              if (comment.user?.type !== "Bot" || comment.user?.login !== "github-actions[bot]") {
+                continue;
+              }
               const match = comment.body?.match(markerRegex);
               if (!match) {
                 continue;
               }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/coderabbit-review.yml around lines 39 - 46, The loop that
parses PR comments (for ... comments.slice().reverse()) currently accepts any
comment containing markerRegex which lets users spoof previousCommitCount;
restrict parsing to workflow-authored bot comments by adding a guard before
matching: check comment.user?.type === 'Bot' and comment.user?.login equals the
bot username (make the bot login configurable via env var if needed) and only
then run comment.body?.match(markerRegex) and set previousCommitCount from the
match; target the loop where comments, markerRegex and previousCommitCount are
used.
cli.js (2)

5948-5953: ⚠️ Potential issue | 🟠 Major

The proxy is still startable through the API and MCP tools.

Lines 5948-5953 only block the CLI wrapper. /api still dispatches proxy-start / proxy-stop / proxy-save-config, and createMcpTools() still exposes codexmate.proxy.start / codexmate.proxy.stop / codexmate.proxy.provider.apply, so the removed runtime can still be configured and launched programmatically.

Those entry points should return the same { error: '该功能已移除' } result as these stubs.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5948 - 5953, Handlers and exposed programmatic APIs
still allow starting/configuring the removed proxy; update the API dispatchers
for "proxy-start", "proxy-stop", and "proxy-save-config" and the programmatic
surfaces created by createMcpTools() (specifically codexmate.proxy.start,
codexmate.proxy.stop, and codexmate.proxy.provider.apply) to return the same
sentinel object { error: '该功能已移除' } instead of performing any runtime
actions—locate the route/command dispatch code that maps those action names and
the createMcpTools() implementation and replace their operational behaviour with
a simple immediate return of the same error object.

5576-5671: ⚠️ Potential issue | 🟠 Major

Persisted cleanup still leaves stale top-level provider/model references.

When this helper removes the [model_providers.codexmate-proxy] block, it never rewrites model_provider / model. Line 5588 then short-circuits future cleanup once the section is gone, so a file can keep model_provider = "codexmate-proxy" indefinitely. Plain readConfig() callers such as cmdUseModel() will still read the removed provider from disk.

Please apply the same fallback-selection logic from sanitizeRemovedBuiltinProxyProvider() before writing the file back.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 5576 - 5671,
removePersistedBuiltinProxyProviderFromConfig removes the provider section but
never updates top-level model selection, leaving model_provider/model pointing
at the removed BUILTIN_PROXY_PROVIDER_NAME; update the rebuilt config before
writing by reusing the same fallback-selection logic from
sanitizeRemovedBuiltinProxyProvider(): after deleting
rebuilt.model_providers[BUILTIN_PROXY_PROVIDER_NAME] compute and set
rebuilt.model_provider (and rebuilt.model if present) to a valid fallback (using
the same helper/path calculus used in sanitizeRemovedBuiltinProxyProvider), then
proceed to stringify and write via writeConfig; ensure you reference
removePersistedBuiltinProxyProviderFromConfig,
sanitizeRemovedBuiltinProxyProvider, BUILTIN_PROXY_PROVIDER_NAME,
model_providers, model_provider, model, readConfig and writeConfig when making
the change.
web-ui/app.js (1)

728-731: ⚠️ Potential issue | 🟡 Minor

Clear codexAuthProfiles when this startup refresh fails.

This path still preserves the previous auth cache on list-auth-profiles failures, so providerPillState() can keep rendering local as 已登录 after the refresh has already failed. Reset the array in the API-error and exception paths before returning.

💡 Minimal fix
 async loadCodexAuthProfiles(options = {}) {
     const silent = !!options.silent;
     try {
         const res = await api('list-auth-profiles');
         if (res && res.error) {
+            this.codexAuthProfiles = [];
             if (!silent) {
                 this.showMessage(res.error, 'error');
             }
             return;
         }
         const list = Array.isArray(res && res.profiles) ? res.profiles : [];
         this.codexAuthProfiles = list.sort((a, b) => {
             if (!!a.current !== !!b.current) {
                 return a.current ? -1 : 1;
             }
             return String(a.name || '').localeCompare(String(b.name || ''));
         });
     } catch (e) {
+        this.codexAuthProfiles = [];
         if (!silent) {
             this.showMessage('读取认证列表失败', 'error');
         }
     }
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web-ui/app.js` around lines 728 - 731, The startup refresh failure leaves
stale auth state; update loadCodexAuthProfiles to clear the in-memory cache by
setting codexAuthProfiles = [] whenever the API call fails or an exception is
caught (both in the API-error path that returns early and in the catch block
around await this.loadCodexAuthProfiles()), so providerPillState() no longer
shows a lingering "已登录" local state after a refresh error.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cli.js`:
- Around line 3188-3214: The sanitization currently checks for the exact
BUILTIN_PROXY_PROVIDER_NAME string and deletes that literal key, which misses
case-variants (e.g., "CodexMate-Proxy"); update
sanitizeRemovedBuiltinProxyProvider to use the case-insensitive matcher
isBuiltinProxyProvider() for both detecting the current provider and when
removing provider keys: set currentIsRemovedBuiltin =
isBuiltinProxyProvider(currentProvider), and build nextProviders by copying only
those entries whose key does NOT satisfy isBuiltinProxyProvider(key) (i.e.,
filter Object.keys(providers) with isBuiltinProxyProvider to exclude all
case-variants), then proceed to compute fallbackProvider/fallbackModel and the
returned fields as before using these filtered providers.

---

Duplicate comments:
In @.github/workflows/coderabbit-review.yml:
- Around line 39-46: The loop that parses PR comments (for ...
comments.slice().reverse()) currently accepts any comment containing markerRegex
which lets users spoof previousCommitCount; restrict parsing to
workflow-authored bot comments by adding a guard before matching: check
comment.user?.type === 'Bot' and comment.user?.login equals the bot username
(make the bot login configurable via env var if needed) and only then run
comment.body?.match(markerRegex) and set previousCommitCount from the match;
target the loop where comments, markerRegex and previousCommitCount are used.

In `@cli.js`:
- Around line 5948-5953: Handlers and exposed programmatic APIs still allow
starting/configuring the removed proxy; update the API dispatchers for
"proxy-start", "proxy-stop", and "proxy-save-config" and the programmatic
surfaces created by createMcpTools() (specifically codexmate.proxy.start,
codexmate.proxy.stop, and codexmate.proxy.provider.apply) to return the same
sentinel object { error: '该功能已移除' } instead of performing any runtime
actions—locate the route/command dispatch code that maps those action names and
the createMcpTools() implementation and replace their operational behaviour with
a simple immediate return of the same error object.
- Around line 5576-5671: removePersistedBuiltinProxyProviderFromConfig removes
the provider section but never updates top-level model selection, leaving
model_provider/model pointing at the removed BUILTIN_PROXY_PROVIDER_NAME; update
the rebuilt config before writing by reusing the same fallback-selection logic
from sanitizeRemovedBuiltinProxyProvider(): after deleting
rebuilt.model_providers[BUILTIN_PROXY_PROVIDER_NAME] compute and set
rebuilt.model_provider (and rebuilt.model if present) to a valid fallback (using
the same helper/path calculus used in sanitizeRemovedBuiltinProxyProvider), then
proceed to stringify and write via writeConfig; ensure you reference
removePersistedBuiltinProxyProviderFromConfig,
sanitizeRemovedBuiltinProxyProvider, BUILTIN_PROXY_PROVIDER_NAME,
model_providers, model_provider, model, readConfig and writeConfig when making
the change.

In `@web-ui/app.js`:
- Around line 728-731: The startup refresh failure leaves stale auth state;
update loadCodexAuthProfiles to clear the in-memory cache by setting
codexAuthProfiles = [] whenever the API call fails or an exception is caught
(both in the API-error path that returns early and in the catch block around
await this.loadCodexAuthProfiles()), so providerPillState() no longer shows a
lingering "已登录" local state after a refresh error.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cea40ca3-064b-467d-84a9-0a6dab2a68ba

📥 Commits

Reviewing files that changed from the base of the PR and between ad8aba5 and 01af830.

📒 Files selected for processing (9)
  • .github/workflows/coderabbit-review.yml
  • README.md
  • cli.js
  • tests/e2e/run.js
  • tests/e2e/test-auth-proxy.js
  • tests/e2e/test-setup.js
  • tests/unit/coderabbit-workflows.test.mjs
  • web-ui/app.js
  • web-ui/index.html
💤 Files with no reviewable changes (3)
  • README.md
  • tests/e2e/run.js
  • tests/e2e/test-auth-proxy.js
📜 Review details
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.
📚 Learning: 2026-03-31T12:37:50.988Z
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Applied to files:

  • tests/unit/coderabbit-workflows.test.mjs
  • .github/workflows/coderabbit-review.yml
  • cli.js
📚 Learning: 2026-03-30T04:47:15.339Z
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Applied to files:

  • tests/unit/coderabbit-workflows.test.mjs
  • .github/workflows/coderabbit-review.yml
  • cli.js
📚 Learning: 2026-03-29T02:42:32.761Z
Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.

Applied to files:

  • .github/workflows/coderabbit-review.yml
  • cli.js
🔇 Additional comments (6)
.github/workflows/coderabbit-review.yml (1)

31-36: Good reliability improvements in pagination and idempotent gating.

Using github.paginate(...) and the previousCommitCount === pr.commits early return is a solid way to avoid duplicate bot comments.

Also applies to: 49-54, 62-67

tests/unit/coderabbit-workflows.test.mjs (1)

21-30: Test updates look consistent with workflow changes.

Coverage now checks the pagination path, commit-count gate, and ASCII-safe command content as expected.

tests/e2e/test-setup.js (1)

55-59: Solid regression coverage for removed CLI surfaces.

The assertions correctly verify that codexmate proxy, codexmate auth, and 内建代理 are no longer exposed in the CLI help output, aligning with the PR's removal of legacy proxy/auth features.

web-ui/index.html (3)

434-436: Text update correctly reflects the removal of auth/proxy editability.

The simplified wording accurately describes what remains editable after the legacy surfaces are removed.


519-524: Provider card updates align with the removal of built-in proxy semantics.

Renaming the badge from "内建" to "系统" and simplifying the subtitle logic are appropriate changes given that the built-in proxy distinction no longer applies.


1831-1834: Empty-state wording now accurately reflects the available configuration sources.

The updated text ("环境变量或外部配置") correctly describes how providers can be configured after the removal of built-in provider/auth profile features.

Comment on lines +3188 to +3214
function sanitizeRemovedBuiltinProxyProvider(config) {
const safeConfig = isPlainObject(config) ? config : {};
const providers = isPlainObject(safeConfig.model_providers) ? safeConfig.model_providers : null;
const currentProvider = typeof safeConfig.model_provider === 'string' ? safeConfig.model_provider.trim() : '';
const hasRemovedBuiltin = !!(providers && providers[BUILTIN_PROXY_PROVIDER_NAME]);
const currentIsRemovedBuiltin = currentProvider === BUILTIN_PROXY_PROVIDER_NAME;

if (!hasRemovedBuiltin && !currentIsRemovedBuiltin) {
return safeConfig;
}

const nextProviders = providers ? { ...providers } : {};
delete nextProviders[BUILTIN_PROXY_PROVIDER_NAME];
const providerNames = Object.keys(nextProviders);
const fallbackProvider = providerNames[0] || '';
const currentModels = readCurrentModels();
const fallbackModel = fallbackProvider
? (currentModels[fallbackProvider] || (typeof safeConfig.model === 'string' ? safeConfig.model : ''))
: '';

return {
...safeConfig,
model_providers: nextProviders,
model_provider: currentIsRemovedBuiltin ? fallbackProvider : safeConfig.model_provider,
model: currentIsRemovedBuiltin ? fallbackModel : safeConfig.model
};
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Make cleanup honor the new case-insensitive builtin-proxy match.

Lines 3192-3193 still look for the literal codexmate-proxy. After Line 256 made isBuiltinProxyProvider() case-insensitive, a manually edited config like CodexMate-Proxy will now be rejected by add/update/delete paths but will survive this sanitization pass, and the persisted cleanup below has the same gap.

Minimal fix
 function sanitizeRemovedBuiltinProxyProvider(config) {
     const safeConfig = isPlainObject(config) ? config : {};
     const providers = isPlainObject(safeConfig.model_providers) ? safeConfig.model_providers : null;
     const currentProvider = typeof safeConfig.model_provider === 'string' ? safeConfig.model_provider.trim() : '';
-    const hasRemovedBuiltin = !!(providers && providers[BUILTIN_PROXY_PROVIDER_NAME]);
-    const currentIsRemovedBuiltin = currentProvider === BUILTIN_PROXY_PROVIDER_NAME;
+    const removedProviderName = providers
+        ? Object.keys(providers).find((name) => isBuiltinProxyProvider(name))
+        : '';
+    const hasRemovedBuiltin = !!removedProviderName;
+    const currentIsRemovedBuiltin = isBuiltinProxyProvider(currentProvider);
 
     if (!hasRemovedBuiltin && !currentIsRemovedBuiltin) {
         return safeConfig;
     }
 
     const nextProviders = providers ? { ...providers } : {};
-    delete nextProviders[BUILTIN_PROXY_PROVIDER_NAME];
+    if (removedProviderName) {
+        delete nextProviders[removedProviderName];
+    }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
function sanitizeRemovedBuiltinProxyProvider(config) {
const safeConfig = isPlainObject(config) ? config : {};
const providers = isPlainObject(safeConfig.model_providers) ? safeConfig.model_providers : null;
const currentProvider = typeof safeConfig.model_provider === 'string' ? safeConfig.model_provider.trim() : '';
const hasRemovedBuiltin = !!(providers && providers[BUILTIN_PROXY_PROVIDER_NAME]);
const currentIsRemovedBuiltin = currentProvider === BUILTIN_PROXY_PROVIDER_NAME;
if (!hasRemovedBuiltin && !currentIsRemovedBuiltin) {
return safeConfig;
}
const nextProviders = providers ? { ...providers } : {};
delete nextProviders[BUILTIN_PROXY_PROVIDER_NAME];
const providerNames = Object.keys(nextProviders);
const fallbackProvider = providerNames[0] || '';
const currentModels = readCurrentModels();
const fallbackModel = fallbackProvider
? (currentModels[fallbackProvider] || (typeof safeConfig.model === 'string' ? safeConfig.model : ''))
: '';
return {
...safeConfig,
model_providers: nextProviders,
model_provider: currentIsRemovedBuiltin ? fallbackProvider : safeConfig.model_provider,
model: currentIsRemovedBuiltin ? fallbackModel : safeConfig.model
};
}
function sanitizeRemovedBuiltinProxyProvider(config) {
const safeConfig = isPlainObject(config) ? config : {};
const providers = isPlainObject(safeConfig.model_providers) ? safeConfig.model_providers : null;
const currentProvider = typeof safeConfig.model_provider === 'string' ? safeConfig.model_provider.trim() : '';
const removedProviderName = providers
? Object.keys(providers).find((name) => isBuiltinProxyProvider(name))
: '';
const hasRemovedBuiltin = !!removedProviderName;
const currentIsRemovedBuiltin = isBuiltinProxyProvider(currentProvider);
if (!hasRemovedBuiltin && !currentIsRemovedBuiltin) {
return safeConfig;
}
const nextProviders = providers ? { ...providers } : {};
if (removedProviderName) {
delete nextProviders[removedProviderName];
}
const providerNames = Object.keys(nextProviders);
const fallbackProvider = providerNames[0] || '';
const currentModels = readCurrentModels();
const fallbackModel = fallbackProvider
? (currentModels[fallbackProvider] || (typeof safeConfig.model === 'string' ? safeConfig.model : ''))
: '';
return {
...safeConfig,
model_providers: nextProviders,
model_provider: currentIsRemovedBuiltin ? fallbackProvider : safeConfig.model_provider,
model: currentIsRemovedBuiltin ? fallbackModel : safeConfig.model
};
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cli.js` around lines 3188 - 3214, The sanitization currently checks for the
exact BUILTIN_PROXY_PROVIDER_NAME string and deletes that literal key, which
misses case-variants (e.g., "CodexMate-Proxy"); update
sanitizeRemovedBuiltinProxyProvider to use the case-insensitive matcher
isBuiltinProxyProvider() for both detecting the current provider and when
removing provider keys: set currentIsRemovedBuiltin =
isBuiltinProxyProvider(currentProvider), and build nextProviders by copying only
those entries whose key does NOT satisfy isBuiltinProxyProvider(key) (i.e.,
filter Object.keys(providers) with isBuiltinProxyProvider to exclude all
case-variants), then proceed to compute fallbackProvider/fallbackModel and the
returned fields as before using these filtered providers.

@SurviveM SurviveM dismissed stale reviews from coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], coderabbitai[bot], and coderabbitai[bot] April 2, 2026 00:48

Force-dismissed by maintainer to unblock PR.

@ymkiux
Copy link
Copy Markdown
Collaborator Author

ymkiux commented Apr 2, 2026

@coderabbitai 当前我就是不需要代理跟鉴权命令 如果我直接合并会带来回归性异常吗

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 2, 2026

Tip

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

@ymkiux 既然你明确不需要代理和鉴权命令,这正是本 PR 的设计意图,直接合并的回归风险评估如下:


✅ 对你的场景:可以安全合并

检查点 结论
从未使用 codexmate-proxy 的配置 ✅ 安全:配置清理逻辑只处理含 codexmate-proxy 的 block,对其他配置是空操作(no-op)
cmdProxy() 抛出异常 ✅ 无影响:你本就不需要该命令
cmdStart() 不再自动启动代理 ✅ 无影响:你不依赖自动代理启动
Web UI 代理/认证 UI 删除 ✅ 无影响:纯界面削减
e2e 测试 ✅ 已通过,核心路径覆盖

唯一需留意的前提

如果你的存量用户中有人曾经配置过 codexmate-proxy 作为 model_provider,合并后他们首次运行时配置文件会被自动迁移(不可逆)。若你确认用户群中不存在这种情况,或你接受这一迁移行为,则无顾虑。


结论:在你不需要代理与鉴权命令的前提下,直接合并是安全的,不会带来回归性异常。


🧠 Learnings used
Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-31T12:37:50.988Z
Learning: In PR `#59` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: github-actions[bot]
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-30T04:47:15.339Z
Learning: In PR `#55` for SakuraByteCore/codexmate, github-actions[bot] repeatedly flagged that CodeRabbit was introducing breaking changes. The maintainer's absolute constraint is: no breaking changes in any review suggestion; limit all feedback to correctness, safety, and quality only within the existing design, without refactoring or altering APIs, interfaces, or behavior.

Learnt from: SurviveM
Repo: SakuraByteCore/codexmate PR: 0
File: :0-0
Timestamp: 2026-03-29T02:42:32.761Z
Learning: The repository maintainer SurviveM (GitHub: SurviveM, repo: SakuraByteCore/codexmate) prefers that CodeRabbit review suggestions do not introduce breaking changes. Reviews should focus on correctness, safety, and quality without recommending refactors or changes that would break existing APIs, interfaces, or behavior.

Copy link
Copy Markdown
Collaborator

@awsl233777 awsl233777 left a comment

Choose a reason for hiding this comment

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

Approving for force-merge per maintainer instruction.

@awsl233777 awsl233777 merged commit f3541e0 into main Apr 2, 2026
8 checks passed
@awsl233777 awsl233777 deleted the fix/remove-legacy-proxy-surfaces branch April 2, 2026 01:09
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.

3 participants