[PR #6761] [CLOSED] fix(execution): exclude discarded POST bodies from request metadata accounting #7408

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6761
Author: @mvanhorn
Created: 10/23/2026
Status: ❌ Closed

Base: main ← Head: fix/6474-web-request-metadata-budget


📝 Commits (2)

  • 97d2c15 fix(execution): exclude discarded POST bodies from request metadata accounting
  • c3efb61 test(execution): cover retained request metadata over budget

📊 Changes

2 files changed (+112 additions, -1 deletions)

View changed files

📝 src/browser/execution/CdpRuntimeRequests.ts (+2 -1)
📝 tests/boundary/browser/cdpWebRuntimeInitiator.test.ts (+110 -0)

📄 Description

Summary

During an armed web-execution observation, a same-origin POST of about 9 MiB makes the CLI exit 1 with unreadable_output and the message that request initiator evidence exceeds its complete 8 MiB event budget. The initiator that would have been kept was a few hundred serialized bytes, and the call returns no completed coverage. A 1 MiB POST in the same kind of window succeeds and returns request metadata with captured coverage.

The retained-metadata counter added the serialized size of the full protocol event parameters, and that serialization still contains the POST body. The request record that is stored omits the body and headers, so discarded body bytes were charged against the 8 MiB retained-evidence limit. Crossing that limit aborts the observation before a completed result is returned.

Retained-budget accounting now adds the byte length of the validated request metadata projection. A body that is dropped from that projection no longer spends the 8 MiB allowance, and a projection that itself exceeds the allowance still fails with the same budget error. The new boundary case emits a POST whose body is larger than the retained budget and expects the request id, method, and URL to be admitted with the body marker absent from the serialized result.

Fixes #6474

Problem and expected behavior

A large same-origin POST during an armed web-execution observation aborts the whole observation with unreadable_output, even though the retained request record never stores the body. Expected: only the bytes actually retained count against the 8 MiB budget, so the observation completes and the request metadata is returned.

Change and scope

src/browser/execution/CdpRuntimeRequests.ts now charges the retained-evidence budget with the size of the validated request metadata projection instead of the raw protocol event parameters. One boundary test added in tests/boundary/browser/cdpWebRuntimeInitiator.test.ts.

Contract and boundary impact

  • Semantic owner and earliest changed stage: CDP runtime request capture, at retained-budget accounting.
  • Contribution scope fit and linked maintainer decision: Fixes the bug reported in #6474.
  • CLI and MCP/tool-catalog contract: Unchanged; observations that previously failed on discarded body bytes now complete.
  • Provider, bridge, target-format, or platform compatibility: None.
  • Evidence, artifact, provenance, or reconstruction contract: Retained request records are unchanged; the 8 MiB limit still applies to what is retained, and an oversized projection still fails with the same budget error.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): Not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): None.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: npx --no-install vitest run tests/acceptance/webRuntimeCli.test.ts tests/boundary/browser/cdpWebRuntimeInitiator.test.ts finished with both files and all 34 tests passing. The boundary run admits a 9 MiB POST while preserving initiator metadata and dropping bodies.
  • Base reproduction or other evidence: The new boundary case fails on the base branch with the 8 MiB initiator event budget error and passes with this change.
  • User-visible CLI/MCP output (if applicable): A ~9 MiB POST observation now returns request id, method, and URL with completed coverage instead of exiting 1 with unreadable_output.
  • Remaining proof gaps: Not exercised against a live browser capture with a real multi-megabyte upload.

For evidence-bearing changes: Retained evidence content is unchanged; only the budget charge is corrected.

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

npx --no-install vitest run tests/acceptance/webRuntimeCli.test.ts tests/boundary/browser/cdpWebRuntimeInitiator.test.ts finished with both files and all 34 tests passing.
The boundary run admits a 9 MiB POST while preserving initiator metadata and dropping bodies.
The acceptance run admits a large POST after CLI arming without charging its discarded body.

Compatibility, safety, and release

  • Breaking changes or migration steps: None.
  • Real Hopper/Ghidra, browser, or OS coverage: Covered by the CDP boundary and CLI acceptance tests; not run against a live Chrome session.
  • Package or release metadata impact: None.
  • Security, privacy, process, or containment review: Request bodies remain excluded from retained evidence.

Author readiness

Human owner: @mvanhorn

  • 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.

AI was used for assistance.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Ra7LM2NyQ7DumdssxbUq5g


🔄 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/6761 **Author:** [@mvanhorn](https://github.com/mvanhorn) **Created:** 10/23/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/6474-web-request-metadata-budget` --- ### 📝 Commits (2) - [`97d2c15`](https://github.com/morluto/rea/commit/97d2c15316a3debc5a0af888bc407b84aa717d6b) fix(execution): exclude discarded POST bodies from request metadata accounting - [`c3efb61`](https://github.com/morluto/rea/commit/c3efb61f0939876d6f13526cc82d6a7d71820bda) test(execution): cover retained request metadata over budget ### 📊 Changes **2 files changed** (+112 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/execution/CdpRuntimeRequests.ts` (+2 -1) 📝 `tests/boundary/browser/cdpWebRuntimeInitiator.test.ts` (+110 -0) </details> ### 📄 Description ## Summary During an armed web-execution observation, a same-origin POST of about 9 MiB makes the CLI exit 1 with unreadable_output and the message that request initiator evidence exceeds its complete 8 MiB event budget. The initiator that would have been kept was a few hundred serialized bytes, and the call returns no completed coverage. A 1 MiB POST in the same kind of window succeeds and returns request metadata with captured coverage. The retained-metadata counter added the serialized size of the full protocol event parameters, and that serialization still contains the POST body. The request record that is stored omits the body and headers, so discarded body bytes were charged against the 8 MiB retained-evidence limit. Crossing that limit aborts the observation before a completed result is returned. Retained-budget accounting now adds the byte length of the validated request metadata projection. A body that is dropped from that projection no longer spends the 8 MiB allowance, and a projection that itself exceeds the allowance still fails with the same budget error. The new boundary case emits a POST whose body is larger than the retained budget and expects the request id, method, and URL to be admitted with the body marker absent from the serialized result. Fixes #6474 ## Problem and expected behavior A large same-origin POST during an armed web-execution observation aborts the whole observation with unreadable_output, even though the retained request record never stores the body. Expected: only the bytes actually retained count against the 8 MiB budget, so the observation completes and the request metadata is returned. ## Change and scope `src/browser/execution/CdpRuntimeRequests.ts` now charges the retained-evidence budget with the size of the validated request metadata projection instead of the raw protocol event parameters. One boundary test added in `tests/boundary/browser/cdpWebRuntimeInitiator.test.ts`. ## Contract and boundary impact - Semantic owner and earliest changed stage: CDP runtime request capture, at retained-budget accounting. - Contribution scope fit and linked maintainer decision: Fixes the bug reported in #6474. - CLI and MCP/tool-catalog contract: Unchanged; observations that previously failed on discarded body bytes now complete. - Provider, bridge, target-format, or platform compatibility: None. - Evidence, artifact, provenance, or reconstruction contract: Retained request records are unchanged; the 8 MiB limit still applies to what is retained, and an oversized projection still fails with the same budget error. - Target selection, authority, upstream behavior, and cleanup details (if applicable): Not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact (CI generates and validates ignored catalogs and `skills/`; edit authored instructions in `.agents/skills/reverse-engineer-anything/` and never commit build outputs): None. Expected effects (check known effects; use documentation-only on its own). Unchecked items do not establish absence; leave uncertainties visible. - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: npx --no-install vitest run tests/acceptance/webRuntimeCli.test.ts tests/boundary/browser/cdpWebRuntimeInitiator.test.ts finished with both files and all 34 tests passing. The boundary run admits a 9 MiB POST while preserving initiator metadata and dropping bodies. - Base reproduction or other evidence: The new boundary case fails on the base branch with the 8 MiB initiator event budget error and passes with this change. - User-visible CLI/MCP output (if applicable): A ~9 MiB POST observation now returns request id, method, and URL with completed coverage instead of exiting 1 with unreadable_output. - Remaining proof gaps: Not exercised against a live browser capture with a real multi-megabyte upload. For evidence-bearing changes: Retained evidence content is unchanged; only the budget charge is corrected. - [x] Observed, derived, and inferred claims remain distinguishable. - [ ] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed npx --no-install vitest run tests/acceptance/webRuntimeCli.test.ts tests/boundary/browser/cdpWebRuntimeInitiator.test.ts finished with both files and all 34 tests passing. The boundary run admits a 9 MiB POST while preserving initiator metadata and dropping bodies. The acceptance run admits a large POST after CLI arming without charging its discarded body. ## Compatibility, safety, and release - Breaking changes or migration steps: None. - Real Hopper/Ghidra, browser, or OS coverage: Covered by the CDP boundary and CLI acceptance tests; not run against a live Chrome session. - Package or release metadata impact: None. - Security, privacy, process, or containment review: Request bodies remain excluded from retained evidence. ## Author readiness Human owner: @mvanhorn - [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. - [ ] 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. - [ ] Owning docs, contracts, and generated metadata are updated where needed. - [ ] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. AI was used for assistance. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Ra7LM2NyQ7DumdssxbUq5g --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:47:38 +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#7408
No description provided.