Skip to content

feat(native-chat): add Codex Fast mode - #10111

Closed
Coke1120 wants to merge 4 commits into
stablyai:mainfrom
Coke1120:codex/native-chat-codex-fast-mode
Closed

Coke1120 wants to merge 4 commits into
stablyai:mainfrom
Coke1120:codex/native-chat-codex-fast-mode

Conversation

@Coke1120

@Coke1120 Coke1120 commented Jul 23, 2026 •

Copy link
Copy Markdown

Summary

  • Discover Codex reasoning levels and service tiers from codex debug models, so the selected model exposes only capabilities reported by the installed CLI.
  • Add a capability-gated Fast mode action to Orca's existing native-chat model/effort picker, including the provider description and live /fast toggle.
  • Preserve the new metadata across local, SSH, and paired-runtime RPC paths, with deduplicated discovery and retry after transient failures.

Screenshots

Codex Fast mode

Captured from Orca's Electron UI with a deterministic Codex capability fixture.

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Completed checks:

  • Focused Vitest regression suite: 8 files, 186 tests passed.
  • pnpm run typecheck: all three TypeScript targets passed.
  • Changed-file oxlint, React Doctor lint, and git diff --check passed.
  • pnpm run build:desktop passed.
  • Headless Electron interaction evidence passed for capability visibility, provider description, and the /fast command.

Environment limitations:

  • Full pnpm lint reached only pre-existing localization-catalog failures in unrelated workspace/sidebar components; this PR adds no translation key.
  • Full pnpm test encountered unrelated sandbox socket/daemon failures; the focused affected suites pass.
  • Full pnpm build completed the desktop build, then the native Swift package was blocked by the local CommandLineTools/SDK Swift version mismatch and unavailable user cache paths.

AI Review Report

Debugger, project-manager, and UI/UX reviews each reached 10/10 after fixes. The review explicitly checked:

  • macOS, Linux, and Windows compatibility, including shortcuts, labels, paths, shell behavior, and Electron-specific behavior; this change introduces no platform-specific shortcut/path logic and uses argv-based process execution.
  • local repositories, SSH worktrees, paired runtimes, mixed-version RPC peers, older Codex CLIs, and host-isolated discovery state.
  • provider-neutral behavior, capability gating, discovery caching/deduplication, bounded output, and hot-path impact.
  • style-guide fit, readable tradeoff copy, keyboard/screen-reader labeling, and dark/light theme token usage.

Issues found and resolved during review included stable-ID gating to avoid label false positives, malformed service-tier filtering, retry after transient discovery failures, host isolation, transport/RPC coverage, visible provider descriptions, and an accessible Fast-only label.

Security Audit

  • Treats codex debug models output as untrusted JSON and filters malformed, null, or blank capability entries.
  • Executes Codex with an argument vector (no shell interpolation) and retains the existing 4 MB output bound.
  • React escapes provider descriptions; no raw HTML is introduced.
  • RPC additions are optional for mixed-version compatibility.
  • No new dependencies, auth flow, secrets, filesystem paths, or credential handling are introduced.

No security follow-up is required.

Notes

  • Fast mode appears only when the selected Codex model reports the stable priority or fast service-tier ID.
  • The live action sends /fast; launch-time Fast selection is intentionally outside this scoped change.
  • Older Codex CLIs fall back to Orca's existing static model/effort behavior.
  • This is an independent, behavior-level implementation inspired by Tessera; no Tessera source code, assets, or dependencies were copied.
  • X (Twitter): not provided on the contributor's GitHub profile. GitHub: @Coke1120.

ELI5

Codex can run in a Fast mode. Orca learns what your installed Codex CLI supports and shows a Fast toggle in the model picker when it is available. That works locally, over SSH, and on paired runtimes.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Codex model discovery now parses and exposes service-tier metadata through runtime capability schemas. Native chat converts discovered capabilities into dynamic Codex catalog options, including reasoning effort and Fast mode, with authoritative option merging. Enrichment retries after empty or failed probes and isolates results by host. Native chat toggle controls now display descriptions, and single-option pill labels use the option’s localized name. Tests cover local, remote, runtime, catalog, enrichment, and UI behavior.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding Codex Fast mode.
Description check ✅ Passed The description covers summary, screenshots, testing, review, security, and notes, matching the template well.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/shared/agent-session-option-catalog-claude-codex.ts (1)

121-163: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Duplicated apply block between codexEffort and codexDiscoveredEffort.

The apply object (launchArgs/agentArgsOverride/midSession) is identical in both functions. Extracting a shared constant would prevent the two from silently diverging later.

♻️ Proposed refactor
+const CODEX_EFFORT_APPLY: CatalogOption['apply'] = {
+  launchArgs: (value) => ['-c', `model_reasoning_effort=${String(value)}`],
+  agentArgsOverride: hasCodexEffortOverride,
+  midSession: { kind: 'agent-picker', command: '/model' }
+}
+
 function codexEffort(includeExtraHigh: boolean): CatalogOption {
   return {
     ...
-    apply: {
-      launchArgs: (value) => ['-c', `model_reasoning_effort=${String(value)}`],
-      agentArgsOverride: hasCodexEffortOverride,
-      midSession: { kind: 'agent-picker', command: '/model' }
-    }
+    apply: CODEX_EFFORT_APPLY
   }
 }

 function codexDiscoveredEffort(model: CommitMessageModelCapability): CatalogOption | null {
   ...
-    apply: {
-      launchArgs: (value) => ['-c', `model_reasoning_effort=${String(value)}`],
-      agentArgsOverride: hasCodexEffortOverride,
-      midSession: { kind: 'agent-picker', command: '/model' }
-    }
+    apply: CODEX_EFFORT_APPLY
   }
 }

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4330cfd4-3c3d-4482-a9d4-d185ff24bda0

📥 Commits

Reviewing files that changed from the base of the PR and between 5610142 and 4e19f7377f1d753383bc334ae7cf424c2fdff806.

