Skip to content

feat(research): add shared locale-aware web_search - #505

Merged
lukemaj merged 4 commits into
integration/423-web-researchfrom
feat/445-web-search
Oct 19, 2026
Merged

lukemaj merged 4 commits into
integration/423-web-researchfrom
feat/445-web-search

Conversation

@lukemaj

@lukemaj lukemaj commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What: Add caller-gated web_search(query, locale?) with SearXNG/TinyFish discovery, explicit engine health and shared limits; fix SearXNG script/numeric-region locale handling.
Why: Supplemental locale/site discovery must preserve caller intent and report provider failures honestly, while each provider receives a language value it supports.
So what: PR #505 now targets integration after the parent's retarget; the parent owns fresh exact-head Opus round two and CI admission, and both unanswered TinyFish user decisions still forbid final main merge.

References #445 and approved Spec #423 (design review, user decisions, correction), without closing either. This approved research detour supports Promachos, Wight, Drafters and Spectrum without changing direction.

Current canonical implementation/proof handoff records commands, failing/passing output, libraries, hashes, findings and limits. Source is frozen at 3393e881540676888c61a4db86b7ba76178f7bc1, tree 9b13d93acf860f7a9f50b594f61201c4a185d2b5, atop 399ba5a38c56e1bceff9bed1a26cb65f455047e0 on current target integration/423-web-research. The parent completed retargeting; this writer changed only its exclusive branch. Reviewed 421 and pre-cascade R1 repair 7b80278606751b68226db6edecc4fa4c5829c018 are preserved. Four own #445 commits were replayed from boundary 183, with no conflicts and all patches equivalent in range-diff. Reviewed 183 and squash 399 have the same tree; the repaired tree is identical before/after cascade.

The thin registered MCP handler delegates through ResearchHost/WebResearch to the Search service. Concurrent SearXNG JSON and pinned GET /call/tinyfish.web.search preserve locale/site intent and filter off-site results. Bounded URL/title/snippet/source output carries per-engine health, delay and Retry-After; challenges, blocks, malformed responses and provider/cost failures stay unhealthy. TinyFish reuses the supported web-research-treg-token secret store, zero-max-cost header and response charge/call validation. No result page bodies are fetched.

The service owns shared 25-second spacing, in-flight deduplication/local subscriber cancellation, minute/hour budgets and Retry-After metadata. No completed SERP cache is stored; ordinary bounded tool/conversation history is outside that guarantee. A configured research host is authoritative through authenticated forwarding with identity, caller narrowing, access checks and typed failures without silent local fallback. Contracts/settings and generic MCP presentation cover existing clients/adapters. One shared instruction paragraph preserves built-in bulk search; map and fork registry retain #445 / PR #505.

Round-one Opus HIGH review failed on 421 for R1: SearXNG rejects full script/numeric-region locale values even though the caller contract accepts them. SearXNG now receives Intl.Locale.language plus only a two-letter region. The returned canonical locale and TinyFish mapping stay unchanged. The fake enforces the primary SearXNG regex and HTTP 400 boundary. On old production source the full changed file gives 3 intended failures / 36 passes for zh-Hant-TW, sr-Latn-RS, es-419; pl-PL, pl, en controls pass. After the two-file fix, 42/42 in two files pass through registered MCP/service and authenticated host seams. Tests assert healthy empty results and independent expected provider parameters. The cleared CI queue repair retains completion, 40-second delay/unavailable, quota and cancellation assertions; no sleeps, polling, skips or timeout changes.

Final cascaded server types and targeted lint/format/diff checks exit 0. The 42-case proof is reused after metadata-only cascade by exact whole-tree equality. Earlier 119/5 and unaffected contracts/settings, reader, map/fork and instruction proof are retained, not added to the current count or claimed as a complete gate. Actual installed Effect/@effect-vitest are 4.0.5, Vite+ 1.0.0, patched Vitest 5.0.1, local Node 26.8.2; vendored Effect reference 4.0.1 is distinct. Prior CI Node 24.22.0 remains an environment limit. No dependency/version change. New-head CI is queued at publication; current source is unreviewed and needs the parent's fresh round two. No review or complete-CI PASS is claimed.

Carried limits from the full review:

Both provider networking/internal DNS/every-subresource isolation and permission for any hosted-body caching, including bounded memory continuation, remain pending user decisions. Final main merge is forbidden until both answers; #423 is not accepted here. #486 local cache activation and #460 browser identity stay separate. No app/browser/account use, installation, deployment, restart, service/configuration/secret mutation, host cleanup, merge or Issue closure. Website impact: none; server/MCP behavior and existing guidance only.

Upstream-first: main ab6be13d438abeace7617e8d789d59cf2e880f42, code/open-PR/open-Issue searches found no equivalent SearXNG/web_search work in that boundary. Owning primary-contract record; R1 was checked against retained primary SearXNG parser/regex source, without provider traffic.

Requirements and who asked: Approved #423/#445 require truthful supplemental discovery and shared limits; accepted Opus HIGH R1 and parent adjudication require provider-specific locale values, a faithful fixture and the sole-branch squash cascade.
Deleted: Unsupported SearXNG subtags, permissive fake validation, optional locale/query/circuit redesigns, dependency changes and repeated suites for identical trees.
Bottleneck: Fresh parent-owned exact-head round two and complete CI; both unanswered user decisions continue to block final main merge.
Checked myself: Complete findings/brief/canonical proof, primary provider regex, faithful three-failure RED and valid controls, 42-case GREEN and preserved queue/cancellation assertions, final types/lint/format output, actual library/lock identities, equal base/final trees, four equal patches, exact-lease publication and parent's current retarget.

Implementation and R1 repair: GPT-6.1-Sol, max reasoning effort, Codex harness. Round-one reviewer: Claude Opus 5.5 HIGH, Claude Code, failure on 421 only. Parent owns fresh review, CI and all merges.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:XL labels Oct 19, 2026
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.9 KiB — 29.3 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 21.2 KiB — 29.3 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: 3393e88 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@lukemaj

lukemaj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

What: PR505's CI failure is in its newly added queue-admission regression, and the existing #445 writer is repairing it.
Why: After a TestClock boundary, the test assumes the third fiber has already completed at that scheduling instant; CI observed it still pending. The root cause needs a faithful milestone/control check, not an unchanged-job retry.
So what: Preserve the actual40-second queue-delay, unavailable-result and no-extra-quota requirements, establish deterministic completion, and revalidate the changed full test file on a new head. Parent retains cascade/review/merges.

Exact candidateff6777dfa983b48f3926b5565ada09a9817d0594, targetfeat/444-tinyfish-fallback. Failed Server6 job117848936677, run39186134121; aggregateCheck117851745357 fails as a consequence. Parent read actual log retained at /tmp/chromeria505-ci-server6.log: WebSearch.integration.test.ts:841, test refuses a late queue admission before reserving quota and reports the actual queue delay, expect(third.pollUnsafe()).toBeDefined() receivedundefined;1298passed/1failed/9skipped. No evidence connects this to #244 or another inherited flake, and no rerun was requested.

Earlier local targeted queue PASS is genuine but does not establish scheduler-independent behavior of the complete file or current CI. Repair must replace an incidental instant-state assumption with Deferred/Queue/completion milestones while retaining the protected runtime behavior; if production admission is wrong, fix that owner. No sleeps, polling loops, relaxed timeouts, skips or result-only expectation edits. The writer also verifies exact installed Effect/runner identities against lockfile and CI, because earlier review prose named4.0.1 while this CI stack names4.0.5. No dependency version change is authorized to make a test pass.

Canonical recovered445handoff now exists; this CI finding supersedes any impression of complete readiness, not its retained scoped proof. Same writer resumedrunordinal4;444R5repair is the other Codex implementation worker, within the explicit2worker ceiling. No445rebase/retarget until parent provides final repaired predecessor. #446/447 implementation is not started ahead of the requested order.

Both TinyFish user decisions stay open for morning; final main merge forbidden before answers. No deployed artifact, app restart, host intervention, live query or credential mutation occurred.

Requirements and who asked: #445 requires truthful shared queue/budget behavior and deterministic focused proof; user requires exact-head review/CI before source admission.
Deleted: Instant-scheduler-state assumptions, unchanged retries for own test failures, weakened behavioral assertions and duplicate workers.
Bottleneck: Deterministic queue proof and then exact-head cascade/review; isolated local PASS is not the complete gate.
Checked myself: Actual completed CI log, decisive assertion and count, currentff head/base, previous retained local queue output and source-owner/task identity.

@lukemaj

lukemaj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

What: Independent review of PR #505 at head 421e7d26fa5721170c3709d053923eccbcb82ec3 (tree fe5e420b287182dd7a737df2173b2ec2e8cc32c6, base feat/444-tinyfish-fallback at 183dfc58dea2a61f452fcf50080c468b4a95583b) finds one required source fix; source verdict failure.
Why: SearXNG's own language check rejects script and numeric-region locales that the new web_search contract accepts, so those calls always fail SearXNG with HTTP 400, while the PR's fake-provider test asserts they succeed.
So what: The existing #445 writer maps the SearXNG language value (R1) and makes the fixture enforce SearXNG's rule; then a new head needs affected proof, CI and a fresh review. Both pending user decisions (#423 provider networking, #444 hosted-body retention) still block final main merge; this verdict does not touch them.

Reviewer: Claude Opus 5.5, high effort, Claude Code harness. Independent of the author (GPT-6.1-Sol, Codex). The author's worktree was used read-only (git -C, git show, git diff); live check at 04:53 Warsaw: PR head/base match the values above, the worktree is clean at 421e7d2, and the tree matches. No app/server start, browser, live provider call, credential, private-network probe or subagent. Public primary sources only: TinyFish search API docs, the treg catalog entry, and SearXNG master source at 1c10abe2d3e4ab7ddcc4e9da1a7d07dc7ca7f8f4.

Scope: the complete 24-file 183..421 diff (three commits) plus the consumers needed to judge it: TinyFish.ts, WebResearch.ts, ResearchHost.read, PeerForwarding, PeerMcpClient, McpRouting, settings authorization, and installed effect@4.0.5 Cache.ts and ai/McpServer.ts.

Required

