aft icon indicating copy to clipboard operation
aft copied to clipboard

aft_search: unrelated lexical hits for a missing literal, denied path reads as 0 matches, contradictory status

Open null-axiom opened this issue 1 month ago • 2 comments

AFT: 0.62.0, OpenCode 2.1.4, macOS.

A few aft_search replies that an agent will misread as real results:

  1. Unrelated "lexical matches" for a literal that doesn't exist. Query bash_wait_detach( (grep confirms it appears nowhere under the root) returned 14 hits labelled [lexical match], all lines about bash_watch. A bare identifier gets an honest "not found … no similar names". A literal with punctuation should also say not found, or the fuzzy fallback should be labelled as fuzzy/similar rather than a match.
  2. A denied out-of-root path= reads as "0 matches". The reply starts "denied … searching the project index only" and then reports "Found 0 match across 0 file", which reads as "your path has no matches" although that path was never searched. Returning an error, or "path not searched", would be clearer.
  3. Contradictory status lines. One reply said "Search status: fully degraded" while its footer said "trigram: ready, semantic: ready"; a regex-only query said "219 match across 52 file" and then "shown 3 of ≥4 results".

null-axiom avatar Oct 23 '26 21:10 null-axiom

Causes from v0.62.0 source (not re-run):

  1. bash_wait_detach( classifies as CodeLiteral, not Identifier (search_b2/router.rs:77-117), and the honest not-found path is gated on Identifier plus nearest_names accepting only [A-Za-z0-9_$] (semantic_search/mod.rs:~4607, nearest_names.rs:110-134). The lexical lane then tokenizes the query into bash/wait/detach, and mod.rs:~8141-8146 labels any group with lexical results [lexical match] without re-checking the literal. Suggested: strip trailing punctuation before the not-found check for code literals, or drop/relabel lexical hits that don't contain the literal ("token match").
  2. The "denied … then Found 0 match" reply is the plugin re-running without path after an external-root denial (opencode-plugin/src/tools/semantic.ts:~198-235), followed by the normal grep summary (commands/grep.rs:457). "0 matches in the project; the denied path was not searched" would fix the reading.
  3. "fully degraded" comes from the response's fully_degraded (the bounded fallback scan used for this request, subc_format.rs:~2306), while "trigram: ready, semantic: ready" is the project's resident index status (SearchLaneStatus::text, mod.rs:1834). Suggest omitting or relabelling the lane lines ("project index: …") when the response is degraded.

null-axiom avatar Oct 24 '26 04:10 null-axiom

The fixes are included in v0.64.0. Missing literals are distinguished from similar lexical results when absence is established; denied external paths are refused as not searched; request status identifies filesystem fallback; and regex summaries distinguish matching lines from file results. Please reopen with a current reply if you still see the misleading wording or contradictory counts.

aft-alfonso[bot] avatar Nov 11 '26 19:11 aft-alfonso[bot]