Skip to content

feat(mcp): page retained incoming reference addresses - #8591

Merged
morluto merged 2 commits into
mainfrom
codex/xrefs-observation-view
Nov 2, 2026
Merged

morluto merged 2 commits into
mainfrom
codex/xrefs-observation-view

Conversation

@morluto

@morluto morluto commented Nov 1, 2026 •

Copy link
Copy Markdown
Owner

Summary

A retained xrefs result can exceed MCP's response budget, and previously its retained parent could not be paged. Extend the existing native-observation view to page its address list and expose source caveats. Related: #8510.

Problem and expected behavior

An oversized completed xrefs returns a retained Evidence ID, but inspect_analysis_view rejects that parent. The caller can export the complete bundle, but cannot follow the result in bounded MCP pages. Return an inspect_analysis_view continuation for the retained parent and preserve source order, duplicates, original indices, and caveats.

Change and scope

Reuse the existing provider-neutral native-observation and native-context contracts; do not add another tool or change xrefs input. Existing source Evidence stays the owner. Pages contain untyped normalized addresses and do not assert reference kind or completeness. The separate Kuna pointer-omission and typed provenance problem in #8510 remains open.

Contract and boundary impact

  • Semantic owner: the native-observation view projects the already retained xrefs result; response-budget recovery supplies its first page.
  • Contribution scope: existing read-only observation; no new target capability or authority. Maintainer scope decision not applicable.
  • MCP: inspect_analysis_view schemas accept xrefs parents; oversized xrefs errors include a page continuation. xrefs itself has no new detail input and continues returning complete Evidence by default. CLI view consumers share the projector.
  • Provider/platform: provider-neutral projection of recorded address lists. Real controls below are macOS arm64; Hopper and other hosts untested.
  • Evidence: the parent ID, source indices, duplicate addresses, source parameters and source-context digest remain available; native-context exposes limitations. Full raw Evidence remains accessible by bundle export. Page exhaustion applies to retained rows, not discovery coverage.
  • Target and cleanup: no new execution, mutation, bridge or lifecycle operations. The view reads retained Evidence.
  • Metadata and packaging: tool description and authored documentation updated; no bundled provider or installation change.

Expected effects of the existing workflow:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Real Ghidra 12.1.4 and Kuna 1.988 compact stdio MCP on an unexecuted owned Mach-O: each paged xrefs matched that provider's complete result, including Ghidra's two addresses and Kuna's empty result; source caveats remained accessible. The target digest stayed unchanged. Kuna's empty result reflects the known omission in [Bug] Kuna 1.988 stored-pointer references disappear from xrefs and feature traces #8510.
  • A 24,000-pointer xrefs Evidence record produced by the unmerged Kuna pointer prototype was imported into fresh target-free MCP sessions. Full and compact schema profiles reconstructed all 24,000 normalized addresses in 24 pages, preserving indices and parent ID; successful outputs validated against the advertised schema. The original record retained its 24,000 typed pointer rows, which these address pages do not project.
  • In a separate temporary combination with that unmerged prototype, real Kuna 1.988 hit the default MCP response budget on the same 24,000-slot fixture. Following the returned continuation and subsequent pages recovered all 24,000 addresses in 25 calls. The target stayed unchanged and was not executed. This is a stress fixture, not evidence that current main returns those missing pointer rows or that the prototype is ready to ship.
  • The MCP boundary regression exercises continuation under a controlled smaller delivery budget without repeating provider work. The view regression checks duplicate indices and source context. Typed-pointer paging, pointer coverage, real Hopper, other platforms, and broader corpora remain unverified.

Validation performed

  • npm run test:focused -- tests/boundary/mcp/nativeObservationViewsMcp.test.ts src/application/analysisView/NativeObservationViews.test.ts — 16 passed.
  • npm run check:fast — passed.
  • npm run docs:check — passed.
  • Formatter check on touched files and git diff --check — passed.
  • Real Ghidra and Kuna, offline full/compact schema, and combined-prototype overflow controls — passed as scoped above.
  • On the earlier PR head, CI static checks failed format:check on 16 files outside this PR. The same 16 untouched base files fail the pinned formatter locally; contributor PR fix(test): restore the two checks #8573 left red on main #8592 addresses those files. CI typecheck/lint did not complete after that failure. Test shard 4 also failed four Frida verifier fixture cases: the copied verifier cannot import dist/domain/fridaRemoteAddress.js. The same four failures reproduce with npm run test:focused -- tests/boundary/process/providerVerifierCleanup.test.ts on exact base d3ab0faf5 (macOS arm64, Node 24.22.1); the other four cases pass. Draft fix(test): load real Frida verifier address dependency #8596 corrects the fixture and passes all eight cases locally. Portable tests report the same four failures, and the required aggregate check failed.

After merging main 75c3cab54 into head 8d38ee3cc, the branch tree exactly matches the temporary integration used for the 16 focused tests. check:fast, docs:check, and git diff --check passed on the merged branch. On that matching tree, real Kuna 1.989 and Ghidra 12.1.4 compact/full MCP controls paged their retained address results; a previously exported 24,000-address prototype bundle also reconstructed in fresh target-free sessions in both profiles. A separate unmerged pointer prototype plus current main recovered a real 48,000-pointer overflow through the continuation; see the PR comments for scope and caveats. New CI results are pending.

Compatibility, safety, and release

No existing input or complete-result shape changes. The view output schema gains an xrefs parent variant and overflow errors gain an actionable continuation; clients caching strict schemas should refresh the catalog. No package, installer, or target authority change. Paged addresses do not contain provider-specific pointer kinds; a complete export remains the tested way to recover those raw rows.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: apex

[Medium impact] The code changes appear safe to merge; no blocking issue was found.

Summary

Adds retained xrefs address pages through the existing native-observation view. Oversized MCP replies now offer a continuation, while native-context exposes source caveats.

  • Callers can page retained xrefs results and read their source caveats.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A["xrefs completes"] --> B["Record complete Evidence"]
  B --> C{"MCP reply fits?"}
  C -->|Yes| D["Return complete Evidence"]
  C -->|No| E["Return error with continuation"]
  E --> F["inspect_analysis_view reads retained parent"]
  F --> G["native-observation: address pages"]
  F --> H["native-context: source caveats"]
Loading

Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

@morluto

morluto commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Current-base control: in a temporary, uncommitted merge of this PR head 6c7592d1f with main 75c3cab54 (#8699), the merge was clean and the two focused native-observation test files passed (16 tests). Real Kuna 1.989 and Ghidra 12.1.4 on macOS arm64 both completed the compact and full stdio MCP xrefs → retained native-observation and limitations handoff on the existing owned pointer-only Mach-O. Each page matched its provider's complete normalized address result and retained its parent ID; Ghidra returned two addresses, and Kuna returned none because #8510 remains unfixed. The unexecuted target SHA-256 stayed 22c604d669ebd4e32be8d1f5c820ecbe9f28b1101dcb8da4b399acea355f21a9.

This checks a temporary integration, not a push or a new PR head. It does not repeat the earlier 24,000-row overflow/offline controls, verify Hopper or other hosts, or resolve the outstanding CI and author-readiness checks.

@morluto

morluto commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Additional current-base handoff control: the same temporary merge imported the previously captured 24,000-address xrefs Evidence bundle from the unmerged pointer prototype into fresh target-free servers. In both full and compact MCP profiles, 24 schema-validated pages reconstructed all 24,000 addresses in source order with their original indices and the same parent ID; the limitations context remained accessible. This fixture has 24,000 distinct addresses, so it does not exercise duplicate values. The focused view regression separately covers duplicate addresses and source identity. This offline control does not establish that current REA produces those pointer rows, and it is not a repeat of the live overflow recovery test.

@morluto

morluto commented Nov 2, 2026

Copy link
Copy Markdown
Owner Author

Current-base real overflow handoff

A separate temporary integration combined main 75c3cab54 with the unmerged pointer/typed-source experiment (which includes this paging design); KunaSessionClient.ts needed a manual conflict resolution retaining both the current verification caveat and experimental reference gaps. This is not a proposed merge or the PR head.

On macOS arm64, real Kuna 1.989 analyzed a newly built, unexecuted 48,000-pointer Mach-O. In both compact and full stdio MCP profiles, the experimental xrefs result exceeded the default 10 MiB response budget and returned resource_constraint with a retained Evidence ID and an inspect_analysis_view continuation. Following that exact first continuation (limit 64), then setting limit 1,000 and following each returned next_offset, reconstructed 48,000 addresses in 49 calls per profile. The ordered addresses matched a separate direct Kuna xrefs --to result, with original source indices and the same parent ID; the SDK received the advertised tool definition for each call. The fixture SHA-256 stayed f7929f8309dab93dc97a3839723dcda7dc6b1d7e3474a2c6175fc17e35db7cdf.

For comparison, the same experimental integration returned the existing 24,000-pointer case inline at approximately 6.97 MB in each profile, so that case no longer triggers overflow after the prototype removed its duplicate representation. These are scripted controls on one host and two constructed fixtures, not autonomous-agent selection or a performance benchmark. Current REA still omits the pointers (#8510); no general provider coverage is implied.

@morluto
morluto marked this pull request as ready for review November 2, 2026 18:07
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-02T18:08:39.597054Z 8d38ee3 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@morluto
morluto merged commit 55078b9 into main Nov 2, 2026
46 of 50 checks passed
@morluto
morluto deleted the codex/xrefs-observation-view branch November 2, 2026 18:13
@morluto morluto mentioned this pull request Nov 11, 2026
3 tasks done
@morluto morluto added area: mcp MCP server, transport, and tool registration enhancement New feature or request labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: mcp MCP server, transport, and tool registration enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant