Repository navigation
feat(analysis): make resource budgets recoverable across CLI and MCP - #9706
Merged
Merged
Conversation
morluto
marked this pull request as ready for review
November 9, 2026 22:01
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. |
# Conflicts: # scripts/verify-windows-native.mjs # src/application/desktop/DesktopApplicationExport.test.ts # src/cli/environmentCommands.ts # src/domain/desktop/appExport.ts # src/domain/desktop/appExportPython.ts # src/domain/desktop/appTaskReaders.test.ts # tests/acceptance/modelArtifactCli.test.ts # tests/boundary/cli/environmentBuildCli.test.ts # tests/boundary/filesystem/evidenceBundleFiles.test.ts # tests/boundary/providers/desktopExportPython.test.ts # tests/boundary/providers/ida/calleeLookupBatch.test.ts
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 10, 2026
main's morluto#9706 adds the native_value_flow_projection semantic to every Ghidra profile, so this branch's raw digests move: repin the x86, x86_64, ARM, ARM64, m68k and M-profile pins, and set the new semantic aside in the pre-base_address snapshot compatibility check like the other later revisions. The bridge keeps main's decompiler payload and value-flow limits beside this branch's entry-context registers.
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 10, 2026
main's morluto#9706 replaces the fixed 16 MiB reverse-command output cap with the caller's max_output_bytes and reserves that allowance per call. The version probe runs inside the call before the command, so it now uses the call's reserved allowance instead of the removed constant, and a probe whose output that allowance cut identifies no tool, as a banner cut by its record budget already did. The Rizin description and guide keep main's output-admission text beside the probe sentence; the test imports drop the removed REVERSE_COMMAND_OUTPUT_LIMITATION.
7 of 22 tasks
RishTheFish21
added a commit
to RishTheFish21/rea
that referenced
this pull request
Nov 10, 2026
Main's morluto#9706 makes this MCP test create two Evidence records instead of three, so the automatic unknown counts drop from 6 to 4 (two per record). The raw profile digests changed again and are repinned; the profile assertion keeps both main's native_value_flow_projection and this PR's indirect_branch_inventory.
3 tasks done
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 11, 2026
…dgets main's morluto#9706 adds native_value_flow_projection to the shared analysis semantics, which changes the profiles of images without a section overlap. With that one revision removed, the previous pins hold (79 of 79).
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 11, 2026
main's morluto#9706 adds native_value_flow_projection to the shared analysis semantics, which changes the profiles that targets outside the M-profile lane keep. With that one revision removed, the previous pins hold (57 of 57).
Entrpi
added a commit
to Entrpi/rea
that referenced
this pull request
Nov 11, 2026
main's morluto#9706 adds native_value_flow_projection to the shared analysis semantics, which moves 10 integration pins: ARM 2, raw 6 and RISC-V 2. With that one revision removed, the previous pins hold (169 of 171; the other two are the raw pins already taken from Change 2's repin).
2 tasks done
3 tasks done
8 tasks
16 of 22 tasks
This was referenced Nov 14, 2026
gensokyo-dev
added a commit
that referenced
this pull request
Nov 14, 2026
General provenance only knew a literal require, so a bundled Electron
external held in one binding and destructured from another
(`const s=n(K);const{BrowserWindow}=s`) lost its windows and IPC. The
Electron binding origin now follows stable lexical aliases, and stops at
a rebindable binding that direct eval may have changed.
Fixes #4490
Supersedes #6993
Squashed from #6993 and rebased onto main. Rebase adaptation: the walk
uses the caller-selectable precision.alias_selections budget (the fixed
SEMANTIC_ALIAS_SELECTION_LIMIT it used was removed by #9706) and records
alias-selections when it stops there; a test pins that an over-budget
chain is not claimed and the limit is reported.
Co-Authored-By: gensokyo-dev <[email protected]>
N0zoM1z0
pushed a commit
that referenced
this pull request
Nov 14, 2026
General provenance only knew a literal require, so a bundled Electron
external held in one binding and destructured from another
(`const s=n(K);const{BrowserWindow}=s`) lost its windows and IPC. The
Electron binding origin now follows stable lexical aliases, and stops at
a rebindable binding that direct eval may have changed.
Fixes #4490
Supersedes #6993
Squashed from #6993 and rebased onto main. Rebase adaptation: the walk
uses the caller-selectable precision.alias_selections budget (the fixed
SEMANTIC_ALIAS_SELECTION_LIMIT it used was removed by #9706) and records
alias-selections when it stops there; a test pins that an over-budget
chain is not claimed and the limit is reported.
Co-Authored-By: gensokyo-dev <[email protected]>
13 tasks
This was referenced Nov 15, 2026
This was referenced Nov 24, 2026
morluto
added a commit
that referenced
this pull request
Nov 24, 2026
…ce (#8464) * fix(ghidra)!: load ESP-IDF flash code in Ghidra's default address space ESP-IDF's linker script reserves the addresses of .flash.text with the NOBITS section .flash_rodata_dummy. Ghidra 12.1.4's ELF loader gives the default address space to the later section, so .flash.text lands in an overlay that its DWARF import, call-frame processing and default-space references do not reach. Flash functions lose their DWARF signatures, locals and no-return flags, each gets a one-byte shadow function in the reservation, and pseudocode runs past calls such as esp_restart(). The ELF reader now records allocated ranges that an executable section shares with another section, through one section-table visitor that the RISC-V ISA reader also uses. When a NOBITS section starts with one executable section and covers it, the RISC-V lanes commit both sections to the analysis profile. ReaGhidraPrepareElfLoad.java then gives the code the default address space before auto-analysis and keeps the reservation as an uninitialized overlay; bytes, file offsets, symbols, functions and entry points are kept. The session reports the outcome, and any memory map that differs from the committed plan is refused. Images without such an overlap keep their analysis profiles byte for byte. BREAKING CHANGE: RISC-V images with this layout, such as ESP-IDF ESP32-C6, H2 and H21 builds, report flash code at its ELF address (0x42...) instead of .flash.text:0x42..., and their analysis profiles change. RISC-V images with any other section overlap that involves executable code are now refused with the overlapping sections named. These include ESP-IDF v5.5.2 ESP32-C5 and C61 builds, whose second reservation, .ext_ram.dummy, also covers .flash.text. See docs/ghidra-riscv.md. * fix(ghidra): bound the overlap sweep and check the load preparation Domain: - Find section overlaps with one sort and sweep that stops at the second overlap involving executable code, and read the ISA and the overlap in one section-table pass. - Record the two sections that cause a refusal as witnesses. The Ghidra lane owns the refusal text and names them with their ranges. Ghidra lane: - Check the preparation report before the first lazily started analysis call, as for the calling-convention report. - The pre-analysis script removes the code's overlay entry points, checks that no symbol or reference remains in the old overlay range, and reports the counts of the result. Its report echoes the blocks it left, which the client compares with the committed sections. A failed move refuses and rethrows. Reservation labels mark no entry points. - Session limitations no longer state a planned move after a canonical outcome. Verification: - The ESP fixture defines ESP-IDF's absolute text bounds and the reservation's label. The lane checks their addresses, the entry points, file-offset uniqueness and snapshot replay, a reservation-first build, a pre-analysis refusal through analyzeHeadless and a truncated double-float section table. - Boundary tests cover the refusal witnesses, a 10,000-section table and an ELF64 table. * fix(ghidra): retarget references into the moved ESP-IDF flash code The move takes the references from the code's range but not the references into it. Besides the entry points, Ghidra 12.1.4's loader records one data reference from the .flash.text section header to the code, which the new post-condition refused in the RISC-V lane. Retarget plain memory references and entry points into the old range to the moved code; any other kind stays behind and is refused. Removing the reservation block keeps the references into its range, so the pinned symbols' entry points need no re-add. * fix(ghidra): move labels past the ESP-IDF flash code's end with it Ghidra 12.1.4 places a section-relative symbol at the section's end, such as ESP-IDF's _etext, in the code's overlay space one byte past the block. The move covers the block only, so the label stayed in the overlay and ended up in the reservation. Everything in the code's overlay space now follows the code: references are retargeted, labels outside the block are created again in the default space, and the post-condition checks the whole space. The script refuses when another block shares that space. The ESP fixture defines _etext, and the lane checks its address. * fix(ghidra): check prepared blocks by coordinates and address spaces The client compared the pre-script's echoed block names with the ELF section names, although section names are display only: an unnamed section's empty name never matches the name Ghidra gives its block, so that preparation was refused. It also accepted any reported address spaces. The check now compares addresses, sizes and the code's file offset, and requires moved code to go from an overlay into the program's default space while its reservation leaves it, and canonical code to stay there. An unnamed section is labelled by its index. The docs and the pre-script now state that a failure during the move may be refused without its reason, and that an entry mark on a reservation label stays at its default-space address. The docs give the llvm-objcopy route for the refused C5 and C61 builds. The lane checks that no other block maps any of the code's file bytes, and the overlap tests add the C5 and C61 section shape. * fix(ghidra): bound the sections the overlap check keeps The overlap check kept one record per allocated, non-empty section, and only the file size limited their number. NOBITS headers take no file bytes, so a crafted 1 GB ELF32 table holds about 27 million of them. The check now keeps at most 65,280 (SHN_LORESERVE, from which ELF counts sections through section zero) and reports the overlap as unavailable beyond that, which the RISC-V lanes refuse as they refuse a table that cannot be read. * fix(ghidra): check RISC-V handshake reports before any analysis call A RISC-V session that committed neither a calling-convention policy nor a load preparation started its bridge lazily on the first query other than `health`. An `elf_load_preparation` or calling-convention report that the profile did not commit was then never checked, and the query returned its result. Every RISC-V session now starts through the checked handshake, so such a report closes the session before any analysis call, whatever the first query is. A double-float session that reports a preparation, and one that reports a calling-convention policy, are now tested with `list_procedures`; both fail without the fix. Admission, profile parameters and profile digests do not change. If Ghidra exits during the first query of a double-float session, the error now tells the caller to reopen the session, as other checked sessions do. * fix(ghidra): skip analysis after a refused ELF load preparation A refused memory map only wrote the refusal, so headless Ghidra still ran seeds, auto-analysis and post-script analysis on a program that REA then discarded. The preparation now turns off headless auto-analysis when it refuses; later pre-scripts and the bridge still run, so the session reports the reason. The swap also renamed the reservation's overlay space to the section's raw name, so a reservation named like another address space, such as the RISC-V default space ram, or containing characters Ghidra rejects, failed after the move. The space now takes the name Ghidra's memory map derives for an overlay block: ':' and whitespace become '_', and a name in use gains .1, .2 and so on. verify:ghidra:riscv drops -noanalysis from the refusal run and checks that Ghidra analyzed nothing, and a seventh fixture names the reservation ram and checks that it moves into the overlay space ram.1. * test(ghidra): read the load preparation report before Ghidra's log suffix * test(ghidra): pin unchanged RISC-V profiles at main's revisions main's byte-search (#8840), data-type (#8602) and reference revisions change every Ghidra profile. With those revisions reversed, the old pins hold. * fix(ghidra): name the moved RISC-V guide in load-layout diagnostics The overlap refusal, the load-layout limitation and the bridge comments named docs/ghidra-riscv.md, which main moved to docs/providers/. * test(ghidra): check load-preparation facts instead of sentences The refusal, report-check and handshake tests compared whole messages. They now check the sections, coordinates, spaces and counts each message must state, and the handshake compares the session's limitations with ghidraRiscvLoadPreparationLimitations. Rewording the messages passes; dropping a count fails. * fix(ghidra): give the ESP-IDF load preparation unused temporary names The preparation created its temporary blocks as <name>.rea, so a disjoint section already named that refused an otherwise admitted image. It now takes the first unused <name>.rea[.N]. verify:ghidra:riscv gains an esp-edge-names fixture with such a section. * fix(ghidra): keep both final block names free during the ESP-IDF swap The code's temporary block could take the removed reservation's name, such as a reservation named <code>.rea, and the reservation's rename back then collided. The picker now skips both final names. verify:ghidra:riscv's esp-edge-names fixture names its reservation .flash.text.rea beside a disjoint .flash.text.rea.1. * test(ghidra): repin the overlap-free RISC-V digests for main's #8340 main's #8340 bumps call_relationship_coverage from v5 to v7, which changes every Ghidra profile digest. With the revision reverted in place, the old pins hold (79 of 79). * test(ghidra): repin unchanged RISC-V digests for main's value-flow budgets main's #9706 adds native_value_flow_projection to the shared analysis semantics, which changes the profiles of images without a section overlap. With that one revision removed, the previous pins hold (79 of 79). * fix(ghidra): inspect RISC-V PIE section overlaps and refuse an unverified PIE reservation Main admits RISC-V PIE, but this lane requires a section-overlap read that the resolver made only for ET_EXEC, so every PIE was refused. A PIE's section addresses are fixed offsets from its load base, so overlaps do not depend on the base: read them for ET_DYN too. The NOBITS reservation preparation is verified for ET_EXEC only, so a PIE that needs it is refused. Main's producer identity now digests the bridge sources, so the test that compared profile digests with main's is replaced by checking that images without an overlap commit no load preparation. * fix(ghidra): find an ESP-IDF reservation that Ghidra 12.2 marks executable Ghidra 12.2 gives each section block the permissions of the first PT_LOAD that contains its address, so a NOBITS reservation that shares the code's addresses comes out executable and the preparation refused every ESP-IDF image. Tell the reservation from the code by its missing bytes alone; the displaced reservation is still made non-executable. The PIE refusal test now uses the ELF64 lane, which admits PIE. * fix(verify): read the ESP-IDF fixtures' identity where main's #11416 moved it Evidence subjects and snapshot targets now carry their digest under identity, as the rest of the RISC-V verifier reads it. * docs(ghidra): describe the ESP-IDF load layout as verified on Ghidra 12.2 The real RISC-V lane now passes on Ghidra 12.2, whose ELF loader still puts the code in an overlay when its reservation follows it. Name 12.2 where the lane exercised that behaviour, and note that 12.2 can mark the reservation executable. Measurements of Ghidra APIs the lane did not re-check keep their 12.1.4 attribution. * docs(domain): align RISC-V section-overlap JSDoc with ET_DYN inspection --------- Co-authored-by: morluto <[email protected]>
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
Agents can change the budget that actually omitted or refused data, retry the same complete input, and retain exact exhaustion and coverage facts. Source-location tracing also gains compact retained delivery so a point answer does not require returning the entire map.
Related: #6176, #8434, #5808, #8978.
Problem and expected behavior
Several producers had fixed ceilings, duplicated allowances, or recovery that suggested changing an unrelated limit. Bun/SEA recognition could interpret unexamined data as absent; desktop seed checks could accept bytes the exported reader refused. A legitimate source-map result could exceed MCP delivery even after map admission succeeded.
The enforcing owner now accepts a bounded policy, preserves selected versus effective values, and explains the next action. Unexamined data stays unknown. Complete Evidence remains available when delivery is compact.
Change and scope
The implementation commits separate shared contracts, ASAR/Ghidra settings, artifact readers, JavaScript precision, source maps, historical captures, desktop views, live capture, managed/Go/Rust/Wasm/EVM/Android producers, and verification.
Scope decision: not applicable to new-provider approval. These are changes within existing workflows; no new target execution, attachment, injection, protection-recovery or network authority is introduced.
Contract and boundary impact
artifact_limits,producer_limits, semantic/capture/view controls and curated runtime settings. Existing complete delivery remains the default.Expected effects within existing caller-selected workflows:
Evidence and regression coverage
Public CLI/MCP regressions cover lower → raise → lower admission on the same target, selected/effective provenance, both schema profiles, retained queries after source removal, malformed controls, unsupported increases, extraction output absence and cleanup. Desktop checks execute real SQLite workers and emitted Python helpers. Source regressions cover recognition uncertainty, escaping, surrogate boundaries and independent exhaustion causes.
Historical calibration records retain their measured runtime pins; they are not benchmarks of this main-integrated head. They support a narrow map-admission change and keeping other measured defaults, not universal optimality or a blanket speedup claim.
Validation performed
Integrated onto main
8dfc47b107afc0cf4b53322a10b94c666fe9e18b, excluding the original branch's unrelated documentation commits.npm run check:fast— typecheck/lint pass.npm run docs:buildpasses. Triaged CodeQL alerts 710–716 and 718–723 as false positives for explicit local operator selections or the REA-owned LLDB journal path, with per-alert source rationale. Fresh observer → JavaScript harness → CLI smoke passed, including process-group cleanup.npm run docs:generateandnpm run docs:check— pass, including README consistency.npm run test:python— 102 passed.npm run verify:test-discovery— 3,343 files, each discovered once.npm run verify:architecture-guards— pass across 2,696 source files.CI follow-up: restored reader/screen-judge documentation and repository receipt links; full
verify:docs:routespasses across 404 pages. Updated real mitmproxy fixture calls for explicit projection depth and corrected the Ghidra live-budget snapshot regression. Focused CLI/MCP snapshot suites pass (49 passed, 2 skipped); Python tests (102) and docs checks pass. Removed a source-location projector dependency cycle and refreshed stale profile/control assertions. Real Python file-only verifier coverage now proves no computer execution is needed, replacing an inherited whole-renderer checksum. Additional source/view/precision tests pass; model suites pass (154), evidence-bundle suite passes (50), and reverse-tools coverage passes (800 passed, 29 platform skips locally). Typecheck/lint pass. Further CI fixes preserve selected directory/file/unknown alias kinds in desktop exports and remove the duplicate alias helper (55 tests passed). Windows conformance now uses the current cleanup guard and bounded readback API (21 lifecycle tests passed locally). Provider fixture/control and live-dossier assertions were corrected with focused checks; no production guards or CI rules were weakened. Completed JavaScript CodeQL triage: alerts 215, 504, 703, 724–726 and 729 are false positives for explicit local executable/path selections or provider-owned request files; all related source flows were checked and per-alert rationale recorded. Latest CI follow-up preserves raw capture-path provenance inenvironment-build(7 public CLI tests pass, byte-identical bundles), restores Windows/POSIX endpoint refusal parity with retained cleanup retry (27 focused tests pass), and checks emitted desktop alias metadata structurally (112 related tests pass). Artifact-limit CLI recovery tests pass (4). GitHub checks are rerunning on head6ecbcd6bc8.The complete
check:prgate was not run. Windows, Linux-only native lanes, full AgentEnv execution and real-provider combinations beyond the listed qualifications remain unverified. Admission/heap requests are not whole-process-family memory guarantees.Author readiness
Human owner: @morluto (PR author)
Before merge
type(scope): outcome.