Skip to content

Open threads on their first unread reply and mark it New - #3794

Merged
max-sixty merged 11 commits into
mainfrom
unread-marking
Oct 24, 2026
Merged

max-sixty merged 11 commits into
mainfrom
unread-marking

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

On the overnight report, a long agent reply stayed unread while the short reply after it read. The thread card opened at the latest reply: the short one showed whole and was marked read, while only the bottom of the long one showed. A reply reads once all of it has been on screen (thread/read.js), so the long one stayed unread. That rule is right; where the card opened was wrong. The unread rail also broke where the card's sticky head fades the words under it.

Landing. A thread card, and now the floating panel's thread view too, opens on the first unread reply's head, or at the end when nothing is unread. Where a closed summary folds that reply away, it opens on the summary, and Next unread opens it. showReturnTurn (thread/reply-landing.js) now takes the thread and scrolls whichever box scrolls its transcript: the transcript itself on a card, the view around it in the panel. It measures from that box's content edge, below the focus-ring room the transcript's padding keeps. A turn the user sends still lands the panel at its end.

Mark. An unread reply says New beside its time (messages.js, .lf-msg-new in controls.css) in place of the 2px accent rail, picked from four candidates (rail, New divider, New in the head, tinted ground). The head sticks on a card, so New stays in view through a long reply until it reads. On a card, New keeps its whole width beside the time and doesn't take part in the head's exit animation. The lf-unread class stays.

Tests: test_a_card_opens_on_its_first_unread_reply (new) and test_a_thread_s_view_opens_on_its_first_unread_reply (rewritten from the old end-landing test) each check that New is in view on opening and that scrolling to the end reads every reply, and test_a_thread_s_view_opens_on_the_summary_holding_its_first_unread_reply checks the summary case. All three fail without the landing change. The panel test also passes in Firefox, and Firefox probes confirm the card.

This was written by Claude Code on behalf of max-sixty

max-sixty and others added 9 commits October 22, 2026 22:06
A margin card opened on its latest turn. Where an earlier unread reply was
taller than the card, the card showed the latest reply whole, which read it,
beneath the end of the earlier one, whose start stayed above the card and so
stayed unread: an unread reply above a read one. The card now opens where the
unread replies begin (`showReturnTurn`), so a long reply is read from its head
down; with nothing unread it opens on its latest turn as before. Read tracking
is unchanged: a body still reads once its whole extent has been shown.

New test: a card opens on its first unread reply, and scrolling to its end
reads both replies.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The unread-mark exploration's "New" divider stands in the gap above the
first unread reply and sets a scroll margin for it, so a card landing there
shows the divider. Drop this commit unless that candidate is chosen.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
An unread reply wore a 2px accent rail down its edge. Under a margin card's
sticky head, the band where the words fade painted over the rail, so it broke
there, and colour was its only cue. Each unread reply now says New beside its
time, as visible text a screen reader reads with the head. The tag stands with
the time rather than among the head's annotations, so a sticky head keeps it in
view through a long reply until the reply has shown whole. The user chose it
over the rail, a divider above the first unread reply, and a tinted ground.

It also rebuilds the kernel for this branch's landing change.

Tests: the card test checks each unread reply's New and that it stays stuck in
view partway down a long reply; the panel's unread test checks New instead of
the rail's border image.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A margin card's head lays its metadata out as a grid whose annotations carry
their own gap and are cut first when the row narrows. New fell into that rule,
so it stood flush against the time and could be cut. It now takes a whole-width
track after the time and a gap of its own.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/runtime/chrome.css
#	browser/styles/chrome.css
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-annotation-overlay~index.js
Since #3722 the card's transcript keeps focus-ring room above its heads in its
top padding. A first unread reply landed with its top in that room never read:
read tracking saw nothing of its first pixels, so scrolling down from the
landing could not cover them. Measure the landing from the content edge.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
# Conflicts:
#	browser/runtime/annotation-overlay/thread-preview.js
#	dist/kernel/kernel.json
#	dist/kernel/runtime/bundle-annotation-overlay~index.js
#	dist/kernel/runtime/bundle-user-intent.js
The floating panel's thread view opened at its end, offering Next unread,
so a long unread reply's head, with its New, sat above the view. It now
lands where a margin card does: the first unread reply's head at the
view's top, else its end. A turn the user sends still lands the view at
its end.

