Commit Graph
4 Commits
Author SHA1 Message Date
yetone ce8b67de37 gui tests: a page's first load gets a minute, not a click's 5s (#4470)
claude-switch-only set page.setDefaultTimeout(5000) and then called
page.goto with no timeout of its own, so Playwright held the first load
of app.js, i18n.js and the plugins to the 5s bar meant for clicks. On a
busy box (a whole-suite run at load 130-160) that load took longer and
goto timed out. The same pattern is in 988 GUI test files (1174 pages):
every one of them now also sets setDefaultNavigationTimeout(60000) on
the same page, right after its default, so goto, reload and waitForURL
wait on the load itself with room, while clicks and waits keep their
short bar. group-from-model-add's own 20s navigation bar is raised to the
same minute. claude-switch-only also gives its first provider row (drawn
from the page's first reads) a minute before clicking it.

nav-timeout.test.cjs (no browser) reads every GUI test file and names
each page given a default under a minute without a navigation timeout of
at least a minute, so a new file can't bring the pattern back.

What was run (WSL magpie-desktop, Playwright 1.62.0, load 70-260 from
other sessions):
- node --check on every file in internal/gui/tests: all parse.
- nav-timeout.test.cjs against origin/main's test files: red (names the
  1174 pages); against this tree: its only reds were my own probe copies
  of the old files, since removed.
- By hand: claude-switch-only with app.js served 7s late (a busy box's
  first load), --test-name-pattern "1100 en": origin/main's file 4 of 4
  red with "page.goto: Timeout 5000ms exceeded"; this file 4 of 4 green.
- claude-switch-only.test.cjs, both engines, en/zh/ja/de, 1100 and 420:
  32 of 32. group-from-model-add, usage-access-key-card and i18n-keys:
  green. agent-plugin-agents: Chromium green; WebKit's de 420 subtest red
  on a 5s waitForFunction at line 115 (a wait after load, not the
  navigation), at load ~230.

Not tried: the whole GUI suite (about 1000 files; the change is one
mechanical line per page), Windows or mote (mote's browsers, #4125).
2026-10-31 02:09:18 +08:00
yetone 64262a19f0 agent: Prime Agent is an Agents-page row, wired like Pi into ~/.prime/agent, and Disconnect puts its files back (#1528, takltc)
What changed
- internal/agent/primeagent.go: Prime Agent (PrimeIntellect-ai/prime-agent,
  CLI prime-agent) through the piLike path, as OmO was added. Its folder is
  ~/.prime/agent or PRIME_AGENT_CODING_AGENT_DIR (~ expands, as upstream's
  agent_dir does; appdir now lets that variable carry ~). models.json and
  settings.json were checked against upstream v0.10.0 (pa-core settings and
  models registry): Pi's camelCase fields, the same thinking levels and
  enabledModels rules. Connect writes providers.magpie, defaultProvider and
  defaultModel and keeps the user's providers and settings. Only the global
  settings.json is written; allowedModels and subagentDefaultModel are left
  alone.
- Prime Agent sends no User-Agent, so its provider block carries the key
  magpie-prime-agent and the usage log names it (piLikeKeyed). The block is
  Pi's otherwise, compat.sendSessionAffinityHeaders included (Prime Agent's
  openai_completions honours it), kept as the user set it (piBlockKept).
- Disconnect restores both files byte-for-byte: before magpie's first write
  a copy is kept (*.before-magpie, or a note that the file was absent), and
  Disconnect puts it back when nothing else changed since (Agent.Restore). A
  file changed while connected is left with only magpie's part taken out.
- WSL kind, agentenv, the icon, PICKS_ITSELF in the GUI, docs and READMEs.

Run
- go test -tags nogui ./internal/agent ./internal/appdir ./internal/agentenv
  ./internal/library ./internal/usage; the new tests went red with the key,
  the restore, the ~ expansion, PICKS_ITSELF and the icon each taken out.
- pi-default-note.test.cjs in chromium and webkit.
- Real use: prime-agent 0.10.0 installed into a sandbox HOME, a sandbox
  gateway on 127.0.0.1:3651 and a fake upstream on 3652. The interactive
  TUI with no flags started on magpie/fake/echo-1, the fake got the request
  and usage.jsonl recorded agent "prime-agent". `magpie prime-agent default`
  put models.json back byte-for-byte; settings.json got its values back, but
  Prime Agent rewrites the whole file when it runs (every key, nulls), so
  that file is equal in content, not bytes. Reconnecting over that
  null-filled file and disconnecting again left it byte-identical. After
  the rebase onto 7a5536793 (compat in Pi's block) the turn was run again:
  same result, and both files byte-identical after Disconnect.
  `prime-agent -p` ignores the saved default upstream (print mode picks a
  featured model); with --provider magpie --model it goes through magpie.
- gofmt -l, GOOS=linux and GOOS=windows go vet, full go test ./...
2026-10-11 03:11:33 +08:00
yetone be832ff01b gui: pi-default-note's agents are connected, so their row pickers list every choice — #709's test was written against the row before 「接入」, where the model field stood in the row; now the model a connected agent starts on is picked beside its switch, and Default there says Pi picks the model itself, as before 2026-10-04 02:14:54 +08:00
yetone 5d126a0db7 agents: Pi's model picker lists the models of its openai-codex sign-in from Pi's own registry, and its Default says it lets Pi pick (#709) — Pi's native options came from models.dev by provider id, and models.dev has no openai-codex (Pi's "OpenAI Codex (legacy)" ChatGPT sign-in), so a Pi signed in to both openai and openai-codex was offered openai/… only. Pi's (and OmO's) own options now come first from the model registry in the package Pi was installed from: the pi command on PATH leads to @earendil-works/pi-coding-agent, and pi-ai's dist/providers/data/<provider>.json (Pi 1.0) is read as is, in its order, chat models only (no gpt-image-2), memoized by the file's stamp — the list Pi's /model offers, which moves with every Pi update. A provider the registry doesn't have keeps models.dev's list; openai-codex with no registry in reach falls back to Codex CLI's models_cache.json (the same ChatGPT backend); models.dev's openai list isn't mapped onto it. The rows are openai-codex/<model> under "OpenAI Codex" with OpenAI's logo, a row each beside openai/<model> of the same name; picking one writes defaultProvider=openai-codex, defaultModel=<model> as before. omp shared the gap for its current model's provider (ownOptions): it now reads omp's own catalog (@oh-my-pi/pi-catalog src/models.json, non-chat kinds left out); omp's signed-in providers that aren't the current one are still #341's. Default in Pi's and OmO's model picker now says "clears the default model; Pi picks one on its own" (zh 清除显式默认模型,由 Pi 自动选择; no ja table exists), other agents' still say what they ship with. TestPiOffersItsOwnOpenAICodexModels (a fake npm-linked Pi 1.0 install, temp HOME and PI_CODING_AGENT_DIR, auth.json with openai and openai-codex oauth test metadata), TestPiOpenAICodexWithoutItsRegistry and TestOmpOffersItsOwnOpenAICodexModels fail on the old code (no openai-codex rows) and pass; pi-default-note.test.cjs (webkit, en/zh) fails on the old app.js and passes; agent-disconnect, agent-models and agent-model-groups GUI tests pass. Read-only against this machine's real installs: Pi 1.0.0 gives openai-codex 9 models and openai 44, omp's catalog openai-codex 8. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass but TestProvidersAnswerWhileListsComeIn, TestClaudeSignedOut, TestClaudeAccountNamedAsItsLogin and TestClaudeIdentityServedWhileAsked, timing tests that pass alone. Not tried in the GUI with real Pi sign-ins, nor with a Pi older than 1.0 (no data folder: models.dev and Codex CLI's list as before) or a Windows npm shim. 2026-10-04 01:53:58 +08:00