Skip to content

Codex Fast Toggle Audit#537

Merged
arul28 merged 2 commits into
mainfrom
ade/codex-fast-toggle-audit-ba73ba38
Jun 8, 2026
Merged

Codex Fast Toggle Audit#537
arul28 merged 2 commits into
mainfrom
ade/codex-fast-toggle-audit-ba73ba38

Conversation

@arul28

@arul28 arul28 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Generalizes the Codex-only fast toggle into a provider-agnostic fastMode.

What changed

  • Rename codexFastModefastMode across chat, automations, review, orchestration, batch launch, and the TUI.
  • Per-provider wiring:
    • Claude: --settings '{"fastMode":…}' CLI flag + Agent SDK settings layer + live applyFlagSettings runtime control. New serviceTiers:["fast"] on Opus models.
    • Codex: service_tier/features.fast_mode -c flags + service_tier JSON-RPC arg; track the app-server's effective tier in AgentChatSession.codexServiceTier.
    • OpenCode: --variant fast on launch/resume.
    • Cursor: explicit standard-tier selection when fast is off, preserving selected reasoning effort.
  • New serviceTiers model-descriptor field.
  • Backward compat: @deprecated codexFastMode aliases read at every input/persistence boundary (fastMode ?? codexFastMode).

Tests: updated/added across services, shared CLI builders, terminal resume signals, and the TUI, including deprecated-alias fallback coverage. Local gate green (typecheck + lint + all 8 vitest shards + build, Node 22).

Summary by CodeRabbit

  • New Features

    • Unified "Fast Mode" support across multiple AI providers (Claude, Codex, OpenCode, Cursor)
    • Claude Opus models now support fast mode capability for improved performance
    • OpenCode fast mode variant for optimized execution
  • Improvements

    • Standardized fast mode configuration across chat, automations, and review workflows
    • Extended fast mode support to CLI launches for all supported providers

Greptile Summary

This PR generalises the Codex-only codexFastMode toggle into a provider-agnostic fastMode field across ~60 files, wiring it to Claude (--settings '{"fastMode":…}' + Agent SDK applyFlagSettings), Codex (service_tier/features.fast_mode), OpenCode (--variant fast), and Cursor (explicit standard-tier SDK param). Backward-compat aliases (fastMode ?? codexFastMode) are applied consistently at every DB-read, IPC, config-parse, and localStorage-normalisation boundary.

  • Rename & compat layer: every type, service, and UI component migrates to fastMode; deprecated codexFastMode fields are kept with @deprecated JSDoc and resolved at every entry point.
  • Provider wiring: Claude sessions now receive a live applyFlagSettings call on toggle (with session-reset fallback); Codex carries service_tier + features.fast_mode CLI flags; OpenCode gains run --interactive --variant fast; Cursor gains explicit standard-tier param when fast is off.
  • New serviceTiers model-descriptor field drives modelSupportsFastMode, gating the toggle for Opus models and the two active GPT models.

Confidence Score: 5/5

Safe to merge. The rename is thorough, every DB-read/IPC/config boundary applies the codexFastMode → fastMode fallback, and all three new provider paths degrade gracefully.

The refactor consistently applies backward-compat fallbacks at every persistence and IPC boundary. The only notable inconsistency is that initialFastMode defaults to true for unknown Claude descriptors, but sessionEffectiveFastMode guards the runtime call so no incorrect API request is made.

agentChatService.ts initialFastMode fallback for unknown Claude descriptors; terminalSessionSignals.ts openCode variant duplication.

Important Files Changed

Filename Overview
apps/desktop/src/main/services/chat/agentChatService.ts Core service migration: renames codexFastMode → fastMode, adds readLegacyFastMode for DB backward compat, wires applyClaudeFastModeSettingToRuntime, and gates initialFastMode with a fallback-to-true for unresolvable Claude descriptors.
apps/desktop/src/shared/cliLaunch.ts Adds codexServiceTierFlags, claudeFastModeSettingsFlags, and openCodeVariantForLaunch; wires fastMode into Claude, Codex, and OpenCode CLI launch/resume commands.
apps/desktop/src/main/utils/terminalSessionSignals.ts Adds extractFastMode, extractClaudeFastMode, extractOpenCodeVariant parsers; inlines openCodeVariantForLaunch logic rather than importing it from cliLaunch.ts.
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx Renames codexFastMode state to fastMode; adds readStoredFastMode compat helper; serialises rapid toggles via pendingFastModeUpdateRef; adds headerChips for codexServiceTier display.
apps/desktop/src/main/services/automations/automationService.ts Removes codex-only providerGroup guard; reads action.fastMode (normalised by projectConfigService) and passes fastMode to createSession for any provider.
apps/desktop/src/main/services/chat/cursorModelsDiscovery.ts Adds standard-tier matching to resolveCursorSdkModelSelectionParams; preserveExistingReasoning prevents reasoning params from being overwritten.
apps/desktop/src/shared/types/chat.ts Adds fastMode + codexServiceTier to AgentChatSession/Summary; adds fastMode + deprecated codexFastMode aliases to all arg types.
apps/desktop/src/renderer/lib/linearBatchLaunch.ts Renames codexFastMode → fastMode in BatchLaunchIssueConfig; passes fastMode to resolveCliLaunchProviderAndModel for Cursor variant resolution.

Sequence Diagram

sequenceDiagram
    participant UI as AgentChatPane
    participant IPC as agentChatService
    participant RT as Runtime

    Note over UI,RT: Fast-mode toggle (Claude)
    UI->>IPC: "updateSession({ fastMode: true })"
    IPC->>IPC: "managed.session.fastMode = true"
    IPC->>IPC: sessionEffectiveFastMode() check
    IPC->>RT: "applyFlagSettings({ fastMode: true })"
    alt applyFlagSettings available
        RT-->>IPC: ok
    else not available or error
        IPC->>RT: resetClaudeQuerySession()
    end
    IPC-->>UI: updated session (fastMode: true)

    Note over UI,RT: Fast-mode toggle (Codex)
    UI->>IPC: "updateSession({ fastMode: true })"
    IPC->>IPC: "managed.session.fastMode = true"
    IPC->>IPC: "managed.runtime.threadResumed = false"
    IPC-->>UI: updated session (fastMode: true)
    Note over IPC,RT: service_tier=fast embedded in next CLI command

    Note over UI,RT: Fast-mode toggle (OpenCode)
    UI->>IPC: "updateSession({ fastMode: true })"
    IPC->>IPC: "managed.session.fastMode = true"
    IPC-->>UI: updated session (fastMode: true)
    Note over IPC,RT: --variant fast embedded in per-turn command
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/desktop/src/main/utils/terminalSessionSignals.ts:277-285
The OpenCode variant computation (`fastMode === true ? "fast" : normalizeCliFlagValue(reasoningEffort)`) is inlined twice here and also expressed as the named `openCodeVariantForLaunch` function in `cliLaunch.ts`. Since this module already imports `claudeFastModeSettingsFlags` and `codexServiceTierFlags` from `cliLaunch.ts`, it could import and reuse that function too, keeping the three-way priority rule in one place.

```suggestion
function buildOpenCodeResumeCommand(args: {
  permissionMode: AgentChatPermissionMode | null | undefined;
  targetId: string | null;
  model?: string | null;
  reasoningEffort?: string | null;
  fastMode?: boolean | null;
  prompt?: string | null;
}): string {
  const variant = openCodeVariantForLaunch(args);
```

### Issue 2 of 2
apps/desktop/src/main/services/chat/agentChatService.ts:17654-17658
When `resolvedDescriptor` is null for a Claude session (e.g. an unknown or dynamically-registered model ID was passed), `initialFastMode` falls through to `true`. The session is created with `fastMode: true` in state, even though `sessionEffectiveFastMode` will later return `false` because the descriptor is missing. The UI will show the fast-mode toggle as "on" while fast mode is not actually applied. Defaulting to `false` for the unknown-descriptor case is safer and matches user expectations.

```suggestion
    const initialFastMode = requestedFastMode === true
      && (
        effectiveProvider !== "claude"
        || (resolvedDescriptor ? modelSupportsFastMode(resolvedDescriptor) : false)
      );
```

Reviews (2): Last reviewed commit: "ship: iter 1 — fastMode backward-compat ..." | Re-trigger Greptile

…tiers

Generalize the Codex-only fast toggle into a provider-agnostic `fastMode`
across chat, automations, review, orchestration, batch launch and the TUI,
with per-provider wiring:

- Claude: `--settings '{"fastMode":…}'` CLI flag + Agent SDK settings layer
  + live `applyFlagSettings` runtime control; new `serviceTiers:["fast"]` on
  Opus models in the model registry.
- Codex: `service_tier`/`features.fast_mode` -c flags and `service_tier`
  JSON-RPC arg; track the app-server's effective tier in
  `AgentChatSession.codexServiceTier`.
- OpenCode: `--variant fast` launch/resume.
- Cursor: explicit standard-tier selection when fastMode is off, preserving
  selected reasoning effort.

Backward compatibility preserved via `@deprecated codexFastMode` aliases read
at every input/persistence boundary (`fastMode ?? codexFastMode`). Tests
updated/added across services, shared CLI builders, terminal resume signals,
and the TUI, incl. coverage for the deprecated-alias fallback.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mintlify

mintlify Bot commented Jun 7, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ade-ac1c6011 🟢 Ready View Preview Jun 7, 2026, 10:53 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Jun 7, 2026 11:42pm

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR systematically renames the Codex-specific codexFastMode field to a cross-provider fastMode field across CLI, services, React components, and tests. Type contracts are extended with the new field while retaining deprecated legacy fields for backward compatibility. CLI command construction now handles fast-mode through provider-specific flags (Codex service tiers, Claude settings JSON, OpenCode variants). Session management is updated to persist and apply fast-mode during creation, updates, and inline commands.

Changes

Cross-provider fast mode unification

Layer / File(s) Summary
Type and API contract updates
apps/*/src/shared/types/*, apps/ade-cli/src/tuiClient/adeApi.ts
Added fastMode?: boolean field to chat session, creation args, launch args, handoff args, and update args types, alongside deprecation markers for legacy codexFastMode. Updated model selection and spawn fingerprint types similarly.
CLI command construction and fast-mode flags
apps/desktop/src/shared/cliLaunch.ts, apps/desktop/src/main/utils/terminalSessionSignals.ts
Added fastMode parameter to startup/launch/resume command builders and new helper functions codexServiceTierFlags() and claudeFastModeSettingsFlags(). OpenCode command builders now derive variant from fast-mode. Resume command parsing extracts fast-mode from provider-specific CLI arguments.
Session type updates and persistence normalization
apps/desktop/src/main/services/chat/agentChatService.ts
Session type now includes fastMode?: boolean and codexServiceTier?: string | null fields. Added normalizeFastMode() and readLegacyFastMode() helpers to treat persisted legacy values as a single field.
Agent chat service core session management
apps/desktop/src/main/services/chat/agentChatService.ts
Updated session creation, persistence, hydration, and updates to compute initial fast-mode from inputs and model support constraints. Added async Claude runtime fast-mode application and inline /fast slash command handling with pending-reset behavior on failures.
Model discovery and routing for Cursor and Droid
apps/desktop/src/main/services/chat/cursorModelsDiscovery.ts, apps/desktop/src/main/services/chat/droidModelsDiscovery.ts
Cursor parameter resolution now supports fast/standard service tier selection. Droid model discovery removed serviceTiers field handling.
Automation service and orchestration tool updates
apps/desktop/src/main/services/automations/*, apps/desktop/src/main/services/ai/tools/orchestrationTools.ts, apps/desktop/src/main/services/ipc/registerIpc.ts
Automation action/execution normalization now derives fastMode from either new or legacy fields. Orchestration tools route fastMode through model selection and spawn fingerprints.
React chat UI component wiring for fastMode
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx, apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx
Updated persisted launch config, composer draft snapshots, session sync, and handoff configuration to use fastMode. Model picker integration and session creation/update flows now propagate fast-mode to backend.
Composer parallel launch and modal support
apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx, apps/desktop/src/renderer/components/app/BatchLaunchModal.tsx
AgentChatComposer props now include fastMode and onFastModeChange with parallel slot support. BatchLaunchModal manages per-issue and default fast-mode state.
Review service and batch launch integration
apps/desktop/src/main/services/review/*, apps/desktop/src/renderer/components/review/*, apps/desktop/src/renderer/lib/linearBatchLaunch.ts, apps/desktop/src/renderer/components/app/LinearQuickViewButton.tsx
Review service and components updated to use fastMode. Batch launch extended with Cursor CLI variant resolution based on fast-mode.
Terminal resume and PTY service integration
apps/desktop/src/main/utils/terminalSessionSignals.ts, apps/desktop/src/main/services/pty/ptyService.ts
Terminal signal parsing now extracts fast-mode from provider-specific CLI patterns. PTY service passes fast-mode into OpenCode replay resume commands.
Automation editor UI component updates
apps/desktop/src/renderer/components/automations/*
ActionRow, RulesTab, and RuleEditorPanel updated to use fastMode field in action row values and draft conversions.
ADE CLI and TUI client updates
apps/ade-cli/src/cli.ts, apps/ade-cli/src/tuiClient/*
CLI chat launch configuration, TUI client API signatures, and model state types updated to use fastMode.
Agent chat CLI launch with fast-mode support
apps/desktop/src/main/services/chat/agentChatCliLaunch.ts
CLI launch command now conditionally sets fastMode for Codex, Claude, and OpenCode providers.
Test suite updates for fastMode
All test files
Updated test fixtures, assertions, and mocking across agent chat service tests, CLI launch tests, composer tests, pane tests, and automation tests to use fastMode instead of codexFastMode.
Renderer browser mock updates
apps/desktop/src/renderer/browserMock.ts
Browser mock's agent chat summary payload now computes fastMode from session resume metadata.
Project config service fast-mode coercion
apps/desktop/src/main/services/config/projectConfigService.ts, apps/desktop/src/main/services/config/projectConfigService.test.ts
Config coercion normalized to read from either new or legacy input fields and emit fastMode output.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Suggested labels

desktop

✨ 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 ade/codex-fast-toggle-audit-ba73ba38

@arul28

arul28 commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

@copilot review but do not make fixes

Comment thread apps/desktop/src/renderer/components/review/ReviewPage.tsx Outdated
Comment thread apps/desktop/src/main/services/review/reviewService.ts Outdated
Comment thread apps/desktop/src/shared/cliLaunch.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

Caution

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

⚠️ Outside diff range comments (5)
apps/ade-cli/src/tuiClient/app.tsx (3)

6614-6631: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Pass fastMode into Claude terminal launches.

Both Claude launch paths compute normalized.fastMode but never forward it to startClaudeTerminalSession, so new Claude chats always start on the default tier. Right now the TUI toggle only affects the non-Claude create path.

🔧 Suggested patch
     const created = await startClaudeTerminalSession({
       connection: conn,
       laneId,
       title,
       model: normalized.modelId ?? normalized.model,
       reasoningEffort: normalized.reasoningEffort,
+      fastMode: normalized.fastMode,
       permissionMode: normalized.permissionMode,
       initialInput: text.trim() ? text : null,
       cols,
       rows: terminalRows,
     });
         await startClaudeTerminalSession({
           connection: conn,
           laneId,
           title: pendingNewChatTitleRef.current ?? "Claude Code",
           model: normalized.modelId ?? normalized.model,
           reasoningEffort: normalized.reasoningEffort,
+          fastMode: normalized.fastMode,
           permissionMode: normalized.permissionMode,
           initialInput: terminalPrompt.trim() ? terminalPrompt : null,
           cols,
           rows: terminalRows,
         });

Also applies to: 8553-8563

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/ade-cli/src/tuiClient/app.tsx` around lines 6614 - 6631, The Claude
launch path builds a normalized object with normalized.fastMode but never passes
it into startClaudeTerminalSession, so Claude chats ignore the fastMode toggle;
update the startClaudeTerminalSession calls (e.g., the call in app.tsx where
title, model, reasoningEffort, permissionMode, initialInput, cols, rows are
passed) to also pass fastMode: normalized.fastMode (and do the same for the
other Claude launch location around lines 8553-8563) so the new Claude terminal
session respects the fastMode setting.

4302-4313: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Preserve the deprecated status-line field during the migration.

This payload drops model.codexFastMode, so existing user status-line scripts will start reading undefined even though the migration keeps deprecated aliases elsewhere for compatibility. Emit both keys until those scripts can move to fastMode.

🔧 Suggested compatibility patch
         model: {
           id: modelState.modelId,
           displayName: modelState.displayName,
           display_name: modelState.displayName,
           provider: modelState.provider,
           fastMode: modelState.fastMode,
+          codexFastMode: modelState.fastMode,
           supportsEffort: modelReasoningEfforts(modelState, models).length > 0,
         },
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/ade-cli/src/tuiClient/app.tsx` around lines 4302 - 4313, The payload
sent to runClaudeStatusLineCommand drops the deprecated alias
model.codexFastMode, breaking existing status-line scripts; update the model
object construction in app.tsx (the call to runClaudeStatusLineCommand / the
model literal using modelState) to emit both keys by adding a codexFastMode
property (e.g., codexFastMode: modelState.codexFastMode ?? modelState.fastMode)
alongside fastMode so legacy scripts continue to see the deprecated field until
fully migrated.

8674-8699: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Claude fast-mode changes never reach the running terminal session.

These branches only flip local modelState.fastMode. For terminal-backed Claude sessions, the normal model commit path is skipped, and the follow-up Claude sync here only applies model/effort changes. The UI can show fast mode enabled while the live Claude session stays on the previous tier.

Also applies to: 8883-8885, 9130-9137, 9902-9905, 11402-11406, 11471-11474

apps/desktop/src/renderer/components/chat/AgentChatPane.tsx (2)

7106-7113: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't send an invisible fastMode override on OpenCode handoffs.

Line 7111 includes fastMode for OpenCode, but the toggle only renders inside the Codex-specific branch here. OpenCode handoffs can therefore inherit a hidden stale value, and unsupported OpenCode targets still receive the flag.

Suggested fix
-        ...(handoffTargetProvider === "codex" || handoffTargetProvider === "opencode"
+        ...((handoffTargetProvider === "codex" || handoffTargetProvider === "opencode")
+          && modelSupportsFastMode(handoffTargetDescriptor)
           ? { fastMode: handoffFastMode }
           : {}),
-          {handoffTargetProvider === "codex" ? (
+          {handoffTargetProvider === "codex" ? (
             <div className="space-y-0.5">
               <select
                 value={handoffCodexSelectValue}
@@
-              {modelSupportsFastMode(handoffTargetDescriptor) ? (
-                <button
-                  type="button"
-                  className={cn(
-                    "mt-1 inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 font-sans text-[11px] font-semibold transition-colors",
-                    handoffFastMode
-                      ? "border-amber-300/28 bg-amber-400/12 text-amber-100"
-                      : "border-white/[0.08] bg-white/[0.03] text-muted-fg/62 hover:bg-white/[0.06] hover:text-fg/78",
-                  )}
-                  aria-pressed={handoffFastMode}
-                  aria-label="Fast mode for handoff"
-                  onClick={() => setHandoffFastMode((current) => !current)}
-                >
-                  <Lightning size={12} weight="fill" />
-                  Fast
-                </button>
-              ) : null}
               {handoffCodexPermissionPreset === "custom" ? (
                 <div className="text-[10px] text-amber-200/55">Session uses a custom policy; select a standard preset to apply to the new chat.</div>
               ) : null}
             </div>
           ) : null}
+          {(handoffTargetProvider === "codex" || handoffTargetProvider === "opencode")
+            && modelSupportsFastMode(handoffTargetDescriptor) ? (
+            <button
+              type="button"
+              className={cn(
+                "mt-1 inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 font-sans text-[11px] font-semibold transition-colors",
+                handoffFastMode
+                  ? "border-amber-300/28 bg-amber-400/12 text-amber-100"
+                  : "border-white/[0.08] bg-white/[0.03] text-muted-fg/62 hover:bg-white/[0.06] hover:text-fg/78",
+              )}
+              aria-pressed={handoffFastMode}
+              aria-label="Fast mode for handoff"
+              onClick={() => setHandoffFastMode((current) => !current)}
+            >
+              <Lightning size={12} weight="fill" />
+              Fast
+            </button>
+          ) : null}

As per coding guidelines, "Keep IPC contracts, preload types, shared types, and renderer usage in sync whenever an interface changes."

Also applies to: 8417-8456

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx` around lines
7106 - 7113, The handoff call is incorrectly sending a fastMode override for
OpenCode targets because fastMode is only rendered in the Codex UI branch;
update the payload building for window.ade.agentChat.handoff so that fastMode is
included only when handoffTargetProvider === "codex" (not when "opencode"),
i.e., change the spread condition around fastMode to explicitly check for codex,
and mirror the same change in the other affected call sites (the similar block
around lines 8417-8456) so OpenCode never receives a hidden fastMode flag.

Source: Coding guidelines


2245-2258: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use the runtime catalog when restoring draft fastMode.

normalizeStoredComposerDraft() only checks getModelById(modelId). Runtime-discovered models will always look unsupported here, so a saved draft can come back with fastMode: false even though the snapshot stored true.

Suggested fix
-  const desc = modelId ? getModelById(modelId) : null;
+  const desc = modelId
+    ? (resolveModelDescriptorWithRuntimeCatalog(modelId) ?? getModelById(modelId))
+    : null;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx` around lines
2245 - 2258, normalizeStoredComposerDraft currently uses getModelById(modelId)
only, so runtime-discovered models appear unsupported and fastMode can be lost;
change the lookup so desc is resolved from the runtime catalog when getModelById
returns null (e.g., fallback to the runtime-discovered model lookup or
runtimeCatalog.get/model lookup) before calling modelSupportsFastMode(desc) and
readStoredFastMode(value), and add any needed import/usage of the runtime
catalog helper so runtime models restore their fastMode correctly.
♻️ Duplicate comments (1)
apps/desktop/src/main/services/automations/automationPlannerService.ts (1)

864-866: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Duplicate: Type check pattern may break fallback logic.

Same issue as lines 755-757. If requestedExecution.session?.fastMode is present but not a boolean, the fallback to requestedExecution.session?.codexFastMode will not work.

🔧 Proposed fix
-...(typeof (requestedExecution.session?.fastMode ?? requestedExecution.session?.codexFastMode) === "boolean"
-  ? { fastMode: Boolean(requestedExecution.session?.fastMode ?? requestedExecution.session?.codexFastMode) }
-  : {}),
+...(() => {
+  const value = requestedExecution.session?.fastMode ?? requestedExecution.session?.codexFastMode;
+  return typeof value === "boolean" ? { fastMode: value } : {};
+})(),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/main/services/automations/automationPlannerService.ts`
around lines 864 - 866, The current conditional uses typeof
(requestedExecution.session?.fastMode ??
requestedExecution.session?.codexFastMode) === "boolean" which prevents falling
back to codexFastMode when fastMode exists but isn’t a boolean; update the logic
in the spread that builds fastMode so it explicitly checks fastMode first and
only if its typeof !== "boolean" then checks typeof
requestedExecution.session?.codexFastMode === "boolean" and uses that, otherwise
omit fastMode; locate the ternary using requestedExecution.session?.fastMode and
requestedExecution.session?.codexFastMode and replace it with a two-step
type-check (fastMode then codexFastMode) to preserve the intended fallback
behavior.
🧹 Nitpick comments (3)
apps/desktop/src/main/services/ai/tools/orchestrationTools.ts (1)

186-194: 💤 Low value

Optional: Redundant .partial() on already-optional fields.

Both reasoningEffort and fastMode are already marked .optional() in the schema (lines 190-191), so calling .partial({ reasoningEffort: true, fastMode: true }) on line 193 is redundant. The .partial() call has no additional effect and can be removed.

The same pattern appears at lines 1023-1030.

♻️ Simplify the schema
       modelOverride: z
         .object({
           provider: z.string(),
           modelId: z.string(),
           reasoningEffort: z.string().nullable().optional(),
           fastMode: z.boolean().optional(),
         })
-        .partial({ reasoningEffort: true, fastMode: true })
         .optional(),
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/main/services/ai/tools/orchestrationTools.ts` around lines
186 - 194, The schema for modelOverride currently marks reasoningEffort and
fastMode as .optional() and then calls .partial({ reasoningEffort: true,
fastMode: true }) unnecessarily; remove the .partial(...) call in the
modelOverride z.object declaration (and the identical redundant .partial at
lines later in the file) so the optional flags on reasoningEffort and fastMode
are the sole indicators of optionality—look for the modelOverride object and the
properties reasoningEffort and fastMode to locate and remove the redundant
.partial usage.
apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx (1)

537-553: 💤 Low value

Optional: Update test description to reflect provider-agnostic field name.

The test description says "toggles Codex fast mode" but the field has been renamed to the provider-agnostic fastMode. Consider updating the test name to "toggles fast mode for Codex sessions with supported models" or similar to better reflect that fastMode is no longer Codex-specific, even though this particular test exercises it with a Codex session.

The same applies to the test at line 555 ("hides Codex fast mode for unsupported models").

📝 Suggested test name updates
- it("toggles Codex fast mode for supported models", () => {
+ it("toggles fast mode for Codex sessions with supported models", () => {
- it("hides Codex fast mode for unsupported models", () => {
+ it("hides fast mode toggle for Codex sessions with unsupported models", () => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx` around
lines 537 - 553, The test name "toggles Codex fast mode for supported models" is
outdated; update the test description to reference the provider-agnostic field
(fastMode) while keeping the intent. Rename the it(...) description to something
like "toggles fast mode for Codex sessions with supported models" (similarly
update the other test "hides Codex fast mode for unsupported models"), leaving
the test body, props passed to renderComposer (sessionProvider, modelId,
availableModelIds, fastMode, onFastModeChange), and assertions unchanged so
renderComposer, fastMode, and onFastModeChange continue to be used as before.
apps/desktop/src/shared/types/chat.ts (1)

1311-1313: ⚡ Quick win

Consider using JSDoc @deprecated tags for better IDE support.

The deprecation comments are helpful, but TypeScript's @deprecated JSDoc annotation on the legacy codexFastMode field would provide stricter tooling support (strikethroughs in IDEs, lint warnings).

📝 Example with proper JSDoc deprecation
 export type AgentChatCreateArgs = {
   // ... other fields ...
   fastMode?: boolean;
-  /** `@deprecated` Use fastMode. Accepted for older renderer/IPC callers. */
+  /**
+   * `@deprecated` Use fastMode instead. Accepted for backward compatibility with older renderer/IPC callers.
+   */
   codexFastMode?: boolean;

Apply the same pattern to AgentChatLaunchCliArgs, AgentChatHandoffArgs, and AgentChatUpdateSessionArgs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/shared/types/chat.ts` around lines 1311 - 1313, Update the
legacy boolean field declarations to use JSDoc `@deprecated` annotations so IDEs
and linters pick up the deprecation: replace the inline comment on codexFastMode
with a JSDoc block like /** `@deprecated` Use fastMode. Accepted for older
renderer/IPC callers. */ placed immediately above the codexFastMode property,
and apply the same change to the codexFastMode definitions in the
AgentChatLaunchCliArgs, AgentChatHandoffArgs, and AgentChatUpdateSessionArgs
interfaces so tooling shows strikethroughs/warnings while retaining fastMode as
the preferred property.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/ade-cli/src/cli.ts`:
- Around line 3504-3505: The session payload currently only sets fastMode (via
fastRequested/standardRequested) which breaks older desktop socket RPCs
expecting the deprecated codexFastMode; when building outbound session objects
(e.g., where config.fastMode is set and in createConnection()’s session
serialization for the "desktop-socket" path) add codexFastMode: config.fastMode
(or codexFastMode: !!fastMode) alongside fastMode so both aliases are sent, and
update all related payload construction sites (including where
fastRequested/standardRequested toggle config.fastMode) to preserve the legacy
codexFastMode field.

