Repository navigation
Models: list a harness's models when something that decides them changes, and take them from running sessions - #1227
Merged
Conversation
…m changes, and taken from running sessions OpenCode answers /api/model with whatever has loaded so far until its plugins are in: nothing, then a partial list (2.4.4). The listing read it the moment the server answered and kept what it got, an empty catalog included. It now subscribes to the event stream first and reads once the plugin list has filled, as OpenCode's own one-shot clients wait, and a running session reads again on each model.updated. Every codex app-server fetches Codex's model catalog over the network as it starts (0.174.0). The process started for the models now reads the account's usage too, and a Codex session reports the list it already fetches for reasoning efforts, so neither starts another. The host listed all seven harnesses on every profile edit, a display name or a colour included, stopping the listing under way each time. It now lists a harness again only when what its listing is started with changes (binary, home, environment, whether any account is enabled), when its account signs in or out, when a secret of its is saved, when Tcode updates its CLI, or when the user asks from the harness dialog. A disabled harness is not listed. A change that the settings do not show waits for the listing under way and lists once more instead of stopping it. Sessions report models as AgentEvent::ProviderModels: Codex at start, OpenCode on model.updated, a registry ACP agent whenever its model option changes, which is how an agent that fills its models in after session/new reaches the catalog. A native catalog takes them from sessions of the harness's own account; an ACP catalog keeps the default its probe saw.
Tryanks
force-pushed
the
claude/model-catalog-lifecycle
branch
from
December 4, 2026 23:16
4ab950e to
0f7cd2e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A harness's models were listed once as the host started and again, for all seven harnesses, on every profile edit. Whatever a listing answered was kept, an empty list included. Two harness behaviours made that wrong:
/api/modelwith whatever has loaded so far until its plugins are in:0models, then a partial73, then the real31. Tcode read it the moment/api/infoanswered.codex app-serverstarts, whatever it is then asked. Each process Tcode starts is one fetch.A change the settings do not show (sign-in, a secret, a CLI update) waits for the listing under way and lists once more, instead of stopping it; a change to what the listing is started with replaces it, since its answer is for the old configuration. A disabled harness is not listed.
A native catalog stays one per harness, as its built-in account sees it, so it takes a session's models only from that account. An ACP agent's catalog takes the models from a session and keeps the default its probe saw, because a session marks the model it is set to.
Not in this change
Evidence
bee52d478, fresh--data-dir,codexonPATHreplaced by a shim that logs and execs the real one, 45 s aftertcode-headless serve):/api/model→0,73,31, thenprovider.updated,model.updated,plugin.updated;/api/plugingoes from0to103at that moment.probe --list-models opencodeon this branch: 31 models on seven of seven runs, from the repository and from/.~/.codex/models_cache.json'sfetched_atmoves on everycodex app-serverstart, five seconds apart, with no request sent.probe(codexandopencode, the latter from a directory other than the listing's): each emits oneprovider_models, equal to--list-modelsin ids, order, default and options.probe --list-models codexnow prints the account usage read in the same process.the_models_a_session_reports_become_its_harnesss: a session of another account leaves the catalog as it was; one of the built-in account replaces and persists it.the_models_a_session_reports_become_its_agents: an ACP agent's catalog takes a session's models and keeps the probe's default.an_agents_models_are_reported_when_its_model_option_brings_them: aconfig_option_updatecarrying a model option yieldsProviderModelsonce, and not again while unchanged.startup_failure_reports_exit_status_and_stderr_tailgained the newread_usageargument; its assertions are untouched.cargo fmt --all --check,cargo clippy --workspace --all-targets --locked -- -D warnings,cargo nextest run --workspace --locked. Not exercised: a real registry ACP agent (none installed here), Windows and Linux, and the harness dialog's Check again button in the running app.Merge Danger
Door: Two-way.
The wire gains the
RefreshModelscommand (noted as Unreleased abovePROTOCOL_VERSION); a client from this tree pressing Check again against an older host is refused.Blast Radius: Model pickers.
A listing that used to run on every edit now runs only for the triggers above, so a cause of model changes not among them shows up as a stale picker until the next start, a session of that harness, or Check again.
PROTOCOL_VERSIONbump: a note was added under "Unreleased" above theconstant in
crates/protocol/src/lib.rs(the number itself changes onlywhen the release is cut — CONTRIBUTING.md, principle 9).