Skip to content

Merge upstream/main into fork (batch 3)#6

Merged
aaditagrawal merged 12 commits intomainfrom
merge/upstream-main-3
Mar 11, 2026
Merged

Merge upstream/main into fork (batch 3)#6
aaditagrawal merged 12 commits intomainfrom
merge/upstream-main-3

Conversation

@aaditagrawal
Copy link
Copy Markdown
Owner

@aaditagrawal aaditagrawal commented Mar 10, 2026

Summary

  • Integrates 8 upstream commits from pingdotgg/t3code main branch
  • Resolves 5 merge conflicts while preserving all fork multi-provider functionality
  • Upstream changes include: downloads page, app version display, terminal restart type alignment, custom provider auth skip, default git action fix, desktop theme sync, error handling cleanup, and Codex overrides overflow fix

Conflict Resolutions

  • index.astro — adopted upstream's Layout component refactor
  • ProviderCommandReactor.ts — kept fork's interrupt guards, adopted upstream's Cause.pretty() error format
  • ProviderHealth.ts — merged both sides' imports (fork's Copilot + upstream's FileSystem/Path)
  • Sidebar.tsx — kept fork's resolveThreadProvider + upstream's version tooltip
  • _chat.settings.tsx — kept fork's provider Select imports + upstream's APP_VERSION

Verification

  • bun typecheck passes (7/7 packages)
  • bun lint passes (0 errors)
  • All fork multi-provider functionality verified intact (Copilot, OpenCode, Amp, GeminiCli, Kilo, Claude)

Summary by CodeRabbit

  • New Features
    • Desktop theme control (light/dark/system) with web↔desktop sync
    • Marketing site: new layout plus Download page that shows latest release and platform downloads
    • App version exposed and shown in UI (header tooltip and Settings)
    • Terminal: restart flow for sessions
    • Git UI: improved behavior/hints when no origin remote present

Noojuno and others added 9 commits March 10, 2026 09:18
…der (pingdotgg#649)

Co-authored-by: Julius Marminge <julius0216@outlook.com>
* fix(web): avoid push and PR defaults without origin

* fmt

* object here too

---------

Co-authored-by: Julius Marminge <julius0216@outlook.com>
Integrates 8 upstream commits: downloads page, app version display,
terminal restart type fix, custom provider auth skip, default git action
fix, desktop theme sync, error handling cleanup, and Codex overrides
overflow fix. Resolves 5 merge conflicts preserving fork's multi-provider
support.
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 10, 2026

📝 Walkthrough

Walkthrough

Adds desktop–web theme sync via a new Electron IPC channel; exposes APP_VERSION to the web app; surfaces git origin presence across contracts, server, and UI; switches terminal restart input and related contracts; enhances Codex provider-health detection and tests; standardizes error formatting; adds marketing release fetching and download pages.

Changes

Cohort / File(s) Summary
Desktop theme & IPC
apps/desktop/src/main.ts, apps/desktop/src/preload.ts, packages/contracts/src/ipc.ts, apps/web/src/hooks/useTheme.ts
Add desktop:set-theme IPC channel, DesktopTheme type and setTheme(theme) on desktopBridge, validate theme in main, and sync theme from web hook.
App version & UI
apps/web/vite.config.ts, apps/web/src/vite-env.d.ts, apps/web/src/branding.ts, apps/web/src/components/Sidebar.tsx, apps/web/src/routes/_chat.settings.tsx
Expose package version as import.meta.env.APP_VERSION (typed), export APP_VERSION, and show version in Sidebar tooltip and settings UI.
Git origin remote tracking
packages/contracts/src/git.ts, apps/server/src/git/Layers/GitCore.ts, apps/server/src/git/Layers/GitCore.test.ts, apps/web/src/components/ChatView.browser.tsx, apps/web/src/components/GitActionsControl.logic.ts, apps/web/src/components/GitActionsControl.logic.test.ts, apps/web/src/components/GitActionsControl.tsx, apps/server/src/wsServer.test.ts
Add hasOriginRemote to GitListBranchesResult across contracts/impls; update tests, mocks, server responses, and UI logic to account for origin remote when enabling/disabling push/PR and resolving quick actions.
Terminal restart API
packages/contracts/src/terminal.ts, apps/server/src/terminal/Layers/Manager.ts, apps/server/src/terminal/Layers/Manager.test.ts, apps/server/src/terminal/Services/Manager.ts
Switch terminal restart to use TerminalRestartInput (new decoder), update method signatures and tests to accept restart-shaped input.
Provider health & Codex detection
apps/server/src/provider/Layers/ProviderHealth.ts, apps/server/src/provider/Layers/ProviderHealth.test.ts, apps/server/src/provider/Layers/CodexAdapter.ts
Add readCodexConfigModelProvider and hasCustomModelProvider; short-circuit Codex auth probe for custom providers; rework tests with temp CODEX_HOME and effect-based scaffolding; adjust attachment read error wrapping.
Orchestration & error formatting
apps/server/src/orchestration/Layers/OrchestrationEngine.ts, apps/server/src/orchestration/Layers/ProviderCommandReactor.ts, apps/server/src/wsServer.ts
Remove some custom error-format helpers, standardize on Cause.pretty/Cause handling, and adjust related signatures/usages.
Marketing site & releases
apps/marketing/src/layouts/Layout.astro, apps/marketing/src/lib/releases.ts, apps/marketing/src/pages/download.astro, apps/marketing/src/pages/index.astro
Add Layout component, fetchLatestRelease helper with sessionStorage caching, downloads page mapping release assets to platforms, and refactor index to use the release helper.
Misc tests & formatting
apps/server/src/..., apps/web/public/mockServiceWorker.js, apps/web/src/components/...
Update tests to new return shapes and inputs; reformat mockServiceWorker.js (stylistic only); various test/mocking updates and small UI wiring changes (e.g., tooltip, branding).

Sequence Diagram

sequenceDiagram
    participant Web as Web App
    participant Preload as Preload Bridge
    participant IPC as Electron IPC
    participant Main as Main Process
    participant Native as nativeTheme

    Web->>Preload: desktopBridge.setTheme(theme)
    Preload->>IPC: ipcRenderer.invoke("desktop:set-theme", theme)
    IPC->>Main: handle "desktop:set-theme"
    Main->>Main: getSafeTheme(rawTheme)
    alt theme valid
        Main->>Native: nativeTheme.themeSource = theme
        Native-->>Main: updated
        Main-->>IPC: success
    else invalid
        Main-->>IPC: no-op
    end
    IPC-->>Preload: response
    Preload-->>Web: result
Loading

Estimated Code Review Effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly Related PRs

"I twitch my whiskers at the change,
I hop from branch to origin's range,
Themes cross wires, versions gleam,
Downloads land and tests convene,
A rabbit cheers the code's new dance!" 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% 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
Title check ✅ Passed The title 'Merge upstream/main into fork (batch 3)' is clear, specific, and accurately summarizes the main change—integrating upstream commits into a fork.
Description check ✅ Passed The description provides a comprehensive summary, detailed conflict resolutions, and verification results. While it exceeds the template's simple structure, it contains all critical information and clearly explains what changed and why.

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

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch merge/upstream-main-3

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

@github-actions github-actions bot added the vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. label Mar 10, 2026
Copy link
Copy Markdown

@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

Caution

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

⚠️ Outside diff range comments (1)
apps/server/src/orchestration/Layers/ProviderCommandReactor.ts (1)

77-90: ⚠️ Potential issue | 🟠 Major

Restore the missing unknown pending approval request branch.

Line 574 is currently a no-op: the failure activity has already been appended, and the generator ends immediately afterward. As written, unknown pending approval request errors now fall through the generic failure path, so this merge dropped the special-case handling entirely. Move the check before the failure append or reintroduce the intended follow-up action.

Also applies to: 559-575

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

In `@apps/server/src/orchestration/Layers/ProviderCommandReactor.ts` around lines
77 - 90, The special-case handling for "unknown pending approval request" was
lost because the check runs after the generic failure activity is appended and
the generator returns; find the logic that appends the failure and returns (the
code path around the generator in ProviderCommandReactor where failures are
handled) and move the isUnknownPendingApprovalRequestError(cause) check (or
reintroduce its branch) to before the failure append so the specific follow-up
action for unknown pending approval/permission requests is executed instead of
falling through to the generic failure path; reference the
isUnknownPendingApprovalRequestError function and the failure-append code in
ProviderCommandReactor to locate and restore the intended branch.
🧹 Nitpick comments (2)
apps/server/src/provider/Layers/ProviderHealth.ts (1)

20-20: Remove unused Array import to avoid shadowing the global.

The Array import from effect shadows the global Array property but is not used in the new code. This was flagged by static analysis. While effect's Array.isArray on line 77 would still function correctly, removing the unused import eliminates the shadowing concern.

♻️ Proposed fix
-import { Array, Effect, Fiber, FileSystem, Layer, Option, Path, Result, Stream } from "effect";
+import { Effect, Fiber, FileSystem, Layer, Option, Path, Result, Stream } from "effect";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/server/src/provider/Layers/ProviderHealth.ts` at line 20, Importing
Array from "effect" shadows the global Array and is unused; remove Array from
the named import list in ProviderHealth.ts (the import that currently reads
import { Array, Effect, Fiber, FileSystem, Layer, Option, Path, Result, Stream }
...) so the global Array (and Array.isArray usage in this file) is no longer
shadowed and static analysis warnings disappear.
apps/web/public/mockServiceWorker.js (1)

1-336: Regenerate this file using MSW CLI instead of manual formatting changes.

This file explicitly states "Please do NOT modify this file" (line 7) as it's auto-generated by Mock Service Worker. Manual formatting changes, while harmless functionally, can cause merge conflicts during MSW version updates and create drift from the canonical distribution.

🔄 Recommended approach

Regenerate the file using the MSW CLI:

npx msw init apps/web/public --save

This ensures you have the exact canonical version for MSW 2.12.10 and prevents future merge conflicts.

Verify whether MSW version 2.12.10 is current and check for any security advisories:

#!/bin/bash
# Check latest MSW version and security status

# Check npm for latest version
npm view msw version

# Check for known vulnerabilities
npm audit --package-lock-only --prefix apps/web 2>/dev/null | grep -A5 "msw" || echo "No MSW vulnerabilities in quick scan"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/web/public/mockServiceWorker.js` around lines 1 - 336, This file
(mockServiceWorker.js, identified by the PACKAGE_VERSION constant and the header
comment "Please do NOT modify this file") was manually reformatted but must be
regenerated from the official MSW distribution; replace the file by running the
MSW CLI (npx msw init apps/web/public --save) to restore the canonical worker
that matches PACKAGE_VERSION (2.12.10), ensuring you do not manually edit
functions like handleRequest, getResponse, respondWithMock, or serializeRequest;
verify the regenerated file's PACKAGE_VERSION/integrity and commit that
generated file instead of hand edits to avoid future merge drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/marketing/src/lib/releases.ts`:
- Around line 19-29: The fetchLatestRelease function currently parses the fetch
response without checking HTTP status, so non-2xx GitHub responses get treated
as valid Release objects; update fetchLatestRelease to first await
fetch(API_URL), check response.ok, and if not ok throw or reject with a
descriptive error (include response.status and statusText or the error body)
before calling response.json(); only parse and cache the JSON when response.ok
and then keep the existing assets check and sessionStorage.setItem logic.

In `@apps/web/src/components/GitActionsControl.tsx`:
- Around line 173-177: The code defaults hasOriginRemote to false while
branchList is loading, causing a transient UI state; change the fallback so
hasOriginRemote uses branchList?.hasOriginRemote ?? true (i.e., default to true
while loading) in the destructuring that reads from
useQuery(gitBranchesQueryOptions(gitCwd)), and apply the same fix to the other
identical destructuring/usage of branchList later in the file so both places
default to true until branchList resolves.

---

Outside diff comments:
In `@apps/server/src/orchestration/Layers/ProviderCommandReactor.ts`:
- Around line 77-90: The special-case handling for "unknown pending approval
request" was lost because the check runs after the generic failure activity is
appended and the generator returns; find the logic that appends the failure and
returns (the code path around the generator in ProviderCommandReactor where
failures are handled) and move the isUnknownPendingApprovalRequestError(cause)
check (or reintroduce its branch) to before the failure append so the specific
follow-up action for unknown pending approval/permission requests is executed
instead of falling through to the generic failure path; reference the
isUnknownPendingApprovalRequestError function and the failure-append code in
ProviderCommandReactor to locate and restore the intended branch.

---

Nitpick comments:
In `@apps/server/src/provider/Layers/ProviderHealth.ts`:
- Line 20: Importing Array from "effect" shadows the global Array and is unused;
remove Array from the named import list in ProviderHealth.ts (the import that
currently reads import { Array, Effect, Fiber, FileSystem, Layer, Option, Path,
Result, Stream } ...) so the global Array (and Array.isArray usage in this file)
is no longer shadowed and static analysis warnings disappear.

In `@apps/web/public/mockServiceWorker.js`:
- Around line 1-336: This file (mockServiceWorker.js, identified by the
PACKAGE_VERSION constant and the header comment "Please do NOT modify this
file") was manually reformatted but must be regenerated from the official MSW
distribution; replace the file by running the MSW CLI (npx msw init
apps/web/public --save) to restore the canonical worker that matches
PACKAGE_VERSION (2.12.10), ensuring you do not manually edit functions like
handleRequest, getResponse, respondWithMock, or serializeRequest; verify the
regenerated file's PACKAGE_VERSION/integrity and commit that generated file
instead of hand edits to avoid future merge drift.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: be2d620e-1048-4276-92f8-7faf7ef2d35f

📥 Commits

Reviewing files that changed from the base of the PR and between fad5a92 and f61eb05.

📒 Files selected for processing (33)
  • CLAUDE.md
  • apps/desktop/src/main.ts
  • apps/desktop/src/preload.ts
  • apps/marketing/src/layouts/Layout.astro
  • apps/marketing/src/lib/releases.ts
  • apps/marketing/src/pages/download.astro
  • apps/marketing/src/pages/index.astro
  • apps/server/src/git/Layers/GitCore.test.ts
  • apps/server/src/git/Layers/GitCore.ts
  • apps/server/src/orchestration/Layers/OrchestrationEngine.ts
  • apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
  • apps/server/src/provider/Layers/CodexAdapter.ts
  • apps/server/src/provider/Layers/ProviderHealth.test.ts
  • apps/server/src/provider/Layers/ProviderHealth.ts
  • apps/server/src/terminal/Layers/Manager.test.ts
  • apps/server/src/terminal/Layers/Manager.ts
  • apps/server/src/terminal/Services/Manager.ts
  • apps/server/src/wsServer.test.ts
  • apps/server/src/wsServer.ts
  • apps/web/public/mockServiceWorker.js
  • apps/web/src/branding.ts
  • apps/web/src/components/ChatView.browser.tsx
  • apps/web/src/components/GitActionsControl.logic.test.ts
  • apps/web/src/components/GitActionsControl.logic.ts
  • apps/web/src/components/GitActionsControl.tsx
  • apps/web/src/components/Sidebar.tsx
  • apps/web/src/hooks/useTheme.ts
  • apps/web/src/routes/_chat.settings.tsx
  • apps/web/src/vite-env.d.ts
  • apps/web/vite.config.ts
  • packages/contracts/src/git.ts
  • packages/contracts/src/ipc.ts
  • packages/contracts/src/terminal.ts

Comment on lines 173 to 177
const { data: branchList = null } = useQuery(gitBranchesQueryOptions(gitCwd));
// Default to true while loading so we don't flash init controls.
const isRepo = branchList?.isRepo ?? true;
const hasOriginRemote = branchList?.hasOriginRemote ?? false;
const currentBranch = branchList?.branches.find((branch) => branch.current)?.name ?? null;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Avoid defaulting hasOriginRemote to false while the branches query is still loading.

The logic helpers default this flag to true, but Line 176 forces false until branchList resolves. If gitStatus wins that race, the toolbar briefly downgrades push/PR actions into the “add origin remote” path even for repos that already have origin.

Also applies to: 206-213

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

In `@apps/web/src/components/GitActionsControl.tsx` around lines 173 - 177, The
code defaults hasOriginRemote to false while branchList is loading, causing a
transient UI state; change the fallback so hasOriginRemote uses
branchList?.hasOriginRemote ?? true (i.e., default to true while loading) in the
destructuring that reads from useQuery(gitBranchesQueryOptions(gitCwd)), and
apply the same fix to the other identical destructuring/usage of branchList
later in the file so both places default to true until branchList resolves.

- Add response.ok check in fetchLatestRelease to handle API errors
- Move isUnknownPendingApprovalRequestError check before failure append
- Remove unused Array import from ProviderHealth.ts
- Default hasOriginRemote to true while loading in GitActionsControl
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
apps/server/src/provider/Layers/ProviderHealth.ts (1)

220-225: Minor optimization: break early after leaving top level.

Once inTopLevel becomes false (line 222), the loop continues iterating through remaining lines but will skip all of them. For large config files, breaking early would be more efficient.

♻️ Suggested optimization
     // Detect section headers — once we leave the top level, stop.
     if (trimmed.startsWith("[")) {
-      inTopLevel = false;
-      continue;
+      break;
     }
-    if (!inTopLevel) continue;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/server/src/provider/Layers/ProviderHealth.ts` around lines 220 - 225,
The loop that scans config lines sets inTopLevel to false when a section header
is found (trimmed.startsWith("[")) but then uses continue on subsequent
iterations, wasting work; update the loop in ProviderHealth (the block using the
inTopLevel flag and trimmed.startsWith("[")) to break out immediately once
inTopLevel becomes false so remaining lines are not processed, i.e., replace the
continue-after-setting-inTopLevel logic with a break (or add a conditional break
when !inTopLevel) to stop the loop early.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/server/src/provider/Layers/ProviderHealth.ts`:
- Around line 220-225: The loop that scans config lines sets inTopLevel to false
when a section header is found (trimmed.startsWith("[")) but then uses continue
on subsequent iterations, wasting work; update the loop in ProviderHealth (the
block using the inTopLevel flag and trimmed.startsWith("[")) to break out
immediately once inTopLevel becomes false so remaining lines are not processed,
i.e., replace the continue-after-setting-inTopLevel logic with a break (or add a
conditional break when !inTopLevel) to stop the loop early.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f62de09-14d4-4af0-9916-11c8325c7104

📥 Commits

Reviewing files that changed from the base of the PR and between f61eb05 and c53f5e3.

📒 Files selected for processing (4)
  • apps/marketing/src/lib/releases.ts
  • apps/server/src/orchestration/Layers/ProviderCommandReactor.ts
  • apps/server/src/provider/Layers/ProviderHealth.ts
  • apps/web/src/components/GitActionsControl.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/marketing/src/lib/releases.ts
  • apps/web/src/components/GitActionsControl.tsx

Replaces inTopLevel flag with direct break when a section header is
found, avoiding unnecessary iteration through remaining config lines.
Copy link
Copy Markdown

@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

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

Inline comments:
In `@apps/server/src/provider/Layers/ProviderHealth.ts`:
- Around line 205-207: The current read of configPath uses
fileSystem.readFileString(...).pipe(Effect.orElseSucceed(() => undefined)) which
swallows all errors; change it so only a "file not found" / missing-file error
is mapped to undefined while any other I/O error is surfaced (logged or
returned) — detect the error from the Effect failure (e.g., check errno/Code
like ENOENT or the file-not-found error class) and in the failure handler return
undefined only for that case, otherwise rethrow or call processLogger.warn/error
with the error; update the handling around fileSystem.readFileString and the
variable content to reflect this selective error mapping instead of using
Effect.orElseSucceed for all failures.
- Around line 342-350: The branch that handles hasCustomModelProvider
incorrectly returns status: "ready" for CODEX_PROVIDER without verifying
external credentials; update the return in ProviderHealth (the block referencing
hasCustomModelProvider and CODEX_PROVIDER) to use status: "warning" (and set
available accordingly, e.g., available: false) and adjust the message to
indicate external auth wasn’t verified, or alternatively perform
provider-specific env var checks before returning "ready" so only validated
providers report ready. Ensure checkedAt and authStatus remain present.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 798e394b-15bd-45b3-aef5-532ead48f894

📥 Commits

Reviewing files that changed from the base of the PR and between c53f5e3 and dba51a0.

📒 Files selected for processing (1)
  • apps/server/src/provider/Layers/ProviderHealth.ts

Comment on lines +205 to +207
const content = yield* fileSystem
.readFileString(configPath)
.pipe(Effect.orElseSucceed(() => undefined));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Only suppress missing-config reads here.

Lines 205-207 currently turn every readFileString failure into undefined. That hides unreadable or broken Codex configs and can fall through to the OpenAI auth probe, which reintroduces the false negative this change is trying to avoid. Please only treat “file not found” as absent config and surface other I/O errors as a warning/error.

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

In `@apps/server/src/provider/Layers/ProviderHealth.ts` around lines 205 - 207,
The current read of configPath uses
fileSystem.readFileString(...).pipe(Effect.orElseSucceed(() => undefined)) which
swallows all errors; change it so only a "file not found" / missing-file error
is mapped to undefined while any other I/O error is surfaced (logged or
returned) — detect the error from the Effect failure (e.g., check errno/Code
like ENOENT or the file-not-found error class) and in the failure handler return
undefined only for that case, otherwise rethrow or call processLogger.warn/error
with the error; update the handling around fileSystem.readFileString and the
variable content to reflect this selective error mapping instead of using
Effect.orElseSucceed for all failures.

- Only suppress file-not-found errors when reading Codex config,
  log warnings for other I/O errors instead of silently swallowing
- Return status "warning" for custom model providers since external
  credentials are not verified
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
apps/server/src/provider/Layers/ProviderHealth.ts (1)

231-232: Consider matching quote pairs for robustness.

The regex allows mismatched quotes ("value'). While unlikely in practice, capturing the opening quote and backreferencing ensures consistency.

♻️ Optional fix
-    const match = trimmed.match(/^model_provider\s*=\s*["']([^"']+)["']/);
+    const match = trimmed.match(/^model_provider\s*=\s*(["'])([^"']+)\1/);
+    if (match) return match[2];
-    if (match) return match[1];
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/server/src/provider/Layers/ProviderHealth.ts` around lines 231 - 232,
The current regex in ProviderHealth.ts that extracts model_provider from trimmed
(const match = trimmed.match(/^model_provider\s*=\s*["']([^"']+)["']/)) allows
mismatched quotes; update the pattern to capture the opening quote and use a
backreference so quotes must match (e.g. capture group for quote and use \1),
then adjust which capture index you read (use the group that holds the value).
Ensure the variable name trimmed and the const match are used as before and
return the proper capture.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/server/src/provider/Layers/ProviderHealth.ts`:
- Around line 231-232: The current regex in ProviderHealth.ts that extracts
model_provider from trimmed (const match =
trimmed.match(/^model_provider\s*=\s*["']([^"']+)["']/)) allows mismatched
quotes; update the pattern to capture the opening quote and use a backreference
so quotes must match (e.g. capture group for quote and use \1), then adjust
which capture index you read (use the group that holds the value). Ensure the
variable name trimmed and the const match are used as before and return the
proper capture.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 162c4e48-6044-4f27-a346-a84e9e4ba9fb

📥 Commits

Reviewing files that changed from the base of the PR and between dba51a0 and f8e73b2.

📒 Files selected for processing (1)
  • apps/server/src/provider/Layers/ProviderHealth.ts

@aaditagrawal aaditagrawal merged commit 9b19a4f into main Mar 11, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants