[PR #5661] [MERGED] perf(frida): add retained summaries for session status #7019

Closed
opened 2026-11-01 21:44:44 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5661
Author: @gensokyo-dev
Created: 10/20/2026
Status: ✅ Merged
Merged: 10/20/2026
Merged by: @gensokyo-dev

Base: main ← Head: perf/5640-runtime-observation-audit-20261020


📝 Commits (4)

  • 8553696 perf(frida): summarize retained session status
  • 32a4690 refactor(frida): share session facts and isolate cancellation coverage
  • 70e08c7 test(frida): verify final status delivery costs
  • 1bfe3ab docs(frida): clarify retained message retrieval

📊 Changes

22 files changed (+1974 additions, -93 deletions)

View changed files

📝 docs/frida-instrumentation.md (+16 -0)
➕ experiments/analysis-efficiency/frida-status-costs.py (+81 -0)
➕ experiments/analysis-efficiency/frida-status-queries.mjs (+267 -0)
➕ experiments/analysis-efficiency/frida-status-views.json (+468 -0)
➕ experiments/analysis-efficiency/frida-status-views.md (+163 -0)
➕ experiments/analysis-efficiency/frida-status-wire.py (+299 -0)
➕ experiments/analysis-efficiency/frida_status_delivery.py (+37 -0)
➕ experiments/analysis-efficiency/test_frida_status_delivery.py (+48 -0)
📝 src/application/analysisView/AnalysisViewService.test.ts (+2 -34)
📝 src/application/frida/FridaInstrumentationService.test.ts (+105 -0)
📝 src/application/frida/FridaInstrumentationService.ts (+47 -7)
📝 src/contracts/analysisViewToolContracts.ts (+1 -1)
📝 src/contracts/fridaToolContracts.ts (+14 -33)
📝 src/domain/analysisView/analysisView.ts (+16 -0)
➕ src/domain/analysisView/fridaSessionStatusView.ts (+86 -0)
➕ src/domain/fridaSessionStatus.ts (+27 -0)
📝 src/server/createServer.ts (+1 -0)
📝 src/server/registerFridaTools.ts (+9 -12)
➕ tests/boundary/cli/fridaStatusViewCli.test.ts (+71 -0)
📝 tests/boundary/mcp/fridaLifecycleMcp.test.ts (+11 -6)

...and 2 more files

📄 Description

Summary

Repeated state checks replay all queued Frida messages. A real libc export capture contains 2,963 exports in 50 messages: each complete status reply is about 463 KB.

Add optional frida_session_status(detail="summary") to return session identity/state, scripts, retained message count and truncation, with the complete parent retained. Omitted/complete detail preserves existing Evidence and payloads. Fixes #5640.

Change and boundary impact

  • The application service reads the provider on every call and uses the shared retained-analysis projector. Historical CLI/file views use that same projector. Parent ID/digest, provider, exact source parameters, target/OS unknowns and capture truncation remain explicit.
  • Start, status and one-shot contracts share a canonical session envelope. Evidence owns opaque JSON payload validation; summaries count retained messages without decoding their meanings.
  • Move the existing mocked file-authentication cancellation test into the isolated process-global lane. The new shared-service import exposed its module preload assumption; cancellation precedence remains tested, including proof that the mocked read ran.
  • Scope is delivery and retained facts within existing tools. Production status reads preserve existing authority/lifecycle metadata. Native verification uses the existing caller-authorized local spawn/script APIs. Configuration, installation and package version are unchanged; generated catalogs remain ignored build outputs.

Executed evidence

  • Final build and 225 exact tests across ten files passed with file parallelism disabled under one CPU. Service, lifecycle, capture truncation, malformed input, retained provenance, default identity and CLI file projection are covered. Three Python delivery-acceptance tests also passed. Five MCP tests passed again after correcting and testing filtered metadata discovery.
  • Source CI's eight IDA retryability assertions reproduce identically on untouched base 1629266e3 (8 failures, 25 passes in IdaOperationFailures.test.ts). This is an unrelated baseline failure; it is not reported as a passing check. Reproduction record.
  • npm run check:fast — passed (full typecheck and lint; guarded retry after a host-memory stop).
  • Architecture guards, formatting, Knip and documentation checks — passed; final refresh recorded in the verification comment.
  • Real Frida binding 17.23.2: small/large public SDK workflows and actual Codex 0.163 app-server captures. Full retained inventory and source linkage are checked. The local deterministic SSE backend performs no AI inference or paid model calls.
  • Final completed-task request token estimate: 1,049,997 → 515,713 (50.9% fewer), including all 211 tool input schemas and history replays. This is cl100k_base compact-JSON estimation, not actual model usage. Default-budget complete JSON is truncated; that incomplete baseline is excluded from gains.

Measurements, native inputs, failed attempts, resource accounting and reproduction.

Small observations cost more with the summary wrapper. No general latency/CPU improvement is established; full messages still consume retained memory and the derived record grows the bundle. Long-lived/saturated queues, remote Frida and real ADB devices are unqualified. Inspector has separate real-application/native-metadata qualification, with its limits recorded; its existing projection is unchanged. The additional bundled Frida verifier's payload cleanup was unverified and is excluded from qualified resource results.

Author readiness

Human owner: @gensokyo-dev

The following owner declarations are transcribed at the human owner's explicit standing instruction in this session.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/5661 **Author:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Created:** 10/20/2026 **Status:** ✅ Merged **Merged:** 10/20/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `perf/5640-runtime-observation-audit-20261020` --- ### 📝 Commits (4) - [`8553696`](https://github.com/morluto/rea/commit/855369683814d7e3cf6509d535deceffe78f607c) perf(frida): summarize retained session status - [`32a4690`](https://github.com/morluto/rea/commit/32a4690059907f09fb29e284ad492d94c1722278) refactor(frida): share session facts and isolate cancellation coverage - [`70e08c7`](https://github.com/morluto/rea/commit/70e08c75600255d211ca96df7966bf6639162da4) test(frida): verify final status delivery costs - [`1bfe3ab`](https://github.com/morluto/rea/commit/1bfe3ab7ee1173fa2997ba927f6dd33675b8e941) docs(frida): clarify retained message retrieval ### 📊 Changes **22 files changed** (+1974 additions, -93 deletions) <details> <summary>View changed files</summary> 📝 `docs/frida-instrumentation.md` (+16 -0) ➕ `experiments/analysis-efficiency/frida-status-costs.py` (+81 -0) ➕ `experiments/analysis-efficiency/frida-status-queries.mjs` (+267 -0) ➕ `experiments/analysis-efficiency/frida-status-views.json` (+468 -0) ➕ `experiments/analysis-efficiency/frida-status-views.md` (+163 -0) ➕ `experiments/analysis-efficiency/frida-status-wire.py` (+299 -0) ➕ `experiments/analysis-efficiency/frida_status_delivery.py` (+37 -0) ➕ `experiments/analysis-efficiency/test_frida_status_delivery.py` (+48 -0) 📝 `src/application/analysisView/AnalysisViewService.test.ts` (+2 -34) 📝 `src/application/frida/FridaInstrumentationService.test.ts` (+105 -0) 📝 `src/application/frida/FridaInstrumentationService.ts` (+47 -7) 📝 `src/contracts/analysisViewToolContracts.ts` (+1 -1) 📝 `src/contracts/fridaToolContracts.ts` (+14 -33) 📝 `src/domain/analysisView/analysisView.ts` (+16 -0) ➕ `src/domain/analysisView/fridaSessionStatusView.ts` (+86 -0) ➕ `src/domain/fridaSessionStatus.ts` (+27 -0) 📝 `src/server/createServer.ts` (+1 -0) 📝 `src/server/registerFridaTools.ts` (+9 -12) ➕ `tests/boundary/cli/fridaStatusViewCli.test.ts` (+71 -0) 📝 `tests/boundary/mcp/fridaLifecycleMcp.test.ts` (+11 -6) _...and 2 more files_ </details> ### 📄 Description ## Summary Repeated state checks replay all queued Frida messages. A real libc export capture contains 2,963 exports in 50 messages: each complete status reply is about 463 KB. Add optional `frida_session_status(detail="summary")` to return session identity/state, scripts, retained message count and truncation, with the complete parent retained. Omitted/complete detail preserves existing Evidence and payloads. Fixes #5640. ## Change and boundary impact - The application service reads the provider on every call and uses the shared retained-analysis projector. Historical CLI/file views use that same projector. Parent ID/digest, provider, exact source parameters, target/OS unknowns and capture truncation remain explicit. - Start, status and one-shot contracts share a canonical session envelope. Evidence owns opaque JSON payload validation; summaries count retained messages without decoding their meanings. - Move the existing mocked file-authentication cancellation test into the isolated `process-global` lane. The new shared-service import exposed its module preload assumption; cancellation precedence remains tested, including proof that the mocked read ran. - Scope is delivery and retained facts within existing tools. Production status reads preserve existing authority/lifecycle metadata. Native verification uses the existing caller-authorized local spawn/script APIs. Configuration, installation and package version are unchanged; generated catalogs remain ignored build outputs. ## Executed evidence - Final build and 225 exact tests across ten files passed with file parallelism disabled under one CPU. Service, lifecycle, capture truncation, malformed input, retained provenance, default identity and CLI file projection are covered. Three Python delivery-acceptance tests also passed. Five MCP tests passed again after correcting and testing filtered metadata discovery. - Source CI's eight IDA retryability assertions reproduce identically on untouched base `1629266e3` (8 failures, 25 passes in `IdaOperationFailures.test.ts`). This is an unrelated baseline failure; it is not reported as a passing check. [Reproduction record](https://github.com/morluto/rea/pull/5661#issuecomment-6299196637). - `npm run check:fast` — passed (full typecheck and lint; guarded retry after a host-memory stop). - Architecture guards, formatting, Knip and documentation checks — passed; final refresh recorded in the verification comment. - Real Frida binding 17.23.2: small/large public SDK workflows and actual Codex 0.163 app-server captures. Full retained inventory and source linkage are checked. The local deterministic SSE backend performs no AI inference or paid model calls. - Final completed-task request token estimate: 1,049,997 → 515,713 (50.9% fewer), including all 211 tool input schemas and history replays. This is `cl100k_base` compact-JSON estimation, not actual model usage. Default-budget complete JSON is truncated; that incomplete baseline is excluded from gains. [Measurements, native inputs, failed attempts, resource accounting and reproduction](https://github.com/morluto/rea/blob/1bfe3ab7ee1173fa2997ba927f6dd33675b8e941/experiments/analysis-efficiency/frida-status-views.md). Small observations cost more with the summary wrapper. No general latency/CPU improvement is established; full messages still consume retained memory and the derived record grows the bundle. Long-lived/saturated queues, remote Frida and real ADB devices are unqualified. Inspector has separate real-application/native-metadata qualification, with its limits recorded; its existing projection is unchanged. The additional bundled Frida verifier's payload cleanup was unverified and is excluded from qualified resource results. ## Author readiness Human owner: @gensokyo-dev The following owner declarations are transcribed at the human owner's explicit standing instruction in this session. - [x] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:44 +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#7019
No description provided.