pearl th-2b5f63: th cast models — list live model groups on configured provider#62
Merged
Conversation
…d provider Adds `th cast models [--provider NAME] [--json] [--filter PATTERN]` — hits `GET /v1/models` on the configured LiteLLM provider (e.g. llm.smoo.ai) and prints the alphabetized list of model groups with the gradient wordmark header and a `N models on URL` footer. The default provider is the one backing the `default` routing slot (what `th routing show` highlights); `--provider` overrides on multi-provider setups. The body parser is tolerant: it strips ASCII control chars (0x00- 0x1F) before strict JSON parse, and a byte-scan fallback extracts complete `"id":"NAME"` entries when the response is truncated. When strict and lossy counts disagree, the footer surfaces a `!` warning so deploys returning partial bodies don't fail silently. - Exits 2 if no provider is configured. - Prints status + first 200 chars of body on non-200. - `cmd_cast_models` runs on a `spawn_blocking` thread so reqwest's blocking client doesn't panic inside the tokio runtime. Twelve tests cover the URL helper, control-char stripper, lossy parser, strict vs lossy reconciliation, sort + filter, and an end-to-end run against a hand-rolled TcpListener mock server. Also fixes a pre-existing build break in smooth-bench: TuiTaskConfig literal was missing `under_test_model` (added field not yet wired in), which was failing `cargo clippy --workspace --all-targets` and blocking the pre-commit hook.
🦋 Changeset detectedLatest commit: 1f6e846 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
brentrager
added a commit
that referenced
this pull request
May 22, 2026
Root cause for every score-tui 0/X result this session. The driver
model was being fed the FULL tmux pane snapshot — including its own
prior 'You: ...' turns — and continuing the user-side narrative by
inventing both the questions AND the agent's responses. Sessions like
~/.smooth/coding-sessions/c503794b-... showed long chains of:
[user] Please read INSTRUCTIONS.md and tell me what it says.
[user] Okay, I will read INSTRUCTIONS.md for you. ← invented
[user] Okay, I have read INSTRUCTIONS.md. It says: ... ← invented file contents
[user] Please read tests/acronym.rs ...
[user] Okay, I will read tests/acronym.rs ... ← invented
[user] Okay, I have read tests/acronym.rs. It contains ... ← invented
Net effect: the under-test agent never got real chances to fire tools
(0 tool_role messages in 12-msg sessions; only ~2 actual assistant
turns); pytest ran against unedited workspaces; the bench reported
0/6 even for claude-sonnet-4-6 — a gold-standard tool-use model.
Total cost ~$0.03/task for claude across the matrix because the
agent was barely ever called.
Two fixes:
1. **Strip 'You:' lines from the pane before showing to driver** —
new collapses everything between
each marker and the next //
marker. The driver now sees only the assistant's output, with
no template to auto-complete.
2. **Tighten system prompt** with a CRITICAL rule explicitly
forbidding first-person action narration ('Okay, I will...',
'Okay, I have read...', 'I'll edit the file now'). Plus a new
token so the driver has an explicit way to let the agent
keep working instead of filling silence with hallucinated turns.
Drive-by: fix the rebase-leftover conflict marker in main.rs
(under_test_model field of TuiTaskConfig was uncleanly resolved
in PR #62's drive-by build fix).
Pearl th-driver-hallucination.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
Adds
th cast models [--provider NAME] [--json] [--filter PATTERN]— hitsGET /v1/modelson the configured LiteLLM provider (e.g. llm.smoo.ai) and prints the alphabetized list of model groups with the gradient wordmark header and aN models on URLfooter.defaultrouting slot (whatth routing showhighlights);--provideroverrides on multi-provider setups."id":"NAME"entries from truncated responses. When strict + lossy counts disagree, the footer surfaces a!warning.cmd_cast_modelsruns onspawn_blockingso reqwest's blocking client doesn't panic inside the tokio runtime.under_test_model: Noneto aTuiTaskConfigliteral insmooth-bench/src/main.rs(pre-existing build break on main that was blockingpnpm pre-commit-check).Sample output
Test plan
cargo test -p smooai-smooth-cli cast_models→ 12 passed)cargo fmt -- --checkcargo clippy --workspace --all-targetsclean (0 errors)th cast models,th cast models --filter smooth,th cast models --json,th cast models --provider nonexistent(exits 2)Pearl: th-2b5f63