Skip to content

Consolidate generated UI into retained Lit render trees - #4393

Merged
max-sixty merged 5 commits into
mainfrom
codex/lit-render-ownership
Oct 27, 2026
Merged

max-sixty merged 5 commits into
mainfrom
codex/lit-render-ownership

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Move generated UI ownership into retained Lit trees and remove the parallel caches, state copies and render roots that had accumulated around them. Native editors, selection, media playback, capture loading and semantic presentation still keep their existing owners.

  • The floating panel commits its shell, menu, stage and editor seat through one template. Composer attachments, errors and action controls share one reactive Lit component, retaining the native editor and its caret.
  • Screenshots use one owner from initial delivery through live inspection. Timeline and motion controls reuse their initial templates, transcript rows use keyed rendering, and command chips and video controls no longer maintain parallel generated-node caches.
  • Composer controls are generated by wireInput; its public contract now takes sendClass and exposes sync.button. All callers and the package reference are updated, with protocol 32 marking the changed public API.

Validation after integration: pnpm run check passes (29 build tests, 681 runtime tests and 85 Worker tests), lint passes, and 23 focused browser cases cover drafts/carets, attachments, rewrites, panel transitions and screenshot inspection. Two additional motion journeys pass. After integrating source stylesheet delivery, six focused cases rechecked first-paint retention, the full comment/reply journey, status animation and draft/caret continuity. Four focused cases passed again after adopting main’s consolidated boot function. A status-animation test now samples known animation phases after base/candidate probes demonstrated that its previous 400 ms sample could hit two identical phases on both versions.

Independent Opus review found and rechecked two performance fixes: composer focus/hint/error subscriptions are scoped to the affected field, and motion playback state updates command controls through a signal. Its follow-up found no remaining actionable issue. Native screenshot popover expanded state and light-dismiss keyboard cleanup were verified in the browser.

A fresh independent live review after integration found no actionable issues: drafts and mid-text carets survive search and folding, keyboard comment/reply sends complete, and Send/Dictate hover/focus presentation is correct in light and dark. Microphone recording and alternate-submit behavior were outside that live pass.

Base/candidate startup comparison against main at 5c6ce8f5c retains 39 code requests for the screenshot example. Combined document/code bytes before first server-state presentation increase by 7,535 bytes: retained initial rendering moves 37,818 bytes into the document while removing 30,283 bytes from requested code. No console errors or layout shifts were observed.

The authored source and documentation shrink by 74 lines; regression tests add 380 lines and generated bundles add 152. This removes ownership duplication rather than every native lifecycle boundary: editor sessions, authored DOM reconciliation and capture races remain necessary owners.

This was written by Codex on behalf of max-sixty

Unify panel and composer rendering, retain one initial/live widget drawing, and remove parallel DOM caches. Narrow composer subscriptions and make motion playback observable so framework updates do not fan out across unrelated controls. Generate composer action controls and update the package-facing API at protocol 29.
leaf-agent
leaf-agent previously approved these changes Oct 27, 2026
@max-sixty
max-sixty merged commit 5e57a24 into main Oct 27, 2026
4 checks passed
@max-sixty
max-sixty deleted the codex/lit-render-ownership branch October 27, 2026 08:51
leaf-agent added a commit that referenced this pull request Oct 27, 2026
The Another option badge test required Add's empty marker to change
while the input event was still bubbling. #4393 moved composer controls
into retained Lit trees with microtask updates, so that observation
became stale even though Add is ready before the next frame and
reachable by the next Tab.

Observe the first frame after input and explicitly require Tab to focus
Add, retaining the existing badge placement checks. This preserves the
rendering consolidation and the keyboard behavior without changing
product code or appearance.

Validation: the original test fails on current main at the input-event
assertion; the revised test passes, including the new focus assertion.
The adjacent badge coverage also passes.

Closes #4434 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
A refused optimistic comment removes its thread before the floating
panel reconciles its route. The retained composer introduced in #4393
can read that stale route during its own update and pass a null thread
to `replyAvailable`, interrupting refusal recovery. The field reader and
panel template now require a current thread before reading reply
availability. This preserves the retained renderer and native editor
ownership intended by #4393.

