Skip to content

perf(frida): add retained summaries for session status - #5661

Merged
gensokyo-dev merged 4 commits into
mainfrom
perf/5640-runtime-observation-audit-20261020
Oct 20, 2026
Merged

gensokyo-dev merged 4 commits into
mainfrom
perf/5640-runtime-observation-audit-20261020

Conversation

@gensokyo-dev

@gensokyo-dev gensokyo-dev commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T19:17:14.796358Z 1bfe3ab Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Final local verification for 70e08c75600255d211ca96df7966bf6639162da4:

  • Production src/ matches the paired runtime at 32a4690059907f09fb29e284ad492d94c1722278 byte for byte (excluding test files). Its package SHA-256 is 4ac402f1de93f76f71b7ccdb8b8e36d8c8d0a87b1184812f06393bfc6fadccba. The follow-up commit updates measurements/docs and authenticates a test's source through parseEvidence.
  • npm run build:cached passed. The exact runner with --no-file-parallelism passed 225 tests in ten files; the six affected MCP/isolated-cancellation cases passed again after strengthening source authentication. Three Python delivery-acceptance tests passed.
  • npm run check:fast passed full typecheck and lint. Architecture guards, full formatting, Knip and documentation checks passed on the final changes. Full checking peaked at 5.16 GiB under an 8 GiB ceiling. One host-memory guard stop was excluded and retried after memory recovered.
  • Four real SDK cases and four actual Codex0.163 captures completed their declared qualification. Both completed large client paths make eight requests; compact request JSON totals 1,049,997 → 515,713 cl100k_base estimated tokens (50.9% fewer), including all 211 tool input schemas and replayed history. Default-budget complete delivery is incomplete and excluded from gains; summary delivery completes. No AI inference or paid model was used.
  • Large status replies are 462,831 → 5,597 bytes. Complete bundles grow 214,214 → 216,931 bytes. The final client pair takes 15.418 → 15.439 seconds, 8.027 → 8.372 CPU seconds, and 824.3 → 813.6 MiB peak cgroup memory. There is no general speedup claim; small summary replies are larger.

Qualified native cases verify the controlled spawn's birthtime/cgroup, script digest, contiguous 2,963-export capture, parent/view metadata, and natural target exit. Payload-exit counters confirm zero limit/OOM events and drained descendants; final whole-scope counters remain unknown after teardown. Full data remains available through the exact parent ID and complete export. Long-lived/saturated queues and remote-device performance remain unmeasured.

The integrated test gate exposed a pre-existing module-mock preload assumption after the shared-service import. That one cancellation test now owns an isolated process and proves the mocked read ran. An existing lifecycle metadata case timed out when projects competed on one CPU; the serial gate passed with unchanged timeouts. Failed attempts remain separate from completed results.

Inspector has a separate real-REA application qualification (776 scripts matched by concurrent native hash/length metadata) and the bundled CLI/MCP verifier passed. ADB is unavailable on this host. The additional bundled Frida verifier's functional success had an unverified payload cleanup receipt and is excluded from qualified resource results. These limits and exact pins are in the audit record.

@greptile-apps

greptile-apps Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous documentation issue is fixed and no new blocking issue was found.

Summary

Adds optional Frida status summaries while retaining complete observations. Default replies keep their existing payloads.

  • Frida status calls can return a summary while keeping the full capture available.
  • The Evidence-file cancellation test now runs in an isolated test lane.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A["frida_session_status"] --> B["Read live session"]
  B --> C["Complete Evidence"]
  C --> D["Retain parent"]
  D --> E["Return summary and parent ID"]
  D --> F["get_evidence_bundle: metadata discovery"]
  D --> G["export_evidence_bundle: complete messages"]
Loading

Reviews (2) · Last reviewed commit: "docs(frida): clarify retained message re..." · Reviewed by Greptile

Comment thread docs/frida-instrumentation.md Resolved
@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

@codex review

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

The Source-tests failure is reproduced on untouched PR base 1629266e3c08c90fed6bba5383528af7986a12b7 in a separate detached worktree with the same locked dependencies and Node24.18.0:

npm run test:local -- src/ida/IdaOperationFailures.test.ts → the same 8 failures, 25 passes. Each failure expects retryable: true for an IDA procedure lookup input error but receives false. The PR changes neither the IDA implementation/tests nor the common error owner involved. The guarded reproduction exits1 as expected, cleans up, and records no limit/OOM event.

The original Source CI log reports those same eight IDA assertions (12,386 other tests passed). This is baseline evidence, not a passing check. Per the authorized scope, I am leaving that unrelated failure unchanged.

The valid review correction is in 1bfe3ab7e: filtered bundle queries are metadata discovery; complete payloads use canonical export and parent-record extraction. Five MCP tests passed again, including the documented filtered-summary request. Production source remains identical to the paired 32a469005 runtime; the performance record remains applicable.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 1bfe3ab7ee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@gensokyo-dev

Copy link
Copy Markdown
Collaborator Author

Final head 1bfe3ab7ee1173fa2997ba927f6dd33675b8e941: Codex reports no findings; Greptile is 5/5; all review threads are resolved. The post-review MCP tests and scoped strict TypeScript check passed, including the documented metadata-discovery request. Production source is unchanged from the paired native runtime.

The previous head passed full CI Static checks. Source CI's eight IDA retryability failures reproduce on the untouched base, as recorded above. Latest repeat CI remains queued/cancelled in part; it is not being described as fully green. With the human owner's explicit authorization to bypass verified baseline/queue blockers, proceeding with the checked-head squash merge.

@gensokyo-dev
gensokyo-dev merged commit 4bfdadb into main Oct 20, 2026
21 of 23 checks passed
@gensokyo-dev
gensokyo-dev deleted the perf/5640-runtime-observation-audit-20261020 branch October 20, 2026 19:21
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
3 tasks done
kangyishuai pushed a commit to kangyishuai/rea that referenced this pull request Oct 20, 2026
…ansition-view

Resolve the inspect_analysis_view description conflict with main's Frida
session-status summaries (morluto#5661). The description keeps main's text and
adds this branch's capture_browser_scenario additions.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@morluto morluto added performance Performance regressions, scaling limits, and bounded-resource work provider: frida Analysis provider / engine: frida labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Performance regressions, scaling limits, and bounded-resource work provider: frida Analysis provider / engine: frida

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Measure and optimize repeated runtime observation queries

2 participants