Skip to content

Allow commenting before saved history arrives - #2649

Merged
max-sixty merged 15 commits into
mainfrom
codex/comment-before-history
Oct 13, 2026
Merged

max-sixty merged 15 commits into
mainfrom
codex/comment-before-history

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

A slow or failed first saved-state read currently holds back commenting on an already rendered page. Open anchored comments, drawing and document navigation at widget upgrade, while saved-state readers wait for the actual answer. The banner says “Loading saved state…” while that request is pending; elapsed time alone no longer reports an offline server.

Local comments use the existing immutable application publisher, unresolved ledger and thread fold in every phase. Complete asks, saved threads and history-dependent actions still use the server's admitted reading. Commands declare their input readiness at the owning boundary, so keyboard, native controls and pointer actions agree; recovery of an existing reaction withdraws its real saved event. Ordered startup keys wait only for inputs their commands need.

A sample's existing ready boundary now means its commenting interface has upgraded. The parent can become usable while a child's state loads; selecting a saved child thread waits for authoritative presentation. Startup-error and telemetry consumers use the same upgrade boundary. The first state answer applies saved facts without rerunning composer setup or dismissing an open draft. Delayed remembered chrome retains the existing document-arrival user intent, so an old Pages drawer cannot open modally over a comment the user has begun; untouched visits still restore it. Contracts and the How it Works page describe these phases.

Validation: 400 runtime tests and 50 application tests pass. Focused real-browser regressions cover held state beyond ten seconds, real failure/recovery, keyboard/native/pointer agreement, reaction undo, parent/child sample startup and selection, initial versus late shadow errors, and open draft words/caret across successful and failed first answers with focus in a sample or Leaf controls, plus the observed-selection banner route before history arrives and phone-width saved Pages restoration with and without newer commenting input. Independent Claude review of the full final proposal and owning history returns MERGE with no demonstrated underlying fix remaining. A fresh context-blind user check of the combined ordinary paragraph/sample flow holds both state reads beyond eleven seconds, preserves the parent draft through failure, resumes its words/caret after Full view and successfully sends the child comment, choice and parent comment (all HTTP 200). The final main-integrated candidate also passes a fresh phone-width blind task: a remembered Pages drawer restores on an untouched visit, yields to newer commenting input, and the anchored comment continues at its original caret and sends successfully (HTTP 200).

A served-preview comparison of runtime bdf1cec3 (unchanged by the test-only 561ed049 repair) against integrated main a8a26745b, with the same held first state read, loads the same 258 requests before widget upgrade and 260 through authoritative presentation. Resource paths are identical at both boundaries; the candidate adds 4,426 decoded bytes (3,678 external JavaScript and 748 inline/document bytes). These bytes make commenting usable before saved state arrives; delaying them until presentation would retain the blocked interaction. Elapsed timings are diagnostic and do not establish a production latency improvement. Faster dormant website reads shorten this window but do not eliminate missing, slow or failing saved state, sample reads, or local-server cases.

Independent part of the replacement for #2249. Faster website state recall is handled by the separate storage change now on main.

This was written by Codex on behalf of max-sixty

leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
Early commenting publishes visual actions before saved state. A failed coordinate reading must invalidate those actions whether it fails during placement or control preparation. Withdraw them at the existing current-generation rollback boundary, and exercise startup, history, fully-ready, and part-anchored comment failures plus recovery.
leaf-agent
leaf-agent previously approved these changes Oct 12, 2026
# Conflicts:
#	build/browser/application.ts
#	skills/leaf/assets/leaf.js
#	skills/leaf/assets/vendor/browser-runtime/application.js
Sample ready now announces child upgrade, so its parent and comments do not wait on a slow child history read. Saved-thread selection waits at its child capability. Startup recovery and timeout telemetry use the same upgraded interface boundary. Reaction toggles require a complete standing reading across mode, chips and execution, including after a refused first read.
leaf-agent
leaf-agent previously approved these changes Oct 13, 2026
Retain document-arrival user intent at the auxiliary-surface owner, matching fragment and revision arrival. A remembered Pages drawer waiting for the first state answer must not open modally over an early quote draft. Untouched visits still restore the drawer; ordinary commenting keeps its native field, words and caret.
leaf-agent
leaf-agent previously approved these changes Oct 13, 2026
The startup test selected lf-draft words by script, so the selection owner correctly offered Comment on selection in the banner. Assert and click that offered route before checking the focused field, preserving the held-history and disabled durable-choice contract. The adjacent field is raised automatically only by a completed native selection gesture.
leaf-agent
leaf-agent previously approved these changes Oct 13, 2026
@max-sixty
max-sixty merged commit 40c3ca1 into main Oct 13, 2026
3 checks passed
@max-sixty
max-sixty deleted the codex/comment-before-history branch October 13, 2026 01:01
max-sixty added a commit that referenced this pull request Oct 13, 2026
40c3ca1 (#2649) made decision commands wait for the page's first complete saved
reading: "Decision commands queue while saved state is loading; their owner's
availability still requires a complete reading" (module-authoring.md). The test
held every state read from before the page loaded and then pressed a suggestion's
Accept, which since #2649 stays aria-disabled until a read lands, so the click
timed out. The test was stale, not the runtime: its premise, a decision made
before any complete read, is a state the contract now rules out.

The race it guards still exists one read later. The page now takes its first read
(`CutOff(lets_through=1)`), every later read is held while the accept's send and
the undo are made, and the read that follows holds both. The assertions are
unchanged: replay leaves the authored markup, and the held send's continuation
does not repaint the withdrawn accept. Renamed from
`test_a_first_complete_read_does_not_repaint_an_already_undone_settlement`.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 13, 2026
… persistent otherwise (#2699)

In the glossary, **Standing** means one thing: the user holding a
destination or a control inside it (a standing target, ending a
standing). Across the tree "standing" was also an ordinary adjective for
things that are in force, current, open or lasting ("the standing log",
"a standing report", `standing_approvals`, `--standing`), which collided
with that term. This rewords every such use and renames the identifiers
with all their callers, leaving "standing" to mean only where the user
is. The glossary gains an **In force** row and a line saying so.

**Replacements, one word per meaning**
- not withdrawn or retracted → **in force** (`InForce`,
`StateProjection.in_force`, `approvals_in_force`, the per-verb
`inForce`); the served field keeps its name `stands`
- the latest value or reading → **current**
- still owed, or a surface on screen → **open** / **active**
- a server or environment that outlives sessions → **persistent** (CLI
`--standing` → `--persistent`, service.json `"lifetime": "persistent"`);
always-present chrome → **fixed**
- a preference → **lasting**; a dispatch → **recurring**; otherwise
**existing**, **present**, **in place**, **permanent**

**Behavior changes**
- `leaf server start --persistent` replaces `--standing`, and refusals
and the lifetime line say "persistent".
- One `server.read_service(page_dir)` now reads `service.json` for every
caller, returning nothing unless the record has its required fields and
a lifetime this Leaf knows. A record an older Leaf wrote with
`"lifetime": "standing"` is therefore no service (root AGENTS.md,
"Stage"), A server that older Leaf started still holds its lease, so
`leaf server stop` and a re-vendor detect it from the lease, delete the
record and wait for it to exit; until then `server start` refuses as
before. A server started persistently before this change is re-served
with `--persistent`.
- Visible wording: "Current text matches this version", the reaction
scope "On a reaction", the margin contribution key `"reactions"`, and
the eval surface `action-in-force` (with its metrics).

**Fixes for journey tests main had broken.** Editing these test files
selects them, and each already failed on main:
- `test_a_comment_box_moves_home_when_a_panel_comes_to_cover_its_seat`
(since #2613 made the Threads dialog's envelope zero-size): it now
checks the dialog is open and its panel visible, as #2639 did for a
sibling.
- `test_each_sampled_focus_ring_is_shown_whole_in_its_surface` (since
#2647): the floating panel's focus rule declares `--lf-focus-ring:
floating-panel`.
-
`test_an_aimed_press_does_only_what_the_outline_promised[release-notes]`
(since #2670 put a Web Awesome Copy control in `lf-draft`):
`elementFromPointAcross` stepped into the control's own shadow tree and
took its internal `id="copy-button"` for a page element, so the aim and
the press both targeted it and no comment landed. The hit test now
enters only shadow roots a widget declares with `x-shadow`, as
`passages.js`'s header already says; the aim takes the `lf-draft`.
-
`test_a_first_complete_read_does_not_repaint_an_already_undone_settlement`
(since #2649 made decision commands wait for the first complete read):
the race it guards moves one read later, so the page takes its first
read before the held Accept and undo; renamed `test_a_complete_read_…`,
assertions unchanged.

The sweep is generated by a script of exact edits plus identifier rules,
so a newer `main` is regenerated rather than conflict-resolved. Root
`AGENTS.md`'s maintainer section ("a standing preference", line 13) is
unchanged.

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 13, 2026
The board's old outbox browser case tried to send a widget action before
the first complete saved-state reading. Since #2649, actions
deliberately wait for that reading, so the test timed out before it
could exercise undo. Replace that unreachable setup with a browser check
that board and suggestion controls are unavailable while history is
offline and become available after the first complete read. This
addresses the board failure in [main CI run
38333313254](https://github.com/max-sixty/leaf/actions/runs/38333313254);
#2699 separately repaired the suggestion settlement case.

Both replacement browser cases pass. The existing action-plus-undo check
and #2699's corrected settlement check also pass, so the undo behavior
remains covered.

---------

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
The offline startup test could press `x` after the held-key notice
disappeared but before the keyboard controller's queued frame released
the hold. The notice marks queue handover, so it cannot establish that
subsequent keys already travel through ordinary DOM delivery. Wait for
`rendered(page)` before exercising post-handover input; the existing tab
navigation, key delivery and empty-queue assertions remain intact.

This preserves #2649's ordered startup keys and early package navigation
without changing runtime behavior. The scheduled run's macOS assertion
failed while its Linux counterpart passed; the preceding scheduled run
passed this case on both platforms. A controlled reproduction pauses the
frame clock before refusing the first state read: the original ordering
fails with `None`, and resuming and waiting for rendering before the
final input passes. The revised case also passes locally at 10× CPU
throttle. The clock instrumentation is diagnostic only and is not
committed.

Closes #4466 — automated triage

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