showReturnTurn now takes the thread and scrolls the box that scrolls its
transcript (the transcript on a card, the view in the panel), so both
surfaces read the first unread reply from one place.

The panel unread test now checks the view opens with the long reply's
New in view and uncovered, and that scrolling to the end reads both
replies; it no longer checks that the opening leaves an unread reply
above the view.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

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

When the first unread reply is inside a closed summary, returnTurn filters that hidden .lf-msg out and falls back to the last visible turn. The card and panel then still open past the first unread reply, with its New label hidden. test_next_unread_into_a_closed_summary_stays_under_the_press already exercises this state: Next unread has to open the fold to reveal that reply. Opening the thread needs to reveal the unread turn before choosing its landing position.

A closed summary hides the messages it covers, so an unread reply inside
one was filtered out and the card or panel landed at the latest turn,
past it. The landing now walks back from the hidden message to the
summary's checkpoint, which stands before the messages it covers, and
opens there; Next unread still opens the summary.

The panel's first-unread test wheeled 20,000px in one step, which skips
the middle of the long reply, so read tracking never saw its whole
extent and the read never came; it now steps 120px at a time, drawing
between steps. The smoke test for a sent margin reply asserted the card
opens on its latest message; with five unread agent turns it now opens
on the first.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
leaf-agent
leaf-agent previously approved these changes Oct 24, 2026
@max-sixty
max-sixty merged commit a582525 into main Oct 24, 2026
3 checks passed
@max-sixty
max-sixty deleted the unread-marking branch October 24, 2026 07:41
leaf-agent added a commit that referenced this pull request Oct 24, 2026
The [failed main
run](https://github.com/max-sixty/leaf/actions/runs/40075126204) has one
remaining test failure on current `main`:
`test_reading_a_thread_moves_nothing_in_it`. After #3794 replaced the
unread rail with a New label beside the time, marking a reply read
removes that label and narrows only `.lf-msg-meta`. The thread's content
and reading position stay fixed. This change permits that metadata width
to close while still requiring its position and height, and every other
retained element's full box, to stay fixed.

The test originally allowed metadata to close sideways in #1025. The
allowance was lost when the old card view was replaced by the panel
thread view in #3100. The run's three other failures, which expected the
former wide layout size, are already corrected by #3798 on current
`main`.

The first PR check passed its Python tests but failed pre-commit because
Ruff added a missing blank line between imports in
`tests/journeys/test_thread_titles.py`. That formatting correction is
included here; the focused `ruff-check` hook passes locally.

Verification: the read-position test failed before this change and
passes after it. All four failing cases from the main run pass locally
as six parameterized cases with `uv run pytest -q -n0`.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty added a commit that referenced this pull request Oct 26, 2026
…ard (#4178)

An unread thread reply said New in a filled accent pill (#3794), a face
no other label in Leaf wore. Unread already had a mark on every other
surface, the 6px accent dot the panel's thread list, the margin entry
and the On me mark wear, so the reply now wears that dot, and says New
only to a screen reader (`.lf-quiet`). The user picked the dot over the
pill, a tag chip and the word, and asked for it on the left where there
is room.

- **Margin card** (`annotation-chrome.css`): the gutter fits the dot, so
it hangs 8px before the author's name. The sticky head reaches into the
gutter by the dot and the head's gap and holds the dot there, so it
sticks with the name through a long reply and nothing moves when the
reply reads. The metadata gives up `position: relative`, which made it
the dot's containing block; as a flex item it still stacks over rising
annotations by its z-index.
- **Panel thread view and every other surface** (`controls.css`): only
14px separates the panel's edge from the name, too little, so the dot
stands after the time.

Probes in Chromium and Firefox put the card's dot 14px before the name,
centred on it, and still there after scrolling a long reply; the two
first-unread-reply browser tests pass unchanged.

> _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