Skip to content

Take placement handlers off the event loop and bound top_k at the MCP and CLI entry points#585

Merged
tobocop2 merged 1 commit into
mainfrom
fix/audit-residue
Jul 21, 2026
Merged

Take placement handlers off the event loop and bound top_k at the MCP and CLI entry points#585
tobocop2 merged 1 commit into
mainfrom
fix/audit-residue

Conversation

@tobocop2

Copy link
Copy Markdown
Owner

Problem

A review of all 80 closed server/core audit findings (fixed in #570) checked each fix against its finding: does it address the root cause, is it the solution a plan would have produced, and do its tests exercise it. 73 held up with no changes needed. Two fixes had stopped at the audited call site: the event-loop fix offloaded one placement route while the five sibling handlers kept running the same blocking GPU subprocess probes inline, and the top_k lower bound covered the HTTP routes while the MCP search tool and CLI search still passed unclamped values to the store. Four smaller residues: whitespace-only tool arguments parsed inconsistently with empty ones, the no-op ingest early return had no test, and two comments went stale (a nonexistent module name; a claim that /api/search has no token gate, from before auth middleware covered every route).

Solution

All five placement handlers now run their action and its serialization through one off-loop helper, which also covers the Intel util notice probe; thread-ident tests pin each handler. The MCP search tool treats a non-positive top_k like its unknown-scope fallback, warning and using the configured default, and the CLI rejects non-positive values at parse time. Whitespace-only tool arguments parse to an empty dict, the ingest early return has a test asserting the whole-vault sync is skipped, and both stale comments are corrected.

…CP and CLI entry points

Two audit fixes stopped at the audited call site. The event-loop fix
offloaded one placement route but left the same blocking GPU probes
inline in the five sibling handlers; they now share one off-loop
helper that also covers the Intel util notice probe. The top_k lower
bound landed on the HTTP routes but not the MCP search tool or the
CLI search command; the tool now falls back to the configured default
with a warning (matching its scope fallback) and the CLI rejects
non-positive values at parse time.

Also: whitespace-only tool arguments now parse to {} like empty ones,
the no-op ingest early return gained the test it shipped without, and
two stale comments (a nonexistent module name, a pre-auth-middleware
claim that /api/search has no token gate) are corrected.
@tobocop2
tobocop2 merged commit 149d598 into main Jul 21, 2026
33 of 34 checks passed
@tobocop2
tobocop2 deleted the fix/audit-residue branch July 21, 2026 21:54
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.

1 participant