Skip to content

feat(tui): offer the benchmark's best Fireworks models, ranked - #4040

Merged
kovtcharov-amd merged 4 commits into
amd:mainfrom
kovtcharov:claude/tui-recommended-fireworks-models
Sep 26, 2026
Merged

kovtcharov-amd merged 4 commits into
amd:mainfrom
kovtcharov:claude/tui-recommended-fireworks-models

Conversation

@kovtcharov

Copy link
Copy Markdown
Contributor

The TUI's Fireworks setup screen advertises "Gemma 4 31B IT" and pins that id to the top of the model list, but Fireworks no longer serves it — the live catalog through Lemonade has 24 models and no gemma-4-31b-it, so the suggestion sorts nothing and names a model nobody can pick. Now the three models that scored best on our agent benchmark lead the list in rank order, each labelled with why (glm-5p3-flash · #1 best overall, cheapest), the setup screen names the current top pick from the same list so it cannot rot separately again, and a recommended model the account does not expose simply does not appear.

Test plan

  • cd tui && go build ./... && go test ./... — all packages green (20 ok locally)
  • cd tui && gofmt -l internal/ && go vet ./internal/lemonade/ ./internal/ui/providers/ — clean
  • python util/check_doc_links.py --internal-only — passes (989 links)
  • With a Fireworks key: /provider → Fireworks AI → the setup screen says Recommended model: glm-5p3-flash · best overall, cheapest; the model list opens with the three recommended rows first, the rest alphabetical, and each row stays on one line at 48 columns
🔍 Technical details

lemonade.FireworksModel is replaced by lemonade.RecommendedModels (ranked []Recommendation{ID, Note}), lemonade.TopRecommendation() (its first entry — the one accessor for anything that still needs a single id) and lemonade.Rank(id) (rank, note, ok). The providers screen sorts by rank key (unranked ids sort after every rank, then alphabetically), labels rows through Rank, and truncates each row to the panel width so a ranked row never wraps and pushes rows above it out of the line budget.

The ranking is a dated snapshot from the agent task benchmark (September 2026, 14 coding and knowledge tasks, LLM-judged, same harness for every model) and will need refreshing as Fireworks' catalog and model quality change — the comment on the list says so:

Model Passed Quality Truthfulness Time Cost
fireworks.glm-5p3-flash 14/14 4.96 4.86 536 s $0.083
fireworks.deepseek-v4p1-flash 14/14 4.88 4.93 349 s $0.105
fireworks.deepseek-v4-pro-0813 14/14 4.84 5.00 428 s $0.489

Reference points on the same tasks: Claude Code on Opus 5 scored 4.97 for $3.89, on Sonnet 5 4.91 for $1.26. Deliberately not recommended: fireworks.qwen3p8-max (12/14, 4.57, $1.325 — costlier than Claude Code on Sonnet and worse) and fireworks.kimi-k2p7-code (14/14 but 4.50 at $0.404).

Tests written first and confirmed failing against the old single-id code: rank-order sort ahead of an alphabetically earlier id, alphabetical order for the rest, an absent recommendation neither injected nor disturbing the order, rank/note on recommended rows only and on one line at 48 columns, the setup text derived from TopRecommendation(), and Rank returning not-found for an unknown id. The three docs that described the Gemma suggestion (tui/README.md, the AI providers guide, the CLI reference) now describe the ranked list.

The Fireworks setup screen advertised "Gemma 4 31B IT" and the model list
pinned that id to the top, but Fireworks no longer serves it: the live
catalog through Lemonade lists 24 models and no gemma-4-31b-it. So the
suggestion sorted nothing and named a model nobody could pick.

The TUI now carries a ranked list of the models that scored best on the
agent task benchmark (September 2026), each with a one-line reason. When
the provider serves them they sort to the top in rank order and render as
`glm-5p3-flash · #1 best overall, cheapest`; everything else follows
alphabetically. The setup screen names the current top recommendation
through the same accessor, so it cannot drift from the list again. A
recommended model the provider does not return is simply absent - the TUI
never injects a row the user cannot select.

The three docs that described the old suggestion (tui/README.md, the AI
providers guide, the CLI reference) now describe the ranked list and say
the ranking is a dated snapshot.
@github-actions github-actions Bot added documentation Documentation changes tui Go terminal UI (gaia-tui) labels Sep 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Approve with suggestions

The TUI stops advertising a Fireworks model nobody can pick and now leads the list with the three models that actually scored best, each labelled with why. The code is correct and the docs were updated everywhere the old suggestion was described.

One thing to fix before merge: the new safeguard that keeps a long recommendation row on a single line isn't actually covered. I deleted that safeguard locally and the test added for it still passed — the two widths it checks (100 and 48 columns) are both wide enough that nothing needs shortening, so the wrap it's meant to prevent never happens. At a narrower terminal the row really does spill onto a second line. Add a narrow case and the test becomes a real guard.

Worth a second look: the recommendations are matched by exact model id. If the server ever reports these models under their longer account-path names — a form GAIA's own code already handles elsewhere — the ranking would silently do nothing again, which is the exact problem this PR fixes. Nothing breaks if it happens (the models just sort alphabetically like any other), but a quick check against the live catalog, or matching on the trailing name segment, would make it stick.

Real-world evidence

No evidence bundle was produced for this PR, so the verdict rests on static review plus what I ran here: go build ./..., go test ./internal/lemonade/ ./internal/ui/providers/, gofmt -l internal/, and go vet on both packages — all clean. The unit tests do render the real provider screen and assert on its text, which covers most of the visible change. The one item left unproven is the live /provider walkthrough against a real Fireworks account (unchecked in your test plan) — a terminal capture of the ranked list would close it.

🔍 Technical details

🟡 The one-line-row guard is untested (tui/internal/ui/providers/model_test.go:270)

TestRecommendedRowsShowRankAndNoteOnOneLine runs at widths 100 and 48. At 48, w = m.width-4 = 44, and the longest ranked row — " › glm-5p3-flash · #1 best overall, cheapest" — is 43 cells, so ansi.Truncate is a no-op. I confirmed it empirically: replacing label = ansi.Truncate(marker+label, w, "…") with label = marker + label in model.go:402 leaves that test green. The strings.Count(view, "#N ") assertion can't catch a wrap either — ansi.Wrap splits at a word boundary, so the rank still appears exactly once.

A width where the row must shorten does catch it. This version fails without the truncate line ([" › glm-5p3-flash · #1 best "]) and passes with it:

func TestNarrowRankedRowStaysOneTruncatedLine(t *testing.T) {
	rec := lemonade.RecommendedModels
	m := New("", 36, 30)
	m.selected = 1
	next, _ := m.Update(modelsMsg{models: []lemonade.Model{{ID: rec[0].ID}}})
	m = next.(Model)
	name := strings.TrimPrefix(rec[0].ID, "fireworks.")
	var rows []string
	for _, line := range strings.Split(ansi.Strip(m.View()), "\n") {
		if strings.Contains(line, name) {
			rows = append(rows, line)
		}
	}
	if len(rows) != 1 || !strings.HasSuffix(strings.TrimRight(rows[0], " "), "…") {
		t.Fatalf("ranked row wrapped instead of truncating: %q", rows)
	}
}

🟡 Rank matches ids exactly (tui/internal/lemonade/cloud.go:95)

Rank compares against fireworks.glm-5p3-flash and friends verbatim. GAIA's Python side already parses the account-path form — tests/unit/test_lemonade_cloud_models.py:27 asserts fireworks.accounts/fireworks/models/gemma-4-31b-it is a valid Fireworks id — so Lemonade's /models plausibly reports some entries that way. If it does, Rank returns ok=false, the rows lose their #N label and sort with the unranked tail: the same invisible no-op the old constant had.

Degradation is graceful, so this is a robustness note rather than a bug. Either confirm the discovered ids are short-form (your 24-model catalog observation likely already does) or match on the final path segment. If it's confirmed short-form, a one-line comment on RecommendedModels saying so would stop the next reader from wondering.

🟢 Setup line is longer than what it replaced (tui/internal/ui/providers/model.go:359)

"Recommended model: glm-5p3-flash · best overall, cheapest" is 56 cells vs. 31 before. It's wrapped by the shared ansi.Wrap pass at the end of View, so nothing overflows, but on a narrow terminal it now costs two lines of the height budget where the old text cost one. Only worth acting on if the setup screen is tight at small sizes.

Strengths

  • Replacing a single hardcoded id with []Recommendation + Rank/TopRecommendation means the setup screen and the list rows derive from one source — the stated goal of "cannot rot separately again" is structurally enforced, not just re-synced.
  • TestMissingRecommendedModelIsNeverInjected tests the right thing: a recommended model the account doesn't expose neither appears nor perturbs the ordering. That's the honest behaviour, and it matches the no-silent-substitution promise in the docs.
  • All three places that described the old Gemma suggestion (tui/README.md, the AI providers guide, the CLI reference) were updated together, and the ranking carries a dated "refresh me" comment in the code rather than only in the PR body.
  • Verified locally: go build ./..., go test ./internal/lemonade/ ./internal/ui/providers/, gofmt -l internal/, go vet — all clean.

@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Merged main in — 24 commits behind, no conflicts.

🔍 Technical details

Merge commit only — no hand resolution. Net vs main: 7 files (+150/−29) across tui/internal/lemonade/cloud.go, tui/internal/ui/providers/model.go, their tests, and the docs.

Tests on the merge result: cd tui && go build ./... && go test ./... — all 20 packages ok.

Lemonade reports a Fireworks model under either its short name or the full
`accounts/fireworks/models/<name>` path. Rank compared ids verbatim, so the
long form matched nothing: no rank label, and the model sorted into the
unranked tail — the same invisible no-op the hardcoded Gemma id had. Ranking
now keys on provider plus the trailing name segment, so both forms resolve
and a gateway model sharing a name still cannot inherit a Fireworks rank.

Also covers the one-line row guard. The existing test ran at 100 and 48
columns, both wide enough to fit a ranked row untruncated, so deleting the
ansi.Truncate call left it green. The new case runs at 36 columns, where the
row must shorten, and fails without the guard.
@kovtcharov-amd

Copy link
Copy Markdown
Collaborator

Both review findings were real and are now fixed.

The ranking would have silently done nothing for half the ids Lemonade can report. Fireworks names a model either glm-5p3-flash or accounts/fireworks/models/glm-5p3-flash, and Rank compared ids verbatim — so under the long form a recommended model lost its #N label and sorted into the unranked tail. That is the same invisible no-op the hardcoded Gemma id had, which is the bug this PR exists to fix. This is not hypothetical: the Python side already has a test for exactly that form.

The one-line row guard was not covered. I deleted the truncate call locally and the whole package stayed green, confirming the review. The new case runs at a width where the row genuinely must shorten, and fails without the guard.

🔍 Technical details

1. Rank on the full account path — fixed (tui/internal/lemonade/cloud.go).

Added rankKey(id), which reduces an id to provider + trailing path segment, and Rank now compares keys:

func rankKey(id string) string {
	provider, name, found := strings.Cut(id, ".")
	if !found {
		return id
	}
	return provider + "." + name[strings.LastIndex(name, "/")+1:]
}

The provider stays in the key deliberately, so amd.glm-5p3-flash cannot inherit a Fireworks rank.

Evidence the long form is live rather than speculative: tests/unit/test_fireworks_catalog.py::TestMissingFromGateway::test_matches_a_gateway_id_written_in_full_path_form asserts fireworks.accounts/fireworks/models/glm-5p3 resolves, and FireworksModel.short_name exists to strip that prefix. test_lemonade_cloud_models.py accepts both forms as valid Fireworks ids. Sorting picks the fix up for free — model.go:338 keys off the same Rank.

Two tests: TestRankMatchesTheFullAccountPathForm (every recommendation resolves under the long form at the same rank and note) and TestRankDoesNotMatchAcrossProviders (amd.<name>, a bare <name>, and amd.accounts/fireworks/models/<name> all stay unranked).

2. Truncate guard — now covered (tui/internal/ui/providers/model_test.go).

Reproduced the review verbatim: replacing label = ansi.Truncate(marker+label, w, "…") with label = marker + label left go test ./internal/ui/providers/ fully green. At 48 columns w is 44 and the longest ranked row is 43 cells, so the truncate never fires.

TestNarrowRankedRowStaysOnOneTruncatedLine runs at 36 columns and asserts the row renders on one line, ends in …, and that the note did not survive intact. Without the guard it fails with row was not truncated at width 36: " › glm-5p3-flash · #1 best". It also asserts up front that the chosen width still forces a truncation, so it fails loudly rather than silently going vacuous if the notes are ever shortened.

Validation. go build ./..., go vet ./internal/lemonade/ ./internal/ui/providers/ clean; both packages pass. Full go test ./...: only tui/test::TestFlagshipBootReachesChat fails, on Language model is Gemma-4-E4B-it-GGUF not downloaded plus a Windows temp-cleanup lock — environmental, and outside both packages this PR touches. gofmt -l internal/ lists every file in the tree including untouched ones (CRLF checkout), so I checked gofmt -d on the changed files instead: no real formatting diff.

Merged current main in first; no conflicts.

The setup-screen line length note was left alone — it is wrapped by the shared ansi.Wrap pass and costs a line only on a very narrow terminal.

@kovtcharov-amd
kovtcharov-amd added this pull request to the merge queue Sep 26, 2026
Merged via the queue into amd:main with commit 8a3a9ae Sep 26, 2026
43 checks passed
@kovtcharov-amd
kovtcharov-amd deleted the claude/tui-recommended-fireworks-models branch September 26, 2026 03:58
kovtcharov added a commit to kovtcharov/gaia that referenced this pull request Sep 26, 2026
Main's ranked recommendations (amd#4040) replace this branch's separate pick
list; what remains is the measured evidence behind each ranked pick, shown
when the model is focused, and the table of those measurements in the guide.
Kimi K2.7 Code is dropped: Fireworks no longer serves it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Documentation changes tui Go terminal UI (gaia-tui)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants