Repository navigation
feat(mcp): support runtime analysis limit recovery - #7049
Conversation
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: abeb95b4fd
ℹ️ 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".
[High impact] The PR appears safe to merge; no new blocking issue was found. SummaryAdds two MCP tools to inspect and update 11 runtime analysis defaults, allowing agents to adjust supported limits and retry without restarting REA.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[MCP settings update] --> B[Validate complete change]
B --> C[Publish new revision]
C --> D[Next tool call captures settings]
D --> E[Provider reads accepted values]
E --> F[Analysis result or structured limit]
F --> A
G[Already accepted work] --> H[Keep earlier settings]
Reviews (7) · Last reviewed commit: "chore: merge main into runtime analysis ..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3b0a70a49b
ℹ️ 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".
* fix(mcp)!: return a compact binary_session status by default
binary_session {} with no target open returned about 66 KB, most of it
provider rejection diagnostics and candidate capability sets that the
skill's recovery flow re-reads on every retry. 6.8.0 grew it by 21%
because the shared regex capability limitation began repeating setting
bounds and step-by-step recovery for every search operation of every
provider (#6099, #6267, #6301, #7049) and IDA gained that limitation for
its two search operations (#4862).
The regex limitation now states the effective deadline and heap, their
sources and where to change them; the deadline and heap errors keep the
full recovery. binary_session gains detail: summary (default) or
complete. The summary keeps open state, target identity, the binding,
route capabilities, run, activity and health status, each candidate's
availability and target-support status, code and reason, and every
tool's availability, reason, remediation and modes, and lists the
fields it leaves out in omitted_fields. Complete detail returns the
previous shape. The CLI capabilities and providers commands keep
complete provider facts through the same application projection.
BREAKING CHANGE: binary_session {} no longer returns
analysis_provider_candidates[].availability.diagnostics,
target_support.diagnostics or capabilities, or tool_availability group
surface, effects and annotations. Pass {"detail": "complete"} to get
them.
Fixes #7109
Co-Authored-By: Claude Opus 5.5 <[email protected]>
* fix(mcp): key binary_session output fields by detail
The output schema accepted detail: "complete" with summary candidates or
tool groups, and a summary without omitted_fields, so detail did not
tell callers which fields existed. Each session kind is now crossed
with a detail-specific shape: a summary requires omitted_fields and
summary-only candidates and tool groups; complete requires diagnostics,
candidate capabilities and static tool flags and forbids omitted_fields.
Both the canonical schema and the SDK-validated advertised schema reject
mismatched shapes.
The verifier helper accepts summary candidates only for a validated MCP
summary; CLI provider output still requires candidate capabilities.
Regex limitation tests check values, sources and setting names instead
of whole sentences.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
---------
Co-authored-by: Claude Opus 5.5 <[email protected]>
The provenance section says the untrusted-content marker is on by default and
that "only export_evidence_bundle and record_unknown" omit it. The audited set
has four members:
export const TARGET_CONTENT_FREE_TOOLS: ReadonlySet<string> = new Set([
"inspect_analysis_settings",
"update_analysis_settings",
"export_evidence_bundle",
"record_unknown",
]);
f3ed165 (feat(mcp): support runtime analysis limit recovery, morluto#7049) added the
two settings tools to that set; its docs hunk did not touch this sentence, so
the exhaustive list there is now short by two names.
Observed through a stdio session: inspect_analysis_settings and
update_analysis_settings return no _meta.provenance, while a tool outside the
set such as list_adb_devices returns
_meta.provenance = {untrusted_content: true, source: "analysis_target"}.
Fixes morluto#7327.
The provenance section says the untrusted-content marker is on by default and
that "only export_evidence_bundle and record_unknown" omit it. The audited set
has four members:
export const TARGET_CONTENT_FREE_TOOLS: ReadonlySet<string> = new Set([
"inspect_analysis_settings",
"update_analysis_settings",
"export_evidence_bundle",
"record_unknown",
]);
f3ed165 (feat(mcp): support runtime analysis limit recovery, morluto#7049) added the
two settings tools to that set; its docs hunk did not touch this sentence, so
the exhaustive list there is now short by two names.
Observed through a stdio session: inspect_analysis_settings and
update_analysis_settings return no _meta.provenance, while a tool outside the
set such as list_adb_devices returns
_meta.provenance = {untrusted_content: true, source: "analysis_target"}.
Fixes morluto#7327.
The provenance section says the untrusted-content marker is on by default and
that "only export_evidence_bundle and record_unknown" omit it. The audited set
has four members:
export const TARGET_CONTENT_FREE_TOOLS: ReadonlySet<string> = new Set([
"inspect_analysis_settings",
"update_analysis_settings",
"export_evidence_bundle",
"record_unknown",
]);
f3ed165 (feat(mcp): support runtime analysis limit recovery, morluto#7049) added the
two settings tools to that set; its docs hunk did not touch this sentence, so
the exhaustive list there is now short by two names.
Observed through a stdio session: inspect_analysis_settings and
update_analysis_settings return no _meta.provenance, while a tool outside the
set such as list_adb_devices returns
_meta.provenance = {untrusted_content: true, source: "analysis_target"}.
Fixes morluto#7327.
The provenance guide named export_evidence_bundle, record_unknown, search_guidance and read_guidance_section as the only tools whose results omit _meta.provenance. TARGET_CONTENT_FREE_TOOLS also exempts inspect_analysis_settings and update_analysis_settings (morluto#7049) and guided_workflows (morluto#6995), so a reader of the guide expected markers those tools never send. List all seven, and assert in the existing provenance conformance test that the documented list equals TARGET_CONTENT_FREE_TOOLS, so the next audited exception cannot be missed again. Fixes morluto#7327.
Summary
Allow agents to recover from REA-owned admission, timeout and worker-heap limits through MCP, then retry the original request without restarting REA. Related: #6176.
Problem and expected behavior
An ASAR index above the default 16 MiB admission could prevent full-archive analysis even when the machine had capacity. Changing launch configuration could not repair a running MCP server. A returned limit now identifies its editable setting and bounds; the agent can update it directly and retry the same archive on the same connection.
Change and scope
Add
inspect_analysis_settingsandupdate_analysis_settingsfor 11 curated defaults across ASAR, Ghidra/Hopper startup, Ghidra decompilation, JADX, regex, capture decoding, JavaScript and WABT. Updates are atomic, support reset and optional revision checks, survive target close/open, and disappear on REA restart. Explicit per-call arguments win; accepted work keeps its snapshot. No framework dependency or upstream changes. JADX release metadata stays dependency-free for pre-install fixture scripts. Invalid JADX launch settings remain provider-local and can be inspected, replaced and reset through MCP. IDA consumes the shared regex controls; Ghidra is excluded from those controls. WASM preserves omitted caller parameters separately from its effective budget, including partial Evidence; shared error copies preserve structured limit recovery.Contract and boundary impact
AnalysisSettingsowns validated runtime overrides and accepted-operation snapshots. Pure domain definitions share existing bounds with environment parsers; injected readers reach provider composition. Removed superseded constant declarations and unused re-exports; launch parsing and provider lifecycle ownership remain distinct.details.limitrecovery metadata. CLI launch/per-call controls remain supported.REA_ASAR_MAX_HEADER_BYTES. No dependency or generated-output commit.Expected effects:
The setter changes runtime configuration only. Existing analysis workflows retain their owned worker/provider launches and local bridge communication.
Evidence and regression coverage
update_analysis_settings({"changes":[{"setting":"asar.max_header_bytes","action":"set","value":33554432}]})returnsrevision: 1,active_work_changed: false, andrea_restart_required: false.Boundary coverage includes admission before allocation, immutable accepted budgets during overlapping writes, cache revalidation, and preserved cleanup/queue regressions. See verification and task-cost measurements.
Validation performed
Merge validation against
mainatab720b421: 54 focused tests passed, with two platform skips; fullnpm run checkandnpm run docs:checkpassed. Preserved main's move of CLI coverage declarations into the boundary test and retained both MCP-only settings entries there.Recovery assertion cleanup: 300 distinct tests across 27 source, boundary and acceptance files passed, including the failing ASAR boundary case, full-archive MCP update/retry/reset, real HAR heap exhaustion, retained timeout Evidence, bridge admission and startup cleanup. Assertions use structured facts or canonical guidance delivery instead of frozen explanatory wording. Testing guidance records this convention.
Mutation verification: a harmless regex-recovery rewording passed; a deliberately incorrect effective deadline failed the structured assertion. Both mutations were restored.
npm run checkpassed, including typecheck, lint/module boundaries, formatting, metadata, architecture, unused-code/reachability checks and typed lint.npm run docs:checkpassed, including 9 consistency tests; discovery found all 2,465 test files once.Earlier feature verification: real Ghidra 12.1.4 / Java 21 timeout recovery passed on macOS with session reuse and complete cleanup. JADX availability/execution repair, Android fixture bootstrap without installed dependencies, lint-plugin resolution in temporary checkouts, IDA regex recovery and WABT partial Evidence passed their focused regressions. Simulated providers do not establish real-engine behavior.
Review follow-up: 42 distinct focused tests passed, with two platform skips. The embedded-server regression failed before repair and now proves that default JADX composition consumes runtime updates and reset. It deliberately stops at the missing-JAR prerequisite; this is not a real-JADX execution claim. All deferred-server gates now use bounded acknowledgements and release/join work in
finally; injected failures at the two reviewed gates exited in 0.6 seconds without teardown timeouts.CI follow-up: the ASAR shard now passes. A later shard exposed missing MCP-only declarations for the two settings tools; that failure was reproduced locally and fixed in the catalog owner, preserving the CLI coverage assertion. A complete new-head CI pass remains pending.
Compatibility, safety, and release
Author readiness
Human owner: @morluto
Before merge
type(scope): outcome.