Skip to content

fix(model-catalog): say why when an agent's Command isn't a runnable program - #48363

Merged
nwparker merged 1 commit into
stablyai:mainfrom
moooowoong:fix/model-catalog-command-not-runnable
Nov 24, 2026
Merged

nwparker merged 1 commit into
stablyai:mainfrom
moooowoong:fix/model-catalog-command-not-runnable

Conversation

@moooowoong

@moooowoong moooowoong commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Original fix by @moooowoong (squashed onto current main; authorship kept via Co-authored-by). Fixes #48362.

ELI5

If you set an agent's Command to something Orca can't start on its own (like a shell alias), Orca couldn't ask that agent which models it has. It quietly showed an old built-in list instead, and you couldn't tell anything was wrong. Now a chat's model picker and the chat composer say why: the Command isn't a program Orca can find.

What Changed

Before: with Settings → Agents → Codex → Command set to a shell function such as oc, every Codex model picker showed the bundled seed (GPT-5.6 Sol/Terra/Luna, GPT-5.5, GPT-5.2 Codex) with no reason.

After: the chat-surface launch picker and the chat composer's availability notice say the existing, already-translated chat-start sentence: "Codex's Command in Settings → Agents must start with a program Orca can find. …". Terminal-surface pickers keep their usual text, because a terminal types the Command into a shell, where an alias still runs. Settings → Agents keeps its built-in note ("Built-in list. Orca could not get a model list from this host."). Clearing or fixing the Command, or pressing Refresh models once it's fixed, brings the account's list back.

Mechanism:

  • agent-model-catalog-scope.ts: a Codex/Claude catalog read no longer drops a refusal from probe.resolve. An AgentSessionPreSpawnError with reason agentCommandNotRunnable yields a scope that carries that reason, held per launch folder (a relative PATH entry can refuse one folder and not another). It is carried alongside the account's saved list when there is one. A resolve-time cliMissing is not held or surfaced; the account's saved list answers for it, as on main.
  • agent-model-catalog-refresh.ts / -store.ts / -failures.ts: a refused scope skips listing. probeFailed maps the same agentCommandNotRunnable refusal when an ACP/Pi or legacy listing re-throws it (no cliMissing hold). The refusal is rechecked once its 30 s hold expires or on Refresh models (including a Refresh pressed mid-lookup), and a Settings change expires it.
  • AgentSessionUnavailable gains { reason: 'agentCommandNotRunnable' }; readAgentSessionUnavailable reads it.
  • Renderer: the chat-surface launch-picker model panel and the chat composer's availability notice show the existing components.native-chat.failureWords.agentCommandNotRunnable sentence (already in every locale). The composer notice keeps its existing "Open agent settings" action. A refused Command does not block catalog authority on any picker surface, so preset retirement and "No models match" behave as on main. The composer does not recheck this reason on window focus or turn edges; opening the model picker or Refresh models rechecks it.

Which program a chat launches is unchanged.

Why

The refusal already existed and already had a clear, translated explanation for chat starts; the catalog just swallowed it (.catch(() => null)). Surfacing it through the existing unavailable channel is the smallest provider-neutral fix and reuses the wording users already see.

Alternatives considered and not done: running shell functions/aliases for structured chats, or listing with the stock codex when a Command is set. Both change which program a chat uses and need a product decision.

Linked Issue

Fixes #48362

Visual Proof

Isolated dev profile (pnpm dev with its own profile directory), Codex Command set to oc (a shell function, not on PATH).

Before After
New-tab Codex picker (chat launch) before picker after picker

Settings → Agents → Codex is unchanged: it keeps its built-in note while the Command is refused, so there is no Settings "After" screenshot.

After clearing the Command, the account's own list is back:

after clearing the Command

Testing

  • I manually tested these changes locally (macOS; before/after above, plus clearing the Command to confirm recovery)
  • Automated tests added/updated, or explained why not below
  • Every added test fails without this change and avoids the test anti-patterns

agent-model-catalog-command-refusal.test.ts (8 tests, at the catalog service read):

  1. A refused Command says why alongside the account's saved list.
  2. A held refusal is looked up again only once it expires, and a fixed Command lists.
  3. A legacy listing refused for the same reason answers why too.
  4. One folder's held refusal does not stand for another folder.
  5. A Refresh rechecks a held refusal at once.
  6. A Refresh pressed during a running lookup still rechecks a held refusal.
  7. A Refresh on a Command still refused keeps the new hold.
  8. A saved-only read drops a held refusal its own lookup no longer gives.

agent-launch-setup-option-rows.test.ts: only a chat-surface picker shows the refusal sentence and hides Retry; a terminal-surface picker keeps "Codex models have not loaded." with Retry.

Maintainer checks (on the squashed commit, rebased onto current main):

  • Repro on main: the refusal tests fail on main's catalog sources ({ origin: 'unknown' } with no reason); a scratch test wiring the real createCodexModelCatalogProbe + resolveStructuredAgentCommand with Command oc returned no reason and ran 5 login-shell lookups for 5 reads on main, versus the reason and 1 lookup on this branch.
  • Targeted vitest on src/main/native-chat/agent-model-catalog/, agent-launch-setup-option-rows.test.ts and src/shared/agent-launch/picker/: 3 files, 16 tests pass. pnpm tc:node and pnpm tc:web passed during review.
  • oxlint, oxfmt, anti-slop oxlint, code-quality native plugins, ast-grep and the changed-code quality gate: clean on all 14 touched files.
  • Platforms: macOS (unit level + the contributor's manual run above). The change has no platform-specific code.

Performance

A refused Command is looked up again (one login-shell capture) at most once per folder per 30 s, plus once per Refresh models click. Window focus spawns nothing: the composer does not recheck this reason on focus or turn edges, so an idle composer plus alt-tab makes no catalog read, as on main. Before, every non-saved read of a refused Command ran a login-shell lookup: 50 reads went from 50 lookups to 1. No new timers, polling or sync I/O.

Benchmark (main process catalog read, not a hot path: runs per picker open, composer mount, or Refresh; 50 reads of one folder, harness probe counts each lookup):

case main this PR
refused Command (recover = login-shell capture) recover=50, no reason recover=1 + reason
refused + 5 Refresh clicks recover=50 recover=6
healthy Command recover=1 recover=1
resolve-time cliMissing recover=50 recover=50 (unchanged)
composer window focus x20, refused shown 0 reads 0 reads

In-process CPU per read is about 0.02 ms on both (1.0 ms CPU for 50 reads on the landed commit), within noise of main.

Risk

The riskiest part is the new unavailable reason on the host → client wire. Older desktop clients read an unknown reason as unknown (readAgentSessionUnavailable), and their launch picker already lists the seed rows, so they look the same as today. Mobile does not read this field. A wrong refusal would only add a note above the built-in rows on a chat picker or in the composer; it never blocks a launch and does not change picker authority. Nothing changes for cliMissing. Plain revert backs it out; nothing is persisted (the reason lives in the in-memory failure map).

Level: Low

Review

  • Cross-platform: no platform-specific code; the refusal comes from the existing shared command resolver on every OS.
  • SSH / remote / Orca server: the reason is produced by the host that resolves the Command and travels in the existing model-catalog answer; older clients ignore it.
  • Agents: provider-neutral. Codex/Claude go through the scope path. ACP and legacy reads go through probeFailed, which holds only agentCommandNotRunnable.
  • Performance: see above.
  • UI: reuses an existing translated sentence and the existing status line in each picker; no new strings or styles.
  • Security: no new inputs; the shown sentence names only the agent.
  • Independent review: Codex found that the first version keyed the refusal without the launch folder, so two folders could overwrite each other's reason; fixed (test 4). The spec pass flagged that ACP/legacy listings still lost the reason; fixed (test 3). Maintainer review rounds (Claude, Codex, Antigravity) added the hold, Refresh rechecks, chat-only wording, and kept authority and focus behavior as on main.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred) — lint, typecheck and build pass locally; pnpm test has 13 failures that also fail on unmodified main here, CI to confirm

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Catalog resolution now preserves agentCommandNotRunnable refusals and associates held failures with a workspace. Refresh can retry a held refusal, including when requested during an in-flight lookup. Catalog responses retain saved models and expose the refusal reason. Picker surfaces display the command failure, with chat-specific retry behavior.

Severity of issue fixed: Medium

Merge Risk: Minimal · up to b7875

Model pickers now explain when an agent's Command is not a runnable program instead of silently showing only bundled models. The refusal is held briefly and rechecked on Refresh or a Settings change. The new tests cover the main behavior and no concrete merge-blocking defect was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the model catalog now explains why an agent's Command cannot run as a program. It is specific, concise, and matches the summarized changes, which add a command-refusal…
Linked Issues check Passed Issue #48362 requires that a model picker state when the agent Command is not a runnable program, and not silently show the bundled seed list as the account's models. The reviewed head meets this for …
Out of Scope Changes check Passed Each changed file relates to the agentCommandNotRunnable refusal path or to the picker and notice behavior that displays it:
- Catalog scope, refresh, store, failures, and account-list files carry the…
Description check Passed The description follows the template closely. It covers ELI5, What Changed (before and after, plus mechanism), Why with alternatives, Linked Issue (Fixes #48362), Visual Proof with before and after im…
Full details: Title check

Explanation

The title names the main change: the model catalog now explains why an agent's Command cannot run as a program. It is specific, concise, and matches the summarized changes, which add a command-refusal reason surfaced in the chat picker and composer notice. The 'fix(model-catalog):' prefix follows a conventional-commit style and is not noise.

Full details: Linked Issues check

Explanation

Issue #48362 requires that a model picker state when the agent Command is not a runnable program, and not silently show the bundled seed list as the account's models. The reviewed head meets this for chat-surface pickers and the chat composer:

  • agent-model-catalog-scope.ts keeps an agentCommandNotRunnable refusal from probe.resolve. It returns it as unavailable, per launch folder, instead of discarding it through .catch(() => null). The raw summary states this change is in the current head.
  • agent-model-catalog-failures.ts (agentModelCatalogCommandRefusal, probeFailed) and agent-model-catalog-account-list.ts keep the same reason for ACP, Pi, and legacy listings.
  • agent-launch-setup-option-rows.ts shows the existing agentCommandNotRunnable sentence on the chat surface and disables catalog retry there. agent-launch-setup-option-rows.test.ts covers chat and terminal wording.
  • use-native-chat-availability-notice.ts shows the same sentence in the composer notice.
  • The hold, Refresh recheck, and Settings-change expiry paths are described in the PR and summarized in agent-model-catalog-refresh.ts and the new command-refusal test file. These changes do not alter the scope conclusion.

The PR objectives narrow the outcome to chat pickers and the composer. Terminal pickers keep their text because terminals run the Command through a shell, and the issue states that terminals still work. Settings → Agents keeps its built-in note, which is not silent but also does not name the Command. The issue names bot settings as a picker that shows the silent fallback. The bot picker wiring was not inspected, so I cannot confirm it shows the notice. The PR description's cliMissing wording is stale relative to the code, but this does not change the requirement result.

Full details: Out of Scope Changes check

Explanation

Each changed file relates to the agentCommandNotRunnable refusal path or to the picker and notice behavior that displays it:

  • Catalog scope, refresh, store, failures, and account-list files carry the refusal from command resolution into the catalog result, per folder.
  • agent-session-availability.ts adds the shared unavailable reason. agent-model-catalog-unavailable.ts adds a distinct message for it.
  • Renderer files (agent-launch-setup-option-rows.ts, agent-launch-setup-state.ts, use-native-chat-availability-notice.ts, use-host-model-catalog-upgrade.ts) show or re-check that reason.
  • agent-launch-picker-authority.ts treats this reason as authoritative so that preset retirement and 'No models match' behave as on main. This follows from the narrowed scope and is not a launch-path change.
  • The test files cover only the new refusal behavior.

No unrelated change is demonstrated. The PR states that the launched program is unchanged, and no launch-path edit appears in the summaries.

Full details: Description check

Explanation

The description follows the template closely. It covers ELI5, What Changed (before and after, plus mechanism), Why with alternatives, Linked Issue (Fixes #48362), Visual Proof with before and after images, Testing with a checklist and test list, Performance with a benchmark table, Risk with level Low and a revert path, and Review notes. Two gaps remain. The AI Disclosure section is left as the template placeholder. The final checklist item for lint, typecheck, test and build is unchecked, and the author states that pnpm test has 13 failures that also fail on main, with CI to confirm.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: baed5915-e40e-43f4-8c0d-f99e4a1acf5c
Commits

Reviewing files that changed from the base of the PR and between af137aa and b787542.

Files selected for processing: 2

  • src/main/native-chat/agent-model-catalog/agent-model-catalog-command-refusal.test.ts
  • src/main/native-chat/agent-model-catalog/agent-model-catalog-refresh.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@nwparker
nwparker force-pushed the fix/model-catalog-command-not-runnable branch from fedcd5b to af137aa Compare November 24, 2026 18:22
…program

When Settings -> Agents -> Command is a shell alias or function, chat
starts refuse it with agentCommandNotRunnable, but the model catalog
swallowed that refusal and silently showed the built-in seed list.

Carry the refusal through the existing `unavailable` channel instead:
- the catalog scope holds an agentCommandNotRunnable refusal per launch
  folder (30 s hold, rechecked on Refresh models, including one pressed
  mid-lookup, and expired by a Settings change); a refused scope skips
  listing and keeps the account's saved list alongside the reason
- probeFailed maps the same refusal for ACP/Pi and legacy listings
- AgentSessionUnavailable gains { reason: 'agentCommandNotRunnable' }
- the chat-surface launch picker and the chat composer notice show the
  existing translated failureWords sentence; terminal pickers keep their
  text and catalog authority, and the composer does not recheck this
  reason on window focus

A refused Command now costs one login-shell lookup per folder per 30 s
instead of one per catalog read.

Fixes stablyai#48362

Co-authored-by: moooowoong <[email protected]>
@nwparker
nwparker force-pushed the fix/model-catalog-command-not-runnable branch from af137aa to b787542 Compare November 24, 2026 19:20
@nwparker
nwparker merged commit e5442da into stablyai:main Nov 24, 2026
57 of 58 checks passed
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.

[Bug]: Model pickers silently show only the built-in models when an agent's Command isn't a runnable program

2 participants