In `@apps/ade-cli/src/services/sync/syncRemoteCommandService.ts`:
- Around line 755-757: The current fallback uses
asOptionalBoolean(value.fastMode ?? value.codexFastMode) which loses a legacy
boolean when fastMode exists but is non-boolean; update the parsing so you
normalize each candidate separately and apply boolean-precedence: set
parsed.fastMode = asOptionalBoolean(value.fastMode) ??
asOptionalBoolean(value.codexFastMode). Do the same fix for the other occurrence
that assigns parsed.fastMode around the code block using the same symbols
(value.fastMode, value.codexFastMode, asOptionalBoolean, parsed.fastMode) so
legacy aliasing works correctly.

In `@apps/desktop/src/main/services/automations/automationPlannerService.ts`:
- Around line 755-757: The spread logic that emits fastMode should evaluate
action?.fastMode and action?.codexFastMode independently because using typeof
(action?.fastMode ?? action?.codexFastMode) can hide a valid boolean fallback
when the first value exists but is not a boolean; update the construction that
currently uses the ternary with typeof (action?.fastMode ??
action?.codexFastMode) to instead check each field separately (e.g., test typeof
action?.fastMode === "boolean" first, else test typeof action?.codexFastMode ===
"boolean") and only include { fastMode: ... } when a boolean is found,
referencing the same action object and the properties fastMode and codexFastMode
so fallback works correctly.