⛔ Files ignored due to path filters (1)
  • docs/assets/codex-fast-mode.png is excluded by !**/*.png
📒 Files selected for processing (18)
  • src/main/runtime/rpc/methods/git-params.ts
  • src/main/runtime/rpc/methods/git.test.ts
  • src/main/text-generation/commit-message-text-generation.test.ts
  • src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.test.tsx
  • src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsx
  • src/renderer/src/components/native-chat/native-chat-pty-session-options.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.test.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts
  • src/renderer/src/components/native-chat/native-chat-session-option-labels.ts
  • src/renderer/src/runtime/runtime-git-client.test.ts
  • src/shared/agent-session-option-catalog-claude-codex.ts
  • src/shared/agent-session-option-catalog-types.ts
  • src/shared/agent-session-option-catalog.test.ts
  • src/shared/agent-session-option-catalog.ts
  • src/shared/commit-message-agent-spec.test.ts
  • src/shared/commit-message-agent-spec.ts
  • src/shared/types.ts

@AmethystLiang

Copy link
Copy Markdown
Contributor

reviewing

@AmethystLiang
AmethystLiang requested a review from OrcaWin July 24, 2026 16:51
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
@Coke1120

Copy link
Copy Markdown
Author

Following up on this PR — I've addressed all actionable CodeRabbit feedback (casing fix in 8e1cad5c and the empty-discovery guard with a regression test). Happy to make further adjustments based on your review.

Also noting that the PR Checks workflow needs maintainer approval to run (first-time external contributor). Could someone approve the workflow so CI can execute?

I'll keep the branch rebased on main in the meantime.

Coke1120 added 3 commits July 29, 2026 19:15
Deduplicate the identical apply block between codexEffort and
codexDiscoveredEffort so the two cannot silently diverge.

Constraint: CodeRabbit nitpick — duplicated apply object
Confidence: high
Scope-risk: narrow
Tested: local typecheck
Not-tested: full test suite (no local pnpm install)
@Coke1120
Coke1120 force-pushed the codex/native-chat-codex-fast-mode branch from 8e1cad5 to 3e4c25a Compare July 29, 2026 11:16
@greptile-apps

greptile-apps Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

Greptile Summary

This PR adds a capability-gated Fast mode to Orca's Codex native-chat model picker. It runs codex debug models to discover per-model reasoning levels and service tiers, builds a CatalogModel from those capabilities, and merges the result against the static seed — with exponential backoff on failures and host-level isolation for SSH/paired-runtime paths.

  • parseModelServiceTiers in commit-message-agent-spec.ts parses and validates service-tier entries from the CLI, mapping the JSON name field to TypeScript label and filtering blank/malformed entries.
  • codexCatalogModelFromCapability sets optionsAuthoritative: true only when effort levels are present, so a Fast-only discovery augments seed options via mergeOptionsById rather than replacing them — correctly fixing the previous concern about the seed effort picker being silently dropped.
  • ensureNativeChatModelEnrichment now tracks consecutiveFailures and a retryAfter timestamp, applying a 200 ms–30 s exponential backoff on empty or failed discovery while keeping the state machine correctly re-entrant.

Confidence Score: 5/5

Safe to merge; all capability paths are guarded, discovery failures back off correctly, and the seed effort picker is preserved when the CLI only reports a Fast tier.

The two concerns raised in the previous round — unbounded discovery retries and silent loss of the seed effort picker on fast-only discovery — are both addressed cleanly. The backoff state machine is straightforward and well-tested. No logic issues were found in the merge, parse, or UI paths during this review.

Files Needing Attention: The JSDoc on optionsAuthoritative in agent-session-option-catalog-types.ts is slightly misleading but carries no runtime risk.

Important Files Changed

Filename Overview
src/shared/agent-session-option-catalog-claude-codex.ts Adds codexCatalogModelFromCapability, codexDiscoveredFastMode, and codexDiscoveredEffort; correctly gates optionsAuthoritative on effort presence only, fixing the previous concern about fast-only discovery silently dropping the seed effort picker.
src/shared/agent-session-option-catalog.ts Adds mergeOptionsById helper and updates mergeCatalogModels to respect optionsAuthoritative; non-authoritative discovered models now augment seed options rather than replace them.
src/shared/agent-session-option-catalog-types.ts Adds optionsAuthoritative field to CatalogModel; the JSDoc comment does not match the implementation which only sets it true when effort levels were discovered.
src/renderer/src/components/native-chat/native-chat-session-option-enrichment.ts Adds exponential backoff (200ms base, 30s cap) for failed discovery with consecutiveFailures tracking; correctly transitions state to idle on failure to allow future retries after the backoff window.
src/shared/commit-message-agent-spec.ts Adds parseModelServiceTiers with correct filtering of malformed/blank entries and maps Codex CLI name field to label; serviceTiers propagated through CommitMessageModel and CommitMessageModelCapability.
src/renderer/src/components/native-chat/native-chat-session-option-discovery.ts Replaces the previous stub (options: []) with catalogModelFromDiscoveredCapability, correctly routing codex to capability-aware construction and other agents to the simple form.
src/renderer/src/components/native-chat/NativeChatSessionOptionPickers.tsx Toggle-command menu items now use ChoiceBody to render provider descriptions alongside the label; case-lowering removed so labels display with correct capitalisation.
src/renderer/src/components/native-chat/native-chat-session-option-labels.ts nativeChatOptionsPillTitle/Label now use the single descriptor's label when no effort descriptor exists, so a Fast-only picker shows 'Fast mode' instead of the generic 'Session options'.
src/main/runtime/rpc/methods/git-params.ts Zod schema for CommitMessageModelCapability extended with optional serviceTiers array, keeping RPC backward-compatible with older peers.
src/shared/types.ts CommitMessageAiModelCapability extended with serviceTiers in the shared types file, consistent with other capability-related changes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([Native-chat surface opens]) --> B{catalog.listModels\npresent?}
    B -- No --> C([Use static seed catalog])
    B -- Yes --> D{enrichmentByAgentHost\nstate for agent+host?}
    D -- pending / settled --> C
    D -- idle, retryAfter > now --> C
    D -- idle, retryAfter <= now --> E[Set state = pending\nspawn codex debug models]
    E --> F{Result?}
    F -- non-empty --> G[parseCodexCatalogModels\ncreate CatalogModel per capability]
    G --> H{optionsAuthoritative?}
    H -- true: effort discovered --> I[Replace seed options\nwith CLI options]
    H -- false: fast-only or none --> J[mergeOptionsById:\naugment seed with discovered]
    I --> K[Notify listeners\nstate = settled]
    J --> K
    F -- empty or error --> L[consecutiveFailures++\nretryAfter = now + backoffDelay\nstate = idle]
    L --> C
Loading

Reviews (2): Last reviewed commit: "fix(native-chat): add discovery backoff ..." | Re-trigger Greptile

…ast-only discovery

Address two Greptile P2 findings:

1. Enrichment resets to idle on failure/empty with no backoff, so a
   caller that retries immediately spins in a tight loop. Add exponential
   backoff (200ms base, 30s cap) so persistent failures don't hammer
   discovery while transient blips still recover quickly.

2. optionsAuthoritative is set true whenever any option is discovered,
   even if only a Fast tier was found. This causes mergeCatalogModels to
   replace the seed effort picker entirely. Only mark authoritative when
   effort levels were actually discovered; for Fast-only results, augment
   the seed options instead of replacing them.

Constraint: Greptile P2 findings — no backoff + silent seed drop
Rejected: capping retry count instead of backoff | backoff recovers
transient failures while capping gives up permanently
Confidence: high
Scope-risk: narrow
Tested: 20 focused tests pass (catalog + enrichment), 32 shared spec tests pass
Not-tested: renderer component tests need path-alias resolution not
available in this shallow clone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants