[PR #937] [MERGED] fix(android): bound fragmented JADX MCP frame memory #2514

Closed
opened 2026-10-17 21:07:01 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/937
Author: @morluto
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @morluto

Base: main ← Head: codex/provider-process-audit


📝 Commits (4)

  • 23b6de5 perf(android): avoid repeated MCP frame copies
  • 1fd7701 fix(android): bound fragmented MCP frame memory
  • 7651db4 Merge remote-tracking branch 'origin/main' into codex/provider-process-audit
  • d656f5f style(android): format JADX transport changes

📊 Changes

4 files changed (+176 additions, -18 deletions)

View changed files

📝 src/android/JadxMcpTransport.ts (+42 -15)
📝 src/process/ProviderProcess.ts (+4 -1)
📝 tests/boundary/android/jadxIntegration.test.ts (+3 -2)
➕ tests/boundary/android/jadxMcpTransport.test.ts (+127 -0)

📄 Description

Summary

Fixes the JADX memory pressure reported in #893. Fragmented JSON-RPC frames no longer trigger a full-buffer copy for every stdout chunk. The transport grows a bounded byte buffer geometrically to the existing 8 MiB frame limit and releases it when a frame completes or the transport closes. Because JADX stdout is protocol data that the transport already parses, its process supervisor now skips duplicate stdout diagnostic retention; the supervisor's default behavior and JADX stderr diagnostics remain unchanged.

Evidence

The production owned-child integration fixture was used for an end-to-end comparison: 34 calls in one retained session, each returning a 1 MiB manifest. The test checks the exact full result on every call. Three alternating runs measured a baseline median of 369 ms and candidate median of 294 ms (about 20% lower). This is a synthetic MCP protocol fixture, not a real JADX engine or 133 MB APK verification.

A separate deterministic launcher/stdout seam sent a 128 KiB response in 131,145 one-byte events. Heap growth before frame completion was 15,198,400 bytes with duplicate stdout capture enabled and 156,864 bytes with it disabled; the decoded result matched exactly, and arrayBuffers returned to its pre-frame level after completion. This is a transport-level heap probe, not an OS-pipe or real-provider memory claim.

Verification

  • npm run test:focused -- tests/boundary/android/jadxMcpTransport.test.ts tests/boundary/android/jadxIntegration.test.ts tests/boundary/android/jadxProtocol.test.ts tests/boundary/process/providerProcess.test.ts — 53 tests passed
  • npm run check:fast — passed
  • npm run verify:hopper — passed on macOS arm64

No real JADX, Ghidra, or IDA engine verification was performed. Ghidra and IDA were unconfigured.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/937 **Author:** [@morluto](https://github.com/morluto) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `codex/provider-process-audit` --- ### 📝 Commits (4) - [`23b6de5`](https://github.com/morluto/rea/commit/23b6de5c034ffffc12021b1e7dc8c1797f4b9a7b) perf(android): avoid repeated MCP frame copies - [`1fd7701`](https://github.com/morluto/rea/commit/1fd7701195335f2258ff0b7f72b155f9ee4df517) fix(android): bound fragmented MCP frame memory - [`7651db4`](https://github.com/morluto/rea/commit/7651db4f74990a614574bf308296773644e4d15d) Merge remote-tracking branch 'origin/main' into codex/provider-process-audit - [`d656f5f`](https://github.com/morluto/rea/commit/d656f5f92e828335793fbd2c6a3486f78ae54534) style(android): format JADX transport changes ### 📊 Changes **4 files changed** (+176 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/android/JadxMcpTransport.ts` (+42 -15) 📝 `src/process/ProviderProcess.ts` (+4 -1) 📝 `tests/boundary/android/jadxIntegration.test.ts` (+3 -2) ➕ `tests/boundary/android/jadxMcpTransport.test.ts` (+127 -0) </details> ### 📄 Description ## Summary Fixes the JADX memory pressure reported in [#893](https://github.com/morluto/rea/issues/893). Fragmented JSON-RPC frames no longer trigger a full-buffer copy for every stdout chunk. The transport grows a bounded byte buffer geometrically to the existing 8 MiB frame limit and releases it when a frame completes or the transport closes. Because JADX stdout is protocol data that the transport already parses, its process supervisor now skips duplicate stdout diagnostic retention; the supervisor's default behavior and JADX stderr diagnostics remain unchanged. ## Evidence The production owned-child integration fixture was used for an end-to-end comparison: 34 calls in one retained session, each returning a 1 MiB manifest. The test checks the exact full result on every call. Three alternating runs measured a baseline median of 369 ms and candidate median of 294 ms (about 20% lower). This is a synthetic MCP protocol fixture, not a real JADX engine or 133 MB APK verification. A separate deterministic launcher/stdout seam sent a 128 KiB response in 131,145 one-byte events. Heap growth before frame completion was 15,198,400 bytes with duplicate stdout capture enabled and 156,864 bytes with it disabled; the decoded result matched exactly, and `arrayBuffers` returned to its pre-frame level after completion. This is a transport-level heap probe, not an OS-pipe or real-provider memory claim. ## Verification - `npm run test:focused -- tests/boundary/android/jadxMcpTransport.test.ts tests/boundary/android/jadxIntegration.test.ts tests/boundary/android/jadxProtocol.test.ts tests/boundary/process/providerProcess.test.ts` — 53 tests passed - `npm run check:fast` — passed - `npm run verify:hopper` — passed on macOS arm64 No real JADX, Ghidra, or IDA engine verification was performed. Ghidra and IDA were unconfigured. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:07:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2514
No description provided.