Repository navigation
feat(environment): time browser scenario records so scenario environments learn a write clock - #6967
Conversation
…ng they took Request events carry observed_at, the wall-clock time the provider observed the request start, and finished or failed events carry the browser's elapsed_ms when it reports one. Both are optional, so earlier captures still parse, and scenario comparisons leave them out as a committed built-in rule. The real-Chrome network lane checks every request and finished response is timed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s a write clock Scenario records take startedDateTime from when each request was observed and time from the browser's duration, as HAR entries are timed. A timed scenario of the book session learns the same clock and serves the same writes as its HAR; an untimed one keeps record order and learns no clock, as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… records Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… start The provider observes a request up to tens of milliseconds after the browser starts it while it reads other responses, so a record starting then and ending after the browser's duration mixed two clocks. Finished and failed events now carry the browser's started_at, records prefer it and fall back to observed_at, and comparisons drop it too. Tests cover the fallback for a request that never ended or ended twice, a partly untimed capture keeping record order, comparing an untimed capture with a timed one, and the real-Chrome lane checks every finished request carries the browser's start and duration. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…and older readers Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gates, the real-Chrome lane, prompt-recorded and re-recorded published scenario captures built with and without their times, the stale published environments left unrepublished, and the review. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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. |
[Medium impact] The PR appears safe to merge, with no new blocking issue found. SummaryBrowser scenarios now record request times and use them to build timed environment records.
No new actionable correctness, security, or repository-rule issue was established. earakely-scale documents and accepts the fallback for unfinished requests because the browser has not reported their start or duration. Review was source-only; tests were not run. Whether another PR supersedes this one could not be checked because GitHub authentication was unavailable. Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Browser request events] --> B[Capture request times]
B --> C[Scenario Evidence]
C --> D[Project transaction records]
D --> E[Use browser start or observed start]
E --> F[Environment timeline and write clock]
C --> G[Remove request timing fields]
G --> H[Compare transaction fingerprints]
Reviews (3) · Last reviewed commit: "fix(environment): integrate scenario tim..." · Reviewed by Greptile |
…mparison test The comparison test's captures had no finished or failed events, so dropping started_at and elapsed_ms from them went untested. The captures now end one request and fail the other, the test asserts both carry times, compares them shifted by seven seconds and against an untimed capture, and a control shows a changed failure on a timed completion is still reported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review round at
|
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
Browser scenario captures record no request times, so every record a scenario projects is untimed. The
environment-state view then reads a scenario in record order and learns no write clock. Any update whose response
carries a modification time the application sets is withheld as
unexplained-change, however carefully it is recorded,while a HAR of the same session serves it with a clock rule. This was the main gap left in building environments from a
prompt (#6946), where the agent records with a browser scenario: Linkding's and Homebox's edits never served.
This PR records the times and uses them:
requestevents getobserved_at, when REA observed the request;request-finishedandrequest-failedevents get the browser's ownstarted_atandelapsed_ms, whichPlaywright reports once a request ends.
observed_at) and itsduration. A timed scenario gets the recorded-start-time timeline and a write clock.
ignore_network_request_timing.On the same recordings built with and without their times, prompt-recorded Linkding serves 4 writes instead of 1, and
Homebox 3 instead of 2. The Linkding bundle with timed records passes all three of the application's write tasks with
both eval models; the earlier prompt-built Linkding bundles passed none. No capture serves fewer writes with times, and
captures made before this change read exactly as before.
Part of #4933 (agent-environment projection, serving and export).
Problem and expected behavior
an application's modification times follow.
Change and scope
src/domain/browserScenarioCaptureValues.ts,src/browser/network/PlaywrightScenarioNetwork.ts):observed_atonrequestevents;started_atandelapsed_msonrequest-finishedandrequest-failedevents, from Playwright'srequest.timing()(startTime > 0,responseEnd >= 0);src/domain/analysisView/scenarioCaptureRecords.ts):startedDateTimecomes from the transaction's single finished or failedstarted_at, else fromobserved_at;timecomes from itselapsed_ms, or 0 without one;src/domain/browserScenarioNetworkComparison.ts,browserScenarioDiffValues.ts):comparisons (documented, as the storage rule's change was).
browser-scenario section, and
docs/specs/agent-environments/scenario-timing/.Not included:
Contract and boundary impact
src/browser/network), scenariorecords for the environment views (
src/domain/analysisView), and scenario comparison (src/domain).boundaries. It observes timing the browser already reports; no new target interaction.
capture_browser_scenariooutput events gain three optional fields;compare_web_capturesgains one built-in normalization rule, sobuilt_in_rulesnow lists 11.strict; consumers pinned to an older
rea-agentscannot read scenario captures made with this one.Expected effects:
Evidence and regression coverage
The same capture with and without its times. Each capture was recorded with this branch, then built as recorded and
with its times removed (the Evidence sealed again as the provider seals it):
their responses carry server-set modification times. PhotoPrism's served album create now stamps
CreatedAtandUpdatedAtfrom the clock instead of replaying the recorded values.(
unconfirmed,contradicted).requestaction. Claude Code recorded each app from a one-paragraph prompt on Ubuntu VMs (snap Chromium 155).fireworks_ai/gpt-oss-120bandfireworks_ai/glm-5p3-flash. Counts are relative to its own state, which holds active and archived bookmarks astwo types.
Stale environments, not republished. Pinry and PhotoPrism are the oldest published environments recorded as
scenarios (0.1.0, replay only). I re-recorded both with this branch and rebuilt them with the publishing pipeline:
task listed another album first. That is a list-order gap in state serving, worth its own issue.
limit/offset, under the same tool schemas as thepublished version.
Review. An independent review rebuilt the branch and tried to refute it.
Confirmed:
Fixed:
responses were read, and mixed two clocks in one interval.
Tests added:
observed_at,started_atandelapsed_ms, and omits what the browser does not report;untimed one keeps record order;
User-visible CLI/MCP output: from a real Chrome capture with this branch (a page that PATCHes
/api/items/1),the transaction's request and completion events now carry:
{"kind":"request","transaction_id":"request-2","method":"PATCH","observed_at":"2026-10-24T12:19:32.578Z"} {"kind":"request-finished","transaction_id":"request-2","started_at":"2026-10-24T12:19:32.576Z","elapsed_ms":0.981}Its scenario record takes
startedDateTime: "2026-10-24T12:19:32.576Z"andtime: 0.981, and a comparison listsignore_network_request_timingamongnormalization.built_in_rules.Remaining proof gaps:
duration;
For evidence-bearing changes:
Validation performed
Current integration: 374436f, macOS with pinned Node v24.22.1.
npm run check: passed, including build, typecheck, format, lint, module boundaries, and architecture guards.npm run docs:check: passed, including 9 documentation tests.npm run verify:browser:networkin real Chrome: 10 timed requests, 9 timed completions, CLI and MCP paths verified, no remaining owned descendants. Connected-browser verification remains outside this local lane.Merged current main to inherit the shared command-ownership and source-loader fixes. The environment skill and coverage wording now distinguish fully timed scenarios from older or partly untimed captures; the packaged skill version is 49.
The earlier application recordings and model evaluations are documented above and in the verification document; they were not rerun during this integration. Hosted CI passed at 374436f, including all eight test shards, real-browser, agentenv, the native package baseline, and the required CI gate.
Compatibility, safety, and release
consumer reading scenario Evidence needs this version or later.
Author readiness
Human owner: @earakely-scale
Before merge
type(scope): outcome.🤖 Generated with Claude Code