Skip to content

[WRONG BRANCH] fix(config): preserve Claude sidecar Auto overrides - #234

Draft
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-claude-auto-sidecar-backend-behavior
Draft

[WRONG BRANCH] fix(config): preserve Claude sidecar Auto overrides#234
luvs01 wants to merge 1 commit into
mainfrom
codex/fix-claude-auto-sidecar-backend-behavior

Conversation

@luvs01

@luvs01 luvs01 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Motivation

  • The Claude-specific sidecar override could not represent an explicit Auto backend and was being conflated with an absent (inherit) backend, causing Claude requests to inherit a global backend unexpectedly.

Description

  • Allow persisted Claude override backend to be null in OcxClaudeCodeConfig so null means explicit Auto while an absent field means inherit (update: src/types.ts).
  • Accept and round-trip backend: null in the management API and stop deleting the backend field when clients send null (update: src/server/management/agent-settings-routes.ts).
  • Resolve replay-time effective config so an explicit persisted Auto (backend: null) removes the inherited global backend for the request while retaining model and other global settings (update: src/server/claude-messages.ts).
  • Teach the GUI to preserve the explicit Auto shape by widening the in-memory SidecarOverride type to allow backend: null (update: gui/src/pages/claude-manual-env.ts).
  • Add/adjust regression tests to assert management API round-trip semantics and that explicit Claude Auto overrides do not inherit global backends (updates: tests/claude-management-api.test.ts, tests/claude-sidecar-override.test.ts).

Testing

  • Ran bun run typecheck, which completed successfully.
  • Ran focused GUI unit tests cd gui && bun test ./tests/claude-code-sidecar.test.ts ./tests/claude-code-sidecar-draft.test.ts, and they passed.
  • Ran cd gui && bun run lint && bun run build and bun run privacy:scan, which passed.
  • Ran targeted server tests; an initial run of bun test tests/claude-sidecar-override.test.ts tests/claude-management-api.test.ts surfaced an environment-specific error (node:zlib.zstdDecompressSync missing in the installed Bun) unrelated to this change; the added assertions are exercised by the updated tests but a full CI run in the repository environment is recommended to verify all suites under the CI Node/Bun matrix.

Codex Task

Summary by CodeRabbit

  • New Features

    • Claude sidecar settings now support explicitly selecting automatic backend selection.
    • Omitted backend settings inherit global configuration, while null preserves an explicit Auto selection.
    • Sidecar-specific models remain configurable independently of backend selection.
  • Bug Fixes

    • Clearing or updating sidecar settings no longer unintentionally removes saved backend preferences.
    • Claude replay configuration now correctly preserves explicit sidecar overrides.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Claude sidecar overrides now support explicit backend: null. Management updates preserve this value, and replay configuration prevents it from inheriting the global backend. Tests cover persistence and replay behavior.

Changes

Claude sidecar backend overrides

Layer / File(s) Summary
Override contracts
src/types.ts, gui/src/pages/claude-manual-env.ts
backend accepts null for Claude sidecars. Omitted values inherit global settings; null selects automatic backend selection.
Override persistence
src/server/management/agent-settings-routes.ts, tests/claude-management-api.test.ts
Management updates store backend: null directly. API tests verify that sidecar sections remain present and that clearing a model does not remove the backend override.
Replay backend resolution
src/server/claude-messages.ts, tests/claude-sidecar-override.test.ts
buildClaudeReplayConfig applies backend separately from other sidecar fields. Tests verify that null resolves to undefined without inheriting the global backend, while models remain effective.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AgentSettingsAPI
  participant AgentSettings
  participant buildClaudeReplayConfig
  participant ClaudeSidecars
  AgentSettingsAPI->>AgentSettings: Store backend: null
  AgentSettings->>buildClaudeReplayConfig: Provide sidecar override
  buildClaudeReplayConfig->>ClaudeSidecars: Resolve null as automatic backend
  buildClaudeReplayConfig->>ClaudeSidecars: Preserve sidecar model
Loading

Suggested labels: bug

Suggested reviewers: lidge-jun, wibias

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: preserving Claude sidecar Auto overrides.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-claude-auto-sidecar-backend-behavior

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

@github-actions

Copy link
Copy Markdown

Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the bug Something isn't working label Aug 10, 2026
@github-actions github-actions Bot changed the title fix(config): preserve Claude sidecar Auto overrides [WRONG BRANCH] fix(config): preserve Claude sidecar Auto overrides Aug 10, 2026
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

⏳ DRAFT

  • wrong target branch (main); retarget to dev. UI screenshot required.

What to do

  • Retarget this PR to dev — all contributions go to dev.
  • Add a screenshot of the UI change to the PR description.

Its title has been prefixed with [WRONG BRANCH].
This pull request was already a draft. Its draft status will be preserved after every issue above is resolved.

@github-actions
github-actions Bot marked this pull request as draft August 10, 2026 01:12

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fe3d458629

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


export type SidecarBackend = "openai" | "anthropic";
export interface SidecarOverride { backend?: SidecarBackend; model?: string }
export interface SidecarOverride { backend?: SidecarBackend | null; model?: string }

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Persist Auto without requiring a model override

When a global sidecar backend is explicitly configured and a dashboard user selects Auto while leaving the Claude-specific model blank, widening this state type is insufficient: applySidecarBackendChange produces an override without a backend, but serializeSidecarOverride returns null for that blank-model state, so ClaudeCode.save sends a null section and the management API deletes the override. After reload it becomes “Use main setting,” and Claude requests still inherit the global backend—the exact regression this change intends to fix. Serialize this selection as { backend: null } and cover the blank-model case.

AGENTS.md reference: gui/AGENTS.md:L9-L10

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aardvark bug Something isn't working codex

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant