Skip to content

feat(environment): serve writes behind bodiless replies, omitted fields, projected reads and digit-group sequences - #6169

Merged
gensokyo-dev merged 53 commits into
morluto:mainfrom
earakely-scale:feat/environment-write-coverage
Oct 22, 2026
Merged

gensokyo-dev merged 53 commits into
morluto:mainfrom
earakely-scale:feat/environment-write-coverage

Conversation

@earakely-scale

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

Copy link
Copy Markdown
Contributor

Summary

Refs #4933. Analyze existing capture Evidence and serve local state for four previously unsupported recording shapes: bodiless write replies, proven omitted fields, identity-free projected reads, and digit-group sequences. No target execution or remote application writes.

Integrated onto current main (9512a80). Follow-up fixes keep late projections as replay Evidence rather than initial entities, share current omitted-field facts with checks and forward observations, and classify unsuccessful responses before the projection shortcut. Existing optional contract members retain source ordinals and replay provenance; no extra cache or second CLI/MCP implementation.

Executed validation

  • 713 related source tests passed, including five new production integration guards. All five guards fail on original author head f5162bb and pass here (late projections, two omission/observation paths, contradictory projected absence, and delete confirmation).
  • 67 CLI/MCP boundary tests passed: serving/export/compare, retained analysis Evidence, named output schemas, dialect validity and compact inputs.
  • Full check (types, lint, module boundaries, architecture guards), docs check and discovery of 2047 tests passed. A latest-main targeted rebuild/recheck is recorded in the merge follow-up.
  • Independent local Codex CLI review found the status-order defect above; final read-only review found no further definite new defect. This is automated source review, not human attestation.
  • Five pinned public capture Evidence datasets (Directus, Homebox, Mealie, Keycloak, Shlink) ran through the real compiled CLI and stdio MCP. All ten manifest/state facts and Evidence IDs match across adapters and the original author control. Downloaded bytes were independently SHA-256 checked; no dataset scripts or applications were executed. Source revisions/digests and complete artifacts retained locally.
  • Sequential fresh-process repeat of that complete capture workflow: original author 23.95 s wall / 39.12 s CPU / 1183 MiB sampled process-family RSS; candidate 24.01 s / 38.54 s / 1205 MiB. Earlier loaded runs were 25.51/46.52 s respectively; do not infer a speedup. RSS is a 500 ms estimate, not an exact peak; filesystem caches were not cleared. No model-token reduction is claimed.

Scope and limitations

These checks qualify retained-data analysis and local serving, not live application write fidelity, all published datasets, or real Hopper/Ghidra/Windows behavior. Full Evidence remains accessible. Original author historical broader experiments remain in docs/specs/agent-environments/write-coverage/verification.md; they were not independently rerun in full.

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.

cursoragent and others added 6 commits October 21, 2026 21:27
… responses

Keep main's environment serving and fold in coverage for non-entity reads,
response summaries, and MCP tool annotations.

Squashed rebase of morluto#5352 onto main.
…tate

Serve write tools whose later reads confirm the effect, and keep main's
state-file ownership and part-wise reply measurement.

Squashed rebase of morluto#5600 onto the rebased morluto#5352 tip.
…eads and masked sequences

- The manifest keeps a write whose every response is empty, with at least one
  success, as a tool whatever its content type (a bodiless 204 delete).
- A field every recording of a view carried is no longer required of an entity
  once a successful read shows the application leaves it out, as APIs that omit
  empty or false members do; the state's views drop it from required_fields.
- An item read that asks for some fields only (fields, fields[...], select,
  $select) and does not return the item no longer blocks the identity proof;
  the view lists it in projected_record_ordinals, serving replays such calls,
  and the write gate does not check them.
- A sequence may be written as digit groups (an asset number 000-005); served
  values keep the mask, and dates are not sequences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Count a reply as bodiless only for a 204 or 205, an empty text or a
recorded size of zero, since a missing text may be a body the capture
did not keep. Run the relaxed item or list check from the omitted-field
module, and test projected reads through a rule helper.

Add manifest, gate, serving and unit tests, the manifest, capture,
state-view and state-writes docs, and the write-coverage spec.

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

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cursoragent and others added 10 commits October 21, 2026 22:12
… responses

Keep main's environment serving and fold in coverage for non-entity reads,
response summaries, and MCP tool annotations.

Squashed rebase of morluto#5352 onto main.
…heir budgets

A recorded body of exponential numbers can render past 256 KiB and turn a
working read into a state size error, so that document stays a recorded replay.
Description samples are measured after JSON quoting, and the replay-fallback
catalog check uses a tool count the longer response descriptions still separate.

Co-authored-by: morluto <morluto@users.noreply.github.com>
…tate

Serve write tools whose later reads confirm the effect, and keep main's
state-file ownership and part-wise reply measurement.

Squashed rebase of morluto#5600 onto the rebased morluto#5352 tip.
… responses

Keep main's environment serving and fold in coverage for non-entity reads,
response summaries, and MCP tool annotations.

Squashed rebase of morluto#5352 onto main.
…heir budgets

A recorded body of exponential numbers can render past 256 KiB and turn a
working read into a state size error, so that document stays a recorded replay.
Description samples are measured after JSON quoting, and the replay-fallback
catalog check uses a tool count the longer response descriptions still separate.

Co-authored-by: morluto <morluto@users.noreply.github.com>
…tate

Serve write tools whose later reads confirm the effect, and keep main's
state-file ownership and part-wise reply measurement.

Squashed rebase of morluto#5600 onto the rebased morluto#5352 tip.
…' into codex/blockers-5600-live

# Conflicts:
#	docs/specs/agent-environments/state-writes/verification.md
#	src/application/environment/environmentState.test.ts
#	src/application/environment/environmentStateStore.ts
@earakely-scale
earakely-scale marked this pull request as ready for review October 21, 2026 22:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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 ⚠️ Failed 2026-10-21T22:42:24.232555Z
We couldn’t complete this review. Comment @codex review to try again.
a4c4a23 Draft marked ready
ℹ️ 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.

… targets

A later overwrite copied surviving derived fields into the sent-member
claim, so a members-only check rejected an update whose sent field still
matched. Serving floored sequences at zero and stored missing history as
zero, so a collection sequence learned from negative ranks skipped the
next value. An absence after a delete forgot the resolved collection, and
an encoded read could not observe an update spelled with another
collection encoding.

Regression tests cover each case.

Co-authored-by: morluto <morluto@users.noreply.github.com>
@greptile-apps

greptile-apps Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; both previous findings are fixed and no new blocking issue was found.

Summary

The PR extends captured write support in four places:

  • Successful writes with empty replies can appear as tools.
  • Complete read-backs can show that a field is optional.
  • Projected item reads replay instead of blocking state-backed answers.
  • Digit-group sequence numbers keep their recorded format.
  • Write checks match encoded paths and own JSON fields.

Both numbered findings from the previous review are addressed. No new actionable issue or security finding was established.

The full PR diff was reviewed because the previous and current heads have different merge bases with the supplied target commit. Tests were inspected, not run. Whether another PR supersedes this one could not be checked because GitHub authentication was unavailable.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Captured exchanges] --> B[Manifest keeps bodiless writes]
  B --> C[Extract initial entities and views]
  C --> D[Retain early and late projection evidence]
  C --> E[Check writes and learn omitted fields]
  E --> F[Generate digit-group sequences]
  D --> G[Serve state or replay projections]
  F --> G
Loading

Reviews (7) · Last reviewed commit: "fix(environment): preserve projection an..." · Reviewed by Greptile

morluto and others added 8 commits October 22, 2026 06:52
Observation search skips a read begun before the write ended. That
comparison now uses the same overlap as the check path.

A clock learned on a later call was not checked against earlier calls
that kept the field. Serving would stamp those calls too, so the plan
stays unserved. A clock learned earlier is still refused when a later
call does not advance it.

Regression tests cover an overlapping empty update and a published_at
clock that one recorded call leaves unchanged.

Co-authored-by: morluto <morluto@users.noreply.github.com>
Keep served write plans and the Greptile fixes, and keep morluto#5352's
response summaries, replay-card pin, and squash note. Restore the SAZ
zero-byte member note and the state-file close notes the write squash
had dropped from main.

Co-authored-by: morluto <morluto@users.noreply.github.com>
…ate, and spell sequences as served

A read naming a projection parameter that the item view replays, or that
leaves out a required field, no longer resyncs, checks or observes a
write, and an empty projection argument still replays. Omitted fields are
noted per type, from whole successful reads of entities the state holds,
and relax every view of the type. A digit-group sequence is only groups
of one width joined by `-`, and a create's later value must be spelled as
serving writes it. A projection of an entity the state lacks answers as
missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 13 commits October 21, 2026 21:17
…e coverage

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

