Commit Graph
4 Commits
Author SHA1 Message Date
yetone 73a70275ce gateway: a relay check asks harder fixed-answer questions too (skingstyle48487 on X)
skingstyle48487 found the check's first questions too easy to tell
relays apart: a cut-down model gets three products and a tool call right
as often as the real one. The check now also asks five short questions
such a model tends to miss, each with one answer a program can check:
- two sums in a few steps: (37 × 43 + 1289) × 7 − 2468 and
  17 × 17 × 17 − 29 × 31;
- how many r's are in "strawberry raspberry", as a number;
- the first five primes past 50, as "53,59,61,67,71";
- five words sorted, in lower case and joined by hyphens.
Numbers are read past separators as before. The two exact-form answers
are compared as written: only quotes, a code mark or a full stop around
them are read past, so case and spacing count. That makes 11 calls, still
three at a time. No prompt names a product, a vendor or a limit, and
TestRelayPromptsNameNoOne holds that. The dialog names each new item in
the five languages ("Work out (37 × 43 + 1289) × 7 − 2468", "Sort five
words"), and its intro names the new kinds.

Run (mote):
- go test -run 'CheckRelay|RelayPrompts|ReadChatStream' -v
  ./internal/gateway: 7 pass;
- usage-model-speed.test.cjs, chromium and webkit, five languages:
  12/12;
- i18n-keys: 4/4.
Broken by hand:
- the exact answers read as numbers turns TestCheckRelayAnsweredAsAsked
  and TestCheckRelayCountsEachAnswer red;
- the exact answers compared without case turns
  TestCheckRelayHarderAnswersApart red ("Apple-banana-…" read as right).
Not tried: a real relay or a real cut-down model; how often each item
splits real relays is not measured.
2026-11-18 05:27:43 +08:00
yetone 495ada49a7 usage: the speed card's Check… shows without hover (skingstyle48487 on X)
skingstyle48487 couldn't find Check… on the Model speed › Providers rows:
with a mouse it showed only while the row was pointed at. It now always
shows, in the muted colour, and takes the control colour when its row is
pointed at or it has focus. No new label.

Run (mote): usage-model-speed.test.cjs, chromium and webkit, five
languages: 12/12.
Broken by hand: the test with the old app.css is red in both engines
("Check… shows without hover").
2026-11-18 05:27:43 +08:00
yetone 5bfa57e3d3 usage: check one model on one provider with a few fixed-answer calls, kept beside the other providers
skingstyle48487 on X runs more than ten relays and asked for something
like the "pelican test" to spot one that waters a model down. In a
follow-up (2122694296054972815) they said speed, failures and the model's
name show whether a relay is fast and stable, not whether the model got
weaker. They asked for small tests with known answers, the share of right
answers and of right tool calls, and relays compared side by side.

On Usage › Requests › Model speed › Providers, each row has a Check… that
opens a dialog. Opening it sends nothing; only its Check makes the calls.
POST /api/relay-check (gateway.CheckRelay) makes 6 small streamed Chat
Completions calls through the gateway, pinned to provider/model as an
agent would, three at a time:
- write 1 to 40;
- 1234 × 5678, 987 × 654 and 2468 × 1357;
- weather in Paris and time in Tokyo, each call offering both tools,
  so the right one has to be picked.

Each part says what it found, never a verdict on the provider:
- whether the answer was the expected one, and what came back;
- the model the reply named, when the ledger would call it another
  model (usage.Swapped, not SameSpelled or ListedAs);
- the provider that answered, when the call was handed on;
- how many input tokens the 118-character prompt was counted as;
- first token, tok/s and the whole time.

The dialog heads the parts with "Answers right: n of m" and "Right tool
calls: n of m". The numbers come from the gateway's own usage records (a
tap in appendUsage keyed on the request's context), not from each
protocol's reply. The tally of each provider's last check is kept in the
window's storage. The Providers table then shows Answers and Tool calls
columns: sortable, amber when short of all, a dash for providers not
checked, so relays are compared side by side. The dialog code is a
lazily loaded root script (relaycheck.js), as app.js has no room left.

Run, at this head:
- mote: go test -timeout 45m ./internal/gateway ./internal/gui
  ./internal/cli ./internal/usage: ok (the full ./... suite passed at
  41d88731c, before the fixed-answer calls; mote and mica were each
  running another session's GUI suite at this head);
- gofmt -l, GOOS=linux go vet -tags nogui ./... and GOOS=windows go
  vet ./...: clean;
- go test -run 'CheckRelay|ReadChatStream' -v ./internal/gateway
  (5 tests pass);
- usage-model-speed.test.cjs, chromium and webkit, en, zh, zh-TW, ja and
  de at 400px: 12/12;
- i18n-keys and old-webkit: their only reds are the three on origin/main,
  each filed (#6877 ", with an image", #5919 :has(), #6030
  headerpresets.js);
- TestCoreScriptBudget and the app.js budget: ok, not raised.
Broken by hand:
- taking tapUsage out of appendUsage turns TestCheckRelayAnsweredAsAsked
  and TestCheckRelaySaysWhatDiffers red;
- dropping the tool-name check turns TestCheckRelayCountsEachAnswer red
  (get_weather for Tokyo read as right);
- pressing Check as the dialog opens turns the GUI test red ("opening the
  dialog sends no call").
Not tried:
- the whole GUI suite at this head (both machines busy with another
  session's suite);
- a real relay (fakes only);
- a context-window probe;
- a comparison with the vendor's own count_tokens;
- a periodic check (the check runs only on a press).
2026-11-17 23:13:03 +08:00
yetone 88c417392e usage: a sortable model speed ranking on the Requests tab (@flying_crp on X)
Usage's Requests tab gets a "Model speed" card: per model, the median output tokens/s, the median wait for the first token and the request count, over the selected range, sortable by every column (aria-sort header buttons, quiet table, no gradients). A request counts when it was answered (not rejected, handed on, failed or canceled), its first token was timed and it wrote 100 tokens or more (usage.MinRankTokens; the tooltip says so). Computed locally: each chunk keeps a 2% log-bin histogram per model beside its cells (speed_rank.go, chunkPart.speeds), a page merges the chunks' histograms, so there is no per-request sort and medians are within ~1%. The settled chunks' histograms are in the page file; its key salt is now page-v2, so the first load after upgrade recounts settled history once. /api/ledger sends speeds and speed_min.

Run (mote): gofmt clean; go vet darwin, linux nogui, windows for the touched packages and ./... earlier; go test internal/usage, internal/usageapi, internal/gui ok at this head; usage-model-speed.test.cjs 12 of 12 (chromium and webkit, en/zh/zh-TW/ja/de, 400px: order, sort by every column, aria-sort, focus kept, no horizontal overflow, ellipsis, hidden when empty); with i18n-keys and i18n-en-no-cjk 20 of 20; the whole GUI suite once on the branch before the rebase: every red is in a file unrelated to this change (account-arrange #6010, account-refresh-holds #5814, account-eye #5052, agent-switch-accounts #5925, bulk visibility and disconnect previews #5982 fixed in e430e2750, accounts-own-signin #6038), each red alone on origin/main 71a68639b or load-only.
Timing: 1M requests added to a chunk in ~185ms (TestModelSpeedRankAtTheLargestLedger).
Broken by hand: dropping the Failed/Canceled exclusion (gpt: 5 requests, 59.7 tok/s) and dropping the page's merge of chunk speeds (ranking empty) each turned the new tests red; restored.
Not tried: the real Linux app (WebKitGTK), a real ledger of hundreds of thousands of rows through the page-v2 file, a Windows run (win-run).
2026-11-11 10:12:23 +08:00