In `@apps/desktop/src/main/services/chat/agentChatService.ts`:
- Around line 24087-24093: The current code unconditionally deletes
managed.session.fastMode when nextProvider === "claude", which can drop a
user-enabled fastMode even if the target Claude model supports it; remove that
unconditional delete and instead only clear fastMode when the destination model
does not support it by consulting sessionSupportsFastMode (use the same check
used later with the model identifier/descriptor.id or nextModel); this makes the
model update path consistent with session creation and preserves user fastMode
when sessionSupportsFastMode(...) returns true while still clearing it when the
new model lacks fast-mode support.

In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx`:
- Around line 8180-8223: handleFastModeChange currently calls
window.ade.agentChat.updateSession immediately which allows concurrent toggles
to race; change it to serialize fast-mode mutations by checking
pendingFastModeUpdateRef.current for the same session and awaiting its promise
(or chaining off it) before issuing a new updateSession call, incrementing
fastModeUpdateCounterRef and computing a new updateId only when ready; retain
the existing optimistic UI via patchSessionSummary/setFastMode, ensure the
finally block clears pendingFastModeUpdateRef for that session/updateId, and
reuse updatePromise/refreshSessions/error handling logic so only one
updateSession runs at a time per session (refer to handleFastModeChange,
pendingFastModeUpdateRef, fastModeUpdateCounterRef, updatePromise,
updateSession, patchSessionSummary, refreshSessions).

In `@apps/desktop/src/renderer/components/chat/ChatModelSelectionPendingCard.tsx`:
- Around line 78-80: The fastMode state in ChatModelSelectionPendingCard can
remain true when the user selects a model that doesn't support fastMode; update
the component to reset/clear fastMode whenever the selected model (e.g., the
selected model prop or the suggested?.model entry used to initialize state)
changes to one that lacks fast capability — detect model changes (where
selected/suggested model is read, e.g., around the initialization and the
selection handlers at lines referenced) and call setFastMode(false) when that
model's supportsFast (or equivalent capability flag) is false so stale/invalid
fastMode values are never submitted downstream.

---

Outside diff comments:
In `@apps/ade-cli/src/tuiClient/app.tsx`:
- Around line 6614-6631: The Claude launch path builds a normalized object with
normalized.fastMode but never passes it into startClaudeTerminalSession, so
Claude chats ignore the fastMode toggle; update the startClaudeTerminalSession
calls (e.g., the call in app.tsx where title, model, reasoningEffort,
permissionMode, initialInput, cols, rows are passed) to also pass fastMode:
normalized.fastMode (and do the same for the other Claude launch location around
lines 8553-8563) so the new Claude terminal session respects the fastMode
setting.
- Around line 4302-4313: The payload sent to runClaudeStatusLineCommand drops
the deprecated alias model.codexFastMode, breaking existing status-line scripts;
update the model object construction in app.tsx (the call to
runClaudeStatusLineCommand / the model literal using modelState) to emit both
keys by adding a codexFastMode property (e.g., codexFastMode:
modelState.codexFastMode ?? modelState.fastMode) alongside fastMode so legacy
scripts continue to see the deprecated field until fully migrated.

In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx`:
- Around line 7106-7113: The handoff call is incorrectly sending a fastMode
override for OpenCode targets because fastMode is only rendered in the Codex UI
branch; update the payload building for window.ade.agentChat.handoff so that
fastMode is included only when handoffTargetProvider === "codex" (not when
"opencode"), i.e., change the spread condition around fastMode to explicitly
check for codex, and mirror the same change in the other affected call sites
(the similar block around lines 8417-8456) so OpenCode never receives a hidden
fastMode flag.
- Around line 2245-2258: normalizeStoredComposerDraft currently uses
getModelById(modelId) only, so runtime-discovered models appear unsupported and
fastMode can be lost; change the lookup so desc is resolved from the runtime
catalog when getModelById returns null (e.g., fallback to the runtime-discovered
model lookup or runtimeCatalog.get/model lookup) before calling
modelSupportsFastMode(desc) and readStoredFastMode(value), and add any needed
import/usage of the runtime catalog helper so runtime models restore their
fastMode correctly.

