Skip to content

test: wait for a card step's scroll before pressing the card's next step - #6843

Merged
leaf-agent merged 2 commits into
mainfrom
fix/issue-6838
Nov 24, 2026
Merged

leaf-agent merged 2 commits into
mainfrom
fix/issue-6838

Conversation

@leaf-agent

@leaf-agent leaf-agent commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

test_a_shared_passage_steps_between_single_thread_cards pressed Previous thread as soon as Next thread had focused the second thread's reply. But a step lands on its thread the way every opening does. In the same task that focuses the reply, it glides the passage into the reading band (394 px on this page), and the card moves with the page. When Playwright aimed the press before the glide ended, the press fell on <body> where the button had stood. That moved the user's place off the passage, and the card closed. This matches the call log in run 45104895190: not stable, then <body> intercepts pointer events, then element is inert, then not visible until the timeout. The test now calls scroll_settled after each step, once the reply's focus shows the glide has started, and presses the next step only then. It still asserts the same behavior.

The glide predates the run's candidate PRs (#6810, #6688). A frame trace at 017ddeccf shows the same 394 px glide after Next, and the same failure hit Linux on Nov 15 (#6048). So no change in 017ddeccf..10ac9da49 caused it.

Evidence
  • A probe that presses where Previous stood before the step, once scrollY > 300, closes the card every time. That is the failure's mechanism.
  • Without the change, the unmodified test passed 12 of 12 copies at --cpu-throttle 8 and 18 of 18 at --cpu-throttle 16 --load 4, so load alone didn't reproduce the timing here. With the change, it passed 12 of 12 at --cpu-throttle 8 and once unthrottled.
  • The glide comes from anchor-travel.js place → placeScroll → landing-scroll.js scrollIntoView → glideTo, in the same handoff that calls focusForNavigation on the reply.

One product question remains open, and this PR doesn't decide it. Opening this card from the margin marker leaves the page still. Stepping to another thread at the same passage, which is already in view, glides the page 394 px. The card moves with the page, so a pointer that presses Next and then Previous misses Previous.

The stills below are from the test's page at 1440×900, with two threads on the bracket question. In both alternatives the second thread is open and its reply has focus.

Before the step: thread 1/2, page at scrollY 0 After Next, current: the page glides to scrollY 394 After Next, alternative: the page stays at scrollY 0
Before the step Current: the page glides Alternative: the page stays
Previous stands at y = 689 Previous moves to y = 295. The passage sits in the reading band Previous stays at y = 689, under the pointer. The passage and card stay low in the window, where they already were

The alternative is a mock-up. It runs the current step and then scrolls the page back to where it stood. It is not a built behaviour. Captured with leaf-dev probe and a journey that presses Next and records scrollY and Previous's box.

Closes #6838 — automated triage

test_a_shared_passage_steps_between_single_thread_cards pressed Previous as
soon as Next had focused the second thread's reply. A step lands on its
thread as every opening does: in the task that focuses the reply, it glides
the passage into the reading band, 394 px on this page, and the card rides
the glide. A press that Playwright aimed before the glide ended fell on the
page where Previous had stood, which took the user's place off the passage
and closed the card. CI run 45104895190 showed that sequence: not stable,
<body> intercepts the press, inert, then hidden. The test now waits for the
scroll to settle after each step before pressing the next one. The behavior
it protects is unchanged.

Closes #6838
@max-sixty

Copy link
Copy Markdown
Owner

@leaf-agent The scroll-settle test change can stand independently, but the PR body leaves an interaction choice open: whether stepping to another thread at the same visible passage should glide the page. Root AGENTS.md requires a picture for a UI option left to the maintainer, including one in a PR body. Please add a labeled side-by-side sketch or still pair showing the current 394 px glide and the alternative that leaves the passage and controls in place, so Max can judge that choice. The test fix itself need not change.

This was written by Codex on behalf of max

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

This head's red test job comes from main, not from this PR. Its only failure is tests/model/test_interact_layer.py::test_every_skill_file_reads_in_one_command, which fails because skills/leaf/references/module-input.md is 30,002 characters, over the 30,000 cap. That test fails the same way on origin/main (54d6820), and #6826 is already fixing it. This PR changes only tests/browser/margin/test_opening_threads.py, and in this run test_a_shared_passage_steps_between_single_thread_cards, the test it claims to fix, passed. So under the repository's CI landing policy the red doesn't block landing. The maintainer's request above for pictures of the open glide choice is still being handled separately.

@leaf-agent

Copy link
Copy Markdown
Collaborator Author

The PR body now pictures the open choice. It shows three stills from the test's page at 1440×900: before the step, after Next as it works now (the page glides to scrollY 394 and Previous rises from y = 689 to y = 295), and the alternative where the page stays still and Previous stays under the pointer. The alternative is a mock-up. It runs the current step and then scrolls the page back, and nothing in the code implements it. The test change is the same as before.

@leaf-agent
leaf-agent merged commit 147b3fa into main Nov 24, 2026
7 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-6838 branch November 24, 2026 06:57
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.

test_a_shared_passage_steps_between_single_thread_cards: Previous thread button becomes inert and hidden after Next

2 participants