Squashed from wei's #1146, onto main. Each test now starts from state of
its own instead of what an earlier test (or an earlier -count run) left:
- plugin: changed() counts the OnChange hooks still running; Told waits
for them, and Settle ends with Told and UseCached(nil), so a change one
test made isn't told in the next and the next test's plugin list isn't
read as changed. Only tests call Settle/Told; in production changed()
only counts. New TestSettleWaitsForTheHooksItTold and
TestSettleForgetsTheFoldersPlugins.
- provider: isolate forgets Copilot's state, the plans' quota cards and
balances; the warm-up, Cursor sign-in, hold and moved-plugin tests wait
for what they started.
- gateway: fresh() forgets refused seals, and TestRouting,
TestSmartRouting and TestQuotaRestsUntilItsReset start from
forgetRouting; codexSignedIn and TestForeignReasoningIsLeftOut start
from fresh.
- codexcat: XDG_CONFIG_HOME under the test's home. tui: costAt reset.
gui: the fake Cursor account no longer outlives its test. cli: Settle.
Left out as already on main: the cli_identity keepIdentities switch
(9c3772311 keeps the asks in a sandbox via testenv's marker) and the
omarchy reset (main's TestCurrent already resets cached/seen/asked).
Run (darwin, loaded machine):
- On main 043e0cfc7, -count=3: TestRouting, TestSmartRouting,
TestQuotaRestsUntilItsReset, TestForeignReasoningIsLeftOut,
TestStandaloneNativeFallback fail; codexcat and tui fail; provider
-shuffle=1791359851244745000 fails TestCopilotAuto and
TestCopilotSignAndModels, and -count=2 -shuffle=1791856220860256000
-run 'Copilot|TestPlanQuotas|TestCachedCardsAskNobody' fails
TestPlanQuotas and TestCachedCardsAskNobody. With this change, that
provider run (-shuffle=on, -count=2), the same gateway tests,
./internal/codexcat, ./internal/tui and the Settle/Hold/warm-up tests
in plugin and provider pass -count=3.
- Breaking Settle by hand: without Told(),
TestSettleWaitsForTheHooksItTold fails; without UseCached(nil),
TestSettleForgetsTheFoldersPlugins fails.
- gofmt -l; go vet ./... on darwin, GOOS=linux -tags nogui, GOOS=windows.
Not run: the whole ./... suite at once (the machine's load times it out)
and Windows/Linux test runs.
Codex sends every MCP tool's full schema inline in `tools` unless the model's catalog entry says supports_search_tool (core/src/tools/spec_plan.rs search_tool_enabled; mcp_tool_exposure.rs Deferred vs Direct); its own gpt-5.5/5.6 entries say so, magpie's generic entries didn't, so with a ChatGPT sign-in's apps a turn began at ~190K tokens. The generic entries now set supports_search_tool: true; base_instructions, the context window and the rest are as they were, and code mode and Responses Lite stay off. The gateway serves the search to models that don't know it: for a model it translates for (Chat, Anthropic…), the client-run tool_search is offered as a function, earlier tool_search_call/tool_search_output become a call and its result ("These tools are now available to call: …"), the tools found are offered after those sent (once, namespaces merged), and a call to it goes back to Codex as the tool_search_call Codex runs, streamed or not. A request relayed to another Responses API (not the ChatGPT backend, which runs it as sent) is rewritten the same way, the found tools' defer_loading dropped, and its stream line by line (toolsearch.go). Measured with codex exec in a sandbox HOME against a fake Responses backend and a fake MCP server with 150 tools: the first request's body went from 307,198 to 23,580 bytes. Tested with toolsearch_test.go (translated, streamed and rendered, end to end through a Chat fake and a relayed Responses fake, merging, the stream split mid-line) and TestCodexCatalogToolSearch (search on, prompt, context window and the other fields unchanged). go vet, go build -tags nogui (and GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. Not tried with real Gemini/antigravity calling the search, real ChatGPT apps, or real third-party Responses providers; a non-streamed relayed reply isn't rewritten (Codex always streams).