Skip to content

Show the queries, not the name of the tool that ran them - #36

Merged
cabibbz merged 1 commit into
mainfrom
claude/pwa-chatgpt-model-selection-o38216
Jul 27, 2026
Merged

cabibbz merged 1 commit into
mainfrom
claude/pwa-chatgpt-model-selection-o38216

Conversation

@cabibbz

@cabibbz cabibbz commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Research works. A production run reported 8 searches and the review cited 5 external sources. The reviewer is looking things up.

One defect in what it showed. The eight queries rendered as:

web_search
web_search
web_search
web_search
web_search
web_search
web_search
webrun

Those are tool names, not queries — the extractor named one field, the query wasn't in it, and the fallback printed the tool name where a query belongs. Same mistake as the tool allowlist, one layer over.

Find it by shape

Both the worker and the hook now take any string under a query-like key (query, q, search, search_query, searchQuery, term, text, input, prompt, url) at any reasonable depth, and handle an input encoded as JSON text rather than an object. Verified against four real shapes:

Input Extracted
{query: "…"} at the top level
{action: {search: {q: "…"}}} nested three deep
'{"query": "…"}' (JSON string) encoded as a json string
{searchQuery: "…"} camel case
{id, status} — genuinely no query web_search (query text not found; fields: id, status)

The last row is the point: when there is no query, say so and name the fields that were there, so one run corrects the extractor instead of another round of guessing.

Counted once

A permitted call appears in both records — the hook sees it before it runs, the event stream after. The previous merge deduplicated by text, which silently hid the double-count while every entry was the identical string web_search; the moment queries became distinct it would have reported 16.

The hook record now wins outright (it alone sees a refused call and carries the input), and is deliberately not deduplicated, because two identical queries are two searches.

A correction, in the source

PR #35 claimed Codex never emits an item for a web call. Wrong — that was drawn from a run whose calls were all blocked. A refused call emits no item; a permitted one does. Corrected in the worker comment and docs/ARCHITECTURE.md rather than left standing.

117 unit tests (116 pass / 1 Windows-only skip), mocked e2e, lint, build clean.


Generated by Claude Code

Research works: a run reported eight searches and cited five external
sources. The trace listed those eight as the strings "web_search" and
"webrun", because the extractor named one field and the query was not
in it, so the fallback printed the tool name where a query belongs.

Both the worker and the hook now find the query by shape: any string
under a query-like key at any reasonable depth, including an input
encoded as JSON text rather than an object. Where there genuinely is
none, the entry names the fields that were present, so one run
corrects the extractor instead of another round of guessing.

A permitted call appears in both records, the hook seeing it before it
runs and the event stream after. Merging them would have doubled the
count the moment the queries became distinct. The hook record wins
outright, because it alone sees a refused call and it alone carries
the input, and it is deliberately not deduplicated: two identical
queries are two searches.

One earlier claim is corrected in the source rather than left
standing. A refused call emits no event item; a permitted one does.
That was drawn from a run whose calls were all blocked.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FxxEQsJEXq9hZmjpNH5PxY
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sol-review-gate Building Building Preview, Comment Jul 27, 2026 3:17pm

Request Review

@cabibbz
cabibbz merged commit 80baec5 into main Jul 27, 2026
1 of 2 checks passed

This branch was successfully deployed

1 active deployment
Preview — a07def20 Deployed Jul 27, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants