[PR #6929] [MERGED] fix(environment): bound create learning and invalidate stale write proofs #7454

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/6929
Author: @earakely-scale
Created: 10/24/2026
Status: ✅ Merged
Merged: 10/24/2026
Merged by: @gensokyo-dev

Base: main ← Head: feat/environment-build


📝 Commits (10+)

  • da42a23 feat(environment): report what an environment serves with an environment-coverage view
  • cc290d9 feat(environment): build an environment bundle in one command
  • 045f14a test(environment): cover environment-build and the coverage view
  • cf7eb70 test(environment): build the real-agentenv lane's bundle with environment-build
  • 1e2c12e docs(environment): document environment-build and the coverage view
  • 093af31 fix(environment): harden environment-build after review
  • a040f01 docs(environment): state the build's conditions and record its verification
  • bc35ef3 fix(environment): dispatch a pending interrupt before each build stage check
  • 62368bd Merge remote-tracking branch 'origin/main' into eb
  • 212c998 fix(environment): scan scenario credentials, own the dry-run tarball and serialize Evidence once

📊 Changes

21 files changed (+683 additions, -141 deletions)

View changed files

📝 docs/agent-environments.md (+4 -2)
📝 docs/specs/agent-environments/environment-build/spec.md (+3 -3)
📝 docs/specs/agent-environments/environment-build/verification.md (+11 -0)
📝 docs/specs/agent-environments/write-rules/spec.md (+6 -1)
📝 docs/specs/agent-environments/write-rules/verification.md (+11 -0)
📝 src/application/environment/environmentBuildReport.test.ts (+84 -0)
📝 src/application/environment/environmentStateWriteReview.test.ts (+270 -0)
📝 src/domain/analysisView/EnvironmentStateAccumulator.ts (+14 -10)
📝 src/domain/analysisView/EnvironmentStateExtraction.ts (+9 -3)
📝 src/domain/analysisView/EnvironmentStateWriteSimulation.ts (+89 -25)
📝 src/domain/analysisView/environmentCoverageView.ts (+2 -1)
📝 src/domain/analysisView/environmentStateRules.ts (+5 -2)
📝 src/domain/analysisView/environmentStateWriteBulk.ts (+2 -2)
📝 src/domain/analysisView/environmentStateWriteCreate.ts (+12 -28)
📝 src/domain/analysisView/environmentStateWriteEffects.ts (+4 -0)
📝 src/domain/analysisView/environmentStateWriteExplain.ts (+6 -7)
📝 src/domain/analysisView/environmentStateWriteSorted.ts (+73 -15)
📝 src/domain/analysisView/environmentStateWriteStamps.test.ts (+1 -12)
📝 src/domain/analysisView/environmentStateWriteStamps.ts (+4 -25)
📝 src/domain/analysisView/environmentStateWrites.test.ts (+49 -2)

...and 1 more files

📄 Description

Summary

Create learning buffered future requests to relax guards, although request variation cannot rebuild copied dependent references or state. Withdrawn array-sorting rules also left stale write confirmations or snapshot overrides.

  • Lease the current parsed request, remove variation lookahead, and keep unsupported dependent values pinned.
  • Retire inconsistent read views with their confirmations and snapshot overrides. Continue checking later observations for value contradictions without restoring serving proof; distinguish changed values from array order.
  • Preserve the shared CLI/MCP report and complete retained-event scan already integrated through #6946, with duplicate-content regression coverage.

Verification

Final head: a6c145a21468224a915f73c27af028fbc454a1e5, preserving all author updates. Local: 1,353 source cases; 46 CLI/MCP/process cases with five platform skips; static/typecheck/module boundaries, architecture, docs and packaged build passed. The unchanged SDK/schema contracts passed 16 cases at fc8176694 after regenerating stale test metadata.

Greptile passed; no unresolved review threads. CI passed 18,159 source cases (13 skipped), static/docs/package/Windows-controls builds, Linux native-package baseline and the actual agentenv runner.

Unrelated CI failure: PR shard 2 has the same two Windows-path error-category assertions as main 798450638 shard 2. Normalized failure sections are byte-identical; test blob and PR ownership scope are unchanged. Seven other shards were cancelled by fail-fast and remain unverified in this run. The user explicitly authorized bypassing confirmed unrelated main failures.

Current-head real workflows:

  • Four pinned public recordings (NocoDB, Ghost, Metabase, Mailpit): generated-bundle HTTP MCP completed 412 SDK calls with shared-engine-equivalent outcomes. Recorded read bodies match in 302/358 comparisons, preserving known recording/model limits. Original third-party apps were not rerun.
  • Real Chromium → owned SQLite HTTP app → one-command bundle → HTTP MCP: seven successful native response bodies and an atomic missing-target refusal matched an independently reset database.
  • Actual browser-scenario CLI → build CLI with an untyped URL-encoded request: three credential-name pointers, byte-identical Evidence copy, verified owned-browser cleanup.
  • Three write regressions fail at frozen 0895c89bc; the later-retired-observation regression fails at fc8176694 and passes at this head.

Post-merge 41cf869949b82bd0f24d425f6557432ae3a63545: rebuilt the actual merged runtime and bundles. All four recordings retained identical write plans and per-record read/write outcomes; generated-bundle HTTP MCP and independent Chromium/SQLite qualification passed again.

Measured workflow costs

Three alternating rounds per input, 15 matched pairs; complete bundles were byte-identical. Evidence workflows take two CLI calls → one; HAR takes three → one. One-CPU medians:

Input Elapsed seconds CPU seconds Peak process-family MiB
NocoDB 6.26 → 3.45 6.06 → 3.28 416.1 → 418.7
Ghost 5.97 → 3.65 5.80 → 3.41 420.8 → 424.4
Metabase 6.37 → 4.15 6.21 → 3.90 430.0 → 429.7
Mailpit 5.56 → 3.24 5.37 → 3.01 413.8 → 416.3
NativeSQLite 8.18 → 3.75 7.91 → 3.43 399.1 → 402.9

Fresh CLI processes; OS caches uncontrolled; persistent-process warm runs unmeasured. Includes orchestration/hashing, excludes install/download/package preparation. These compare equivalent workflows on the same implementation. Payload-exit counters and cleanup verified; final whole-scope counters unavailable. Maximum build-workflow peak: 433.7 MiB; no general memory-saving claim.

cl100k_base estimates: coverage replies 1,892–2,031 tokens versus full state 8,907–64,282, preserving parent/artifact/coverage/unknowns and retained Evidence. Already-redirected workflows' arguments + final stdout increase from 521–591 to 630–986 tokens because build reports include coverage/warnings. No blanket token-saving claim: actual model usage, schemas, prompts, orchestration and retries are outside that estimate. The affected SDK entry separately measures 114,557 tokens (20,088 for name/description/input).

Author readiness

Human owner: @earakely-scale

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

🔄 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/6929 **Author:** [@earakely-scale](https://github.com/earakely-scale) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/24/2026 **Merged by:** [@gensokyo-dev](https://github.com/gensokyo-dev) **Base:** `main` ← **Head:** `feat/environment-build` --- ### 📝 Commits (10+) - [`da42a23`](https://github.com/morluto/rea/commit/da42a23ceec4b82d836eb298b2bff930bc6c0b5f) feat(environment): report what an environment serves with an environment-coverage view - [`cc290d9`](https://github.com/morluto/rea/commit/cc290d9f7770126dfb7eca74e081309417db5515) feat(environment): build an environment bundle in one command - [`045f14a`](https://github.com/morluto/rea/commit/045f14a3ae907df9878ea060413377b4cd4111de) test(environment): cover environment-build and the coverage view - [`cf7eb70`](https://github.com/morluto/rea/commit/cf7eb709e19f61bc5e1b23a2b905f2c31b2c3305) test(environment): build the real-agentenv lane's bundle with environment-build - [`1e2c12e`](https://github.com/morluto/rea/commit/1e2c12e5c3bda69a952e33f3c4eeddc90d1deb11) docs(environment): document environment-build and the coverage view - [`093af31`](https://github.com/morluto/rea/commit/093af3144853d28fec554b1c0d507c8bca00574b) fix(environment): harden environment-build after review - [`a040f01`](https://github.com/morluto/rea/commit/a040f01e34351cc7de25e2757e580273e27fe674) docs(environment): state the build's conditions and record its verification - [`bc35ef3`](https://github.com/morluto/rea/commit/bc35ef3cc095213ce8adeaf4cabcab3c945aee66) fix(environment): dispatch a pending interrupt before each build stage check - [`62368bd`](https://github.com/morluto/rea/commit/62368bdae95311dccb1d3b538103d17089965c4b) Merge remote-tracking branch 'origin/main' into eb - [`212c998`](https://github.com/morluto/rea/commit/212c998cc067fcea452f89aa6eb5d26aec27abf6) fix(environment): scan scenario credentials, own the dry-run tarball and serialize Evidence once ### 📊 Changes **21 files changed** (+683 additions, -141 deletions) <details> <summary>View changed files</summary> 📝 `docs/agent-environments.md` (+4 -2) 📝 `docs/specs/agent-environments/environment-build/spec.md` (+3 -3) 📝 `docs/specs/agent-environments/environment-build/verification.md` (+11 -0) 📝 `docs/specs/agent-environments/write-rules/spec.md` (+6 -1) 📝 `docs/specs/agent-environments/write-rules/verification.md` (+11 -0) 📝 `src/application/environment/environmentBuildReport.test.ts` (+84 -0) 📝 `src/application/environment/environmentStateWriteReview.test.ts` (+270 -0) 📝 `src/domain/analysisView/EnvironmentStateAccumulator.ts` (+14 -10) 📝 `src/domain/analysisView/EnvironmentStateExtraction.ts` (+9 -3) 📝 `src/domain/analysisView/EnvironmentStateWriteSimulation.ts` (+89 -25) 📝 `src/domain/analysisView/environmentCoverageView.ts` (+2 -1) 📝 `src/domain/analysisView/environmentStateRules.ts` (+5 -2) 📝 `src/domain/analysisView/environmentStateWriteBulk.ts` (+2 -2) 📝 `src/domain/analysisView/environmentStateWriteCreate.ts` (+12 -28) 📝 `src/domain/analysisView/environmentStateWriteEffects.ts` (+4 -0) 📝 `src/domain/analysisView/environmentStateWriteExplain.ts` (+6 -7) 📝 `src/domain/analysisView/environmentStateWriteSorted.ts` (+73 -15) 📝 `src/domain/analysisView/environmentStateWriteStamps.test.ts` (+1 -12) 📝 `src/domain/analysisView/environmentStateWriteStamps.ts` (+4 -25) 📝 `src/domain/analysisView/environmentStateWrites.test.ts` (+49 -2) _...and 1 more files_ </details> ### 📄 Description ## Summary Create learning buffered future requests to relax guards, although request variation cannot rebuild copied dependent references or state. Withdrawn array-sorting rules also left stale write confirmations or snapshot overrides. - Lease the current parsed request, remove variation lookahead, and keep unsupported dependent values pinned. - Retire inconsistent read views with their confirmations and snapshot overrides. Continue checking later observations for value contradictions without restoring serving proof; distinguish changed values from array order. - Preserve the shared CLI/MCP report and complete retained-event scan already integrated through #6946, with duplicate-content regression coverage. ## Verification Final head: `a6c145a21468224a915f73c27af028fbc454a1e5`, preserving all author updates. Local: 1,353 source cases; 46 CLI/MCP/process cases with five platform skips; static/typecheck/module boundaries, architecture, docs and packaged build passed. The unchanged SDK/schema contracts passed 16 cases at `fc8176694` after regenerating stale test metadata. Greptile passed; no unresolved review threads. [CI](https://github.com/morluto/rea/actions/runs/40108214026) passed 18,159 source cases (13 skipped), static/docs/package/Windows-controls builds, Linux native-package baseline and the actual agentenv runner. **Unrelated CI failure:** [PR shard 2](https://github.com/morluto/rea/actions/runs/40108214026/job/120914596815) has the same two Windows-path error-category assertions as [main `798450638` shard 2](https://github.com/morluto/rea/actions/runs/40106164357/job/120911483741). Normalized failure sections are byte-identical; test blob and PR ownership scope are unchanged. Seven other shards were cancelled by fail-fast and remain unverified in this run. The user explicitly authorized bypassing confirmed unrelated main failures. Current-head real workflows: - Four pinned public recordings (NocoDB, Ghost, Metabase, Mailpit): generated-bundle HTTP MCP completed 412 SDK calls with shared-engine-equivalent outcomes. Recorded read bodies match in 302/358 comparisons, preserving known recording/model limits. Original third-party apps were not rerun. - Real Chromium → owned SQLite HTTP app → one-command bundle → HTTP MCP: seven successful native response bodies and an atomic missing-target refusal matched an independently reset database. - Actual browser-scenario CLI → build CLI with an untyped URL-encoded request: three credential-name pointers, byte-identical Evidence copy, verified owned-browser cleanup. - Three write regressions fail at frozen `0895c89bc`; the later-retired-observation regression fails at `fc8176694` and passes at this head. Post-merge `41cf869949b82bd0f24d425f6557432ae3a63545`: rebuilt the actual merged runtime and bundles. All four recordings retained identical write plans and per-record read/write outcomes; generated-bundle HTTP MCP and independent Chromium/SQLite qualification passed again. ## Measured workflow costs Three alternating rounds per input, 15 matched pairs; complete bundles were byte-identical. Evidence workflows take two CLI calls → one; HAR takes three → one. One-CPU medians: | Input | Elapsed seconds | CPU seconds | Peak process-family MiB | | --- | ---: | ---: | ---: | | NocoDB | 6.26 → 3.45 | 6.06 → 3.28 | 416.1 → 418.7 | | Ghost | 5.97 → 3.65 | 5.80 → 3.41 | 420.8 → 424.4 | | Metabase | 6.37 → 4.15 | 6.21 → 3.90 | 430.0 → 429.7 | | Mailpit | 5.56 → 3.24 | 5.37 → 3.01 | 413.8 → 416.3 | | NativeSQLite | 8.18 → 3.75 | 7.91 → 3.43 | 399.1 → 402.9 | Fresh CLI processes; OS caches uncontrolled; persistent-process warm runs unmeasured. Includes orchestration/hashing, excludes install/download/package preparation. These compare equivalent workflows on the same implementation. Payload-exit counters and cleanup verified; final whole-scope counters unavailable. Maximum build-workflow peak: 433.7 MiB; no general memory-saving claim. `cl100k_base` estimates: coverage replies 1,892–2,031 tokens versus full state 8,907–64,282, preserving parent/artifact/coverage/unknowns and retained Evidence. Already-redirected workflows' arguments + final stdout increase from 521–591 to 630–986 tokens because build reports include coverage/warnings. No blanket token-saving claim: actual model usage, schemas, prompts, orchestration and retries are outside that estimate. The affected SDK entry separately measures 114,557 tokens (20,088 for name/description/input). ## Author readiness Human owner: @earakely-scale - [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. --- <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:58 +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#7454
No description provided.