Skip to content

Bound repeated empty tool_search misses for external models #159

Closed

Description

@NOirBRight

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 --check

report_quality_gates.py is report-only.

Expected hotset

  • src-python/codex_proxy.py
  • src-python/codex_semantic_adapter.py
  • tests/test_routing.py
  • tests/test_codex_semantic_adapter.py
  • one sanitized fixture under tests/fixtures/ if the deterministic replay needs it

Relationships

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

  1. added
    bugSomething isn't working
    ready-for-agentFully specified, ready for an AFK agent
    wayfinder:taskWayfinder implementation task
    on Jul 16, 2026
  2. self-assigned this
    on Jul 16, 2026
  3. NOirBRight commented on Jul 16, 2026

    @NOirBRight
    OwnerAuthor

    Implemented and merged to dev via PR #163 (#163).

    Evidence:

    • merge commit: bf1115247f5939b096a9453b05215a70fcfe26f1
    • strict candidate Python suite: 1144 passed, 1 skipped, 305 subtests
    • final targeted delta: routing tool_search 11 passed; semantic adapter 5 passed; telemetry-focused 20 passed
    • independent review: Spec PASS; Standards APPROVED
    • GitHub CI run 29536785550: Python, frontend/UI contract, Rust normal/debug, clippy, and release flavor steps completed successfully

    The 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingwayfinder:taskWayfinder implementation task

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions