Repository navigation
fix(native): retain value trace source evidence - #8384
Conversation
[Medium impact] The reviewed changes appear safe to merge; no new actionable issue remains. SummaryThe PR keeps the function Evidence cited by
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
Observation[Function observation] --> Owned{Retained ID present?}
Owned -->|Yes| Reuse[Reuse original ID]
Owned -->|No| Collector[Keep function and producer Evidence]
Collector --> ID[Return kept ID]
Reuse --> Trace[Build trace with source IDs]
ID --> Trace
Trace --> Retain[Retain collected sources before success]
Retain --> Accepted{Recorder accepts?}
Accepted -->|Yes| Result[Publish linked trace]
Accepted -->|No| Refusal[Return typed failure]
Reviews (5) · Last reviewed commit: "test(native): keep value-trace stop cove..." · Reviewed by Greptile |
Codex Review SummaryThis 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. |
|
A real-Kuna, injected-zero-capacity integration control found an interaction with #8444: after the combined branches complete This is a source-publication ownership and resource-boundary follow-up; it does not invalidate the normal-capacity source-closure fix. A fix needs to keep the failed source and completed workflow distinct and report actual retention/closure, while honoring headroom and transport bounds. |
…rce-evidence # Conflicts: # docs/native-investigation.md
Main's stop and continuation cases now meet the trace's evidence-owner precondition: direct calls supply a source id, and a completed MCP trace runs in a session that can retain it.
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Summary
trace_native_valuescan cite function Evidence that is missing from the session bundle. Fixes #8282.Problem and expected behavior
A Ghidra snapshot replay adds a replay caveat to the returned observation; reconstructing Evidence from that observation creates a different ID from the retained original. Kuna's live observations can have no session-issued ID at all. Consequently the IDs in trace procedures, nodes and edges can fail lookup even though the trace is otherwise usable.
Change and scope
Contract and boundary impact
trace_native_valuesworkflow revision 2 refuses replay of revision 1 results; existing source observations and historical records remain usable. Other workflow revisions do not change.Expected effects when running the real verifier:
Evidence and regression coverage
On a source-owned unexecuted Mach-O, real Ghidra 12.1.4 MCP produced two missing warm source IDs on main; this branch resolved both. Real Kuna 1.986 produced one missing source ID per trace on main; this branch retained it, while preserving the explicit unavailable def-use unknown. In both cases, the corrected IDs also resolved after bundle export/import into a fresh target-free server. The target hash was unchanged.
The real-provider lanes now check that cited sources exist in the bundle. The MCP boundary tests exercise both advertised schema profiles and an adapter without a recorder; the workflow and snapshot tests cover live source ownership, replay identity, cancellation after source observation, and the older workflow revision. The full Ghidra host-native lane passed against the final runtime and edit/source-identity regression in an isolated checkout with separate verifier corrections for #8172 and #8380. It recorded 437 successful and 52 rejected boundary calls, and verified complete cleanup with no remaining descendants. The added verifier has formatting-only differences from the committed file. This was not a clean-tree lane. No Windows, Hopper, other Ghidra/Kuna versions or general corpus claim.
A further real-provider control used an owned, unexecuted arm64 Mach-O with an imported GOT slot and computed call (SHA-256
62da83d290c7b276d8708937930ef12f469f41782710fed439001c01c2747c76). On current main, the warm two-node Ghidra page cited one source ID absent from the imported bundle; this branch resolved it. Both unpaged and repeated Kuna traces cited one missing source ID on main and a resolvable source on this branch. Ghidra retained its static computed-call observation andmax_depthlimitation; Kuna retained its unavailable def-use unknown. Within each provider, normalized traces matched across revisions after excluding source Evidence IDs. Bundle imports preserved the original trace results and limitations; the target hash was unchanged. This is one static import-slot case, not evidence of runtime reachability or general paging completeness.Kuna 1.988 and profile integration control
On head
a20c186e, real Kuna 1.988 stdio MCP on a source-owned, unexecuted x86-64 ELF: cold and repeatedtrace_native_valuescalls in compact and full profiles retained each cited source, linked it at the top level, and resolved its summary; the unavailable def-use unknown remained. On separate #8651 headc103de06, the same cold and repeated Kuna calls returned a source ID absent from the session bundle and an empty top-level link list; following the ID returnedevidence_integrity_mismatch. The target digest was unchanged (d3baa5cf385b68e3a8de02ed0884d9c9e781bd2c6b63201250635e4dc37655e8). Both versions were real-provider runs, but #8384's older release policy reported 1.988 as unverified. No offline-bundle control was run for this particular fixture.Both branches independently assigned value traces revision 2 for different semantics. #8651's later head
febd4ee70instead addsvalue_flow_limitations: provider-attributed-v1as a separate profile commitment. In an isolated cherry-pick combination, the intermediate commits removed this PR's revision 2; manually retaining revision 2 alongside the new commitment produced distinct combined identity. Real Ghidra carried the value-flow caveat, and real Kuna retained resolvable source IDs and its no-def-use unknown in both profiles. Preserve both fields when combining; this was an explicitly adjusted experimental checkout, not either PR's clean head.Validation performed
Hosted CI on prior head
1e77ce796failed one fixed-adapter registration test that still expected a value trace without a source Evidence owner. Updated that test to assert the intentionalcapability_unavailableresult; focused MCP registration, value-trace failure, and schema/paging suites passed (12 tests). A later review narrowed the assertion to stable error code and operation; the registration and no-owner suites passed again (10 tests). The latest head is awaiting hosted CI.npm run check:ci:fastandnpm run docs:check— passed.Focused source tests (workflow, value trace, native reader, snapshot cache) — 105 passed.
npm run test:focused -- tests/boundary/mcp/nativeValueTraceCompleteness.test.ts tests/boundary/mcp/nativeValueTraceFailures.test.ts— 5 passed.npm run verify:kuna— passed with verified Kuna 1.986 on macOS arm64; both symbolized and stripped fixture lanes and cleanup completed.Real Ghidra 12.1.4 and Kuna 1.986 stdio MCP cold/warm and fresh-server bundle controls — passed on macOS arm64; pre-change controls reproduced missing IDs.
Additional real Ghidra selected-project x86-64 Mach-O control: full traces, eight five-node pages, and depth/function/edge budget controls produced 13 records that survived export/import with unchanged normalized results. Across those traces, all 23 per-trace distinct source references resolved on this branch; 19 did not on main. The unmatched-argument finding itself remains [Bug] Native value trace does not locate recovered call arguments without bindings #8358. Target and selected-project hashes were unchanged.
Real Ghidra saved-snapshot controls, including an ambiguous historical binding — source IDs resolved live and after fresh-server import. These controls precede the final unowned-ID guard, which does not affect session-issued IDs.
Real Kuna 1.986 lifecycle control on the final head: an explicitly injected per-function watchdog stall produced a partial trace and retained unavailable pseudocode; after saving and reopening the snapshot with a separate clean cache, a fresh trace retained a distinct successful source. The snapshot had no replay entries for these live observations. Both historical and new pseudocode views resolved after export/import into a target-free server. Target and snapshot hashes were unchanged. This does not claim a natural failure rate or automatic cache repair.
Integration control: applied PR fix(cli): export source Evidence for native value traces #8297 head
acdddafon this branch in an isolated checkout, resolving its documentation conflict. Real Ghidra selected/fresh and Kuna CLI exports contained every cited source; fresh target-free MCP servers imported the bundles and resolved each source. Kuna summary also retained its source and no-def-use unknown. This is a combined-branch result, not a claim that fix(cli): export source Evidence for native value traces #8297 alone fixes source ownership. That historical combination omittedpage_truncatedandtraversalfrom the summary. Current fix(cli): export source Evidence for native value traces #8297 head095e8f394includes both fields; a later standalone Ghidra CLI control is described below.Review follow-up measurement
The success path now reuses the retained ID without rebuilding and hashing the full function Evidence; error branches still construct the partial observation. One before/after real Kuna run traced the same Brotli function and retrieved its source summary through stdio MCP. Cold (new provider caches) elapsed 2.185 / 2.188 s, sampled process-family CPU 2.14 / 2.13 s and peak RSS 462 / 464 MiB; warm (fresh server, reused respective cache) elapsed 1.301 / 1.305 s, CPU 1.45 / 1.45 s and peak RSS 391 / 390 MiB. Trace and source-view results matched excluding Evidence identifiers. These single runs do not establish a speedup; OS caches and scheduling were not controlled, and sampling can miss short-lived children.
Estimated
o200k_basetokens for JSON-serialized SDK catalog, tool requests and replies were 130,950 / 130,928 cold and 130,933 / 130,887 warm; approximately 125,362 tokens were the full compact catalog in each. Evidence IDs and temporary paths varied. This is not measured model usage and excludes transport negotiation and host-specific tool filtering. The full Ghidra lane, including the added edit/source-identity regression, passed with the two separately described verifier corrections.Combined-branch limitation
In an isolated combination with #8444, a real Kuna value trace completed before a test-injected zero-capacity ledger refused its function source. The current combined branches returned the refused source but omitted the completed trace. An uncommitted shared-recovery experiment returned both, but lacks a verified pre-construction allocation admission and is not part of this PR. A separate Ghidra zero-capacity control refused its source before trace completion. These are injected capacity controls, not observed production exhaustion. See #8425.
Compatibility, safety, and release
Current #8297 summary control
On #8297 head
095e8f394, real Ghidra 12.1.4 one-shot CLI on an unexecuted, source-built arm64 Mach-O distinguished two cases with--detail summary --evidence_output: a two-node page of a completed 12-node traversal reportedpage_truncated: trueandtraversal.status: complete; a five-node traversal capped bymax_nodesreportedpage_truncated: false,traversal.status: truncated, and reasonmax_nodes. The exported capped trace retained the same fields. The uncapped and capped bundles respectively contained two and one linkedanalyze_functionrecords, and every top-level trace link resolved within its bundle. This corrects the stale observation in the earlier combined-branch control; this standalone control does not establish source identity for a combination of the two PRs. Target SHA-256b814f3cc4226f9fe3788dedf8a14f869ca45339c5f49fc2a7709eddd2df0bd6bremained unchanged.Current combined CLI and offline handoff control
In an isolated, uncommitted combination of #8297
095e8f394and this PRa20c186eb(one documentation conflict resolved by retaining both descriptions), real Kuna 1.989 and Ghidra 12.1.4 one-shottrace-native-values --detail summary --evidence_outputsucceeded on the unexecuted fixture described above. The Kuna trace retained its no-def-use unknown and one function source; the paged Ghidra trace retained two function sources, two procedures, two nodes and four edges. Every source ID cited by the page's procedures, nodes and edges was in its exported bundle; fresh target-free MCP servers opened each cited source viainspect_analysis_viewin both compact and full input/output profiles. The focused CLI export tests passed in this combined checkout. The SHA-256 stayed unchanged. This covers one fresh-import CLI path, not snapshot replay, finalization cancellation, larger graphs, or either PR independently.Current combined snapshot control
On the same isolated #8297
095e8f394+ this PRa20c186ebcombination, an MCP session analyzed_evaluateand saved a snapshot before a fresh session reopened it and rantrace_native_values. Real Ghidra 12.1.4 reused the original function Evidence ID and reported snapshot replay; every source ID cited by the returned trace page was present in its exported bundle in both schema profiles. With real Kuna 1.989, the trace instead used a new resolvable function Evidence ID, kept its no-def-use unknown and reported no replay limitation; this control does not establish Kuna snapshot reuse. The same fixture digest was unchanged.The one-shot CLI does not expose
--snapshot: the equivalent command reportsUnknown flag, including on a checkout based on current main. The MCP test therefore does not establish a CLI snapshot handoff. #8781 tracks that separate UX question.Author readiness
Human owner:
Before merge
type(scope): outcome.