Skip to content

feat(environment): serve writes by what their recordings show - #6897

Merged
gensokyo-dev merged 107 commits into
morluto:mainfrom
earakely-scale:feat/environment-write-rules
Oct 24, 2026
Merged

gensokyo-dev merged 107 commits into
morluto:mainfrom
earakely-scale:feat/environment-write-rules

Conversation

@earakely-scale

@earakely-scale earakely-scale commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Environment writes were refused for common generated values, bulk targets and view ordering, while other writes could be confirmed without checking their own fields. This change derives those effects from retained capture Evidence and withholds unsupported or contradictory effects. Part of #4933; #6385 is merged.

  • Preserve field-level attribution and compact equality facts for earlier structured values.
  • Share atomic bulk writes, item actions, clocks/tokens, enveloped bodies and recorded-query enforcement through the existing application layer.
  • Classify complete multi-row responses and verify every recorded call using the serving renderer. Keep literal JSON IDs and nested parsed-body memory ownership intact.
  • Preserve initial/learned ordering and counter formats. Mask envelope members only with independent repeat evidence on every concrete path.
  • Advertise fixed values and optional recorded-query defaults in compatible schemas, with shared runtime enforcement.

Verifier source imports also release their transformer service; the Windows graph loads only when needed so copied Linux supervisors remain independent.

This reads retained captures and mutates only the served local environment state. Existing states remain readable; optional metadata and derived Evidence identities can change. The original author's subsequent bulk tests and measurements are retained.

Verification

Qualified at 7360127f2: 1,284 source tests in 52 files, serial typecheck/lint/module boundaries/format/knip/metadata, architecture/docs/build, and four compiled real HTTP MCP write cases passed. Eight process/cold-loader cases passed at 7f01865c2 (five platform skips); unchanged schema/process boundaries passed 22 cases at 034eed476. Authenticated regressions failed at their pinned pre-fix revisions, including two newly reproduced single/bulk precision regressions at 7f01865c2. Live Gemini execution was not performed.

Latest review fixes preserve confirmed body absence separately from unretained/malformed bodies; use observed entity fields to distinguish arrays from envelopes; reject unmodelled nested token links; and recognize string-valued bulk counts. One shared generated-value owner now checks complete nested-clock objects for creates and single/bulk updates, including constants, omissions, equal clock members and formats. Obsolete request/envelope interpretations and the partial nested-clock validator were removed.

At 7360127f2, four immutable public application recordings were rebuilt and served through real CLI listeners and the MCP SDK (412 calls). Initial reads match 109/114, session reads 302/358, preserving every previous result record by record. Sessions apply six NocoDB mutations, one Ghost deletion and one Metabase update. Write-response proof now precedes stored-read restamping, preserving Metabase's millisecond response/microsecond read semantics. Bulk rendering consumes validated response fields directly, with separately budgeted storage facts; unequal response clocks remain refused even when the later read normalizes them. Mailpit's unparsed text/plain acknowledgement is withheld as body-unusable; its previous session already refused the missing target, so no applied mutation was lost. Read mismatches and unserved creates remain coverage gaps. Original apps and the historical 50-capture census were not re-recorded/requalified by this follow-up.

A separate SQLite-backed HTTP application was recorded by actual Chromium (11 API exchanges), inspected/projected by public CLI commands, then reset and compared against the real HTTP MCP SDK. Seven successful JSON responses matched the native app and one missing-target request was refused atomically by both, including subset/full updates, atomic refusal and ordered deletion. This controlled fixture does not establish live third-party multi-row behavior. At the current head its complete fresh-process run took 12.619 s wall / 11.600 s CPU / 555.8 MiB peak, with verified payload cleanup; artifacts and source hashes were retained locally.

Final CI passed 17,919 source tests (13 skips), static/docs/build, agentenv, three native package baselines and shard 8. Its only test failures are three WASM prefix assertions and ten Windows typed-error assertions independently reproduced on main be2811e414; six portable shards were canceled by fail-fast. Baseline comparison and authorized bypass. Greptile reviewed 91 files with no new findings; all threads are resolved.

Cost and limits

Measurements at 352c0278d, versus main 3ce311757: three alternating fresh four-capture sweeps had median wall/CPU/peak 5.360 s / 4.263 s / 327.3 MiB → 4.960 s / 4.357 s / 323.1 MiB; ranges overlap. Complete SDK replay (403 → 413 calls), one observation per revision, took 20.905 s / 19.039 s / 508.7 MiB → 23.426 s / 19.396 s / 462.8 MiB. Different coverage and sampling prevent a general performance-improvement claim.

The current head separately qualified at 4.861 s / 4.601 s / 326.7 MiB for extraction and 19.984 s / 19.593 s / 514.1 MiB for 412 SDK calls. These observations are not pooled with the earlier cohort. Current catalog estimates (cl100k_base) are NocoDB 9,408, Ghost 11,355, Metabase 12,648 and Mailpit 2,955 tokens. Instructions, named arguments and text replies were also counted; the historical counting method was independently matched. Actual model usage, prompts and client/protocol rendering were not measured. No token saving is claimed.

Tasks used one CPU, 3 GiB early-stop / 4 GiB hard memory limits and zero swap. Recorded-data tasks verified payload cleanup with no observed OOM/limit events. Final whole-scope counters were unavailable. Builds, downloads and identity preparation are excluded from measurements. Detailed evidence and historical author measurements.

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.

earakely-scale and others added 30 commits October 22, 2026 12:22
A POST that repeats the latest read of its path, tunnels only read
operations, names a lookup in its path's last meaningful word, or renews
a session no longer counts as a state write: it is replayed, does not cut
initial windows, and does not end observation searches. A tool stays a
write when a related read line changes across one of its calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…first shows it

A successful item read of an entity the gate's copy never held, after a
write no built plan models, puts the entity into the copy instead of
failing the read, so later writes to it are checked as usual. An entity a
modelled write touched is never taken back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… under

A POST whose path names no state type becomes a create into the type
whose item read first names an id its response returned, when the id is
new to the state; serving creates in that read's collection. A successful
POST that returned an id a type's reads only show after it also ends that
type's initial window, so entities a capture created stay out of the
initial state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…isagree across

When a type's reads disagree across a write under another root, the
type's initial window now ends at the earliest write within that change
and the state is extracted again, instead of leaving every view of the
type replayed. The cut composes with the creation cut; the earlier wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…form

A read line that shows the same entities in another form, by an extra
query parameter that adds or drops members, or conflicts with a base
line on a shared entity, is a variant: it leaves the view's checks and
the entity observations, the view names it with the query keys that pick
it out, and a call matching those keys replays its recording. A filter
role whose name matches no field needs two agreeing values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…incomplete

Body-level container operations are skipped like query ones, a lookup is named only
by the path's last literal segment and never alongside a write word, a tool with a
redirected or unanswered call is not reclassified, and the mutation veto is resolved
over all candidates at once so another read-only call cannot explain a read change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it exactly

Serving tests a field selection before any variant key: a projection value a replayed
read gave, or one no checked line gave other than `*`, replays. A list sets aside a
line asking for some fields only before the identity proof, and a dropped variant's
membership change no longer rewrites the type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e recording shows

An adopted entity is charged against the view's budget like a created one. A linked
create holds only for its exemplar's path arguments: serving refuses others and the
gate counts such a call as unmodelled. A response's identity-named id links at any
length, but a short one only to a type read before the call.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…gain

A rewrite cut clears the first pass, so the budget rewinds to a checkpoint taken after
the write cutoffs and created ids before the state is extracted again. Rewrite spans are
charged and appended without spreading them into an argument list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… read only whole batches

A linked create is rejected when an earlier list of its type or read of its collection
showed the returned id. Body ids are walked without spreading children into an argument
list. An RPC call reads only when every operations entry names an operation of its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Serving's replay decision moves to the domain as replayReason, and the write gate uses it:
a read serving replays can neither approve nor veto a write, and a read of every field
beside a replayed selection is checked. A selection read missing a required field is
still skipped, since part of an entity can neither confirm nor check it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-targets

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ence that rules out other causes

- A read-only POST repeats only a read that finished before it began; the veto compares
  the latest read finished before a call with the first begun after it, and counts a
  recorded absence on one side as a change. `modify` and `replace` are write words.
- A redirected or unanswered write lets a later item read adopt the entity it may have made.
- A creation cut counts a read still running when the POST began as after it, and a list
  read shows its listed entities' own ids, not those they nest.
- A linked create's item read must come before any other tool's write.
- Line shapes are charged to the budget as they are built.
- A `fields=*` list line is whole, not a field selection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…state by the lines left

- A linked create is observed only in a read of an id its response returned,
  envelopes included, and serving takes its recorded path values in either spelling.
- A list read shows a suffix-named identity (`projectId`) distinct across its entities.
- A read-only POST compares the read that finished last before it began.
- An entity's first sighting comes from the lines left after variant lines are dropped.
- The pairwise variant pass stops at a work limit, leaving every line checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the import list for the renamed state retention measure, and use it in the adoption charge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep the replayed-call reasons and pass the observed query through every recording they replay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…out of write evidence

