Repository navigation
feat(native): deliver batch decompile as a retained summary - #8631
Conversation
…s views A completed batch_decompile could only be read whole. When it did not fit the MCP response budget, or an agent wanted one function, inspect_analysis_view refused the parent as unsupported and the only recovery was exporting the session. - Own the batch result schema in the domain, replacing the contract's copy and the workflow's hand-written item types. - Add summary and batch-decompile views: body-free rows keyed by original index with exact filters and opt-in bodies, and UTF-16 pages of one body. - Report the decompiling provider from the upstream analysis profile, since the Evidence provider is the composing workflow. - Keep batch limitations visibly aggregated rather than attributing them to one successful item. Fixes #8498 Co-Authored-By: Claude Opus 5.5 <[email protected]>
A batch that fits still floods the caller's context with every body, and one that does not fit only named an export. Selecting a body that cannot fit named an export too, even though its text pages can. - Accept detail: summary on batch_decompile: retain the complete batch first and return its counts, identities and sizes. The default stays complete, and the selection never reaches the Evidence parameters. - Offer a ready-to-call body-free first page when a complete batch overflows. - When a selected batch page overflows, continue from the same retained parent with fewer rows, then with one body's text pages. Refs #8498 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c2fdb6f3bb
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
label_unavailable only counted failed lookups, so a batch whose provider answered null for every label reported zero. The identity contract defines a null name as an unavailable label in both cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b78c6c553a
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ource A batch view read from an Evidence file or inline record advertised a retained-evidence continuation for a parent the session never retained, so following it failed. A view's continuation now repeats the caller's source and only narrows the selection. An inline record offers none, because it cannot be repeated within the reply it overflowed. Non-batch views skip the selection parse, since delivery asks about every view it returns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…idator A local validator map dropped any tool without an output schema, so removing an advertised schema would have left these contract tests green. Require both named schemas and validate through createMcpSchemaValidation, as docs/testing.md asks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…compile-detail # Conflicts: # tests/boundary/mcp/batchDecompileViewsMcp.test.ts
[Medium impact] The PR appears safe to merge; no new actionable issues were found. SummaryAdds
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["batch_decompile"] --> B{"Summary requested?"}
B -->|Yes| C{"Can retain the parent?"}
C -->|No| D["Refuse before analysis"]
C -->|Yes| E["Run batch and retain full Evidence"]
E --> F["Return summary with parent ID"]
B -->|No| G["Run batch and return complete Evidence"]
G -->|Over budget and retained| H["Offer body-free items page"]
F --> I["inspect_analysis_view"]
H --> I
I --> J{"Page fits?"}
J -->|Yes| K["Deliver page"]
J -->|No, repeatable source| L["Offer fewer rows or shorter text"]
L --> I
Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile |
…hing A fixed-target server reads an Evidence file through inspect_analysis_view but records nothing, so its overflow skipped the continuation and returned generic CLI guidance. A view's continuation names the caller's source and needs no session, so it no longer depends on recording. Retained references still do. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pile-detail # Conflicts: # .agents/skills/reverse-engineer-anything/references/evidence-workflows.md # docs/mcp-contracts.md # docs/native-investigation.md # src/contracts/toolOutputSchemaGroups.ts # src/domain/analysisView/analysisViewResult.ts # src/domain/analysisView/batchDecompileView.ts # tests/boundary/mcp/batchDecompileViewsMcp.test.ts # tests/boundary/mcp/ghidraMcpHarness.ts
…8631) * feat(native): select retained batch decompile results through analysis views A completed batch_decompile could only be read whole. When it did not fit the MCP response budget, or an agent wanted one function, inspect_analysis_view refused the parent as unsupported and the only recovery was exporting the session. - Own the batch result schema in the domain, replacing the contract's copy and the workflow's hand-written item types. - Add summary and batch-decompile views: body-free rows keyed by original index with exact filters and opt-in bodies, and UTF-16 pages of one body. - Report the decompiling provider from the upstream analysis profile, since the Evidence provider is the composing workflow. - Keep batch limitations visibly aggregated rather than attributing them to one successful item. Fixes morluto#8498 Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(native): deliver batch decompile as a retained summary A batch that fits still floods the caller's context with every body, and one that does not fit only named an export. Selecting a body that cannot fit named an export too, even though its text pages can. - Accept detail: summary on batch_decompile: retain the complete batch first and return its counts, identities and sizes. The default stays complete, and the selection never reaches the Evidence parameters. - Offer a ready-to-call body-free first page when a complete batch overflows. - When a selected batch page overflows, continue from the same retained parent with fewer rows, then with one body's text pages. Refs morluto#8498 Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(native): count every unavailable entry label in a batch summary label_unavailable only counted failed lookups, so a batch whose provider answered null for every label reported zero. The identity contract defines a null name as an unavailable label in both cases. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(native): continue an oversized batch view from the caller's own source A batch view read from an Evidence file or inline record advertised a retained-evidence continuation for a parent the session never retained, so following it failed. A view's continuation now repeats the caller's source and only narrows the selection. An inline record offers none, because it cannot be repeated within the reply it overflowed. Non-batch views skip the selection parse, since delivery asks about every view it returns. Co-Authored-By: Claude Opus 5.5 <[email protected]> * test(native): require advertised batch schemas through the shared validator A local validator map dropped any tool without an output schema, so removing an advertised schema would have left these contract tests green. Require both named schemas and validate through createMcpSchemaValidation, as docs/testing.md asks. Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(native): offer file view continuations on servers that retain nothing A fixed-target server reads an Evidence file through inspect_analysis_view but records nothing, so its overflow skipped the continuation and returned generic CLI guidance. A view's continuation names the caller's source and needs no session, so it no longer depends on recording. Retained references still do. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Summary
Follow-up to #8498, built on the retained view from #8629, which has merged. This PR now shows only its own change. Design: #8498 (comment).
Problem and expected behavior
An agent reading two of 64 functions received all 64 bodies: about 207 KB and 67k estimated tokens on the real workflow below. The retained view from #8629 only helps after that cost is paid. Over budget, the reply named an export rather than the view.
Expected: the caller chooses delivery up front, and an overflow names a call that can succeed.
Change and scope
batch_decompiledetail: uses the existing enhanced-tool summary delivery, asget_call_graphdoes. It refuses before analysis when the server retains no Evidence.detailis stripped before the workflow, so the parent's parameters and Evidence ID match a complete call.{kind:"batch-decompile", collection:"items", offset:0, limit:64}.smallerBatchDecompileSelection: an oversized selected page continues from the caller's ownsource, so a parent read from an Evidence file is never named as retained. Several rows halve; one row with a body moves to itspseudocodepages; a text page halves its limit. An error row that alone cannot fit keeps the export guidance. An inline source offers no continuation, because the record cannot be repeated within the reply it overflowed. A view's continuation doesn't depend on session recording, so a fixed-target server reading an Evidence file offers one too.continuationOfis extracted so both paths share one schema-validated call builder, andinspect_analysis_viewpasses its caller's source throughrunEvidenceToolOperationto delivery.Follow the contribution scope. Read-only delivery of completed Evidence within existing boundaries; no maintainer scope decision is required.
Contract and boundary impact
projectBatchDecompileView(feat(native): select retained batch decompile results through analysis views #8629) still owns selection;smallerBatchDecompileSelectionlives beside it and reads only the page's view and row identities.detailonbatch_decompile; output is complete Evidence or its summary view. The CLI has no batch command and reads saved Evidence as in feat(native): select retained batch decompile results through analysis views #8629.docs/public/product-catalog.json), package, or installation impact: catalog only.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Before and after, executed. Real Kuna 1.988 (release digest verified), stdio MCP compact profile, macOS arm64, on Homebrew's unexecuted
tmux(arm64 Mach-O, SHA-2568ab1bd9e…a86d, unchanged in every run). The task is to read two of 64 functions. Task columns cover the batch and view calls, including request text, and excludeopen_binaryandlist_procedures(identical in every run). Bytes are the SDK-serialized reply; tokens aretokenxestimates, not billing. CPU and peak memory cover the whole session's process family, sampled withps. One run each on a machine shared with other jobs, so small timing and memory differences are noise.8250bf232, complete8250bf232, completeThat is about 85–87% fewer estimated tokens for this task, with no measurable analysis saving: decompilation still runs for all 64 functions. A task that reads most bodies gains little or nothing from selected delivery, and the default stays
complete.The two wanted bodies hash identically between complete and selected delivery in the same cache state. The first function's text differs between cold and warm on both base and this branch, which matches Kuna's documented single-function run versus project export; this PR doesn't change it.
Schema cost, one catalog per session: compact 580,675 to 581,159 B (+484 B, about +133 estimated tokens); full 3,958,851 to 3,972,219 B (+13,368 B, about +3,961 estimated tokens). Both are against base
8250bf232, so they include #8629.Over budget, executed on the same provider: the largest real body selected 1,000 times (13.4M code units, default 10 MiB budget).
resource_constraintwith a ready-to-call continuationdetail: "summary"of the same selectorstests/boundary/mcp/batchDecompileViewsMcp.test.ts: summary delivery in full and compact input and output profiles validated against advertised schemas, parameters excludingdetail, no provider call after the batch, the overflow chain (complete, fewer rows, one body's text, oversized text page), an unretained Evidence-file parent that continues from its file (including on a fixed-target server that retains nothing), an inline parent that offers no continuation, no retention, ledger failure, and cancellation retaining nothing. Three existing batch tests now narrow the wider output union through the owner schema.{"batch":{"total":64,"succeeded":64,"failed":0},"decompiling_provider":{"id":"kuna","name":"Kuna","version":"1.988"},"procedures":{"distinct_resolved":64,"unknown_identity":0,"label_unavailable":0},"pseudocode":{"code_units":81682,"largest":{"index":57,"code_units":13397}},"limitation_count":5}Applicable lifecycle regressions: cancellation during the batch retains nothing. Retention-failure recovery beyond the existing typed error is #8444.
For evidence-bearing changes:
Validation performed
npm run check:fast— passednpm run format:check— passednpm run knip— passednpm run docs:check— passednpm run metadata:check— passednpm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts tests/boundary/mcp/ghidraRoutingMcp.test.ts tests/boundary/providers/kuna/kunaBatchDecompileMcp.test.ts tests/boundary/mcp/nativeViewPredicateMcp.test.ts tests/boundary/cli/analysisViewCli.test.ts tests/boundary/cli/cliToolCoverage.test.ts tests/conformance/contracts/targetContentProvenance.test.ts tests/boundary/mcp/featureTraceViewsMcp.test.ts tests/boundary/mcp/nativeInventoryViewsMcp.test.ts tests/boundary/mcp/largeToolResult.test.ts src/application/analysisView/AnalysisViewService.test.ts src/application/WorkflowEvidence.test.ts src/application/EnhancedInputDiagnostics.test.ts src/application/EnhancedToolSelectorOrigin.test.ts— 15 files, 207 tests passedlabel_unavailablefix from feat(native): select retained batch decompile results through analysis views #8629,npm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts— 8 tests passed. The suites above and the real workflows were not rerun for that one-line count change.npm run check:fast,format:check,knip,docs:checkandmetadata:checkpassed;npm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts tests/boundary/mcp/ghidraRoutingMcp.test.ts tests/boundary/providers/kuna/kunaBatchDecompileMcp.test.ts tests/boundary/mcp/nativeViewPredicateMcp.test.ts tests/boundary/mcp/analysisViewMcp.test.ts tests/boundary/mcp/featureTraceViewsMcp.test.ts tests/boundary/mcp/nativeInventoryViewsMcp.test.ts tests/boundary/mcp/largeToolResult.test.ts tests/boundary/mcp/contractToolHandlerTargetContent.test.ts tests/boundary/cli/analysisViewCli.test.ts src/application/analysisView/AnalysisViewService.test.ts— 12 files, 183 tests passed; and the over-budget real Kuna workflow was rerun with the same results as the table. The cold and warm comparison was not rerun; this fix only changes overflow recovery.mainatf95bdbce7,npx tsc --noEmitandnpm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts— 2 files, 27 tests passed. Every required CI check had passed on96d794166before this merge.mainataba56df68, which includes feat(native): select retained batch decompile results through analysis views #8629: the conflicted files were verified identical onmainand feat(native): select retained batch decompile results through analysis views #8629's final tree before keeping this branch's versions, and the resulting diff againstmainis byte-identical to this PR's change against feat(native): select retained batch decompile results through analysis views #8629.npx tsc --noEmitandnpm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.ts tests/boundary/cli/analysisViewCli.test.tspassed (3 files, 57 tests).mainat0e6943c9d,npx tsc --noEmitandnpm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/enhancedTools.callPathsAndBatches.test.tspassed (2 files, 28 tests).npm run test:focused -- tests/boundary/mcp/batchDecompileViewsMcp.test.ts tests/boundary/mcp/ghidraRoutingMcp.test.ts— 2 files, 11 tests passed.Compatibility, safety, and release
batch_decompileoutput sees the union only when it selectsdetail: "summary".Author readiness
Human owner: @kaoru0822-kitauji
Before merge
type(scope): outcome.🤖 Generated with Claude Code