---

Duplicate comments:
In `@apps/desktop/src/main/services/automations/automationPlannerService.ts`:
- Around line 864-866: The current conditional uses typeof
(requestedExecution.session?.fastMode ??
requestedExecution.session?.codexFastMode) === "boolean" which prevents falling
back to codexFastMode when fastMode exists but isn’t a boolean; update the logic
in the spread that builds fastMode so it explicitly checks fastMode first and
only if its typeof !== "boolean" then checks typeof
requestedExecution.session?.codexFastMode === "boolean" and uses that, otherwise
omit fastMode; locate the ternary using requestedExecution.session?.fastMode and
requestedExecution.session?.codexFastMode and replace it with a two-step
type-check (fastMode then codexFastMode) to preserve the intended fallback
behavior.

---

Nitpick comments:
In `@apps/desktop/src/main/services/ai/tools/orchestrationTools.ts`:
- Around line 186-194: The schema for modelOverride currently marks
reasoningEffort and fastMode as .optional() and then calls .partial({
reasoningEffort: true, fastMode: true }) unnecessarily; remove the .partial(...)
call in the modelOverride z.object declaration (and the identical redundant
.partial at lines later in the file) so the optional flags on reasoningEffort
and fastMode are the sole indicators of optionality—look for the modelOverride
object and the properties reasoningEffort and fastMode to locate and remove the
redundant .partial usage.

In `@apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx`:
- Around line 537-553: The test name "toggles Codex fast mode for supported
models" is outdated; update the test description to reference the
provider-agnostic field (fastMode) while keeping the intent. Rename the it(...)
description to something like "toggles fast mode for Codex sessions with
supported models" (similarly update the other test "hides Codex fast mode for
unsupported models"), leaving the test body, props passed to renderComposer
(sessionProvider, modelId, availableModelIds, fastMode, onFastModeChange), and
assertions unchanged so renderComposer, fastMode, and onFastModeChange continue
to be used as before.

In `@apps/desktop/src/shared/types/chat.ts`:
- Around line 1311-1313: Update the legacy boolean field declarations to use
JSDoc `@deprecated` annotations so IDEs and linters pick up the deprecation:
replace the inline comment on codexFastMode with a JSDoc block like /**
`@deprecated` Use fastMode. Accepted for older renderer/IPC callers. */ placed
immediately above the codexFastMode property, and apply the same change to the
codexFastMode definitions in the AgentChatLaunchCliArgs, AgentChatHandoffArgs,
and AgentChatUpdateSessionArgs interfaces so tooling shows
strikethroughs/warnings while retaining fastMode as the preferred property.
🪄 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: 19f63200-b28c-444b-859a-e1660732b161

📥 Commits

Reviewing files that changed from the base of the PR and between 810dc75 and c41eb98.

⛔ Files ignored due to path filters (1)
  • docs/features/chat/agent-routing.md is excluded by !docs/**
📒 Files selected for processing (58)
  • apps/ade-cli/src/cli.ts
  • apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
  • apps/ade-cli/src/tuiClient/__tests__/adeApi.test.ts
  • apps/ade-cli/src/tuiClient/__tests__/planMode.test.ts
  • apps/ade-cli/src/tuiClient/adeApi.ts
  • apps/ade-cli/src/tuiClient/app.tsx
  • apps/ade-cli/src/tuiClient/types.ts
  • apps/desktop/src/main/services/ai/tools/orchestrationTools.test.ts
  • apps/desktop/src/main/services/ai/tools/orchestrationTools.ts
  • apps/desktop/src/main/services/automations/automationPlannerService.ts
  • apps/desktop/src/main/services/automations/automationService.test.ts
  • apps/desktop/src/main/services/automations/automationService.ts
  • apps/desktop/src/main/services/chat/agentChatCliLaunch.test.ts
  • apps/desktop/src/main/services/chat/agentChatCliLaunch.ts
  • apps/desktop/src/main/services/chat/agentChatService.test.ts
  • apps/desktop/src/main/services/chat/agentChatService.ts
  • apps/desktop/src/main/services/chat/cursorModelsDiscovery.test.ts
  • apps/desktop/src/main/services/chat/cursorModelsDiscovery.ts
  • apps/desktop/src/main/services/chat/droidModelsDiscovery.test.ts
  • apps/desktop/src/main/services/chat/droidModelsDiscovery.ts
  • apps/desktop/src/main/services/config/projectConfigService.test.ts
  • apps/desktop/src/main/services/config/projectConfigService.ts
  • apps/desktop/src/main/services/ipc/registerIpc.ts
  • apps/desktop/src/main/services/orchestration/runtimeProfile.ts
  • apps/desktop/src/main/services/pty/ptyService.test.ts
  • apps/desktop/src/main/services/pty/ptyService.ts
  • apps/desktop/src/main/services/review/reviewService.test.ts
  • apps/desktop/src/main/services/review/reviewService.ts
  • apps/desktop/src/main/utils/terminalSessionSignals.test.ts
  • apps/desktop/src/main/utils/terminalSessionSignals.ts
  • apps/desktop/src/renderer/browserMock.ts
  • apps/desktop/src/renderer/components/app/BatchLaunchModal.tsx
  • apps/desktop/src/renderer/components/app/LinearQuickViewButton.tsx
  • apps/desktop/src/renderer/components/automations/ActionRow.tsx
  • apps/desktop/src/renderer/components/automations/RulesTab.tsx
  • apps/desktop/src/renderer/components/automations/components/RuleEditorPanel.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/components/chat/ChatModelSelectionPendingCard.tsx
  • apps/desktop/src/renderer/components/prs/shared/PrRequestAiReviewDialog.tsx
  • apps/desktop/src/renderer/components/review/ReviewPage.test.tsx
  • apps/desktop/src/renderer/components/review/ReviewPage.tsx
  • apps/desktop/src/renderer/components/shared/ReviewLaunchModelControls.tsx
  • apps/desktop/src/renderer/components/terminals/cliLaunch.test.ts
  • apps/desktop/src/renderer/lib/draftLaunchJobs.ts
  • apps/desktop/src/renderer/lib/linearBatchLaunch.test.ts
  • apps/desktop/src/renderer/lib/linearBatchLaunch.ts
  • apps/desktop/src/shared/cliLaunch.ts
  • apps/desktop/src/shared/modelRegistry.test.ts
  • apps/desktop/src/shared/modelRegistry.ts
  • apps/desktop/src/shared/types/automations.ts
  • apps/desktop/src/shared/types/chat.ts
  • apps/desktop/src/shared/types/config.ts
  • apps/desktop/src/shared/types/orchestration.ts
  • apps/desktop/src/shared/types/review.ts
  • apps/desktop/src/shared/types/sessions.ts
💤 Files with no reviewable changes (1)
  • apps/desktop/src/main/services/chat/droidModelsDiscovery.ts

Comment thread apps/ade-cli/src/cli.ts Outdated
Comment thread apps/ade-cli/src/services/sync/syncRemoteCommandService.ts
Comment thread apps/desktop/src/main/services/automations/automationPlannerService.ts Outdated
Comment thread apps/desktop/src/main/services/chat/agentChatService.ts
Comment thread apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
…deRabbit x6)

Greptile:
- ReviewPage display + reviewService.executeReviewerPass now read
  `fastMode ?? codexFastMode` so legacy persisted runs keep fast mode.
- openCodeVariantForLaunch: document that fast supersedes reasoningEffort.

CodeRabbit:
- cli.ts: mirror fastMode to the deprecated codexFastMode on OUTBOUND launch
  payloads so a pre-rename desktop daemon still honors --fast.
- syncRemoteCommandService + automationPlannerService: normalize each fast
  field independently so a non-boolean fastMode can't drop a valid codexFastMode.
- agentChatService.updateSession: only clear fastMode on a Claude switch when
  the target model lacks fast support (Opus supports it).
- AgentChatPane.handleFastModeChange: serialize rapid toggles via
  pendingFastModeUpdateRef so writes persist in order.
- ChatModelSelectionPendingCard: clear/gate stale fastMode when the picked
  model doesn't support it.

Tests added: agentChatService (preserve/clear Claude fast on model switch),
reviewService (legacy codexFastMode-only config launches fast), automation-
PlannerService (non-boolean fastMode falls back to codexFastMode).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@arul28

arul28 commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

@copilot review but do not make fixes

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant