A Codex turn often goes: a one-line preamble, then reasoning (summary
or hidden), then a tool call. firstToken.see stopped looking for
reasoning once the first text had come, so such a turn was timed from
the preamble and its window held all of the thinking. The output then
read as a burst (flow*4 < window) and Usage showed "—" for its speed;
reasoning_hidden was missed for it too. Whether a turn shows a speed
depended on its shape, hence "sometimes there, sometimes not". Fast
(priority) makes the burst rule trip more often, but is not the cause.
Now reasoning seen after text marks the turn "again": the next content
restarts the text clock there, and hidden reasoning is noted. Both SSE
and WS reach the same see().
Fixture: testdata/codex-preamble-reasoning-tool.json is a real capture
(Codex gpt-6.1-sol, service_tier priority, effort high, through
/v1/responses in a sandbox HOME), encrypted_content cut short.
Run on mica. The full run was at this change on f9492fd8e; it was then
rebased onto b1d5912de (two commits, Gemini draw and Antigravity
discovery, no file in common). At the pushed head: go vet of gateway,
provider, usage and catalog; go test of internal/agent, usage and
catalog in full; gateway and provider -run Speed|Reasoning|TTFT|
FirstToken|Gemini|Draw|Tier: all ok.
At f9492fd8e:
- gofmt -l: clean
- go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go
vet ./..., go build, GOOS=linux go build -tags nogui, GOOS=windows
go build: ok
- go test -tags nogui -count=1 -timeout 45m ./...: 103 ok, no FAIL
(gateway 1117s), log kept whole and grepped
- Broken by hand: TestCodexPreambleThenReasoningTellsSpeed is red on
the old ttft.go, green on the new.
- Real use: a sandbox gateway built from this head, real Codex
account, priority, preamble+reasoning+tool turns: before the fix 3 of
4 such turns read burst-flow ("—"); after, 2 of 2 show a speed (147,
125 tok/s) with reasoning_hidden set. Plain preamble+tool turns: 6 of
6 OK.
Not changed / not tried:
- The preamble's few tokens (~27) count in the post-reasoning window,
about a 4% overcount.
- Hidden reasoning then a tool call with no text at all stays on
page.js's "≥" floor (2d3b33bb7).
- The GUI was not opened against the new rows; page.js is unchanged.