Skip to content

Polish thread controls and reaction picker - #441

Merged
max-sixty merged 3 commits into
mainfrom
codex/thread-ui-polish
Sep 8, 2026
Merged

max-sixty merged 3 commits into
mainfrom
codex/thread-ui-polish

Conversation

@max-sixty

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

Copy link
Copy Markdown
Owner

Resolve now belongs to the thread rather than its first message, so the control aligns with the quoted passage in the upper-right corner. Quiet dividers separate adjacent threads without restoring full card borders.

The message reaction picker is now a compact floating palette. Opening it leaves the thread and every following thread in place; persistent reactions still occupy their own row after selection. The scroll holder also accounts for Chromium clamping a shrinking list, so resolving a thread does not move another thread under the pointer.

Tested with the 910-test everyday suite, all 77 conversation browser tests, focused reaction-picker and inline-thread browser coverage, pre-commit, narrow and wide light/dark browser sweeps, and a context-blind usability pass. The existing reaction-fold focus flake reproduced on origin/main under the same repeated-test conditions.

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.

Both findings are in the inline half (theme.css); the panel half lands as described.

The sibling divider goes inside the thread's own focus surface, and an existing test says it may not. .lf-conversation-thread + .lf-conversation-thread now adds padding-top: var(--sp-3) and border-top to the thread box itself — the same box that carries the :focus-within outline at -2px. test_inline_thread_surface_has_room_without_focus_reflow in tests/test_render_navigation.py pins exactly that ("a later inline thread inherited an asymmetric current edge" / "a sibling separator remained inside the current region"). It passes at the merge base and fails deterministically at this head:

uv run pytest tests/test_render_navigation.py::test_inline_thread_surface_has_room_without_focus_reflow -q -n0
AssertionError: a later inline thread inherited an asymmetric current edge:
  {'padding': ['16px', '4px', '4px', '4px'], 'borderTop': '1px'}

PR CI never sees this — test_render_*.py is nightly-marked, and the test job skips it — so the green check doesn't cover the file. Drawing the rule outside the thread box (a pseudo-element, or the separator on the container) keeps the divider and leaves the focus surface symmetric.

Resolve is never absolutely positioned in an inline seat. .lf-conversation-thread > .lf-resolve (0,2,0) is overridden by the later .lf-resolve.lf-icon-action { position: relative; flex: none; margin-inline-start: auto; ... } in the same sheet, at equal specificity. The panel half escapes this because chrome.css is inside @scope (.lf-chrome), where scope proximity outranks specificity; nothing scopes the inline rule. Computed position on the inline control is relative.

So the control stays in flow and takes a row of its own above the first message instead of sitting in the corner. Measured on a two-thread #jobs seat, merge base vs this head: the unresolved inline thread grows from 114.3px to 142.3px, and Resolve moves from sharing the first message's head row (resolve.top == head.top) to sitting entirely above it (resolve.bottom 492.5, head.top 496.5). inset-inline-end: var(--sp-1) also reads as a relative shift, pulling the control 4px in from the content edge rather than flush to it. The three companion declarations added alongside it are dead as a result: the first-message-head min-height and padding-inline-end, and the reaction-trigger offset whose comment says "A source-less inline thread can put Resolve and the first reply on the same row" — it never does.

The suggestion below restores position: absolute (verified: computed absolute, thread height back to 114.3px). With the divider moved out of the box it also lands at the same offset on every thread; left as padding, the absolute inset measures from the padding box and Resolve sits 12px higher on the second and later threads than on the first.

Neither is covered by a test today, which is why test_render_conversations.py and test_render_reactions.py both pass here (127 passed).

One smaller thing, no behavior change today: the move left three selectors still addressing .lf-resolve inside a message head — resolutionControl in runtime/keyboard/page.js, the receipt before argument in conversation/acknowledgments.js, and syncEdited's insertBefore target in conversation/messages.js. All three now resolve to null and happen to degrade to the same result, but they read as live structure.

Comment thread skills/leaf/assets/theme.css Resolved

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