shownBefore and the item-or-list fields check move to the observe module,
keeping the write effects within the line limit.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An unmodelled path kept the request's collection spelling. An archive under
the plain spelling of a collection held encoded marked only that plain
collection unknown, so a later update was blamed for the archive's fields
and dropped. Name that entity the way a modelled write does.

Co-authored-by: morluto <morluto@users.noreply.github.com>
…tten replacements, and bound the served clock

A members-only check no longer compares volatile fields, which render
from the read itself. A document replacement credits the members it
wrote or removed at its object, so a later merge that overwrites them
takes its confirmation away. A recorded time past the range of a date
gives no served clock instead of throwing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…olatile fields and unchecked calls

A failed item read that is no absence leaves an unknown entity unknown, so
a later usable read still checks its writes. A read showing an unknown
entity again checks no write on a volatile field. An update of an unknown
entity takes its recorded outcome and adds nothing to a built plan. A later
update that does not answer with its entity is observed only by a read
whose view shows every learned clock; without one it is unmodelled.

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

The gate built a later create's path fields from the recorded request path,
while serving fills them from the held collection it selects for that path,
so a read showing the other spelling's parent could confirm a create serving
cannot reproduce. Rules still learn from the recorded path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds updates write, and keep later members' types

An unmodelled write below an item path names its entity through itemTarget,
and one at or above a collection resolves the held collection, as modelled
writes do, so an encoded spelling no longer hides the entity it changed.
An update's answer counts the fields its rules write, other than increments,
as available, so a field only the update writes no longer makes it
incomplete-entities. A member a later call first stores keeps that call's
JSON type in the body's kinds, which the body check falls back to.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A read begun while a write still ran, or a page the collection outgrew,
noted the fields it lacked before the gate set it aside, so a read serving
replays could drop a field from every view's required ones. Omissions are
now noted only once the read is checked.

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

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

A replacement claims only the members it wrote or removed, but it now
overwrites every earlier effect under its object, so a merge that wrote
the object it replaces loses its confirmation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both sides named unmodelled writes as modelled ones do and dropped volatile
fields from members-only checks; this keeps the taint that also resolves
collection-level writes through heldCollection, and one volatile filter.

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
earakely-scale and others added 2 commits October 21, 2026 23:17
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rite coverage

morluto#5600 landed on main as a squash, so this merge takes 3f1f825, the write-plan
commit this branch last merged, as its base.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep projected reads and omitted-field learning alongside main's query-page coverage and insertion retries. Retain omissions only after the final read coverage passes taint and in-flight write checks, preserve both fixture sets, and cover a create confirmed by a filtered list.

Validation: 1016 environment/domain tests and 89 CLI/MCP/schema tests passed. Final comparison and served-write boundary rerun passed (3 tests). npm run check and npm run docs:check passed. Published-capture census, live environments, and the full repository suite were not rerun.
Use exemplar-aware sequence counts and shared segment matching, pass resolved item IDs into omission detection, and restrict update kind checks and change tracking to own JSON members. Add workflow regressions for all four review findings and boundary cases for raw IDs and encoded prefixes.

Validation: 1025 environment/domain tests, 17 CLI/MCP boundary tests, npm run check, and npm run docs:check passed. Seven new regression assertions fail on the previous source. Full suite and live-application/capture-census runs were not repeated.
gensokyo-dev and others added 3 commits October 22, 2026 15:03
…ites

Retain late identity-free projections without seeding them, share current omission facts with every write check, and classify error statuses before projection replay.

Assisted-by: Kogasa (gensokyo-skills:kogasa-surprise-testing)
@gensokyo-dev
gensokyo-dev merged commit 5375ff0 into morluto:main Oct 22, 2026
19 of 20 checks passed
@gensokyo-dev

Copy link
Copy Markdown
Collaborator

Merged as 5375ff0; the actual merge commit was rebuilt and all 10 selected source/CLI/MCP serving tests passed again. Before merge: 713 source tests, 67 boundary tests, static/docs/discovery checks and final independent Codex source review passed; current-head GitHub build passed, but other CI/Greptile checks were still running/queued. Used the explicitly authorized bypass without claiming unfinished CI passed. A separate real Codex CLI analyst task then queried the retained Directus Evidence in one successful selected-output call, correctly reported the two served writes with checked ordinals and no live-app claim. Reported model usage was 52,806 input (46,720 cached) / 657 output tokens including repository instructions; no token reduction claim. Its first sandboxed attempt was blocked by child-process EPERM; the same read-only task succeeded outside that nested sandbox. No live apps were launched. Original author ownership/readiness was preserved; no coauthor trailer added.

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.

5 participants