Repository navigation
feat(environment): serve creates whose answers show less than reads, and whole-object updates - #7080
Conversation
…pdate members - A create's observation takes the fields the first read of its entity shows that the answer lacks, and an item read's clock spellings, when the read agrees with the answer otherwise. The plan records the read (observation.read with its shape); an item read then observes rather than checks, a list read only adds fields and still checks. Serving merges the same recorded objects. - An update member sent back as the clock the entity held and stored as a fresh clock near the call is a clock rule; one stored as the slug of another member stored as sent is a slug rule. Both are accepted with any value, as whole-object writes send what they read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
[Medium impact] The PR appears safe to merge; the remaining slug-only edit finding is addressed. SummaryThis PR lets create plans borrow compatible read-back fields and learn regenerated slugs and clocks from whole-object saves.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Create answer] --> C[Check compatible read-back]
B[First read before next write] --> C
C --> D[Stored entity]
D --> E[Learn write rules]
F[Earlier update calls] --> G[Check promoted rules]
E --> G
G --> H[Serve confirmed writes]
Reviews (3) · Last reviewed commit: "fix(environment): reject incompatible sl..." · Reviewed by Greptile |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Agents built environments from a prompt for five applications the prompt flow had never seen: Vikunja, Ghost, EspoCRM,
Paperless-ngx and Miniflux. Most of their creates and edits were withheld, and two write-model gaps accounted for most
of them:
document_countits item read shows.countits list shows.slugwith its new name, and the application slugs the name anew.updated_atit read, and the application stamps a new one.unexplained-change, or its first call's value was pinned so later calls conflicted.This PR handles both:
(
observation.read). The read must otherwise agree with the answer.clockrule. One stored as the slug of another member stored as sent is aslugrule.Results on the same recordings, against main:
GLM (1/3 to 2/3).
Part of #4933 (agent-environment projection, serving and export).
Problem and expected behavior
served with the fields reads show. It should still be answered in the application's answer shape.
value, accepting any sent value for that member.
Change and scope
environmentStateWriteCreate.ts,environmentStateWriteObserve.ts):withReadBacklooks for the first read of the created id before the next write.respelledInstant),leaves the observation as it was.
withReadmerges: item reads lend fields and clock spellings, list reads only add fields.environmentStateWriteRules.ts,environmentStateView.ts):observation.readholds theordinal,pointerandshapeof the read.environmentStateWriteAnswer.ts):observedEntitymerges the observation and its read withwithRead.environmentStateWriteChanges.ts):sentRulelearns aclockfor a member sent back as the held clock and stored as a fresh clock near the call.slugfor a member stored as the slug of another member stored as sent.docs/web-network-captures.md, anddocs/specs/agent-environments/write-views/.Not included: these follow-ups surfaced in the same recordings:
all).created_byin create answers.PUTs recorded through a UI.Contract and boundary impact
(
src/domain/analysisView), and served write answers (src/application/environment).reads recorded captures only and adds no new target interaction.
environment-statewrite plans may carryobservation.read, and update plans may carryclockandslugrules forsent members.
observation.read. Earlier REA versions refuse it, becausethe schema is strict.
Expected effects:
Evidence and regression coverage
How the held-out recordings were made.
claude-sonnet-5-5) built each environment from a one-paragraph prompt on Ubuntu VMs, with REA at main475f09d5(skill v49).construct. Its second run was given an API key.
Census, environment-state views on main and on this branch:
allmember lists every id, which rendering does not model.created_bywhere the answershowed a partial one, and that is a disagreement this PR deliberately keeps.
Served write tasks. The held-out round's write tasks, rebuilt from the same recordings with this branch:
PUTrequires every member the recorded call sent (about 14 here); GLM sent them all.
Tests added: each fails on main.
restamps pass unchanged.
For evidence-bearing changes:
Validation performed
Review follow-up (
dc4db9081,1cfc598b6)npm run checkpassed; environment-state source tests passed (38 files, 1,040 tests); compiled served-writes MCP/serve CLI tests passed (2 files, 12 tests).docs:checkpassed atdc4db9081; documentation is unchanged in the second fix.dc4db9081. MCP SDK coverage verifies incompatible slug-only tools are withheld in either call order; unchanged slug-only saves remain covered as compatible.1cfc598b6with no remaining findings (5/5). Codex re-review could not run because the integration reported insufficient review credits.Original author validation, before the review fixes:
Run on macOS with Node v24.22.1 at
421d2410(main8e6a9578and this branch).npm run check(build, typecheck, format, lint, typed lint, module boundaries, architecture guards) andnpm run docs:check: passed.npx vitest run --project domain --project services --project adapters: 17,624 passed, 25 skipped, 1 failed ("stopsInspector target authorization after the current stat settles"), which fails the same way on main in this environment.
npm run test:focused --the analysis-view, environment build, compare, export and serve CLI boundaries, theanalysis-view, environment bundle, serve and served-writes MCP boundaries, tool schema validity, output schema profile
and MCP schema validation: 12 files, 106 passed.
Compatibility, safety, and release
later to serve.
macOS.
Author readiness
Human owner:
Before merge
type(scope): outcome.🤖 Generated with Claude Code