ac4af582301a4e8a29245dbba767eba31334ddf9
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
5666cb0490 |
search MCP: web_search takes a count, 6 by default, 1 to 20 (treeman)
The web search MCP server's web_search always gave 6 results: searchHits was both what a search API (a plugin's included) was asked for and where its pages were cut. It now takes an optional count, described in its input schema (integer, minimum 1, maximum 20, default 6). A number or a number in a string is taken, floored; below 1 is held to 1, above 20 to 20 (Brave and Tavily take no more than 20); null or a non-number is the default 6. The tool's description is unchanged, and the web_search magpie offers models on vendor requests keeps its schema (no count). The count rides the search's context (withSearchCount/searchCount), so every backend reads it: plugin search APIs by key and signed-in (the count handed to the hook and the pages cut), Tavily max_results, Brave count, Exa numResults, Firecrawl limit, DeepSeek count, Volcengine Count, You.com count (all three routes), Yuanbao Search's Cnt (the fewest of 10/20/... that covers it), SearXNG (cut only), Kimi Code's limit, GLM's search MCP and Codex's backend search (cut only, neither takes a count), WorkBuddy (its client's 5 unless more than 6 is asked). A searcher model's search is prose and has no count. Run (mote): go test -run 'Search|Codex|Kimi|GLM|WorkBuddy|Plugin' ./internal/gateway ok; -race of the new tests and TestSearchMCP* ok; go vet, GOOS=linux go vet -tags nogui, GOOS=windows go vet of the package ok; gofmt -l empty. Broken by hand: searchCount ignoring the count went red in both new tests (plugin asked for 6, said 6, every vendor asked 6); withSearchCount without the clamp went red for 50, 0 and -3. Not tried: a real search API or plugin with count > 6; the full suite runs after the push. |
||
|
|
73c98ebc20 |
gateway: a search API's or plan service's ask is routed and archived (axelburks)
axelburks on Discord: when magpie searches for a model through a search API, the Routing page doesn't say which API answered, and Usage → Requests lists the row but has no request archive, so the request and response sent to the API can't be seen. A model's search (searchWith) was already routed and archived. A search API's ask (askSearchAPIKeys, a plugin's search hook, a signed-in search API) and a plan's own search service (Kimi Code, GLM Coding Plan, WorkBuddy, Codex's searchBy, and searchBy's Kimi branch, which wrote no row at all before) only wrote a usage row. Now every ask that writes a row goes through keepSearch (search_archive.go): a done web_search route, agent magpie, For the agent searched for, the API's name as model and its host as provider, seated on the masked key or account; a Recent call with ring-cut bodies; and with the request archive on, archiveOwn of the exchange as sent. The row gets RouteID and Archive, which the Requests tab already opens. Each ask has a searchWire in its context, filled where it is sent (tapSearch tees the answer as read; the last exchange stands, so GLM's MCP tools/call is the one kept). A plugin's search is noted as what magpie handed the hook (key masked) and what came back (PLUGIN method). The key is replaced by MaskSearchKey in path, query, headers and both bodies before anything is kept; the archive's own scrub runs on top. Bodies are kept up to RequestArchiveMaxMB (longer marked cut); archive off keeps nothing on disk, the route and Recent call stay. Run (mote's disk filled mid-work, see below; the rest on WSL magpie-desktop via wsl-run): - mote-run: go test -run 'Search|Archive' ./internal/gateway ok; GUI usage-ledger-search, routing-side-calls, request-archive-usage in chromium+webkit, every language and width: 38 pass. - wsl-run: go test -run 'Search|Archive' ./internal/gateway ok; go vet ./internal/gateway ok; GOOS=windows go vet ./internal/gateway ./internal/gui ok; GOOS=darwin CGO_ENABLED=0 go vet ./internal/gateway ok; GUI usage-ledger-search, routing-side-calls, request-archive-usage, search-instead, search-mcp in both engines: 68 pass, 0 fail. - gofmt -l clean. Broken by hand: keepSearch's call commented out turns all five new gateway tests red; taken()'s key masking turned off turns TestSearchAPIAskIsRoutedAndArchived and TestSearchAPIKeyInQueryNotArchived red. TestSearchRowKeepsRouteAndArchive (internal/gui) is a guard that the row's RouteID and Archive reach /api/usage/requests; it passed on the old code too. Not tried: real Tavily/Brave/Kimi/GLM/WorkBuddy/Codex accounts (httptest stubs only); Linux go vet of internal/gui (WSL lacks gtk4/webkitgtk); web_fetch (search_fetch.go) and a vendor's own search (search_native.go), which magpie doesn't send, are unchanged. Full suite runs after the push. No GUI asset, API call or i18n string changed. |
||
|
|
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. |