Skip to content

Reuse completed revision-history readings across retries and edits - #2383

Merged
leaf-agent merged 3 commits into
mainfrom
codex/reuse-history-readings
Oct 11, 2026
Merged

leaf-agent merged 3 commits into
mainfrom
codex/reuse-history-readings

Conversation

@max-sixty

@max-sixty max-sixty commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

Long page histories exceeded the parsed-document cache, so state reads and source checks repeatedly reparsed completed revisions. A timed-out request could leave the server doing that work while its retry queued the same scan again.

Keep one bounded compact inventory per revision for Question registration, data bindings, and element IDs. Historical dynamic registrations reuse the canonical fold's last answer, keyed by its relevant event contents and withdrawals. Source saves and new revisions retain completed historical work without retaining document parses or complete event logs.

On the same 219-revision, 271-event page snapshot, repeated Question reads fell from 177 parses and roughly 2.5 CPU seconds to one parse and 0.07–0.09 CPU seconds, with identical output. The compact inventory used 5.5 MB within its 8 MiB budget.

Validation covers forced parse eviction, retries and new revisions, changed event payloads, Undo, restatement and report settlement, captured data contracts, nested sample scopes, and frozen thread markup. A headless copy of the historical page also exercises an actual read timeout, automatic retry, subsequent edits, and a choice surviving reload.

The full-suite gate also exposed a collapsed diff finishing its lazy source render after rendering had already been declared complete. Registered finite widget preparation now holds the canonical rendering reading until every capable producer finishes, including failed siblings and superseded or reconnected work. A held grammar request reproduces the old gap; the stability watcher remains unchanged.

This was written by Codex on behalf of max-sixty

Long histories exceeded the parsed-source budget and repeatedly reparsed completed revisions during state reads and source checks. Retain bounded compact authored facts separately, and reuse canonical historical Question results keyed by their event basis. Preserve existing Question and data-binding behavior across retries, new revisions, Undo and captured sample scopes.
leaf-agent
leaf-agent previously approved these changes Oct 11, 2026
A collapsed diff can finish its lazy source render after the mechanical loop has already become quiet. Include registered finite preparation in the canonical rendering reading, retiring holds on removal and restoring every still-capable producer on reconnect. Keep failure reporting prompt while waiting for all sibling work to finish; superseded producers can still commit DOM.

Reproduced with a held Markdown grammar request that made the old readiness reading report complete before source arrival. Preserve the stability watcher. Cover failed siblings, superseded batches, reconnection, detached registration, and intentional semantic deferral.
@leaf-agent
leaf-agent merged commit ba50ba3 into main Oct 11, 2026
6 checks passed
@leaf-agent
leaf-agent deleted the codex/reuse-history-readings branch October 11, 2026 11:21
max-sixty added a commit that referenced this pull request Oct 11, 2026
Use the existing queued-work lifecycle to retain cause across native awaits. Keep current application proof separate from counted loop quiet, replacing the global preparation gate introduced in #2383. Held mouse, touch and keyboard cases distinguish owned commits from passive work even after newer input.
leaf-agent added a commit that referenced this pull request Oct 12, 2026
The [deployment failure on
main](https://github.com/max-sixty/leaf/actions/runs/38191563247)
followed the hosted agent's published revision but read the page before
that revision finished presenting. The agent published revision 2 and
replied; the journey then saw the new revision marker with the old
visible words. The same diagnostic occurred in the [earlier failed
deployment](https://github.com/max-sixty/leaf/actions/runs/38135253146).

An in-place revision can advance the meta tag while the document patch
and widget presentation are pending. The site journey now waits for
Leaf's current presentation reading as well as the revision number
before checking the rendered page. If presentation never finishes, the
timeout reports that missing step. The requirement that the agent's
words appear on the page remains intact. The failure surfaced after
#2383; its revision-history optimization remains intact.

A browser test holds presentation behind an advanced revision marker,
then finishes it and checks both readings. The three focused site
journey tests and `node --check dev/leaf_dev/verify_site_browser.js`
pass locally. This branch includes main at 75515cd so CI can run past
the lint failure that blocked its earlier check.

The first refreshed CI attempt collected extra `unchanged write`
diagnostics in an unrelated thread-list test. That test passed in
isolation on both this head and the main commit merged into it, and the
full CI rerun passed on the same PR head.

---------

Co-authored-by: leaf-agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants