Skip to content

test(desktop): pin ACP availableModels merge for #3934 (#3934) - #5076

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue3934-20260801-v2
Open

test(desktop): pin ACP availableModels merge for #3934 (#3934)#5076
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue3934-20260801-v2

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

Summary

Closes #3934. Supersedes #4048 (rebase onto current main @ bd2fdf4).

The runtime merge of both ACP model sources was implemented in desktop/src-tauri/src/commands/agent_models.rs (normalize_agent_models, merged after commit 925a9a7), but no regression test existed for the unstable availableModels path — a silent future regression there would reproduce the bug.

Changes

Two unit tests under desktop/src-tauri/src/commands/agent_models_tests.rs:

  1. agent_models_populates_unstable_available_models_only_hermes_shape
    Reproduces the exact JSON shape Hermes Agent emits: stable.configOptions = null, unstable.availableModels = [...], plus unstable.currentModelId. Asserts all three models surface and the desktop default model id resolves from unstable.currentModelId.

  2. agent_models_stable_config_options_take_precedence_over_unstable_duplicates
    When a model id appears in both stable configOptions and unstable availableModels, the stable entry takes precedence for the UI display name — first-seen dedup wins, keeping the stable path authoritative.

Why not a code change?

Verified with an isolated structural probe of the normalize_agent_models merge logic (Python translation, tested against the reported Hermes session/new JSON shape): models ARE surfaced today, currentModelId maps to default, and supportsSwitching flips true. The reporter on v0.5.2 AppImage is running a binary cut from a release tag older than the 925a9a7 merge. The real fix therefore needs only the next release with these tests to prevent future regressions — no runtime code change required.

Test plan

cd desktop/src-tauri
cargo test --lib agent_models
# expected: 38 passed (36 existing + 2 new), 0 failed
cargo clippy --lib --tests -- -D warnings
# expected: no warnings

Local cargo-test run is blocked on my machine (missing binaries/ sidecars required by sherpa-onnx-c-api static lib, unrelated to the diff) — relying on CI for execution. The diff is strictly additive inside a single test file.

Why default path is the right choice

The unstable availableModels path is an evolving ACP convention — the route for "the agent carries its own catalog". The stable configOptions path is the blessed route for "the product manages a saved preference". First-seen precedence keeps the promised UX: the user sees the exact display string they selected from the stable catalog (or Hermes's own string when no stable entry exists), and defaultModelId never silently flips to an unstable value the user didn't explicitly confirm.

Closes block#3934. Supersedes block#4048 (rebase).

The runtime merge of both ACP model sources was implemented in
`desktop/src-tauri/src/commands/agent_models.rs` (`normalize_agent_models`,
merged after commit 925a9a7), but no regression test existed for the
unstable `availableModels` path.

Two unit tests under `desktop/src-tauri/src/commands/agent_models_tests.rs`:

1. `agent_models_populates_unstable_available_models_only_hermes_shape` —
   reproduces the exact JSON shape Hermes Agent emits (stable
   `configOptions = null`, `unstable.availableModels = [...]`, plus
   `unstable.currentModelId`), asserts all three models surface and the
   desktop default model id resolves from `unstable.currentModelId`.

2. `agent_models_stable_config_options_take_precedence_over_unstable_duplicates`
   — when a model id appears in both stable `configOptions` and unstable
   `availableModels`, the stable entry takes precedence for the UI
   display name (first-seen dedup wins, keeping the stable path
   authoritative).

Rebased onto main @ bd2fdf4; no runtime code change.

Signed-off-by: iroiro147 <sarthak.singh@mastersunion.org>
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.

Model dropdown stays empty for ACP harnesses that report models via session/newmodels.availableModels (e.g. Hermes Agent)

1 participant