Repository navigation
fix(model-catalog): say why when an agent's Command isn't a runnable program - #48363
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Severity of issue fixed: Medium Merge Risk:
|
fedcd5b to
af137aa
Compare
…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]>
af137aa to
b787542
Compare
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 fromprobe.resolve. AnAgentSessionPreSpawnErrorwith reasonagentCommandNotRunnableyields 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-timecliMissingis 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.probeFailedmaps the sameagentCommandNotRunnablerefusal when an ACP/Pi or legacy listing re-throws it (nocliMissinghold). 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.AgentSessionUnavailablegains{ reason: 'agentCommandNotRunnable' };readAgentSessionUnavailablereads it.components.native-chat.failureWords.agentCommandNotRunnablesentence (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 existingunavailablechannel 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
codexwhen 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 devwith its own profile directory), Codex Command set tooc(a shell function, not on PATH).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:
Testing
agent-model-catalog-command-refusal.test.ts(8 tests, at the catalog service read):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):main: the refusal tests fail on main's catalog sources ({ origin: 'unknown' }with no reason); a scratch test wiring the realcreateCodexModelCatalogProbe+resolveStructuredAgentCommandwith Commandocreturned no reason and ran 5 login-shell lookups for 5 reads on main, versus the reason and 1 lookup on this branch.src/main/native-chat/agent-model-catalog/,agent-launch-setup-option-rows.test.tsandsrc/shared/agent-launch/picker/: 3 files, 16 tests pass.pnpm tc:nodeandpnpm tc:webpassed during review.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):
mainrecover= login-shell capture)cliMissingIn-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
unavailablereason 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 forcliMissing. Plain revert backs it out; nothing is persisted (the reason lives in the in-memory failure map).Level: Low
Review
probeFailed, which holds onlyagentCommandNotRunnable.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred) — lint, typecheck and build pass locally;pnpm testhas 13 failures that also fail on unmodified main here, CI to confirm