Skip to content

fix(mobile): read the model catalog shape the Harness actually serves - #311

Merged
yaojin3616 merged 1 commit into
dataelement:mainfrom
smarthomeblack:fix/mobile-model-catalog-shape
Sep 5, 2026
Merged

fix(mobile): read the model catalog shape the Harness actually serves#311
yaojin3616 merged 1 commit into
dataelement:mainfrom
smarthomeblack:fix/mobile-model-catalog-shape

Conversation

@smarthomeblack

Copy link
Copy Markdown
Contributor

Problem

Two bugs in the mobile session-settings panel (Model selector), both caused by the page reading a field shape session/modelCatalog does not serve:

  1. The Model select is permanently disabled. syncSettingsControls computes model.disabled = settingsBusy || !modelCatalog?.routable, but the catalog has no routable field — it serves routableProviders: string[]. !undefined is always true, so the select can never be enabled.
  2. The displayed model is wrong. renderSessionSettings reads modelCatalog.current, but the catalog serves default: { provider, model, reasoningEffort? }. current is undefined, so no <option> matches and the select falls back to rendering the first catalog entry instead of the model the desktop is actually running.

Verified against the host contract (@deepseek-ai/dsh-api-session-controller typert schema):

modelCatalog = {
  default: { provider, model, reasoningEffort? },
  routableProviders: string[],
  groups: [...],
  failures: [...]
}

and against a live Harness: GET session/modelCatalog returns exactly that shape (default = the selection actually in use, routableProviders non-empty).

Fix

In lan-mobile-pages.ts, read the real shape with a fallback for older builds:

  • current selection: modelCatalog.current ?? modelCatalog.default ?? {}
  • routable: (modelCatalog.routableProviders?.length ?? 0) > 0 || modelCatalog.routable === true
  • the RPC-failure fallback object now uses the real shape (default + routableProviders: [])
  • after a successful session.selectModel, both current and default are updated

Test

  • node --check on the extracted page script: syntax OK.
  • Patched a local install with the same change: after a full app restart the mobile Model select becomes enabled and shows the running model (default) correctly.

Note

session/modelCatalog takes no session argument, so default is the host-wide last/default selection, not a per-session override. Mobile can only display that value; per-session display would need a host API addition (out of scope here).

The mobile session-settings page read modelCatalog.current and
modelCatalog.routable, but session/modelCatalog has always served
{ default, routableProviders, groups, failures }:

- modelCatalog.current is undefined, so no option matched and the
  select displayed the first catalog entry instead of the running model
- modelCatalog.routable is undefined, so the model and effort selects
  were permanently disabled

Read default as the current selection (falling back to current for
older builds), derive the routable flag from routableProviders, keep
the error fallback in the real shape, and update both fields after a
successful selection.
@yaojin3616
yaojin3616 merged commit 6252eac into dataelement:main Sep 5, 2026
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.

3 participants