Yuu_jiang_ on X (#6849): 100milionseek and Coarena take at most 8 images
a request, counted over the whole conversation, tool results included,
and every turn after the ninth screenshot failed with no way on but
/clear. ID-VerNe's max-images (the commit before) set one number from
the CLI. This builds on it:
- The cap is per provider, and optionally per model: max-images=8, or
max-images=8,gemini-3-flash=10. The exact model is looked up first,
then its upstream name, then "*" for all. The provider's cap moves
with a model's local id like the other per-model limits.
- 100milionseek's "At most 8 images per request (MAX_IMAGES)." and
Coarena's "A request may carry at most 8 images." are learned as
Copilot's words are, by provider and model, so the first refusal is
the last. A user's own number is fitted before any refusal; a learned
one that is smaller still lowers it.
- Images are counted everywhere, a tool_result's too; the oldest are
left out first and the latest user turn keeps its own. Only the
request sent changes; session files are not touched. A request with
no cap, or within it, goes out byte for byte as it came.
- The provider editor's Advanced (folded unless set) has Images per
request under Max output, in maximages.js, imported as that field is
drawn, in every language. A GUI save keeps the value when the field
isn't drawn. An editor opened and closed is not dirty (the draft
takes the value only when typed), and the import, like keyrates.js's,
draws nothing once the editor has closed: before that, a quick close
threw "Cannot read properties of null (reading 'maxImages')" and
('keyPriceRates'), which add-sheet and key-box-once caught.
- Budgets: app.js and the core +354, said in core_budget_test.go.
What was run:
- go test -count=1 -timeout 45m ./... on mote at 618bfc1a9 + these two
commits: 102 packages ok; internal/tui red on TestEveryWordHasZh
("subagent pool", red on main, fixed by 6fbc24a05). After rebasing on
origin/main c9e8422fa: internal/gui (budgets), tui, agent, testenv,
gateway and provider: all ok. gofmt clean; GOOS=linux go vet -tags
nogui ./... and GOOS=windows go vet ./... ok on mica.
- At 618bfc1a9 + these commits, on mote: provider-max-images 60/0,
add-sheet 6/0, add-button 6/0, key-box-once 20/0, nokey-editor 4/0,
provider-base-api 4/0, add-sheet-custom 32/0, kimi-subagent-pool
20/0, sync-signins-except 20/0; old-webkit 4/2 (#6030 headerpresets,
#5919), i18n-keys 3/1 (#6877), provider-max-output 4/20 (#6209),
editor-hints 30/10 (the same at origin/main, in #6934).
- The whole GUI suite (1569 files, chromium + webkit, every language)
on mote at the pre-fix head under another session's suite: 153 files
red. Each red file rerun at the fixed head and at origin/main
ad585ccd6 on mica (and mote for the close ones). Red at head only:
add-button (Escape showed the discard confirm: the dirty draft, fixed),
add-sheet and key-box-once (the null draft above, fixed); now 3/0,
6/0, 20/0, provider-max-images 60/0. Every other red file is red the
same at origin/main, the same subtests: filed with its numbers as
#6934 (the #6782 class). i18n-keys' ", with an image" is #6877,
old-webkit #6030/#5919, provider-max-output #6209.
Broken by hand (each red, then put back): the relay words left out
(TestImageCapLearnedFromRelayWords), per-model lookup by upstream name
gone (TestMaxImagesOnAModelListedByItsOwnID), a copy made when nothing
applies (TestImageCapNoneIsTheSameBytes), the learned cap over the
user's (TestMaxImagesStandsOverTheLearnedCap), the GUI save dropping it
(TestProviderSaveKeepsMaxImages), the CLI's empty value
(TestProviderSetMaxImages), the cap not moving with a local id, the JS
parse without its 1000 limit and the field not unfolding Advanced
(provider-max-images), and the draft written on open (provider-max-
images' Escape check, 20 red).
Not tried: no real 100milionseek or Coarena account (the words are the
reporter's literal ones); no GUI run on Windows or Linux; the suite's
GUI half ran under load, so many reds are shared timeouts.
Co-authored-by: ID-VerNe <yuu_seeing@foxmail.com>
100milionseek's and Coarena's APIs take at most 8 images a request, counted
over the whole conversation, and answer the ninth with a 400 of their own
words (#6849): "At most 8 images per request (MAX_IMAGES)." and "A request
may carry at most 8 images.". imageCapWords matches Copilot's wording
alone, so the cap is never learned there and every turn of a session that
has shown nine screens fails, with no way on but /clear.
`magpie provider set <id> max-images=<n>` sets the user's own cap. The
gateway fits a request over it before it is sent, the oldest images left
out for the line imageOverCap stands, exactly as the learned Copilot cap
does; no refusal is needed to know it. The user's number stands over a
cap Copilot's refusal taught the same provider. 0, the default, keeps
the learned path as it was. The provider editor has no field for it: a
GUI save keeps what the CLI set, as it keeps usefirst and standin.
What was run:
- gofmt -l internal/ (clean); go vet ./internal/gateway ./internal/cli
./internal/provider ./internal/gui (clean); GOOS=linux go vet ./...
(only wails beta.24's own cross-compile errors, the same 12 as at the
base commit 1bfc6378c)
- go test ./internal/gateway -run 'ImageCap|MaxImages|CopilotGemini'
-count=1 (ok)
- go test ./internal/cli -run 'MaxImages|ProviderSet' -count=1 (ok)
- go test ./internal/gui -run 'TestProviderSaveKeepsMaxImages|
TestEveryRouteIsNamedForTheCLI|TestSettingsSaveKeepsWhatItDoesNotSend|
TestEveryWordHasZh' -count=1 (ok); go test . -run
'TestNoEagerPackageRegexps' -count=1 (ok)
- full packages: ./internal/cli, ./internal/gateway, ./internal/provider,
./internal/gui at -timeout 45m/40m
Broken by hand: TestMaxImagesFitsBeforeSending was written asserting
three images left out of twelve against a cap of eight; it went red on
the correct code and was corrected to four, the count the body shows.
TestMaxImagesUnderCapUntouched first compared the bytes sent with the
bytes posted and went red because the gateway sends the vendor the
model's own id, not the provider-prefixed one; it now compares the
images and texts. Its second case first said "one history image and
eight latest" leaves the history image alone, which was wrong arithmetic
(nine minus one is eight, a fit); it now posts nine in the latest
message alone, where nothing can be left out.
Not tried: a real 100milionseek turn through the built gateway (the
provider serves from this machine; the probe in #6849 measured it on
/v1/messages directly). The learned-Copilot path is unchanged and its
tests pass as before. -race: this Windows box has no C compiler, so
-race doesn't build there; the MaxImages tests were run -count=5
instead. Full-suite reds on this machine, all reproduced at the base
commit 1bfc6378c with this change stashed, none in files this change
touches: internal/gateway (ClaudeAsRootEnv, HandedOver/HandedOff x5
("A device attached to the system is not functioning" on a TCP
handover), HubRootsOfACodexThread, MaskedRecordKeepsSentAndBack in a
full run only), internal/cli (healthcheck x2, library-project,
opencode-default, update-find: the real magpie running on 3425 and a
real OpenCode install), internal/provider (Codex keychain x11, priced
free, resolve x2, Qianwen, saved-but-signed-out, git-on-disk x2: real
proxy settings and Windows keychain), internal/gui
(GatewayHeldByAContainer: Windows file lock on magpie.exe;
LodyImportHandoff: %AppData% undefined), internal/agent (WorkBuddy,
Hermes x4, mise shim x2, DesktopHandler, Grok, Codex own-models,
AppliedOf, AsideOffline, ClaudeViaMagpieKept, ClaudeDesktopLanguage:
macOS-specific paths and real installs), build/darwin
(FreedHeap: darwin overlay build on Windows).