Commit Graph
2 Commits
Author SHA1 Message Date
yetone 01de489de1 search: a ChatGPT account searches for another model by the backend's own search (lucy_85908)
A third-party model in Codex (DeepSeek, MiniMax, ...) had its web
searches made by asking gpt-6-luna on the Codex account to search
through /responses. A ChatGPT account now searches by the ChatGPT
backend's /alpha/search, the request Codex's web.run sends by itself
with no model turn (codex-rs ext/web-search): one search_query, the
account's small model in "model", allowed_callers ["direct"], and
external_web_access from the client's web_search tool (#5018: Codex's
"cached" sends false; live by default). The output's pages are read by
their 80-dash rule and ref_id; the private-use citation marks are dropped.

Measured on a real Plus account (2026-11-03, token not refreshed): 151
alpha/search calls left the 5h window at the same percent, ~1.5-2.2s
each; 51 searches by gpt-6-luna took 0% -> 1% of it, 7-15s each,
~9-17k tokens in (40 of them: 414,585 in, 10,313 out). The backend
answered the same for any "model" (deepseek-v4 too) and any
max_output_tokens.

- Automatic (and searchInTurn) picks the backend's search for a ChatGPT
  account; Settings > Web search offers "<id>/@search" as "its web
  search". "<id>" and "<id>/<model>" saved before still search by that
  model, so a user's pick is unchanged.
- When the backend's search fails, the account's small model searches
  (codexSearchBy).
- Codex web.run's own search for a non-ChatGPT model (alphaSearchHere)
  and a Responses request's web_search tool pass their mode on.

Run at this head (rebased on origin/main), on mote:
- go test ./internal/gateway/... ./internal/gui/ ./internal/agent/
  -timeout 45m: gateway and agent ok; gui red only on
  TestMainWindowCorners/macOS_26_SDK (#3949, macOS 27 on mote).
  After the rebase: the gateway's search tests again ok.
- searcher-pick.test.cjs: 22/22, chromium + webkit, en/zh (+ the label
  is in zh, zh-TW, ja, de).
- gofmt -l clean; GOOS=linux go vet gateway, provider; GOOS=windows go
  vet gateway, gui.
- Whole GUI suite on the Linux box (wsl-run): not finished when pushed;
  its reds so far are WebKit pages this doesn't touch (add-provider,
  API key palette, Routing headers, click-scroll, Codex resets).

Broken by hand, each red: the Automatic switch (TestCodexSearchesWith
ItsCheapModel, TestChatGPTAccountSearchesByItsWebSearch), the
responses.go mode (TestResponsesWebSearchModeKept), the body's mode,
the fallback, and the picker option (searcher-pick).

Not tried: a real search through magpie in a sandbox (the request shape
was tried by hand against the backend); an account out of its
allowance (does alpha/search still answer?); the model fallback still
searches live when Codex asked cached.

Suggested by lucy_85908 on Discord.
2026-11-03 15:59:14 +08:00
yetone 8ee172ca03 search: a Codex account searches with its cheap model, not the flagship its list starts with
lucy_85908 (Discord #feedback, v0.1.2682) ran a third-party model in Codex
and found each web search magpie ran for it logged as Anthropic -> Responses
on gpt-6.1-sol, 10,532 tokens in, through the Codex account. The searcher
was picked right (a Codex account searches for models that can't), but its
model was not. smallCands ranks a provider's models by small-tier name
(haiku/mini/flash), then m.Price. A subscription's list has no prices, and
GPT-6 has no mini, so every Codex model ranked equal and the first listed
(gpt-6.1-sol) was used for every search and every AutoVision description.

Now a model with no price on the list is ranked by its list price
(Provider.ListPrice, the price the Usage page counts it at). "luna" is a
small-tier word beside mini, for when no catalog is loaded yet (the same
rule warmPick has used since #604). codex-auto-review is left out: it is
free only for the reviews it runs. A searcher or model named in Settings
-> Web search still wins (namedSearcher is unchanged). The fix is in the
pool AutoVision shares, so a Codex account's image descriptions now go to
the cheap model too.

Not changed: Codex's web_search = "cached" (external_web_access:false)
is still dropped when magpie searches for a model that can't; filed as
#5018.

Run at the pushed head (mote-run):
- go test ./internal/gateway -run TestCodexSearchesWithItsCheapModel
  (new), and with Search|Searcher|Vision|Small|TestRankSmall|TestAutoVision:
  ok.
- go test -timeout 45m ./internal/gateway at the pushed head (rebased on
  06944e065): ok (714s). ./internal/gui (before the rebase, which touched
  no gui file): ok but TestMainWindowCorners/macOS_26_SDK, red alone too,
  open as #3949 (mote is macOS 27).
- GOOS=linux and GOOS=windows go vet ./internal/gateway: ok; gofmt -l
  clean.
Broken by hand: with search.go as on main, the test is red
("searcher = codex/gpt-6.1-sol with no catalog, want codex/gpt-6-luna").
With the list-price fill alone turned off, it is red at the priced
no-luna list (gpt-6.1-sol, want gpt-6-sol).
Not tried: a real search on a Codex account with gpt-6-luna. Its
models.json entry has web_search_tool_type text_and_image and
use_responses_lite, the same as gpt-6.1-sol.
2026-11-03 14:09:03 +08:00