Repository navigation
fix(kuna): guide inventory selector recovery - #8397
Merged
Merged
Conversation
Contributor
[Medium impact] The PR appears safe to merge; no blocking issue was found. SummaryThis PR centralizes Kuna selector guidance and preserves exact failed procedure selectors in structured errors.
Reviews (6) · Last reviewed commit: "chore: merge main for current static che..." · Reviewed by Greptile |
3 tasks
morluto
marked this pull request as ready for review
November 1, 2026 03:55
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
2 tasks done
This was referenced Nov 3, 2026
13 tasks
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #8396 and #8478. Kuna
xrefsaccepts names from its inventory, including data names, but a missing name currently says no procedure was found and advises repairing the input schema. Ambiguous names likewise identify candidates while suggesting schema repair.Change and scope
The Kuna selector owner now reports that a missing name was not found in its inventory, with conditional guidance to inspect symbols or exports and verify address coordinates. Ambiguous names retain all reported candidate addresses and advise selecting one. Both remain
invalid_request; no schema-inspection recovery is emitted for these valid string selectors. Missing procedure names and entry addresses, and ambiguous procedure names, now receive inventory-search or explicit-address recovery as appropriate, with the exact selector in structured issues.The MCP descriptions of
xrefsandfind_xrefs_to_nameexpose the existing Kuna inventory-name route and warn that an unlisted name may still exist. This does not turn the route into a general name inventory or silently select an ambiguous match. Related design discussion: #8183.This is an existing static-analysis boundary: no new provider capability, target execution, injection, mutation, or protection recovery is introduced, so an additional maintainer scope decision is not applicable. REA may use its existing owned Kuna cache. No output schema or snapshot format changes. Mach-O code/data classification and its separate recovery remain open in #8352.
Evidence and regression coverage
On current main, a real Kuna 1.986 MCP and CLI xref query for a known exported data name absent from Kuna's inventory returned “no procedure named” and schema-inspection recovery. A separate export-to-address handoff found references. The new behavior reports the inventory scope and suggests verifying an address; it does not assert the symbol is absent from the target.
Real Kuna MCP and CLI controls on two unexecuted Mach-O fixtures exercised missing and ambiguous names, plus successful function and data inventory-name queries. Successful named results matched the corresponding exact-address results; an ambiguous overload retained both candidate addresses. Target hashes were unchanged. Successful MCP calls used fetched compact output schemas; error projections were inspected separately.
The real Kuna verifier now checks the missing-name error through public MCP. Against the old main entrypoint, this regression failed at the expected message and reported cleanup complete; against this branch, the full verifier passed. The focused producer-boundary test also covers ambiguous candidates, absent schema recovery, and the existing data-name success control.
Review follow-up moved xref guidance into a producer-owned formatter/constants. A deliberate wording-only change passed both the focused suite and real Kuna verifier; deliberately dropping an ambiguous candidate address failed the focused test. After restoring the producer, the focused suite, real verifier, baseline failure control, and
check:fastpassed or failed as expected, with real-verifier cleanup complete.After the shared-selector follow-up, real Kuna 1.986 MCP and CLI xref controls again verified missing/ambiguous name recovery and successful function/data names against exact addresses; target hashes remained unchanged.
On final code, real Kuna 1.986 full and compact MCP profiles exercised missing and ambiguous procedure names through
procedure_address,procedure_assembly,procedure_callers, andanalyze_function; all four exact-address retries succeeded. The CLI decompile path exercised missing, ambiguous, and exact selectors. A well-formed missing address also returned inventory guidance with its exact original spelling through three procedure operations; graph-basedprocedure_callersretained its distinct unavailable-relationships result. Twenty-four MCP error payloads and three CLI error envelopes passed canonical schema validation. The target hash stayed unchanged. A separate compact MCP control saved and reopened a Kuna snapshot: ambiguous procedure and xref guidance still preserved both choices, and exact-address lookup succeeded before and after reopening. The full real Kuna verifier passed with new missing-procedure-name and address public MCP assertions, verified lineage, and complete cleanup.Real Kuna mixed
batch_decompilein full and compact MCP profiles preserved ambiguity, missing-name and missing-address recovery alongside one successful exact-address item. A separate Ghidra control showed that decompilation can succeed via file-offset fallback when the preliminary address lookup fails; the two provider observations must not be blindly collapsed. The successful batch item does not retain the producer mapping; see [Bug] Successful batch decompiles lose per-item provider provenance #8350 and [Design] Disambiguate analysis addresses from file offsets in decompilation #8178.Fetched MCP tool descriptions were checked on a live compact server. No autonomous agent-selection trial, other operating system, broad corpus, or other provider verification was performed for this change.
Kuna 1.990 unflagged-section control on head
65939bc4a: in compact/full MCP, incoming xrefs identified the call site to0x1000003e0; requesting assembly at that inventory-missing address returnedinvalid_requestwith the exact selector and inventory-scoped recovery, without schema-repair advice. An explicit same-session Ghidra 12.1.4 switch found the two-edge path; the earlier Kuna trace Evidence was retained exactly. The owned Mach-O hash stayed unchanged. This does not recover the missing Kuna entry or combine this branch with fix!: qualify call paths by provider discovery #8443; see [Bug] Kuna call paths can report complete negative despite omitted direct calls #8362.Combined Kuna path recovery control: a disposable checkout combining fix!: qualify call paths by provider discovery #8443 head
ef5a7e68band fix(kuna): guide inventory selector recovery #8397 head65939bc4areturned discovery-qualifiedunknown, an inventory-specific assembly refusal, and a reached Ghidra path after explicit same-session provider selection. The original Kuna trace was retained exactly; successful responses validated against fetched compact/full MCP schemas. This is one real Kuna 1.990 / Ghidra 12.1.4 fixture on macOS arm64, not an automatic fallback or a merge of either PR. Details: [Bug] Kuna call paths can report complete negative despite omitted direct calls #8362.Validation performed
After merging current main, Node 24.22.1 focused source and in-memory MCP tests
kunaMachoInventoryandkunaAliasSearchMcp: 11 passed. Current main paging guidance and data-address recovery were preserved. Targeted formatting andgit diff --cached --checkpassed. The full typecheck and real Kuna verification were not rerun for this merge; hosted CI is pending.npm run test:focused -- tests/boundary/providers/kuna/kunaMachoInventory.test.ts— 7 passed.npm run verify:kunawith caller-supplied Kuna 1.986 — passed on macOS arm64; the final rebuilt verifier also passed after the producer refactor, with verified lineage and cleanup complete.Real MCP and CLI missing/ambiguous/name/address controls — passed as described above.
npm run check:fast,npm run docs:check,oxfmt --checkon touched files, andgit diff --check— passed. Documentation check ran after the contract-description change.Compatibility, safety, and release
The existing error code remains
invalid_request; accepted xref and procedure name lookups receive specific recovery rather than generic input-contract advice. Procedure lookup failures additionally preserve the exact selector in structured issues. No provider protocol, input/output schema, cache, or target authority changes. Real provider testing covered Kuna 1.986 and the narrower 1.988 control above, on macOS arm64 only.Kuna 1.988 shared-alias control
Real Kuna 1.988 on macOS arm64, using full and compact stdio MCP, analyzed an unexecuted source-built x86-64 ELF where
audit_transformnames two versioned entries. Forprocedure_address,procedure_assembly,procedure_callers, andanalyze_function, the error retained both candidates without schema-inspection recovery; retrying each operation with either exact address succeeded. Target SHA-2561f158b0ea39494fcd3424844a1b02511325c567e073fbc0ed045e0bef5f0abferemained unchanged. This is one additional provider version and fixture, not a broad corpus or autonomous-agent test.Author readiness
Human owner: