Skip to content

fix: close a resolved thread's margin card over the empty reply box Send leaves - #5364

Merged
leaf-agent merged 1 commit into
mainfrom
fix/issue-5147
Nov 4, 2026
Merged

leaf-agent merged 1 commit into
mainfrom
fix/issue-5147

Conversation

@leaf-agent

Copy link
Copy Markdown
Collaborator

When an agent resolved a thread right after the user's reply in its margin card was accepted, the card stayed open with its reply editor. That is the margin-accepted case of test_reply_admission_finishes_or_restores_its_native_session, which has failed on every ci run on main since #5039. Bisecting the ten commits between the last passing run and the first failing one finds #5039.

Cause. #5039 leaves the caret in the reply box after Send. Acceptance still ends the reply's editing session. But when the agent's Resolve redrew the thread, holdThreadPlace carried the focused box to the resolved thread's reply, because mayReplyTo admitted every thread. Focusing that box fired the row's focusin, which started a new session, and a session keeps a resolved thread's card in the margin (annotation-inventory.js). So focus was opening an editing session that the user never started.

Change.

  • mayReplyTo (thread/focus.js) carries a reply box to a resolved thread only while a reply is being written there (replyIsEditing). The comment above holdThreadPlace already stated that rule.
  • The user's own edit in a reply box that has no session now starts one (save in thread/replies.js). Open threads in the panel on a phone, and seven more thread-surface fixes from a Firefox pass #5039 says the box Send leaves "counts as written in only once the user types there or comes back to it". Coming back to the box already started a session through focusin, but typing did not. With only the first change, a reply typed into that box disappeared from the screen when the agent resolved the thread, and the suite's words-left-screen watcher reported it.

Tests.

  • margin-accepted fails on main and passes with this change.
  • test_typing_in_the_box_a_send_left_keeps_its_reply_through_settlement is new. It types into the box Send left, then has the agent resolve the thread. It passes with both changes and fails when only the carry rule is applied.
  • These also pass: all of tests/browser/drafts, margin/test_card_reply.py, and threads/test_composing.py, test_agent_replies.py and test_seated_threads.py; pnpm run test:runtime (777 tests); pnpm run check:browser; and pre-commit.
  • One test in that selection fails, test_draft_editing.py::test_a_draft_uses_shared_editing_and_saves_exact_markdown_source. It fails the same way on main without this change and in main's recent ci runs.

Closes #5147 — automated triage

Since #5039 a send leaves the caret in the reply box. Acceptance ends the
reply's editing session, but when the agent then resolved the thread, the
thread pass carried the still-focused box to the resolved thread's reply
(`mayReplyTo` admitted every thread), and that focus started a new session
through the row's focusin. The session kept the resolved card in the margin,
so an editor the user had finished with stayed open.

A focused reply box now carries the user to a resolved thread only while a
reply is being written there (`replyIsEditing`), as the carry's own header
already said. The user's own edit in a box with no session now begins one,
so a reply typed into the box Send left is retained through an agent's
Resolve like any reply being written; without that, the stricter carry took
those words off the screen.

test_reply_admission_finishes_or_restores_its_native_session[margin-accepted]
failed on main from #5039 and passes again. The new
test_typing_in_the_box_a_send_left_keeps_its_reply_through_settlement covers
the typed case.

Closes #5147
@leaf-agent
leaf-agent merged commit 12d3b15 into main Nov 4, 2026
5 checks passed
@leaf-agent
leaf-agent deleted the fix/issue-5147 branch November 4, 2026 11:27
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.

Accepted margin reply leaves its native editor visible

1 participant