Skip to content

Render conversation trees through Lit - #732

Merged
max-sixty merged 4 commits into
mainfrom
codex/lit-conversation-trees
Sep 15, 2026
Merged

max-sixty merged 4 commits into
mainfrom
codex/lit-conversation-trees

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner

This cuts Leaf's generated conversation trees over to one immutable descriptor path and synchronous Lit owners across the Threads panel, inline page conversations, widget outlets, and margin threads. It removes the parallel imperative builders, DOM-search receipt routing, raw-tree capture/restore rollback, and reaction-surface construction while retaining native editors and validated authored message fragments as explicit islands.

The existing application publisher and presentation coordinator remain the authority. A complete conversation candidate now checkpoints the keyed list, count, narrowing reading, and sibling seats together; failed candidates restore the committed descriptors through those same owners, and obsolete retained views are pruned only after commit. Pending-ledger accounting also invalidates descriptors in the poll-before-POST ordering so controls repaint from current semantic state.

Frozen widgets now explicitly republish projection presentation after their authored facets are first captured. This closes the ordering where a widget connected against the pre-capture epoch and rendered correctly, but replay coverage still described only the earlier page-owned widgets.

Regression coverage exercises complete rollback, frozen-widget readiness, exact editor/message/widget identity, draft/caret/focus retention, stream markup, message edits, and poll-first settlement. The TODO now names the remaining Lit work precisely: banner shelf/menu, thread-panel narrowing, anchor note marks, and target-chooser status.

This was written by Codex on behalf of max-sixty

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Three things the cutover drops and does not put back. The inline comments carry the first; the other two are outside the diff.

reactions.js's mount() still installs a lf-thread-hidden listener, but the dispatch that fed it went with thread-list-view.js's old willUpdate, and nothing else in the tree sends that event. Disarming on hide is now covered by ThreadView.retire() reaching #registration.close(), so this is dead wiring rather than lost behaviour — but it reads as live. Happy to push the deletion if you want it in this PR.

ThreadListView.updated (thread-list-view.js:148) keeps only the .lf-thread[hidden] half of the recovery it replaced. The half it drops — #focusListAfterPaint ||= this.contains(focused()) read before the mutation, then !this.contains(standing) after — was the one that caught focus leaving the list because its card left rather than became hidden: a retraction, or a refused state application withdrawing the candidate card the reader was standing in. Chrome's focus fixup fires on removal, so focused() is already <body> by updated(), closest returns null, and the reader lands outside the panel instead of on the list. Retained cards make this rarer than it was, not unreachable.

How the merge-base comparison was run

Everything here was checked against a65f25eb in a second worktree on this machine, same Chrome, -n0. On the current head tests/test_smoke.py, tests/test_render_application_boundary.py, tests/test_render_conversations.py and tests/test_render_export.py are green locally, matching CI.

@max-sixty

max-sixty commented Sep 15, 2026 •

Copy link
Copy Markdown
Owner Author

The two review-body findings are fixed in 9c476b5. Thread-list focus recovery now covers a focused card that is removed as well as one that becomes hidden, with a refusal/removal regression. The dead lf-thread-hidden listener and its orphaned comment are removed; ThreadView retirement remains the sole reaction teardown path. I also collapsed widget-outlet cleanup onto one marker-clearing teardown path after Astra found the obsolete branch.

This was written by Codex on behalf of max-sixty

@max-sixty
max-sixty merged commit 4cb17dc into main Sep 15, 2026
19 checks passed
@max-sixty
max-sixty deleted the codex/lit-conversation-trees branch September 15, 2026 11:20
max-sixty pushed a commit that referenced this pull request Sep 15, 2026
…hot flip's margin command, and a ring specimen behind a closed tab (#734)

The nightly suite went red on main with 4 failures and 22 errors ([run
34960165078](https://github.com/max-sixty/leaf/actions/runs/34960165078)).
Three durable causes account for 25 of those 26 nodes; the fourth was
already repaired by #732, which merged 24 minutes after the run started.
Each cause is one commit here.

**The website adapter 404s the startup beacon.** #717 added the public
startup report, handled it in `worker/src/index.ts`, and required it in
`scripts/verify_site.py` — but `worker/server.py` never learned the
route. Every released document posts to `<page>/api/performance`; the
deployed site answers at the edge, and a site served straight from the
adapter has no edge in front of it, so the POST fell through to the base
handler's 404. That is a console error on every page the adapter serves,
which is why one missing route reddened 23 nodes of the suite's
clean-console reading. The adapter now answers 204 at its own boundary,
the way `end_headers` already adds the `Leaf-Session` reading the Worker
would have.

**`lf-shot`'s margin entry lost the flip's name.** #716 replaced adopted
source controls with immutable margin projections and deleted
contributor-owned margin command rows, adding a `marginEntry` `scope`
option to carry the declaration across to a control the margin
generates. `lf-draft` was cut over in that commit; `lf-shot` was not, so
standing on Show before / Show after left the shortcut bar with nothing
to say about the flip. It is now one `commandScope`, attached to the
widget's own checkbox and projected onto its margin entry.

**A ring specimen moved behind a closed tab.** #721 added an example
that sorts ahead of `triage-board` in the corpus, so the first
`.lf-grip` landed in a tab panel that arrives hidden. Nothing inside it
is focusable, so the sweep read a ring the grip paints perfectly well as
undrawn. The sweep now asks the runtime's `reveal()` before focusing,
deriving the surface from where the specimen sits instead of from a tab
order that follows the examples directory.

The fourth failure,
`test_conversation_readiness_waits_for_the_keyed_thread_list`, raised
`Page.evaluate: Resulting promise was garbage collected` from the
`armed` re-entrancy hack around `scheduleUpdate`. #732 replaced that
arrangement with an explicit `performUpdate` hold, and the test passes
on main as it stands. Nothing here touches it.

<details><summary>Verification</summary>

Each regression was reproduced on main and bisected to its origin with
`git bisect run`, one node id per run under `-n0`: the shot regression
to e790513 (#716), the ring regression
to eb055b1 (#721). The adapter 404 is
not a bisect — the route has never existed in `server.py`; it reproduced
directly and the fix clears it.

On this branch:

- `tests/test_render_controls.py` — all passed, ring sweep included.
- `tests/test_site.py` — 1 failed of 136.
`test_the_interaction_gallery_drives_real_widgets` expected `Playing`;
it passes alone under `-n0` and passed in the failing run above, so it
is timing under parallel load rather than this diff.
- `tests/test_render_commands.py`, `tests/test_render_margin.py`,
`tests/test_website_server.py` — 193 passed, 4 failed. All four are
`bin/leaf` subprocesses reporting `no browser launched`; each reproduces
on unmodified main in this sandbox and each was green in the failing run
above.
- `uv run pytest tests` — 1119 passed, 4 failed: the umask, read-only
`/tmp`, and `bundleLayer` cases this sandbox cannot run.
- Changed-file pre-commit hooks pass. No TypeScript changed, so the
website-worker gate is unaffected.

</details>

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 4, 2026
A message the user sends gets a yellow cue on its own words, but an
agent reply arriving in a thread card the user has open got nothing. It
was also marked read as soon as it was fully on screen, so its unread
rail barely painted. The cue's condition was the message being a pending
local send (`messages.js`). It is now any message joining a thread view
that was already presented, whoever wrote it, plus a pending send for a
new thread's first message. Opening a card still cues nothing it already
holds, and admission still never replays the cue.

`.lf-msg.grow` had no writer since the Lit rewrite (#732) and is
removed; `.lf-thread.grow` still settles a new thread into the list.

`test_an_agent_reply_into_an_open_card_cues_only_its_own_words` fails
without the runtime change and passes with it;
`test_sending_flashes_only_the_new_message` still passes on all six send
surfaces.

TODO gains "Decide whether a thread card may cover the margin rail": the
card starts right of the target's margin marker (`comment-placement.js`,
`margin`), and no element can yet declare whether a floating surface may
cover it.

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

Co-authored-by: Claude Opus 5.5 (1M context) <[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