[PR #1284] [MERGED] fix(process): localize capture truncation diagnostics #2765

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

📋 Pull Request Information

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

Base: main ← Head: fix/process-capture-truncation


📝 Commits (5)

  • a9b3a4a fix(process): localize capture truncation diagnostics
  • 422c6a3 Merge remote-tracking branch 'origin/main' into fix/process-capture-truncation
  • 2c3c686 test(process): allow recorded unrelated cleanup unknowns
  • 10c7514 Merge remote-tracking branch 'origin/main' into fix/process-capture-truncation
  • e35ab82 test(process): verify scoped truncation through composed tools

📊 Changes

14 files changed (+739 additions, -50 deletions)

View changed files

📝 docs/process-capture.md (+30 -1)
📝 src/domain/process/processCapture.ts (+7 -0)
➕ src/domain/process/processCaptureCoverage.ts (+101 -0)
📝 src/domain/process/processCaptureValidation.ts (+77 -0)
📝 src/domain/process/processComparison.ts (+52 -24)
📝 src/domain/process/processTraceEvaluation.ts (+2 -1)
📝 src/process/capture/FilesystemSnapshot.ts (+39 -2)
📝 src/process/capture/ProcessCaptureLifecycle.ts (+81 -5)
📝 src/process/capture/ProcessHarness.ts (+20 -6)
📝 src/process/capture/ProcessSampling.ts (+30 -3)
📝 src/process/capture/TerminalRenderer.ts (+16 -0)
📝 tests/acceptance/tools/localToolContracts.test.ts (+13 -7)
📝 tests/boundary/process/processCaptureNormalization.test.ts (+1 -1)
➕ tests/boundary/process/processTruncationAdapters.test.ts (+270 -0)

📄 Description

Sparse process output can fit entirely in the raw PTY budget while cumulative rendered screens exhaust their independent budget. Previously the capture exposed only truncated:true, and comparison marked every dimension truncated, including observed exit and interactions.

Return optional truncation_details with actual raw/rendered byte and frame accounting, filesystem enumeration reasons and per-file digest omissions, and sampled-process limits/failures. Derive the aggregate from these observations, validate the accounting against retained records, and compare unaffected dimensions normally. Trace assertions use their selected sources' coverage; older truncated captures without details retain conservative behavior. Keep existing budgets and whole-chunk/frame admission rules.

Closes #1250. Partially addresses #1251 by explaining omissions under the existing aggregate file_bytes budget; no independent hashing budget or digest tool is added, so #1251 remains open.

Validation:

  • 46 focused tests passed across ten files, including actual CLI and SDK MCP captures for sparse rendering, raw omissions, file-count/hash exhaustion, later smaller-file hashing, sampled-process limits, unaffected observed changes and filesystem unknown-absence regressions.
  • Actual stdio SDK verification passed for sparse, hash and combined cases; all 139 tools remain listed. Both affected tools' advertised input/output schemas validate and compile, results pass the SDK output validator, and ping/cleanup controls pass.
  • The two composed acceptance cases also passed after updating their former blanket-truncation expectation; these cover reconstruction verification, behavior aggregation and CLI comparison parity. The initial complete acceptance-file run hit its 120-second local guard; broad coverage remains in CI.
  • Build, static checks and npm run docs:check passed. Local static checks use the installed compiler's single-threaded execution mode under the resource guard, preserving strict checks.
  • Real Linux process capture was performed. No new Windows process-capture support or Hopper/Ghidra runtime claim is made.

Excerpt from the sparse stdio result (original PTY bytes versus cumulative rendered state/line bytes):

{
  "truncated": true,
  "truncation_details": {
    "raw_terminal": {
      "budget_bytes": 30000,
      "observed_bytes": 2004,
      "retained_bytes": 2004,
      "observed_frames": 65,
      "retained_frames": 65
    },
    "rendered_terminal": {
      "budget_bytes": 30000,
      "observed_bytes": 190786,
      "retained_bytes": 27774,
      "observed_frames": 65,
      "retained_frames": 13
    }
  }
}

The complete result also includes both filesystem checkpoints and process sampling coverage. These byte counts measure the producer's existing budget units, not JSON size or model context cost.


🔄 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/1284 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/process-capture-truncation` --- ### 📝 Commits (5) - [`a9b3a4a`](https://github.com/morluto/rea/commit/a9b3a4aaf5827d83e46e03c3a66513f1d773a29f) fix(process): localize capture truncation diagnostics - [`422c6a3`](https://github.com/morluto/rea/commit/422c6a314d9b4d03622c35f46194b7824ff6acc4) Merge remote-tracking branch 'origin/main' into fix/process-capture-truncation - [`2c3c686`](https://github.com/morluto/rea/commit/2c3c6862a509701f7cd8f32c87345686e7a84ab0) test(process): allow recorded unrelated cleanup unknowns - [`10c7514`](https://github.com/morluto/rea/commit/10c75148650f830cd882011d80f9499a376df899) Merge remote-tracking branch 'origin/main' into fix/process-capture-truncation - [`e35ab82`](https://github.com/morluto/rea/commit/e35ab829e35d2f7d9095dad9ba82660127d7793d) test(process): verify scoped truncation through composed tools ### 📊 Changes **14 files changed** (+739 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `docs/process-capture.md` (+30 -1) 📝 `src/domain/process/processCapture.ts` (+7 -0) ➕ `src/domain/process/processCaptureCoverage.ts` (+101 -0) 📝 `src/domain/process/processCaptureValidation.ts` (+77 -0) 📝 `src/domain/process/processComparison.ts` (+52 -24) 📝 `src/domain/process/processTraceEvaluation.ts` (+2 -1) 📝 `src/process/capture/FilesystemSnapshot.ts` (+39 -2) 📝 `src/process/capture/ProcessCaptureLifecycle.ts` (+81 -5) 📝 `src/process/capture/ProcessHarness.ts` (+20 -6) 📝 `src/process/capture/ProcessSampling.ts` (+30 -3) 📝 `src/process/capture/TerminalRenderer.ts` (+16 -0) 📝 `tests/acceptance/tools/localToolContracts.test.ts` (+13 -7) 📝 `tests/boundary/process/processCaptureNormalization.test.ts` (+1 -1) ➕ `tests/boundary/process/processTruncationAdapters.test.ts` (+270 -0) </details> ### 📄 Description Sparse process output can fit entirely in the raw PTY budget while cumulative rendered screens exhaust their independent budget. Previously the capture exposed only `truncated:true`, and comparison marked every dimension truncated, including observed exit and interactions. Return optional `truncation_details` with actual raw/rendered byte and frame accounting, filesystem enumeration reasons and per-file digest omissions, and sampled-process limits/failures. Derive the aggregate from these observations, validate the accounting against retained records, and compare unaffected dimensions normally. Trace assertions use their selected sources' coverage; older truncated captures without details retain conservative behavior. Keep existing budgets and whole-chunk/frame admission rules. Closes #1250. Partially addresses #1251 by explaining omissions under the existing aggregate `file_bytes` budget; no independent hashing budget or digest tool is added, so #1251 remains open. Validation: - 46 focused tests passed across ten files, including actual CLI and SDK MCP captures for sparse rendering, raw omissions, file-count/hash exhaustion, later smaller-file hashing, sampled-process limits, unaffected observed changes and filesystem unknown-absence regressions. - Actual stdio SDK verification passed for sparse, hash and combined cases; all 139 tools remain listed. Both affected tools' advertised input/output schemas validate and compile, results pass the SDK output validator, and ping/cleanup controls pass. - The two composed acceptance cases also passed after updating their former blanket-truncation expectation; these cover reconstruction verification, behavior aggregation and CLI comparison parity. The initial complete acceptance-file run hit its 120-second local guard; broad coverage remains in CI. - Build, static checks and `npm run docs:check` passed. Local static checks use the installed compiler's single-threaded execution mode under the resource guard, preserving strict checks. - Real Linux process capture was performed. No new Windows process-capture support or Hopper/Ghidra runtime claim is made. Excerpt from the sparse stdio result (original PTY bytes versus cumulative rendered state/line bytes): ```json { "truncated": true, "truncation_details": { "raw_terminal": { "budget_bytes": 30000, "observed_bytes": 2004, "retained_bytes": 2004, "observed_frames": 65, "retained_frames": 65 }, "rendered_terminal": { "budget_bytes": 30000, "observed_bytes": 190786, "retained_bytes": 27774, "observed_frames": 65, "retained_frames": 13 } } } ``` The complete result also includes both filesystem checkpoints and process sampling coverage. These byte counts measure the producer's existing budget units, not JSON size or model context cost. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:00 +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#2765
No description provided.