- A list read counts a suffix-named field as its entities' ids only when no
  id-named field identifies them, so an `ownerId` beside `id` cuts no window.
- A read-only POST is compared with the read that finished last among those no
  other write follows, so a consuming call stays a write.
- A linked create's source path values compare as spelled on both sides, so no
  spelling is decoded twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lds once and bound read and variant scans

- A linked create's source values compare segment by segment, so a template
  naming two parameters alike cannot accept a changed first one.
- Serving fills a linked create's path fields with its arguments decoded once,
  as the gate learned them.
- The read-only check reads each related line's records once per call, between
  the nearest other writes.
- Member signatures are JSON arrays, so a name holding the separator still
  conflicts; the variant work limit counts line pairs as well as entities.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gensokyo-dev

gensokyo-dev commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

The earlier 585d71cd6 CI source failure is independently reproduced on its exact main base dd02d8ff: agentEvaluationReport.test.ts fails with Runner failure gate missing on both this PR and main. The test and runner blobs are identical between main and the CI merge 217f9e916; this PR changes neither. The PR source job otherwise passed 17,866 tests. This supersedes the earlier JavaScript-worker baseline failure, which is not the latest source failure.

The current 034eed476 qualification passed 1,273 source cases in a single selected run, static/docs/build/architecture checks, 22 SDK/schema/process cases, four immutable external application recordings, and a controlled native SQLite/Chromium/CLI/HTTP-MCP comparison (8/8 fresh calls). The current head integrates main9895's runner-test correction and the maintainer's verifier-transform cleanup. Earlier JavaScript constructor-binding failures remain documented as main-owned; current CI is assessed afresh. Codex review remains unavailable due to the repository review usage limit; it is not reported as passed.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

CI classification for the earlier ea64ca4 run: the Windows packed-bridge lane has the same10 failures on the exact main base be2811e: PR job, main job. The test, packed-bridge verifier and command owner blobs match the CI merge. This is independently demonstrated baseline failure, not an assumed platform exception.

The shard8 supervisor failure was separately reproduced locally and was PR-owned: the copied Linux fixture imported a new static Windows-loader dependency that was absent from its isolated graph. Fixed in7f01865c2 by loading the Windows source loader only when requested. The original failing ownership test now passes, alongside cold-transform cleanup:8 passed,5 platform skips; static checks also passed. It is not being bypassed as unrelated.

Feature qualification at130121f74 passed1,280 source cases, full static/docs/build/architecture and final HTTP MCP writes. Four public recordings retain every previously matching read; the now-withheld Metabase precision mismatch reduces actual applied mutations to7. Latest-head CI is assessed separately; cancelled/skipped lanes are not reported as passed.

@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Final qualification at 7360127:

  • CI run https://github.com/morluto/rea/actions/runs/40094601799 passed all 17,919 source tests (13 skips), static checks, docs, build, the real agentenv export/run, Windows controls, all three native package baselines, and test shard 8. Greptile reviewed 91 files with no new comments; all review threads are resolved.
  • Shard 1 failed exactly the same three packagedWasmVerifierOwnership.test.ts assertions already present on main be2811e: expected rea-package-command-, actual rea-verifier-command-. Compare current job 120874366593 with main run 40089642035/job 120860205299.
  • Windows failed exactly the same ten packedBridgeVerification.test.ts cases as that main run/job 120862180035, including obsolete stderr assertions against typed verifier errors. Current job: 120875915872. Failure names were compared programmatically; the relevant tests and command owners have no diff from that main revision.
  • Six remaining portable shards were canceled by fail-fast, so they are not claimed as passed. The required/portable aggregators inherit these failures. The PR-owned copied-Linux-supervisor import defect was fixed in 7f01865 and its real ownership fixture passes; it is not being bypassed.

Local qualification passed 1,284 relevant source tests, full static/architecture/docs/build, four compiled HTTP MCP write cases, 412 SDK calls over four immutable public-app recordings, and Chromium/SQLite native-to-MCP response/atomicity checks. Scope and performance limitations are current in the PR body. Proceeding with the explicitly authorized admin bypass for the independently established main failures.

@gensokyo-dev
gensokyo-dev merged commit d361c53 into morluto:main Oct 24, 2026
36 of 46 checks passed
@morluto morluto mentioned this pull request Oct 25, 2026
3 tasks done
@morluto morluto added the enhancement New feature or request label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants