Skip to content

Show unread boundaries inside Threads - #970

Closed
max-sixty wants to merge 4 commits into
mainfrom
codex/agent-reply-arrivals
Closed

max-sixty wants to merge 4 commits into
mainfrom
codex/agent-reply-arrivals

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Returning to a Thread now shows where each visible run of current unread messages starts. A quiet closing separator distinguishes later read or reader-authored turns, and a collapsed summary shows how many unread originals it covers. The markers derive from the existing exact-version unread reading, so edits and Mark thread read update them without another state store.

The gallery and public Thread reference describe the behavior. Browser tests cover mixed read/unread versions, edited content, collapsed and expanded summaries, resolved-thread First unread navigation, and keyboard marking with draft and focus retention. The read-state and conversation render suites, runtime tests, and pre-commit checks pass. A matched startup comparison kept 209 requests; encoded bytes rose by 5,550 bytes because the Thread renderer and styles are available with the initial page, allowing the boundary to appear when Threads first opens.

This was written by Codex on behalf of max-sixty

A proposal to replace Leaf's document/workspace dichotomy with independent layout axes: posture (flow or bounded), measure (column width), arrangement (sequence, grid, tabs), and height (natural or fill). Includes design using CSS grid sizing instead of JS measurement, pane grammar, and region reading unification. Planned in five slices starting with lf-grid in flow (#29) and CSS fitting for bounded pages (#30).

@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.

New since you last looked renders as the first child of the message node, but thread-card.js hoists a thread's first message header out of that node into .lf-thread-root-meta whenever the card shows header actions (headerActions && messages[0]). On those cards the divider lands between the root message's own author line and its body: the author, timestamp, Unread label and Mark thread read sit above the separator, and only the root's prose reads as new.

That is the ordinary shape for a thread the agent opened, not a corner. cmd_comment writes every leaf comment root as author: "agent", and read_state.reader_message_content makes agent-authored messages the only ones that can be unread — so an agent-opened thread has an unread root, is unresolved, and therefore hoists its header. Two of the three cards in examples/developer/feature-gallery.html — the fixture this PR updates the prose for — are in that state on a first visit.

Reproduction

Open Threads on the shipped gallery and read each card's first .lf-msg:

{"id": "2be2443f0bb6cc49fc86b52f340e6073", "hoistedHeader": true,  "firstChildIsBoundary": true}
{"id": "bab3cdfcfb8c02aacbb27da731de947a", "hoistedHeader": false, "firstChildIsBoundary": true}
{"id": "a554d5e884abffdb6494a2fb90b0634f", "hoistedHeader": true,  "firstChildIsBoundary": true}

The same shape falls out of the test harness with panel_comment(serve.page_dir, "…", author="agent") — the card renders .lf-thread-root-meta (holding .lf-msg-head and .lf-thread-meta-actions), then the root .lf-msg whose children are .lf-read-boundary, .lf-msg-body.

The underlying problem is placement, not the condition that computes it: a boundary is a fact about the seam between two messages in the rendered sequence, but it is rendered from inside MessageView, which does not own where its own header goes. Emitting it in thread-card.js's ranges render — a sibling before range.node, and before each node in an expanded summary's list — puts it above the whole message in both cases and retires the third positional parameter threaded through present to reach one call site. Adding a second emission site for the hoisted branch would leave the marker in two places instead.

Both new cases in test_render_read_state.py step around this: the first roots its thread with author="user", and the second resolves the thread, which leaves headerActions null so nothing is hoisted. A case with an agent-authored, unresolved root would pin the placement.

Separately, the branch also carries notes/layout-model.md (245 lines) and a new TODO Layout section, which the description does not mention. Merging squashes with PR_BODY as main's commit message, so that history would record the layout proposal with no description at all — worth either a paragraph here or its own PR.

@max-sixty max-sixty closed this Sep 23, 2026
max-sixty added a commit that referenced this pull request Sep 23, 2026
Returning to a Thread now shows where each visible run of current unread
messages starts. A quiet closing separator distinguishes later turns,
and a collapsed summary shows how many unread originals it covers. The
markers derive from the existing exact-version unread reading, so edits
and Mark thread read update them without another state store. The
separator sits above the complete turn, including an agent-authored root
whose header the card hoists beside its actions.

The gallery and public Thread reference describe the behavior. Browser
tests cover mixed read/unread versions, edited content, collapsed and
expanded summaries, resolved-thread First unread navigation, the hoisted
agent root, and keyboard marking with draft and focus retention. Focused
browser, corpus-generation, runtime, and pre-commit checks pass. A
matched startup comparison kept the request count at 209; the boundary
uses the existing Thread renderer and styles before first presentation
so it appears as soon as Threads opens.

This replaces #970 with a clean branch from main; the earlier PR also
inherited an unrelated local layout proposal.

> _This was written by Codex on behalf of max-sixty_
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