Repository navigation
Bound repeated empty tool_search misses for external models #159
Description
Part of #156.
Problem
On the external-model compatibility path, an exact tool_search query can return tools=[] repeatedly while the same search function remains visible in replayed history. The model may resample the identical unavailable callback query without a terminal policy, amplifying requests, tokens, latency, and cost without creating a callable host tool.
Outcome
Bound identical empty tool-search misses in the CodexHub adapter and return one sanitized, machine-classifiable unavailable terminal result. A different query and every non-empty result remain unaffected.
Scope
- Track identical exact-name search misses within one request/turn history.
- Permit at most two identical empty searches or two additional model samples.
- On the bound, emit a deterministic unavailable result and prevent a third identical search sample.
- Preserve successful discovery, distinct queries, call IDs, history, SSE terminalization, and existing Official/third-party tool behavior.
- Record only sanitized query classification/count/status telemetry; do not record prompts, tool arguments, callback addresses, or Task identifiers.
Non-goals
- Do not inject a callback schema without a real host handler.
- Do not implement Codex Host sidebar Worker registration, result receipts, or model-binding readback.
- Do not use GPT, Hidden Subagent,
codex exec, Background, or Inline work as a substitute for Enable sidebar-visible third-party Worker callbacks and binding readback #156 acceptance. - Do not change unrelated retry, transport, apply-patch, or Task activity behavior.
Acceptance criteria
- The first exact-name miss returns the existing explicit empty/unavailable search result.
- A second identical miss produces one classified terminal unavailable result and no third model sample for that query in the turn.
- A distinct legitimate query is not suppressed by the identical-query guard.
- A non-empty search result remains unchanged and callable.
- History replay preserves call/result identity and exactly one terminal outcome.
- Sanitized telemetry records the bound without prompts, callback addresses, credentials, paths, or Task identifiers.
- Official, namespace, MCP, collaboration, and strict apply-patch regressions remain green.
Verification
python -m pytest -q tests/test_routing.py -k "tool_search"
python -m pytest -q tests/test_codex_semantic_adapter.py
python -m pytest -q
python scripts/report_quality_gates.py
git diff --checkreport_quality_gates.py is report-only.
Expected hotset
src-python/codex_proxy.pysrc-python/codex_semantic_adapter.pytests/test_routing.pytests/test_codex_semantic_adapter.py- one sanitized fixture under
tests/fixtures/if the deterministic replay needs it
Relationships
- Parent/human Visible Worker gate: Enable sidebar-visible third-party Worker callbacks and binding readback #156
- Full collaboration matrix: 0.1.8 Beta2: Define the Codex CLI 0.146 Collaboration V1/V2 schema boundary #64
- Deferred search classification: 0.1.8 Beta3: Complete the generic client tool_search lifecycle #63
Execution contract
Execution-Contract: v2
Verification-Class: strict
Verification-Commands: targeted routing/semantic-adapter tests; full Python suite once; git diff --check; report-only quality gate
Manual-Evidence: none
Architecture-Decision: resolved
Review-Owner: orchestrator
Activity
NOirBRight commentedon Jul 16, 2026
Implemented and merged to
devvia PR #163 (#163).Evidence:
bf1115247f5939b096a9453b05215a70fcfe26f1tool_search11 passed; semantic adapter 5 passed; telemetry-focused 20 passedThe adapter now bounds the third identical empty query in body and multi-event SSE paths, preserves distinct/non-empty discovery, and strips private guard state from telemetry.