R1. SearXNG rejects locales the contract accepts, and the test claims the opposite.

  • WebSearchInput.locale accepts up to three subtags with scripts and numeric regions (packages/contracts/src/webResearch.ts:38-44). Search.ts:629-631 canonicalizes with Intl.Locale, and Search.ts:307 sends the result unchanged as SearXNG language.
  • SearXNG validates that value in searx/webadapter.py:parse_lang against VALID_LANGUAGE_CODE = ^[a-z]{2,3}(-[a-zA-Z]{2})?$ (searx/webutils.py:32) and raises SearxParameterException; searx/webapp.py:679-681 answers HTTP 400.
  • Checked: pl-PL, pl, en pass. zh-Hant-TW, sr-Latn-RS and es-419 all pass the PR's contract pattern and Intl canonicalization, and all fail SearXNG's pattern.
  • Effect: every such call reports all four SearXNG engines as provider_error/http/400, uses the 25-second SearXNG slot, and returns degraded. It is explicit, not a false empty, but the SearXNG lane can never succeed for an accepted input. The configured SearXNG is the main locale engine in feat(research): web_read tool with a shared cache and free-first fetch ladder #423's evidence.
  • Proof gap: WebSearch.integration.test.ts:309-318 ("preserves region/script locales") asserts status: "ok" for zh-Hant-TW because the fake SearXNG accepts any language. The fake does not model the real provider.
  • Smallest fix: send SearXNG language as language or language-REGION only when the region is two letters, otherwise only language (keep TinyFish's mapping); make the SearXNG fixture reject values outside SearXNG's pattern, so the script-locale test fails before the fix and passes after.
  • Unverified: a SearXNG instance that locks language in its preferences ignores the parameter. The bestia configuration was not read (private network).

Optional

  • O1. Real SearXNG error texts fall through to provider_error. SearXNG writes unresponsive_engines reasons from exception_classname_to_text (searx/webutils.py:41-66): access denied, too many requests, CAPTCHA, timeouts, optionally prefixed Suspended: . Search.ts:502-508 maps only /blocked|forbidden|403/ to blocked, so access denied (the measured Google/Qwant failure mode) and too many requests (Brave) both become provider_error. The fixture's "403 forbidden" (WebSearch.integration.test.ts:282) is not a string SearXNG emits. The engines stay unhealthy, so the acceptance criterion holds; the label is just less precise. Mapping access denied to blocked and too many requests to rate_limited is a small improvement.
  • O2. SearXNG rewrites the echoed query for its own syntax. get_json_response echoes sq.query (searx/webutils.py:164), which RawTextQuery.getQuery() produces after removing bangs (!g), :lang and similar tokens (searx/webadapter.py:251-254). Search.ts:426 requires an exact echo, so such a query fails the whole SearXNG lane as contract. Explicit, rare in research queries; worth a note in the tool description or a tolerant comparison only if it shows up in test(research): prove 20 URLs and per-harness research-tool usage #447.
  • O3. A host on an older version reports invalid_request. An old research host's McpServer answers JSON-RPC InvalidParams "Tool 'web_search' not found" (installed ai/McpServer.ts:487-489). PeerMcpClient.ts:217 maps body.error to invalid_request, and ResearchHost.search passes it through. The failure is typed and nothing falls back to local search, but the code points at the caller, not at the host. Same family as feat(research): share page reads through a linked environment #455's O1 diagnostics; the planned rollout updates all three hosts together.
  • O4 (carried from feat(research): add zero-charge TinyFish fallback with OpenBao secret #444). An observed non-zero x-treg-cost-micro fails the call as charge but opens no circuit, so later calls still try. This matches the reviewed TinyFish.fetch behavior (TinyFish.ts:267-269), and X-Treg-Route-Max-Cost: 0 is the primary guard. Not a regression.

Cleared

  • No SERP retention. In installed effect@4.0.5 Cache.ts:640-652, a zero TTL sets skipCache and calls removeEntry when the lookup fiber exits, so completed results leave the map and only in-flight work is shared. With capacity: Infinity that means no buildup either. The only persisted data are search-{searxng,tinyfish}-quota.json with starts and blockedUntil; the tests check that no token, query, URL or snippet reaches disk.
  • Shared flights and cancellation (local). The last awaiter's exit interrupts the daemon lookup fiber (Cache.ts:681-692), which releases the per-source semaphore and aborts the HTTP request; a first subscriber's interruption leaves a second subscriber's flight running. Reservations are written before the request, so cancelled or uncertain attempts stay counted. Both are covered by tests that I read in full.
  • Queue, deadline and quota. Each source has its own Semaphore(1); reserve runs under it, refuses blockedUntil, TinyFish 500/hour and 30/minute, and any start that would pass queuedAt + 30s, before storing a start, and sleeps for the 25-second spacing while holding the lock. The outer 50 s timeout bounds lock wait plus the 20 s request. The secret is read before admission, so a missing key never reserves quota. Retry-After (seconds and HTTP-date, capped at 24 h) and 429 (at least 60 s) block only their own source.
  • CI repair is faithful. The failure (third.pollUnsafe() undefined at line 841, run 39186134121) asserted an instant scheduler state. The repaired test joins third, then checks rate_limited/queue, delayMs === 40_000, four provider requests and quota starts [0, 25_000]. third is queued at 0, so its admission deadline is 30 000 ms; once second releases the lock at 40 000 ms, reserve refuses without sleeping, so the join cannot depend on unadvanced time (lock order is observed through the asserted request times, not assumed). The clock assertion is trivially true under TestClock; the delayMs assertion carries the real check. Server 6 is green on 421.
  • Parsing and limits. Responses are capped at 1 MiB before decode. The TinyFish envelope (query, results, total_results, page: 0) matches the TinyFish API docs (page is 0-based, the example echoes query). Result URLs must be http(s) without credentials and at most 2048 characters; titles/snippets are HTML-cleaned and cut to 300/1000; site:/-site: are filtered locally by host suffix and path; providers are interleaved; output stops at 20 results or 20 000 characters with truncated. These fit the contract limits (5 engines, 4 engine names per result).
  • Secrets. The token comes from the existing web-research-treg-token store, is sent only to the pinned https://treg.to/call/tinyfish.web.search GET with X-Treg-Route-Max-Cost: 0, is redacted in headers, has tracing disabled, and is rejected if it appears in the call id, the raw body or a cleaned result (plain, JSON-escaped and HTML-entity cases tested). Transport errors are mapped without their message.
  • Host routing and scopes. ResearchHost.search mirrors the reviewed read: settings failure, linked-caller loop, expired link, read-only link, expected link identity, orchestration_error to research_host_unavailable, and a check of researchEnvironmentId. McpRouting rejects environmentId for web_search. The handler is readsAsCaller with linkedCallers: "allowed", and the destination denies read-only links. Real authenticated loopback peers show two environments sharing one host search with narrowed caller limits and no local provider call. webResearch.searxngUrl writes require AuthSettingsWriteScope, and the setting rejects credentials, query and fragment.
  • Service boundary. The MCP handler decodes and calls one service method; Search owns the behavior; WebResearch re-exports search; production wiring provides Search.layer with NodeHttpClient and ServerSecretStore. One shared instruction paragraph keeps built-in search for bulk discovery and adds web_search; no adapter or client change is needed (generic MCP presentation). Map WRS carries feat(research): web_search over live SearXNG and TinyFish #445 PR feat(research): add shared locale-aware web_search #505; the fork registry lists the new files.
  • No dependency or lockfile change in 183..421.

Unverified

  • Cross-environment cancellation of a forwarded call is not exercised by feat(research): share bestia research host across cavallo and rocky #443 or feat(research): add shared locale-aware web_search #505 tests. The likely mechanism exists: installed ai/McpServer.ts:1074-1077 disconnects the HTTP client, interrupting its requests, when the request scope closes. Without propagation, an abandoned forwarded search still finishes within 50 s and spends one reserved start.
  • Live provider contract. The treg catalog documents no x-treg-cost-micro/x-treg-call-id headers for this endpoint; their presence on search responses is inherited from feat(research): add zero-charge TinyFish fallback with OpenBao secret #444's fetch observation. Also unverified: TinyFish echoing a query that contains site: text, TinyFish accepting language=zh-Hant, and the bestia instance's engine names (google cse, duckduckgo web). test(research): prove 20 URLs and per-harness research-tool usage #447 owns live settlement and the 25-query comparison.
  • Proof not rerun. I did not rerun the 119-test run, types or lint. The manifest proof-421e7d…json hashes to 84a7ba6372059b3092a664edb9a7dedbfd3a9c59c7430c3dabb99120eb0cd1f4; all 15 hashes recorded in it (three toolchain package.json files, five repair logs, seven cascade logs) match. cascade-behavior.log shows Test Files 5 passed, Tests 119 passed; the range-diff marks all three patches =; lint shows the one inherited WebResearch.ts:550 warning. The local Node 26.8.2 versus CI Node 24.22.0 difference is retained.
  • Complete CI on 421 is not green yet. Live: Build and Typecheck, Lint, Release Smoke, Fork Stack Model and Test Server 1, 2, 4-8 succeed; Test Server 3, Test Web and Test are in progress. Parent owns admission.

Acceptance limits (carried forward, not waived)

Evidence (outside any worktree)

File sha256
/tmp/rev505/webutils.py (SearXNG 1c10abe) 0c193cc553ed8e7db20ddc6b2072f0226e4b2a408fc8e30a5a9e369a9ff14851
/tmp/rev505/webadapter.py (SearXNG 1c10abe) fa1c9a5d02eabd4f91b715efaa759fc5a3fb33d95c7a92a0e25e1fa7b0c20aa6
/tmp/rev505/webapp.py (SearXNG 1c10abe) 8d1a764258411a60de5c3d854ec48a21cd4c356527ea0ebd47919e96ed6c8b70

Locale check: Node Intl.Locale canonicalization plus Python re with SearXNG's pattern: pl-PL True, pl True, en True, zh-Hant-TW False, sr-Latn-RS False, es-419 False; the contract pattern accepts all six.

Elon record

🤖 Generated with Claude Code

@lukemaj

lukemaj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

What: PR #505's first independent Opus5.5/high review failed on one accepted locale-mapping defect; the existing #445 writer has resumed the repair.
Why: Our input accepts script/numeric-region locales, but SearXNG only accepts language or language plus a two-letter region; the fake provider accepted invalid values and falsely asserted success.
So what: Fix only this provider boundary and faithful fixture, then cascade #445 onto merged integration399, obtain current affected proof/CI and fresh independent review; #446 continues on its preserved exact421 base until a coordinated cascade.

Required R1 and all optional/cleared/unverified findings: #505 (comment) . Reviewed head421, treefe5e420b287182dd7a737df2173b2ec2e8cc32c6, predecessor183. Authenticated independent failure56656288317 is retained. Parent inspected full review, actual Search.ts provider mapping, contract pattern and scripted locale fixture, plus primary SearXNG webutils.py32 and webadapter.py55-70 retained by the reviewer: ^[a-z]{2,3}(-[a-zA-Z]{2})?$ rejects zh-Hant-TW, sr-Latn-RS and es-419. The runtime failure is HTTP400/degraded, not false successful empty. Parent accepts R1. Keep canonical caller locale and TinyFish mapping, map only SearXNG to language plus optional two-letter region, and make the fixture enforce the actual upstream condition. Preserve faithful baseline failure and pl-PL/pl/en controls; no contract narrowing.

Optional findings adjudicated: O1 imprecise SearXNG health labels remain optional because unhealthy/error status is explicit; O2 special query syntax changes echoed text and remains a #447 live/query compatibility limit, without speculative normalization; O3 old-peer invalid_request instead of host-unavailable remains a typed mixed-version diagnostic limit; O4 nonzero-charge validation lacks a follow-up circuit, unchanged from reviewed fetch, with Max-Cost0 primary admission. No new circuit/framework mandated. Unverified cross-environment cancellation is not a demonstrated bug; preserve the explicit source-proof gap for #447. Current independent review cleared zero-TTL no-retention semantics on installed Effect4.0.5, local cancellation/shared flights, queue/quota/Retry-After, the CI repair, parsing/secrets/host scopes/settings/instructions/map and predecessor regressions. No new whole-CI or live acceptance claim.

Parent delegated ONLY the existing writer's own branch cascade: preserve421 and repair refs, replay only own445 commits from boundary183 onto integration 399ba5a38c56e1bceff9bed1a26cb65f455047e0 (tree equals183), inspect range-diff and revalidate. Parent will retarget #505 AFTER publication and dispatch a new independent round. #446 writer was told to preserve existing421 source/base and continue independent session work, without copying lower fixes or rebasing early. Exactly two Codex implementation writers now, with disjoint branches/workspaces. No third worker or competing review.

The learning belongs at the provider test boundary: an accepting fake cannot establish that the real upstream accepts the same request. R1's fixture correction owns it; no duplicated global guidance is needed. Both TinyFish networking and ANY hosted-body retention decisions remain PENDING USER. Final main merge, deployment admission and morning restart remain gated; no live/account/browser/credential/host operation was added.

Requirements and who asked: #445 locale support and independent Opus high R1 require accepted inputs to form a valid SearXNG request; user requires bounded writers and exact-head fresh review after repair.
Deleted: Sending arbitrary locale subtags to every provider, a permissive fake that hides rejection, unrelated provider redesign, broad duplicate tests and early descendant rebases.
Bottleneck: One source/test boundary repair and own-branch cascade before round2; #446 source work continues while human TinyFish decisions remain pending.
Checked myself: Full reviewer findings, exact current PR/base and integration remote, contract locale acceptance, actual outgoing language mapping, faulty test and primary SearXNG validation source, same-writer resume and preserved descendant instruction.

@lukemaj
lukemaj force-pushed the feat/445-web-search branch from 421e7d2 to 3393e88 Compare October 19, 2026 03:01
@lukemaj
lukemaj changed the base branch from feat/444-tinyfish-fallback to integration/423-web-research October 19, 2026 03:04
@lukemaj

lukemaj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

Agent work on this PR

Estimated cost $7.10 · 187 responses · 10 sessions · 5.5 h wall time

Model Responses Tokens Estimated cost
gpt-6.1-sol (codex, max) 170 32,430,273 $6.23
gpt-6.1-sol (codex, medium) 9 2,095,187 $0.36
claude-opus-5-5 (claude, high) 8 1,492,480 $0.51

Flags: 11 large tool outputs · 10 repeated commands · 7 repeated reads · 26 repeated skill loads · 1 test edited after a failure

Details: snapshot, prices, coverage, counters
  • Task toolboxmd/chromeria#505: outcome unknown (recorded acceptance only; a finished process never implies it).
  • Proof: feat(research): add shared locale-aware web_search #505
  • Snapshot c01c10978175edd4953c813fcf3d7aec52bc8916f2a83cfab5cbc322be072291, records up to 2026-10-19 02:50 UTC.
  • 10 sessions on claude, codex; AgentsMD 17.2.0.
  • Not counted: 655 responses ($32.39) in sessions shared with other PRs that worked in no single PR's checkout.
  • 300 responses in these sessions worked on other PRs and are counted there.
  • Totals reconcile with the measured sessions: yes. Evidence complete: yes.
  • Prices: list-price estimate from T3 local rate table (path withheld) as of 2026-10-18, schedule 414551dda4c47258113dcfa46a5dfa5aa512406e3dfcadcca3381421595c5588. Unknown prices stay unknown, never zero.
    • T3 LiteLLM rate table when present; bundled schedule covers the rest.
    • Model price sources: T3 local rate table (path withheld).
  • Harness-reported cost: none reported.
  • Usage totals are not billing. Subscription spending is separate and is never posted as spend.
  • Crashed runs are counted separately: 0.

Token counters by model (native counter semantics; never added across semantics):

  • gpt-6.1-sol (codex, max), codex counters: input includes cached, output includes reasoning: input 32,276,538; cache-read 31,503,616; cache-write 0; output 153,735; reasoning 70,169; harness total 32,430,273.
  • gpt-6.1-sol (codex, medium), codex counters: input includes cached, output includes reasoning: input 2,087,174; cache-read 2,051,712; cache-write 0; output 8,013; reasoning 4,712; harness total 2,095,187.
  • claude-opus-5-5 (claude, high), claude counters: input excludes cache, output includes thinking: input 16; cache-read 1,470,011; cache-write 19,449; output 3,004; reasoning 1,051; harness total 1,492,480.

Generated tokens (reasoning and other output are disjoint; other output includes code, tool calls and replies):

Model Reasoning Other output Reasoning share Split known for
gpt-6.1-sol (codex, max) 70,169 83,566 45.6% 170 of 170
gpt-6.1-sol (codex, medium) 4,712 3,301 58.8% 9 of 9
claude-opus-5-5 (claude, high) 1,051 1,953 35.0% 8 of 8

Usage by work phase (this task's own responses):

Phase Model Responses Input Cache read Cache write Output Reasoning Total Priced part
unclassified gpt-6.1-sol (codex, max) 170 32,276,538 31,503,616 0 153,735 70,169 32,430,273 $6.233556
unclassified gpt-6.1-sol (codex, medium) 9 2,087,174 2,051,712 0 8,013 4,712 2,095,187 $0.356225
unclassified claude-opus-5-5 (claude, high) 8 16 1,470,011 19,449 3,004 1,051 1,492,480 $0.509738

Recorded activity by phase (observations, not separate token bills):

Phase Tool calls MCP results Reads File changes Failed tool results
unclassified 384 74 97 8 47

Selected rates (USD per million tokens). These rates value the report at the selected schedule date; they do not establish historical prices or subscription spending.

Model Input tier Input Cache read Cache write Other output Reasoning
claude-opus-5-5 all 4 0.2 5m: 5; 1h: 8 20 20
gpt-6.1-sol all 2 0.1 2.5 10 10

Other output and reasoning are priced without double counting inclusive native output. Missing rates remain unknown.

Local measurement from native records; usage totals are not billing. Updated in place by agent-observer publish.

@lukemaj

lukemaj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

What: Round-two independent review of PR #505 at head 3393e881540676888c61a4db86b7ba76178f7bc1 (tree 9b13d93acf860f7a9f50b594f61201c4a185d2b5, base integration/423-web-research at 399ba5a38c56e1bceff9bed1a26cb65f455047e0) finds no required source fix; source verdict success.
Why: The R1 repair now sends SearXNG only language or language-RR, which matches SearXNG's own validation for every locale the contract can produce, and the fixture now rejects what real SearXNG rejects.
So what: The parent owns CI admission: the CI and Fork workflows have not run on 3393 yet. Final main merge still waits for both pending user decisions (#423 provider networking, #444 hosted-body retention); this verdict accepts neither.

Reviewer: Claude Opus 5.5, high effort, Claude Code harness. Independent of the author (GPT-6.1-Sol, Codex). The author's worktree was used read-only (git -C, git show, git diff, git range-diff). Live check at 05:09 Warsaw: PR head and base match the values above, the worktree is clean at 3393, its tree is 9b13d93, and the merge base is 399. No app/server start, browser, live provider call, credential, private-network probe, install or subagent.

Round 1 findings: #505 (comment). Parent adjudication: #505 (comment).

Topology checked

  • Tree of 399 equals the previously reviewed 183dfc58 tree (bffd27588b581b9ea73d43641a32a89f0715061c).
  • git range-diff 183..421 399..3393: the three round-1 commits are =; one new commit 3393e88154 fix(research): map locales to SearXNG language syntax.
  • Since base trees are equal, git diff 421e7d2 3393e88 is the whole change since round 1: Search.ts (+8/-1) and WebSearch.integration.test.ts (+28/-7). Nothing else moved; the 24-file 399..3393 diff is otherwise identical to what round 1 cleared. No dependency or lockfile change.

Required

None.

R1 repair: cleared

  • Mapping. Search.ts:307-314 sends language as ${language}-${region} only when Intl.Locale.region has two letters, otherwise language alone. The TinyFish branch (Search.ts:292-299, language[-Script] plus location) and the canonical caller locale in the result (Search.ts:636-653) are unchanged.
  • Against SearXNG source. Retained SearXNG 1c10abe files still hash as in round 1. webadapter.py:55-72 (parse_lang) raises SearxParameterException unless the value matches VALID_LANGUAGE_CODE (webutils.py:32, ^[a-z]{2,3}(-[a-zA-Z]{2})?$) or equals auto, and webapp.py:679-681 answers 400. The fixture now applies that rule only to SearXNG requests and accepts absent and auto, which is the upstream condition.
  • Reachability of the remaining failure mode. I ran a disposable Node check outside any worktree: every 2- and 3-letter language combined with '', -TW, -419, -001, -840, -Hant-TW, -Latn, -1996 and -DE-1996 (164 268 accepted-and-canonicalized locales) maps to a value SearXNG accepts; zero rejections. Hand cases include legacy aliases (iw-IL→he-IL, tl→fil, sh→sr, mo→ro, art-lojban→jbo), numeric aliases (en-840→en-US), variants (de-DE-1996→de-DE), and lowercase/uppercase input (PL-pl→pl-PL). Inputs Intl cannot parse (zh-min-nan, no-bok, en-GB-oed) fail before any provider call, as at round 1. The contract's 2-3 letter language subtag keeps the canonical language within [a-z]{2,3}.
  • Proof is faithful. Manifest proof-3393…json hashes to 305a793a92e421fead0dd9ab2c891d11fda4c181973b200ad42a1da5b33b886b; all 14 recorded log hashes match; recorded blobs 26ef865d (Search.ts) and dad67ac0 (test) equal the blobs at 3393. r1-red-source.diff is test-only and its post-image is blob dad67ac0, the committed test. r1-red.log (exit 1): Tests 3 failed | 36 passed (39), the failures are exactly zh-Hant-TW, sr-Latn-RS and es-419, each status: 'degraded' instead of 'ok', the 400 path R1 described; pl-PL, pl, en pass. r1-green.log (exit 0): Test Files 2 passed, Tests 42 passed (WebSearch.integration.test.ts, WebSearchHost.test.ts). No timeout, sleep or polling was added; no assertion was weakened (the old single case is now the zh-Hant-TW row with an extra SearXNG language assertion and a fetch absence check).
  • The Fiber.join(third) CI repair from round 1 is unchanged (= in range-diff); pollUnsafe is not reintroduced.

Optional

  • O5 (new, minor). Locales that differ only in what SearXNG drops (zh-Hant-TW and zh-TW, es-419 and es) are separate in-flight keys, so simultaneous calls do not share one SearXNG request. Both still pass the shared 25-second spacing, so no rate or quota rule is broken; it only costs one extra spaced slot in a rare case. No change needed.
  • O1-O4 from round 1 stand as adjudicated and are untouched by the repair: O1 SearXNG access denied/too many requests labels become provider_error (still explicitly unhealthy); O2 SearXNG query-syntax rewriting (and, related, a :xx language token in the query overriding language, webadapter.py:61-62) belongs to test(research): prove 20 URLs and per-harness research-tool usage #447 live compatibility; O3 an older host answers invalid_request rather than host-unavailable, with no local fallback; O4 a non-zero charge fails the call without opening a circuit, as reviewed fetch does, with X-Treg-Route-Max-Cost: 0 the primary guard.

Cleared at 421 and unchanged

No SERP retention (installed effect@4.0.5 zero-TTL Cache removes completed entries), shared flights and local cancellation, queue/deadline/quota/Retry-After, parsing and output bounds, secrets, host routing and scopes, settings write scope, shared instructions, map and fork registry. The repair touches none of these paths.

Unverified

  • CI on 3393. At 05:12 Warsaw only Mobile Fingerprint Check (success), Prepare PR size config and Native fingerprint diff have completed; PR Size and PR Vouch are queued; the CI and Fork workflows have no run on this head (both succeeded on 421). Parent and Actions own this.
  • Proof not rerun by me. I inspected the RED/GREEN, types, lint, format, range-diff and tree-equality logs by hash and content; I did not rerun them. Local Node 26.8.2 versus CI Node 24.22.0 remains a limit; ICU alias tables can differ slightly, but the contract keeps the canonical language at 2-3 letters on any version.
  • Live behavior. The bestia SearXNG may lock language in preferences (then the parameter is ignored); how SearXNG engines treat zh-TW or sr-RS; TinyFish acceptance of zh-Hant and numeric location=419; live charge/call-id headers; site: echo. Cross-environment forwarded cancellation is still not exercised (a test(research): prove 20 URLs and per-harness research-tool usage #447 source gap, not a reproduced defect). test(research): prove 20 URLs and per-harness research-tool usage #447 owns live settlement. No fake-fixture result here is a live claim.

Acceptance limits (carried forward, not waived)

Elon record

  • Requirements and who asked: The feat(research): web_read tool with a shared cache and free-first fetch ladder #423 coordinator requested a round-two exact-head source review of feat(research): add shared locale-aware web_search #505 by Claude Opus 5.5 at high effort, as the user chose, focused on the R1 repair the parent accepted.
  • Deleted: Rerunning the author's suites, a new isolated worktree and install, live SearXNG/TinyFish probes, and re-reviewing paths the repair does not touch.
  • Bottleneck: CI has not run on 3393; after that, the two pending user decisions gate final main merge.
  • Checked myself: Live PR head, base and tree, a clean author worktree and merge base; range-diff and the full two-file delta; SearXNG parse_lang source by retained hash; an exhaustive Node mapping check of 164 268 locales; manifest, 14 log hashes, both blobs, the RED source diff and the RED/GREEN log contents; live runs and statuses on 3393.

🤖 Generated with Claude Code

@github-actions github-actions Bot added size:XXL and removed size:XL labels Oct 19, 2026
@lukemaj lukemaj closed this Oct 19, 2026
@lukemaj lukemaj reopened this Oct 19, 2026
@lukemaj

lukemaj commented Oct 19, 2026

Copy link
Copy Markdown
Contributor Author

What: PR #505 has exact-head Opus5.5/high source PASS on3393, and its missing current-head CI/Fork workflows are now queued after a supported same-SHA reopen.
Why: The source push occurred while the PR still conflicted with its historical target; retargeting fixed mergeability but is an edited event, outside the workflows' default opened/synchronize/reopened triggers.
So what: Wait for complete current CI before integration admission; #446 continues against unchanged review-ready3393, and final main merge still awaits both user TinyFish decisions.

Full round-two review #505 (comment) . Newest authenticated review/independent success56656962929 creator lukemaj verified on exact3393e881540676888c61a4db86b7ba76178f7bc1, integration base399ba5a38c56e1bceff9bed1a26cb65f455047e0, tree9b13d93acf860f7a9f50b594f61201c4a185d2b5. R1 is independently cleared; the reviewer also mapped164268 accepted/canonicalized locale inputs against the actual upstream validation with zero rejections. Parent read full findings. New O5 equivalent provider locale inputs use separate shared-flight keys; accepted optional because correct spacing/quota holds. O1-O4 and all live/forwarded-cancellation gaps remain unchanged and explicitly unverified. No new source fix or full acceptance claim.

CI diagnosis: inspected exact3393 CI/Fork workflow definitions, run inventory (no runs on3393, old421 green), current mergeability and GitHub primary event documentation. GitHub documents skipping pull_request workflows with conflicts and the default event subset. Parent closed then immediately reopened the SAME PR without deleting its branch or changing any source/base/head; verified OPEN, MERGEABLE, unchanged3393/integration and autoMergeRequest null. This is a CI-trigger step, not cancellation or a final disposition. No repository/workflow setting changed, no new authored commit and no review waiver.

Verified fresh current-head CI39193751158 and Fork39193751131 queued, alongside current fingerprint39193751163. Source CI has not passed yet. Review remains valid on unchanged3393. Cost publication exists at #505 (comment) . Parent will preserve ancestry on the next component integration merge to avoid another squash-only stack rebase; all current reviewer/proof gates still apply. #446 writer received the source PASS and unchanged-artifact notice, with no new account/browser/host authority.

Both user networking and ANY hosted-body retention choices stay pending; no final main merge, no #423 acceptance, no host build/sign/stage/install/restart/activation. #486 and #460 remain separate. #447 is still awaiting the next source artifact, with frozen inputs and live constraints preserved.

Requirements and who asked: User requires exact-head review and complete gate before integration; GitHub workflow defaults determine which valid event starts missing CI.
Deleted: Treating absent checks as green, reusing421 full CI for changed3393, adding an empty source commit just to trigger CI, bypassing gates and mutating repository settings.
Bottleneck: Current-head CI now has an actual queued execution; #446 source can continue while the final user decisions remain pending.
Checked myself: Full round-two findings and authenticated current status, exact workflow triggers, absent-run inventory, official event contract, supported close/reopen result, unchanged head/base/review identity and fresh queuedCI/Fork run IDs.

@github-actions github-actions Bot added size:XL and removed size:XXL labels Oct 19, 2026
@lukemaj
lukemaj merged commit d5b7163 into integration/423-web-research Oct 19, 2026
36 of 38 checks passed
lukemaj added a commit that referenced this pull request Oct 19, 2026
* feat(research): add shared locale-aware web_search

* docs(research): link web_search component PR

* test(research): await queued search completion before checking time

* fix(research): map locales to SearXNG language syntax
lukemaj added a commit that referenced this pull request Oct 19, 2026
* feat(research): add shared locale-aware web_search

* docs(research): link web_search component PR

* test(research): await queued search completion before checking time

* fix(research): map locales to SearXNG language syntax
lukemaj added a commit that referenced this pull request Oct 19, 2026
* feat(research): add shared locale-aware web_search

* docs(research): link web_search component PR

* test(research): await queued search completion before checking time

* fix(research): map locales to SearXNG language syntax
lukemaj added a commit that referenced this pull request Oct 19, 2026
* feat(research): add shared locale-aware web_search

* docs(research): link web_search component PR

* test(research): await queued search completion before checking time

* fix(research): map locales to SearXNG language syntax
lukemaj added a commit that referenced this pull request Oct 19, 2026
…560)

* feat(research): share page reads through a linked environment (#455)

* feat(research): share page reads through a linked environment

* docs(research): link the shared-host pull request

* fix(research): preserve shared host contracts across MCP clients

* test(research): cover bounded queues through the shared host

* fix(research): preserve shared subpage and render contracts

* test(research): prove forwarded subpage count and pending limits

* feat(research): add zero-charge TinyFish fallback (#502)

* feat(research): add zero-charge TinyFish fallback

* fix(research): close TinyFish response scopes

* docs(research): link TinyFish component PR

* fix(research): preserve pages and bound hosted fallback

* fix(research): avoid caching hosted deadline refusals

* feat(research): add shared locale-aware web_search (#505)

* feat(research): add shared locale-aware web_search

* docs(research): link web_search component PR

* test(research): await queued search completion before checking time

* fix(research): map locales to SearXNG language syntax

* feat(research): read selected existing browser sessions privately (#513)

* feat(research): read selected existing browser sessions privately

* docs(research): link the session reader component PR

* fix(fork): register session reader upstream edits

* fix(research): classify a JavaScript-only instruction shell as thin (#535)

* fix(research): classify a JavaScript-only instruction shell as thin

Navigation and headings pushed the public enable-JavaScript page past 80 characters, so web_read reported it ok and never rendered. The existing thin status now covers that instruction when it is the whole remainder.

* docs(map): point agent web research at the JavaScript-shell fix

PR #535 does not close #423, so the open corrective PR is a secondary map ref.

* fix(research): judge a JavaScript shell from its lines

Compacted text let a heading pattern swallow the hours and price paragraphs, and the same pattern threw on a 4 MiB plain-text heading run. The shell check now accepts only short pages whose lines are headings, links, or one instruction.

* docs: link final research train PR in feature map

* fix(research): reconcile shared browser feature ownership

* test(server): give the RemoteDelegation box mock readRunRecovery

#556 added ThreadManagementService.readRunRecovery to every thread read,
but this file's box Layer.mock lacked it. The unimplemented method died on
each read there, the laptop follower retried it as transient, and each
remote-follow test waited out the 120 s test timeout, hanging the Test
Server shard that runs the file.

Fixes #562

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
lukemaj added a commit that referenced this pull request Oct 29, 2026
…560)

* feat(research): share page reads through a linked environment (#455)

* feat(research): share page reads through a linked environment

* docs(research): link the shared-host pull request

* fix(research): preserve shared host contracts across MCP clients

* test(research): cover bounded queues through the shared host

* fix(research): preserve shared subpage and render contracts

* test(research): prove forwarded subpage count and pending limits

* feat(research): add zero-charge TinyFish fallback (#502)

* feat(research): add zero-charge TinyFish fallback

* fix(research): close TinyFish response scopes

* docs(research): link TinyFish component PR

* fix(research): preserve pages and bound hosted fallback

* fix(research): avoid caching hosted deadline refusals

* feat(research): add shared locale-aware web_search (#505)

* feat(research): add shared locale-aware web_search

* docs(research): link web_search component PR

* test(research): await queued search completion before checking time

* fix(research): map locales to SearXNG language syntax

* feat(research): read selected existing browser sessions privately (#513)

* feat(research): read selected existing browser sessions privately

* docs(research): link the session reader component PR

* fix(fork): register session reader upstream edits

* fix(research): classify a JavaScript-only instruction shell as thin (#535)

* fix(research): classify a JavaScript-only instruction shell as thin

Navigation and headings pushed the public enable-JavaScript page past 80 characters, so web_read reported it ok and never rendered. The existing thin status now covers that instruction when it is the whole remainder.

* docs(map): point agent web research at the JavaScript-shell fix

PR #535 does not close #423, so the open corrective PR is a secondary map ref.

* fix(research): judge a JavaScript shell from its lines

Compacted text let a heading pattern swallow the hours and price paragraphs, and the same pattern threw on a 4 MiB plain-text heading run. The shell check now accepts only short pages whose lines are headings, links, or one instruction.

* docs: link final research train PR in feature map

* fix(research): reconcile shared browser feature ownership

* test(server): give the RemoteDelegation box mock readRunRecovery

#556 added ThreadManagementService.readRunRecovery to every thread read,
but this file's box Layer.mock lacked it. The unimplemented method died on
each read there, the laptop follower retried it as transient, and each
remote-follow test waited out the 120 s test timeout, hanging the Test
Server shard that runs the file.

Fixes #562

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant