Skip to content

thread/list: omitted modelProviders filters to the server default provider, hiding other threads #48358

Open

Description

@luvs01

Problem

Codex app-server's thread/list treats an omitted modelProviders parameter as "filter to the server's configured default provider" rather than "all threads".

Observed on codex app-server 0.155.0-alpha.16 / 0.158.0-alpha.2 (Windows), driven over the WebSocket JSON-RPC API:

  • Config: model_provider = "custom" + a [model_providers.custom] table
  • Threads created earlier under the built-in openai provider (~5,200 rows)
  • thread/list without modelProviders → returns only the threads tagged custom (1 item)
  • thread/list with modelProviders: [] → returns all threads

So omission and an explicit empty list behave differently, and omission silently hides most of the user's history.

Impact

Clients that omit modelProviders — notably the ChatGPT mobile remote-control client — render an almost-empty thread list on any host whose default provider differs from the provider its existing threads were created with. Nothing in the host's data is lost; the threads are simply filtered out of the default view.

Suggestion

Either:

  • treat omitted modelProviders as "no provider filter" (same as []), or
  • document the default-provider semantics and have remote-control clients send the full configured provider list explicitly.

Repro steps: configure a second provider, set it as model_provider, keep older openai-tagged threads, then compare thread/list with and without modelProviders.

Activity

  1. added
    bug
    app-server
    custom-model
    on Sep 26, 2026
  2. argszero commented on Sep 26, 2026

    @argszero

    Thanks for the careful report — the two observations are exactly right, and I traced both to a single match on current main (e72da2b538). The short version: this is intended behavior, not an oversight, but there is a real documentation gap that makes your expectation the reasonable one. Details below, then the one change I'd actually propose.

    Where the filtering happens

    It is not in storage and not in the request handler:

    • Storage treats omission as "no filter" — codex-rs/state/src/runtime/threads.rs (fe64fb6050ea):
      if let Some(model_providers) = model_providers
          && !model_providers.is_empty()
      {
          builder.push(" AND threads.model_provider IN (");
          ...
      }
    • thread_list_response_inner (codex-rs/app-server/src/request_processors/thread_processor.rs, 9679a31578eb, around :2513) destructures model_providers and forwards it unchanged into ThreadListFilters.

    The injection is one layer down, in list_threads_common — thread_processor.rs:5470:

    let model_provider_filter = match model_providers {
        Some(providers) => {
            if providers.is_empty() {
                None
            } else {
                Some(providers)
            }
        }
        None if relation_filter.is_some() => None,
        None => Some(vec![self.config.model_provider_id.clone()]),
    };

    That reproduces both of your observations precisely: omitted → Some([config.model_provider_id]), i.e. filtered to the server's configured provider; [] → None, i.e. every provider. (The fallback_provider you may see further down thread_list_response_inner is display-only — it is passed to thread_from_stored_thread as the per-row provider label fallback, not as a filter.)

    Why it is deliberate

    The parameter and this default came in together as a feature — commit 5907422d65, "feat: annotate conversations with model_provider for filtering (#5658)" (Oct 2025). Its stated rationale:

    Because conversations that use the Responses API can have encrypted reasoning messages, trying to resume a conversation with a different provider could lead to confusing "failed to decrypt" errors. (This is reproducible by starting a conversation using ChatGPT login and resuming it as a conversation that uses OpenAI models via Azure.)

    So the default filter exists to keep cross-provider rows out of the picker precisely because resuming one under a different provider fails confusingly. Two further signals that the omitted case was considered rather than missed:

    1. The middle arm, None if relation_filter.is_some() => None — sub-thread listings (parentThreadId / ancestorThreadId) deliberately bypass the default. Someone scoped the default rather than applying it blindly.
    2. The store layer treats None as "no filter", so the default is an app-server policy layered on a store that has no such notion.

    It is also long-standing, not a regression from the versions you tested — the arm predates the request-processor split (#20940) and traces back to #5658.

    The actual gap: the field's doc comment is silent on omission

    codex-rs/app-server-protocol/src/protocol/v2/thread.rs (2e166d5506b1), :1391:

    /// Optional provider filter; when set, only sessions recorded under these
    /// providers are returned. When present but empty, includes all providers.
    pub model_providers: Option<Vec<String>>,

    and its immediate sibling at :1395:

    /// Optional source filter; when set, only sessions from these source kinds
    /// are returned. When omitted or empty, defaults to interactive sources.
    pub source_kinds: Option<Vec<ThreadSourceKind>>,

    source_kinds documents what omission means; model_providers documents the "set" case and the "present but empty" case, and never says what omission does. Since the published JSON schema and the TS types are both derived from these doc comments, an app-server client reading the contract learns that [] returns everything but has no way to learn that leaving the field out silently narrows to one provider — which is exactly the trap you hit. That the escape hatch is documented while the default is not is what makes the two spellings look interchangeable when they are not.

    Proposed change (doc-only): add the omitted case to that comment, mirroring source_kinds, e.g.

    /// Optional provider filter; when set, only sessions recorded under these
    /// providers are returned. When omitted, defaults to the configured provider.
    /// When present but empty, includes all providers.
    

    If a comment-only change is made there, the vendored artifacts need refreshing with just write-app-server-schema (cargo run -p codex-app-server-protocol --bin write_schema_fixtures), otherwise the generated schema/TS fixtures drift.

    I would not recommend changing omission to mean "all providers": that would reintroduce the cross-provider resume failure #5658 was created to avoid. If the remote-control client needs every thread, sending [] explicitly is the supported spelling — it is the spelling the existing list tests already use (app-server/tests/suite/v2/thread_read.rs:1077).

    Worth noting on the coverage side: the closest test to this behavior is thread_list_respects_provider_filter (app-server/tests/suite/v2/thread_list.rs:448), which does create rollouts under two providers (mock_provider and other_provider) — but it only exercises an explicit filter (Some(vec!["other_provider"])). I could not find a test that pins the omitted case at all, so the omitted-default is currently both undocumented and unasserted; the only place it is discoverable is the match above.

    Two adjacent details that may matter for the client side

    • thread/search has no provider filter at all. ThreadSearchParams (thread.rs:1455+) carries source_kinds but there is no model_providers field on it — the provider filter exists only on thread/list. So the rows the list hides are still reachable through search, which may be a usable workaround for a client that must find them.
    • The response does not echo the default. ThreadListResponse is {data, next_cursor, backwards_cursor} — nothing reports which provider the omitted case resolved to, so a client that omits the field cannot detect that a filter was applied, let alone which one. That is an additional argument for stating it in the contract.

    Happy to open a PR for the one-line doc change if that's the direction you want; I held off since the semantics here are a deliberate design choice and the call between "document the default" and "change the default" is a maintainer decision. If you'd prefer the semantics changed instead, the doc fix is moot and the handler's third arm is the place to look.

  3. nostitos commented on Oct 14, 2026

    @nostitos

    Confirming this from the client side on newer builds: Codex Desktop 26.1007.30912, app-server 0.162.0-alpha.17.2, macOS host, ChatGPT for Android Remote (codex_chatgpt_android_remote). The phone's thread list matches thread/list with modelProviders omitted. For one project that is 2 threads, against 46 with modelProviders: [].

    A documentation fix alone won't help Remote users, because the Android client also saves the threads it starts under openai while the host default is a custom provider. All 3 of 3 Android thread/start requests on that day were saved under openai, and all 9 of 9 Desktop starts under the custom default. So the phone creates threads that its own list then filters out. Repro and evidence: #53848. Having the remote client send modelProviders: [], as suggested above, would fix both.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app-serverbugcustom-modelremote

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions