Commit Graph
1 Commits
Author SHA1 Message Date
yetone ba37e78b4c provider: a plugin model's test is told a queue at once and warms its host first
mingxia_16024 on Discord (v0.1.1862): testing models on Qoder (CN and
international) and WorkBuddy always failed with "qfmodel: context deadline
exceeded", even though agents got answers from the same models.

Cause, checked with the owner's real Qoder account in a sandbox HOME:
- The test already takes the gateway's route: p.Do, then the plugin's
  fetch in the host.
- The Qoder plugin waits out Qoder's free-plan queue (plan queue p3) for
  up to 4 minutes, unless X-Magpie-Fallback is "1". magpie never sent
  that header.
- The probe gives up after 20s. A raw request with no deadline got its
  head after 3m49s.
- The probe's 20s also had to cover the plugin host's cold start and the
  account loader's first run, which can renew the sign-in. A first
  WorkBuddy AI test took 8.4s.

Changes:
- For a plugin provider, probe sends X-Magpie-Fallback: 1, so a queued
  model answers at once with the plugin's queue message.
- It starts the host and runs the account's loader (warmPlugin, through
  the account's proxy) under the caller's deadline, not the probe's.
- A plugin probe waits up to pluginTestWait (60s). The GUI gives a model
  test 3 minutes.
- host.js lists x-magpie-fallback in MAGPIE_ONLY, so no vendor receives
  it.

"Recent calls" lists only the gateway's own calls, for every provider. A
test is written to the Requests page as magpie's own test, timed-out
tries included, so that is unchanged.

The gateway still never sends the header when another candidate follows,
which Qoder 0.2.40 and CodeArts 0.2.3 expect: #4049.

Run (mote-run):
- New tests TestPluginModelTestSaysQueued and TestPluginModelTestColdHost.
  They use the fake plugin's new $FAKE_QUEUE and $FAKE_LOAD_WAIT, with a
  cold host from plugin.Restart.
- go test -tags nogui -timeout 45m ./... at 76218200a: every package ok (77), none FAIL.
- GOOS=linux and GOOS=windows go vet of internal/provider and
  internal/plugin, go build ./..., and gofmt -l.
- Real Qoder account, sandbox HOME, a TestModels of qfmodel:
  - before: failed at 20.00s, twice;
  - after: "Qoder queued the request for qfmodel (this plan's queue: p3);
    try again in 30s" in about 0.5s, twice. One more run got a 200 in
    767ms.

Broken by hand, each red:
- Without the header set: SaysQueued fails with "context deadline
  exceeded" at its 5s wait.
- Without warmPlugin: ColdHost fails with a deadline at 2001ms.
- Without the MAGPIE_ONLY entry: the vendor gets fallback="1".

Not tried:
- WorkBuddy CN with a real account. It reads the desktop app's sign-in,
  which the sandbox doesn't have.
- A cold start on a slow machine or on Windows.
- The GUI button itself. The handler is unchanged.
2026-10-28 18:24:50 +08:00