Skip to content

fix(tui): check the picked local model when the default is a cloud model - #6017

Merged
kovtcharov-amd merged 4 commits into
mainfrom
autofix/issue-6016
Oct 29, 2026
Merged

kovtcharov-amd merged 4 commits into
mainfrom
autofix/issue-6016

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

With an AMD LLM Gateway model saved as the default, launching the TUI on a picked local model listed the gateway model as "not downloaded — About 4 GB" and blocked the launch on a download it would never use. Now the model row checks the local model you picked: it goes green when that model is on disk, and if it isn't, the row names that model, not the cloud one. This is the local-launch half of #5992, which covers launching on the gateway model itself.

Closes #6016

Test plan

  • cd tui && go test ./internal/ui/... passes, including a new test that reproduces the issue's exact "amd.… not downloaded — About 4 GB" row without the fix
  • python util/lint.py --all passes in CI (here GAIA wasn't installed, so the two checks that import it failed for that reason)
  • Manual: set an amd.* gateway model as default_model, launch gaia-tui on a downloaded local model (e.g. Gemma-4-E4B). The model row should read "downloaded — chat uses Gemma-4-E4B-it-GGUF", with no download offer

⚠️ Needs manual validation: the automated checks cover the gate's logic with a stubbed daemon and Lemonade. Before merging, a maintainer should run the manual step above on a machine with a saved gateway key.

🔍 Technical details
  • Root cause: the daemon-path model row in probeInit (tui/internal/ui/preflight/check.go) reads body.Model from the sidecar's /init, which names the saved default_model. With a cloud default and a local cfg.Model, that cloud id came back present:false, so the row fell through to the local FixPullModel / "About 4 GB" branch.
  • Fix: when cfg.Model is a local pick and the sidecar's model is a cloud id, the row comes from checkLocalModelDownloaded, the existing on-disk check pulled out of localRunner.checkPickedModel in local.go.
  • Scoped to a cloud sidecar model, so a local default under a local pick behaves as before (context-window reporting included).
  • Touches the same block as fix(tui): check a cloud default model as cloud after Lemonade restarts #5992, so whichever merges second needs a small rebase. The two changes don't overlap in logic: fix(tui): check a cloud default model as cloud after Lemonade restarts #5992 handles an empty cfg.Model, this one a local cfg.Model.
  • New test: TestDaemonGateChecksThePickedLocalModelOverACloudDefault in cloud_daemon_test.go covers both the downloaded and the missing pick.

With an AMD LLM Gateway model saved as default_model, a TUI launch on a
picked local model still showed the gateway model as "not downloaded —
About 4 GB". The sidecar's /init reports the saved default, and the
daemon gate judged that model even though this launch never uses it. A
cloud default under a local pick now gets the picked model's on-disk
check instead.

Closes #6016
Covers a fireworks default, a user.-prefixed model on disk, a missing pick,
and a failed Lemonade listing under a local pick, and checks a missing local
default under a local pick still offers its download.
@kovtcharov-amd kovtcharov-amd added the ready_for_ci Run CI workflows on draft PR without requesting review label Oct 29, 2026
@github-actions github-actions Bot added the tui Go terminal UI (gaia-tui) label Oct 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor Author

Verdict: Approve with suggestions

With an AMD LLM Gateway model saved as the default, launching the TUI on a local model you picked no longer shows the gateway model as a ~4 GB download and blocks on it. The model check now looks at the local model you actually picked: green when it's on disk, and when it's missing, it names that model. The fix is narrow: it only applies when the saved default is a cloud model, so a local default behaves exactly as it did before. The logic is correct and the tests cover the cases that matter.

One thing before merge:

  • Nobody has run the real TUI on this yet. The PR's own manual step (gateway default saved, launch on a downloaded local model, confirm the row reads "downloaded — chat uses …") is still unchecked. A screenshot or a copy of the preflight screen from that run would close it.

Real-world evidence

N/A: no evidence bundle was produced for this run. The verdict rests on static review plus a local go test ./internal/ui/preflight/ run, which passes. The live TUI launch with a saved gateway key hasn't been exercised anywhere yet.

🔍 Technical details

Issues found

🟡 No real-surface evidence for a user-visible TUI change. The change alters what the preflight screen shows and whether launch is blocked, but the PR has only stubbed-daemon tests. Please attach the TUI preflight output (or a screenshot) from the manual step in the test plan before merging.

🟢 The picked-local path drops context-window reporting (tui/internal/ui/preflight/check.go:795). This branch returns before the CtxSize switch, so a picked local model never gets the "· 64K context" or ctx-shortfall line. That's reasonable, because the sidecar's CtxSize describes the cloud default, not the pick. The PR body says this is intentional. It would still help to say in a comment that the shortfall check deliberately doesn't run here, so nobody later "fixes" it by reading body.Model.CtxSize:

	// A cloud default_model arrives as the sidecar's model; a launch on a picked
	// local model never uses it, so check the picked one instead (the sidecar's
	// ctx describes the default, so no window check here).

Ordering check (no issue). The new branch sits after the cloud-launch branch, so cfg.Model is a non-empty non-cloud id when it's reached. An empty cfg.Model with a cloud default is still handled by the earlier chat = body.Model.ID path, and a local default with a local pick still falls through to the sidecar's own answer and FixPullModel. The final assertion in TestDaemonGateNeverOffersACloudDefaultUnderALocalPick pins that.

Strengths

  • Reuses the existing on-disk check by pulling checkLocalModelDownloaded out of checkPickedModel, so the local-runner and daemon paths can't drift apart.
  • The tests cover the right edges: a non-AMD cloud provider, the user. prefix, a missing pick, a Lemonade list error landing as Unknown/Notify rather than a pass, and the regression guard that a local default keeps its download offer.
  • No silent fallback: when the model list fails, the row says "could not confirm" instead of pretending the model is there.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Code, tests and CI are green; what's left is the manual launch with a saved gateway key, which this machine can't do without a real key.

I merged main (which now has #5992), added a test that a cloud default never reaches the download branch under a local pick, and took the review's comment suggestion about the skipped window check.

🔍 Technical details
  • New TestDaemonGateNeverOffersACloudDefaultUnderALocalPick: fireworks and amd defaults, a user.-prefixed model on disk, a missing pick, and a failed Lemonade listing must never produce FixPullModel or the "About 4 GB" detail; a missing local default under a local pick still offers its download. Fails on the pre-fix code, passes here.
  • Manual step still open: set an amd.* default_model, launch gaia-tui on a downloaded local model, and confirm the row reads "downloaded — chat uses …".

@kovtcharov-amd
kovtcharov-amd marked this pull request as ready for review October 29, 2026 08:23
@kovtcharov-amd
kovtcharov-amd self-requested a review as a code owner October 29, 2026 08:23
@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Oct 29, 2026
Merged via the queue into main with commit aced35e Oct 29, 2026
70 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the autofix/issue-6016 branch October 29, 2026 08:24
@github-actions

Copy link
Copy Markdown
Contributor Author

Verdict: Approve

With a cloud (AMD LLM Gateway) model saved as the default, launching the TUI on a local model you picked used to block on a ~4 GB download of the gateway model, which that launch never uses. Now the TUI checks the model you actually picked: the row goes green when it's on disk, and names that model when it isn't. The fix is small, reuses the existing on-disk check, and leaves the local-default path alone. The new tests cover the downloaded, missing, user.-prefixed and Lemonade-unreachable cases, plus a guard that a missing local default still offers its download.

The one gap is the manual step in the test plan (gateway default plus a local pick on a real machine), which is still unchecked. A maintainer should run it before relying on this in a release.

Real-world evidence

N/A: no evidence bundle was produced for this run. The change is in TUI preflight logic, and real-machine validation needs a saved gateway key, so it is left to the author's manual step. The verdict rests on static review plus a local run of the preflight package tests:

$ cd tui && go test ./internal/ui/preflight/
ok  	github.com/amd/gaia/tui/internal/ui/preflight	8.930s
$ go vet ./internal/ui/preflight/
(clean)
🔍 Technical details

Issues found

🟢 Local variable shadows the cloudDefault helper (tui/internal/ui/preflight/cloud_daemon_test.go:219). TestDaemonGateChecksThePickedLocalModelOverACloudDefault declares cloudDefault := strings.ReplaceAll(...), which is the same expression the package-level cloudDefault(id) helper (line 122) already builds. It compiles, but it shadows the helper for the rest of the function. Calling the helper is shorter:

	body := cloudDefault("amd.DeepSeek-V4.1-Flash")

(then pass body to the two gaiaFake(503, …) calls in that test.)

🟢 Ordering assumption worth knowing. The new branch in probeInit (check.go:796) runs before the !body.Model.Present check, so under a local pick with a cloud default the sidecar's present flag is ignored entirely. That's correct, because present describes the default and not the pick. It does mean the picked model's context window goes unreported on this path, which the comment acknowledges. No change needed.

Strengths

  • Pulling checkLocalModelDownloaded out of localRunner.checkPickedModel means the daemon path and the local-runner path report a missing pick with the same row text and the same remedy, so the two can't drift apart.
  • The tight guard (cfg.Model != "" and a cloud sidecar model) keeps the change from reaching the local-default path, and the final assertion in TestDaemonGateNeverOffersACloudDefaultUnderALocalPick pins that.
  • The tests check what the user sees (no amd. id in the line, no "4 GB", no FixPullModel), so they would catch the original bug, not just a call being made.

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

Labels

ready_for_ci Run CI workflows on draft PR without requesting review tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI shows the saved gateway default as a 4 GB download when launched on a local model

1 participant