The inline half now matches the panel half. Both findings from the previous round are verified fixed at 1fb2580a: the sibling separator is painted by an out-of-box pseudo-element in the margin gap, leaving the thread's focus surface symmetric and border-free, and .lf-resolve.lf-icon-action computes absolute, putting Resolve back in the thread's corner instead of a row of its own. Details are in the reply on the theme.css thread.

Test selection: tests/test_render_conversations.py, tests/test_render_reactions.py, and tests/test_render_navigation.py — the conversation markup, the reaction picker, and the thread-surface geometry the diff moves. 220 passed, 1 failed.

The one failure is not this branch's: test_an_inline_thread_uses_surface_focus_until_its_reply_takes_over times out waiting for .lf-margin-preview .lf-conversation-thread at rest, before the test clicks anything. It reproduces deterministically under -n0 at the merge base (37b8478f) and on current main (f38be9ed) in this environment, so it predates the branch. test_render_*.py is nightly-marked and the test job skips it, which is why nothing on either landing path has reported it.

uv run pytest tests/test_render_navigation.py::test_an_inline_thread_uses_surface_focus_until_its_reply_takes_over -q -n0
playwright._impl._errors.TimeoutError: Locator.evaluate: Timeout 30000ms exceeded.
  - waiting for locator(".lf-margin-preview .lf-conversation-thread")

@max-sixty
max-sixty merged commit 7e40310 into main Sep 8, 2026
13 checks passed
@max-sixty
max-sixty deleted the codex/thread-ui-polish branch September 8, 2026 08:52
max-sixty pushed a commit that referenced this pull request Sep 8, 2026
…ts (#444)

[#441](#441) moved Resolve out of
the first message's metadata row and into the thread's own corner. Three
nightly readings still described the old address.
[#443](#443) has since landed the
margin one on `main` — it dropped that test's `.lf-conversation-head`
reading and loosened Resolve's box to the thread's own — so this branch
now carries the two that remain.


`test_render_startup.py::test_a_thread_says_what_the_agent_is_doing_about_it`
asserted the receipt's `nextElementSibling` matches `.lf-resolve`.
Nothing follows the receipt in the head now, so the probe raised
`TypeError: Cannot read properties of null (reading 'matches')` before
it could assert anything. The case keeps the claim it was making — the
receipt is metadata on its own message rather than a full-width row —
and pins it at the new address, as the row's last element. That is what
`paintAcknowledgmentsNow` guarantees by passing `null` as the receipt's
`before` for a message head.


`test_render_navigation.py::test_inline_thread_surface_has_room_without_focus_reflow`
already said Resolve does not hang below the first inline message's row,
but that reading is vacuous on its own: a control that leaves the corner
and takes a full-width row above the head is still the thread's first
flow child, so it lands at the content top and right edge and the head
is pushed below it — the bound holds either way. The case now also
asserts `head.top < control.bottom`, which is what fails under that
layout.

Verified on the merged head: both named cases pass, and so does the
margin case this branch no longer touches. Pre-commit passes on all
three files.

---------

Co-authored-by: leaf-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Sep 8, 2026
`test_an_inline_thread_uses_surface_focus_until_its_reply_takes_over`
has been red on every complete run since a15715c, and it is the third
failure in the nightly [`ci` run on
`7e403108`](https://github.com/max-sixty/leaf/actions/runs/34217624366)
— the one #444 measured at its merge base and correctly set aside as not
its branch's. `git bisect` over `0b50e4c5…7e403108` puts it on a15715c
(`Simplify thread and reply chrome`): the case passes at that commit's
parent b094e80 and fails at a15715c, alone under `-n0`.

Two things were wrong, and the second was hidden behind the first.

**The case read the thread before the preview built one.** a15715c
added a resting-tint reading as its first act on the page, from
`.lf-margin-preview .lf-conversation-thread`. The margin preview builds
its thread when it opens one, so at rest that locator resolves nothing
and the case spent its 30s timeout there. The resting tint now comes
from the same element once the region gives the focus back, so
`pointer["background"] != resting` still contrasts a current thread
against a quiet one rather than against a value read before the thread
existed.

**Every reading after that point had never run, and one of them was
measuring a cascade collision.** a15715c's message says *Reply fields
use one focus ring instead of an accented border plus outline*, and it
set the chrome text-box rule to `outline-offset: 0` with the border
cleared under the ring. `theme.css`'s conversation rule still said
`outline-offset: 1px`, and it wins the declaration at (0,3,0) against
the text-box rule's (0,2,1) — the extra class coming from `.lf-btn`
sitting in that `:is()` list beside `textarea`. So the offset that
commit set reached every text box in the document except the reply field
it was written for, and one control shape wore the band at two offsets.

The fix is in the layer rather than the expectation. The reply is a text
box, so it takes the text box's band: the conversation rule keeps its
1px gap for the thread's buttons and summary, and the reply gets the
chrome rule's terms — ring on the border, border cleared under it —
repeated inside the shadow-carried slice.

That repeat is the fix rather than a restatement of a rule that already
reached the field. A thread an `x-thread-surface` widget seats inside
its own shadow tree reads only the theme's `lf-shadow` slice;
`runtime/chrome.css` is never adopted there, so the reply in a diff's
inline outlet never met the text-box rule at all. Measured on the diff
fixture before this change, that field wore its resting `--border-2`
border (`rgb(69, 63, 54)` on the dark scheme) *and* the 2px accent ring
1px outside it — exactly the accented border plus outline a15715c
removed from the document copy. It now wears the same single band as the
panel's copy, at `offset: 0px` with the border transparent.

`test_a_diff_surface_keeps_the_complete_thread_lifecycle_inline` gained
the reading that pins the shadow half: it focuses the reply in both
seats and asserts the two bands are identical. Reverting `theme.css`
alone fails it on all three fields — offset, border, and the ring's own
name.

Verified: `tests/test_render_navigation.py`,
`tests/test_render_anchors.py`, and `tests/test_render_conversations.py`
green in full (253 passed); every `-k ring` case across the nightly
suite green (91 passed), including the corpus ring floor; the everyday
suite green (904 passed, 6 skipped); pre-commit clean on the three
changed files. The margin and startup failures in the same nightly run
are #444's.

<details><summary>Bisect and the state the preview is in at
rest</summary>

```
0b50e4c  Simplify Leaf state, serving, and browser initialization (#429)   pass
c20aaa5  Use standard UI and keyboard terminology (#431)                   pass
b094e80  Keep go-to hints stable across filters                            pass
a15715c  Simplify thread and reply chrome                                  fail
f38be9e  Bundle the published Leaf runtime (#442)                          fail
7e40310  Polish thread controls and reaction picker (#441)                 fail
```

Probing `INLINE_PAGE` with one anchored mark, on `7e403108`:

```
AT REST      .lf-conversation-thread count: 0   .lf-margin-preview count: 1
AFTER CLICK  background: color(srgb 0.967373 0.969412 0.96502)   (thread focused)
AFTER BLUR   background: rgba(0, 0, 0, 0)       (thread still built, preview still open)
AFTER ESC    preview hidden, thread retained
```

</details>

<details><summary>The reply field's band before and after, in both
seats</summary>

Read with `getComputedStyle` on the focused reply textarea. The
light-DOM reading is the inline thread the margin preview builds; the
shadow reading is the same shared Thread view seated in `lf-diff`'s
outlet, which adopts only the theme's `lf-shadow` slice.

| seat | before | after |
| --- | --- | --- |
| light DOM | `offset: 1px`, `border: transparent`, `--lf-here-ring:
conversation` | `offset: 0px`, `border: transparent`, `--lf-here-ring:
text-box` |
| widget shadow tree | `offset: 1px`, `border: rgb(213, 207, 194)` light
/ `rgb(69, 63, 54)` dark — the resting `--border-2` — `--lf-here-ring:
conversation` | `offset: 0px`, `border: transparent`, `--lf-here-ring:
text-box` |

The panel's own reply field was already the second column and did not
move; it is the control the new assertion compares the inline copy
against.

</details>

---------

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