tui: the agent view's picker test wants codex/gpt-6-luna, from a row (#3919)

TestTUIFetchesSubscriptionModels/agent is red on ubuntu and macOS CI
since c80b32c9 ("agent: a model Codex hides but the user ticked is
offered in Codex's picker"): the picker gives codex/gpt-6-luna where
the test wants gpt-6-luna. The picker is right. The test passed before
c80b32c9 only because nothing matched.

The test signs a ChatGPT account in to Codex and writes no
models_cache.json, so Codex has no list of its own here, and
codexViaMagpieFor offers the models magpie serves on that account,
codex/gpt-5.5 and codex/gpt-6-luna, in Codex's group. Before c80b32c9
those were dropped: at e056779a, once the list is in, the agent view's
whole list is auto/gpt-5.5 and b/gpt-5.5, with no gpt-6-luna row.
Codex's model field takes a value of one's own, and a picker that does
hands back the typed text when no row matches, so choice() gave
"gpt-6-luna", the test's want.

The agent view now wants codex/gpt-6-luna, and every view's last check
also needs a row to match, so typed text can't pass it again. The
other five views' wants were rows already.

What was run (tree bca161d7, on origin/main 791e27ec, go1.26.8,
linux/amd64, Linux 5.15), outside graftcp, umask 077:
- TestTUIFetchesSubscriptionModels -v at 791e27ec: agent red as on CI
  (models_test.go:96: got "codex/gpt-6-luna", want "gpt-6-luna"), the
  other five views pass. Here, with TestTUIAsksAgainForAMissingList,
  -count=3: 24 of 24 PASS.
- The agent view's items before and after the list comes, printed by a
  throwaway test at e056779a and at 791e27ec: the lists above.
- Broken by hand, TestTUIFetchesSubscriptionModels -v:
  - codexViaMagpieFor dropping every codex/ entry, as before c80b32c9:
    agent red (got "gpt-6-luna", want "codex/gpt-6-luna"), the other
    five pass;
  - the same, with the test as on main: all six pass, which is how the
    agent view's missing row went unnoticed;
  - the same, with main's bare want and the row check kept: agent red
    (got "gpt-6-luna", want "gpt-6-luna"), so the row check alone
    catches the typed text.
- go test -tags nogui -count=1 -timeout 45m ./... (log kept), Bun
  1.4.2: 69 packages ok and 7 red, none in what this changes, and
  internal/tui ok. The reds: agent TestCodexDriftReached (#3398),
  TestInstalledVersion, TestCursorFolderFromTheEditorIsNotTheCLI,
  TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
  TestQoderSettingsFromAnIDEPluginIsNotTheCLI, TestOmpDetectedWithPiDir
  and TestZedAppPath (#3141),
  TestReasonixCLIRequiresSupportedNativeVersion and
  TestReasonixCLIRecoversAfterProbeTimeout (#3641), and
  TestWSLColdPlaceOpensNothing (#3924); davsync TestSync (#3420); edit
  TestWriteAtomicReadOnlyHardLink and testenv TestProgram (umask 077,
  #3640); gateway TestHandedOverGatewayFinishesItsStream (#3568) and
  TestPluginToldWhereTheAgentWorks (#3675); gui
  TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie
  (#3649); provider TestCodexAppServersOnHome (#3906), then "close of
  synctest channel from outside bubble" from
  TestUnreadLoginsWriteErrorsKeepCredentials (#3632).
- gofmt -l clean. go vet -tags nogui and go build -tags nogui for
  linux, windows and darwin, and go vet and go build for windows
  without the tag: exit 0 each. go vet and go build without the tag on
  linux: exit 1 (this box has no GTK or WebKitGTK dev packages).

Not tried: macOS, where CI is red too.

Merged from JoeyWu-tech's branch, cherry-picked onto origin/main f13aafa87 together with the other of #3919/#3924. Run on mote at that tree:
- go test ./internal/tui/: ok.
- GOOS=linux and GOOS=windows go vet ./internal/agent/ ./internal/tui/: ok.
This commit is contained in:
JoeyWu-tech
2026-10-28 07:06:27 +08:00
committed by yetone
parent 41427e016b
commit d6c459c79c
+7 -2
View File
@@ -92,7 +92,9 @@ func TestTUIFetchesSubscriptionModels(t *testing.T) {
}
m.pk.input.SetValue("gpt-6-luna")
m.pk.refilter()
if got, _ := m.pk.choice(); got != want {
// a row of the list, not the typed text a picker that takes a
// value of one's own hands back when no row matches
if got, _ := m.pk.choice(); got != want || len(m.pk.match) == 0 {
t.Fatalf("the picker hasn't Codex's listed model: got %q, want %q\n%s", got, want, m.View())
}
})
@@ -154,7 +156,10 @@ func openModelPicker(t *testing.T, m model, view string) (model, string) {
m.agents = []*agent.Agent{a}
m.reload()
m.openFieldPicker()
return m, "gpt-6-luna" // Codex's own account: its models bare
// Codex has no list of its own here (no models_cache.json), so the
// models magpie serves on its ChatGPT account are offered via magpie
// (codexViaMagpieFor)
return m, "codex/gpt-6-luna"
default:
m.page = pageGroups
m.openMemberPicker(pickMsg{newGroup: "Test"})