The visible behavior remains the existing refusal recovery: the rejected
thread closes, the user's words return to their editor, and focus
follows the existing intent rules. No layout, styling, or timing changes
are introduced.

Validation: the detached-comment test reproduces the reported exception
before this fix. The same focused selection passes afterward: 24 browser
cases, including all seven cases in the report and adjacent
refusal/application-boundary transitions. The browser build and all 682
runtime tests pass. Existing regression tests provide coverage without
adding another copy.

A served command-hub startup comparison against the base keeps 45 code
requests through widget upgrade and first server-state presentation,
with 115 additional code bytes; both arms report no console errors or
layout shifts. The document/code combined increase is 206 bytes. Timing
was diagnostic only.

Closes #4422 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 27, 2026
A refused comment removes its temporary thread before the retained reply
field finishes repainting. The shared `fieldReading` still classified
that missing subject as “Reply”, allowing the turn lead added in #4510
to call `threadAttention` without a thread. The field reader now returns
an empty reading while its subject is absent, so both the hint and its
lead stop describing a reply until the panel retires the route.

This preserves the retained composition renderer and native editor
ownership from #4393. The rejected thread still disappears and the
user's words, placement and focus return through the existing refusal
recovery. No layout or styling changes are introduced.

Both reported browser regressions reproduce the null dereference on the
base and pass with the fix. Validation also passes 10 adjacent refusal
cases, four panel cases covering status, reply/walk labels and sending,
the browser build, and all 684 runtime tests. Existing tests cover the
transition without another reproduction test.

A served command-hub startup comparison against the base keeps 45 code
requests through widget upgrade and first server-state presentation,
adding 158 code bytes. Both arms show no console errors or layout
shifts. The added branch belongs in the shared field reading rather than
a second null guard in the attention reader; it states whether the
retained field still has a subject.

Closes #4522 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
)

The retained composition renderer in #4393 inserted
`leaf-composition-field` between the reply row and its editor. The
diff's direct-child selectors still used the old structure, so every
empty reply showed a full editor instead of the compact Reply face
chosen in #4323. Update those selectors to follow the retained renderer,
including the conditions that keep attachments and nonempty drafts open.

Empty, unfocused diff replies now show one compact line without a frame
or microphone. Focused replies and nonempty drafts keep the expanded
editor. The existing regression failed on the base with a 40px field and
visible Dictate control; it passes with the repair, and now also checks
that leaving a nonempty draft preserves its expanded face and words. The
adjacent pinned-header Tab check passes; all 695 runtime tests pass.

Compared and inspected the `diff-file-reply` and
`diff-file-reply-dark-touch` catalogue stills against the base: the
empty second reply becomes compact while the first conversation's active
draft retains its editor. Reproduce with `uv run leaf-dev stills
809f092 --state diff-file-reply --state diff-file-reply-dark-touch`.

Closes #4433 — automated triage

Co-authored-by: leaf-agent <[email protected]>
leaf-agent added a commit that referenced this pull request Oct 28, 2026
)

The DOM-write watch now credits the menu's remove-and-restore
measurement of its line limits, while continuing to reject direct
repeated assignments. Reopening during the closing fade retains the
status nodes; `holdMenu` removes the previous opening's limits, measures
the fresh text, and reapplies them. Equal dimensions therefore produce a
necessary round trip that the watch previously rejected.

This preserves #4393's retained menu controls and scroll position. That
change removed the previous teardown on reopening, exposing the watch's
assumption that an attribute returning to its original value did no
useful work. The correction is confined to the held marker and
line-limit-only styles passing through removal; it does not exempt
arbitrary writes on these nodes. No product rendering changes.

Validation: the new sensor regression fails before the correction and
passes afterward, with controls proving direct restatements still report
errors. Nine focused browser checks pass: both sensor cases, all six
cases in the report, and the open-menu news stability case. Before the
correction, five of the six reported cases reproduced the teardown
diagnostic on current main; all six test bodies passed. The earlier CI
artifact from run 40470206147 records all six cases passing before
#4393.

Closes #4435 — 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