Skip to content

fix: render full model names, load the real catalog, add thinking-effort picker - #1

Open
windfallscout wants to merge 5 commits into
mainfrom
fix/model-name-overflow
Open

windfallscout wants to merge 5 commits into
mainfrom
fix/model-name-overflow

Conversation

@windfallscout

Copy link
Copy Markdown
Owner

What

Three related fixes to the model selector, plus a CI artifact so the build is testable without a local toolchain.

1. Long model names are no longer truncated

  • Selector rows render the full provider:model id (no maxLines = 1 + ellipsis), so 40–80 char ids wrap instead of being cut mid-name.
  • The current marker moved to the secondary line (with the provider and the parsed effort), so a long name can never hide it.
  • Provider headers fill the sheet width; the top-bar chip is bounded (widthIn(max = 140.dp), single line, ellipsis) and wrapped in a TooltipBox/PlainTooltip showing the full provider:model on long-press.
  • Search also matches provider:model.

2. Model list loads from the endpoints the server actually serves

The app called GET /api/model/options, which hermes-webui does not serve (404) — that is why providers such as opencode-go were missing and the list could come back empty/erroring.

  • GET /api/providers is now the source (id → slug, display_name → name, active_provider → is_current).
  • Each provider with a key (plus the active one) is enriched concurrently from GET /api/models/live?provider=<slug> with an 8s per-provider budget; a slow or failing provider keeps its static list.
  • GET /api/model/options remains only as a 404/405 fallback for older servers.
  • POST /api/model/set is unchanged.

3. Thinking effort is selectable from the selector

  • A Thinking effort row (Low / Med / High / XHigh) in a horizontally scrollable chip row, so it cannot overflow narrow screens.
  • If the provider encodes effort in the model id (claude-opus-5-5-high, gemini-4-hydrogen-xhigh), picking a level switches to the sibling model.
  • Otherwise it sends the gateway's /reasoning <level> slash command — /reasoning <level> --global when the sheet scope is Default.

Tests

  • ModelCatalogTest — mapping, merge/dedupe, live-target selection, fallback policy.
  • HermesRestApiModelsTest — MockWebServer: providers + live merge, 404 → legacy fallback, live 500 → static models.
  • EffortTest — suffix parsing, effective effort, sibling resolution, labels.
  • ModelSelectorTest — 40–80 char names, provider:model search, per-row effort.
  • ChatViewModelTest — sibling switch, /reasoning fallback, --global + error surfacing.
  • ModelSelectorUiTest (androidTest) — rows inside a 320dp container, chip width bound.

No JDK/Android SDK on the machine that produced this branch, so the build was not run locally — CI (assembleDebug + testDebugUnitTest) is the verification. The CI job now uploads app-debug.apk as the hermes-debug-apk artifact.

Note: CONTRIBUTING.md asks for PRs into dev; this targets main as requested.

- Model selector rows wrap long ids instead of ellipsizing, provider headers
  fill the sheet width, and the top-bar chip is width-bounded with a tooltip
  showing the full provider:model string.
- The model list now comes from GET /api/providers, enriched per keyed
  provider from GET /api/models/live with an 8s budget (static models are the
  fallback), so providers such as opencode-go are visible again.
  GET /api/model/options stays as a 404/405 fallback for older servers.
- Thinking effort (low/medium/high/xhigh) is selectable in the sheet: it
  switches to a catalog sibling when the provider encodes effort in the model
  id, otherwise it sends /reasoning <level> (--global for the default scope).
- Tests: pure mapping/effort helpers, MockWebServer coverage for the new
  endpoints, selector tests with 40-80 char names, ChatViewModel effort tests
  and Compose UI tests for the wrapped rows and the bounded chip.
- CI uploads the debug APK as an artifact so a build can be installed without
  a local toolchain.
The per-provider timeout ran on the caller's dispatcher, so kotlinx-coroutines
virtual time in runTest fired it immediately and the live models were dropped.
Run the enrichment on Dispatchers.IO (wall clock), and print full assertion
messages from the unit-test tasks so a CI failure is diagnosable.
…rors

/api/providers and /api/models/live publish `models` as objects
({"id": "...", "label": "..."}), but both DTOs declared List<String>, so
kotlinx.serialization threw and the whole provider list failed to decode —
no opencode-go, empty picker. ModelIdDto now accepts an object or a plain
string, so older servers keep working; ModelCatalog reduces entries to ids.

The chat model sheet also gets real catalog state: a failed fetch clears any
pending spinner and shows the error with Retry instead of an empty sheet, and
the Models screen error state gets the same Retry action.
…ture

Each ephemeral Actions runner generated a fresh ~/.android/debug.keystore, so
consecutive hermes-debug-apk artifacts carried different signatures and Android
required an uninstall before the next debug build could be installed.

- add app/debug.keystore: debug-only PKCS12 key (alias androiddebugkey, RSA
  2048, valid to 2056, public "android" password — not a release secret) and
  un-ignore it in .gitignore
- point signingConfigs.debug at it so local and CI debug builds share the same
  certificate; release/beta signing is untouched
- CI asserts the assembled APK's signer SHA-256 against the pinned fingerprint,
  so an accidental revert to an ephemeral key fails the build instead of
  silently changing the signature

Devices carrying a debug build installed before this change need one final
uninstall to pick up the new key.
The first version piped `apksigner verify --print-certs` straight into sed,
so an empty match ended in a bare `test` failure with no clue why: the step
logged "APK signer SHA-256: " and nothing else.

Capture stdout+stderr, echo the full apksigner output, and match the digest
line case-insensitively with a `.*digest:` strip so indentation, label casing
and colon-separated fingerprints all parse. A missing digest or a non-zero
apksigner exit now prints the raw output and an annotated ::error::.
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.

2 participants