Repository navigation
perf(native): record pwntools diagnostics once in their Evidence - #1404
Conversation
inspect_binary_layout and inspect_recorded_crash passed the decoded report as both result and rawResult, so every Evidence record carried the whole report twice (and an MCP response four times, counting its text copy). The decoded report is the only representation, so raw_result is now null, as for other single-representation operations. The real pwntools verifiers asserted the duplicate; they now assert null. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
TL;DR: The fix works. Both pwntools tools now keep one copy of the report. That cuts their output in half. The huge test ELF still does not fit the 10 MiB MCP budget. It fails cleanly and points to the saved evidence. This is a check after the merge. I tested TestsThe PR changes two test files and one fixture. Four more test files use that fixture. I ran all six.
Then I put the new tests on the parent, on Node 24. Two tests fail there. Each gets a full report where it expects Real pwntools runs
The new check also bites. I pointed this verifier at the parent's REA. It failed on the first file, at the new The full crash verifier needs pwndbg. I did not install it. So I wrote a small driver. It calls
Before and afterThese are bytes from the CLI with
Before, The 10 MiB budgetI also called the tools over MCP. Sizes are in MiB.
The big case still needs a bigger budget. At the default, both commits give Typecheck and lint
Not run
Thanks to kaoru0822-kitauji for the fix and the tighter verifier checks. Commands# pwntools in a throwaway venv
uv venv --python /usr/bin/python3 venv
uv pip install --python venv/bin/python 'pwntools==4.15.0' 'pyelftools==0.33' 'unicorn==2.1.2'
export REA_PWNTOOLS_PYTHON=$PWD/venv/bin/python
# tests, on each Node
npx vitest run \
src/application/binaryDiagnostics/BinaryLayoutService.test.ts \
src/application/binaryDiagnostics/RecordedCrashService.test.ts \
src/domain/analysisView/analysisView.test.ts \
src/application/analysisView/AnalysisViewService.test.ts \
tests/boundary/mcp/analysisViewMcp.test.ts \
tests/boundary/cli/analysisViewCli.test.ts
# layout verifier, with the large lane
REA_VERIFY_STRACE_COMMAND=/usr/bin/strace REA_VERIFY_LARGE_ELF_MCP=1 \
node scripts/verify-binary-layout.mjs
# same verifier, aimed at the parent's REA
REA_VERIFY_STRACE_COMMAND=/usr/bin/strace \
node scripts/verify-binary-layout.mjs ../base/scripts/rea.mjs
# before and after, on copies
node scripts/rea.mjs inspect-binary-layout ./protected --format json
node scripts/rea.mjs inspect-binary-layout ./extended-large --format json
node scripts/rea.mjs inspect-recorded-crash ./recording.core --format json
# typecheck and lint
/usr/bin/time -f "%e %M" npm run typecheck
npx oxlint
git ls-tree -r --name-only 7623e21f -- src | grep '\.ts$' \
| xargs node scripts/verify-module-boundaries.mjsThe ELFs come from the verifier's own gcc flags and Test setup
🤖 Generated with Claude Code (Opus 5.5) 🦊 |
…luto#1404) inspect_binary_layout and inspect_recorded_crash passed the decoded report as both result and rawResult, so every Evidence record carried the whole report twice (and an MCP response four times, counting its text copy). The decoded report is the only representation, so raw_result is now null, as for other single-representation operations. The real pwntools verifiers asserted the duplicate; they now assert null.
Problem
BinaryLayoutServiceandRecordedCrashServicebuild Evidence withresult: value, rawResult: value. The decoded pwntools report is their only representation, so everyinspect_binary_layoutandinspect_recorded_crashEvidence record carries the complete report twice (raw_resultdeep-equalsnormalized_result). An MCP response repeats Evidence in text and structured content, so it carries the report four times. The duplicate also counts twice against the 10 MiB transport budget, whichverify-binary-layout's large-result lane exercises with a 65,281-section ELF.This is the explicit-argument variant of the default copy that #1402 removes from
createAnalysisExecution. The two changes are independent.Change
rawResult: null.normalized_result, confidence, limitations and locations are unchanged.tests/fixtures/analysisView.tsmirrors production withrawResult: null.inspect_analysis_viewdoes not readraw_result.deepEqual(normalized_result, raw_result)anddeepEqual(raw_result, report)). They now assertraw_result === nulland still check the full report throughnormalized_result.Tests
BinaryLayoutServicecase: the decoded layout is the completenormalized_result, andraw_resultis null. TheRecordedCrashServicedebugger-context case also asserts null.npm run test:focused --the two service tests, analysis-view service/domain tests, andbinaryDiagnosticsMcp/analysisViewMcp/recordedCrashMcp(7 files, 41 passed)npm run check:fastReal pwntools/pwndbg verification needs Linux x64. I could not run it on this Mac. The PR touches
src/application/binaryDiagnostics/**and both verifiers, so the Real offline binary layout and Real recorded crash evidence workflows run here and are the real-provider check for this change.Refs #723, #1065.
🤖 Generated with Claude Code