Skip to content

fix(quick-message): Open the pill on hover whatever Chat is doing - #1697

Merged
omesser merged 13 commits into
mainfrom
fix/qm-pill-ignores-chat
Oct 21, 2026
Merged

omesser merged 13 commits into
mainfrom
fix/qm-pill-ignores-chat

Conversation

@omesser

@omesser omesser commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Why

The quick-message pill's hover was gated on the Instance's Chat window state. The Shell pushed that state to every overlay on every frame so a hover could be suppressed while Chat was up. Two composers excluded each other, and a hover did different things depending on a window the user may not be looking at.

What changed

The pill now depends only on the pointer, its own state and its dismissal latch. The placement wire carries no Chat status, and the overlay no longer keeps a copy of it. chat_is_up, the placement field and the machine's chat state are gone. The test-only MinimizedChats::hides query had no caller left, so it and its two tests went with them. Minimization is still tracked for its focus level and its log lines.

A Summon or Send still dismisses the pill and holds it down until the pointer leaves. That is a pointer rule, not a Chat rule.

ADR-0039 records the decision, the rejected alternatives and the cost the gate used to hide: an opening pill takes the keyboard, so a pointer resting on the Character while someone types in Chat moves their next word to the pill. It also corrects the stuck-hover cost the first draft over-stated, since #1565's Shell-driven enter and leave clears the latch whenever the pointer leaves, stuck :hover or not. The cues playground, the landing playground and the verify-fidget guide carry the new rule. Scenario copy that said a minimized Chat lets the pill back was corrected.

Deliberately not done: no replacement Chat signal. The caret move above is the accepted cost.

Rebased onto #1694: the remembered key window drains only while holding, as its pid does, so a Stay keeps both for the next close instead of leaving -1 with no window.

The macOS keyboard fix

Live verification found a pre-existing focus bug, on main too: with only the built-in Retina display, a sprite click left the overlay's web view holding the keyboard, so the next keystroke never reached TextEdit. canBecomeKeyWindow was already refusing, but AppKit still ran NSPanel's default becomeKeyWindow after tao keyed the panel. The closed overlay now skips that default; a pill still runs it.

The new Chat-open scenario step also exposed the hand-back: when a pill opened over Fidget's own Chat, the app remembered no previous app and stepped aside on close. It now remembers the key window and returns the keyboard to Chat, and the scenario waits for the app: hand back window trace line so a close that stepped aside instead fails the run.

On Windows and X11 the same close returns the keyboard to Chat or Settings. A pill that moves to another display does not remember the overlay it left. Wayland has no X window to remember, so the compositor keeps the keyboard.

How to verify

  • scripts/scenarios/manual-only/chat-close-pill-type.sh — three passes on the built-in Retina display at f0412322, including hover and typing with Chat open and the app: hand back window line. Not rerun after the later commits.
  • scripts/scenarios/manual-only/chat-close-pill-type.win.ps1 case 8 opens Chat and requires hand back Restore to name Chat's window. Not run on a Windows desktop.
  • scripts/scenarios/manual-only/pill-two-displays.sh matches app: hand back Restore holding=true remembered=<pid> window=0 alive=true. A sample of that line matches both regexes. The live two-display run is still open.
  • The verify-fidget guide's X11 "Chat open" step is unrun. Open.
  • At 2184e016: cargo test -p fidget --bin fidget -- a_stay_keeps a_hand_back_spends the_overlay_or_no_window passed, and cargo clippy -p fidget --all-targets -- -D warnings was clean on macOS.
  • Earlier cargo test -p fidget --bins on this branch, before the merge of main, passed 932 with 7 ignored.

— OpenCode agent, on @omesser's behalf.

The verify section above was refreshed at 2184e016.

— Grok Build, on @omesser's behalf.

At f65c021e: X11 skips every overlay when a pill remembers the front. cargo test -p fidget --bins passed 933 with 7 ignored, and cargo clippy -p fidget --all-targets -- -D warnings was clean on macOS. The X11 module is not compiled on this machine; Linux CI typechecks remember_active_window.

— Grok Build, on @omesser's behalf.

At aa2c1155: Windows and X11 both ask is_overlay_label, which uses the same prefix as overlay_label. cargo test -p fidget --bins passed 934 with 7 ignored, and clippy was clean on macOS.

— Grok Build, on @omesser's behalf.

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft Open

Tip: 3346d3ac

What changed

  • Pill ignores Chat: Hover opens the pill whether Chat is open, minimized or closed. chatting, chat_is_up, setChatOpen and MinimizedChats::hides are gone.
  • Latch: A Summon or Send still holds the pill down until the pointer leaves, and closing Chat no longer clears that hold.
  • Docs: ADR-0039, the verify guides, the playgrounds and the scenario copy describe the new rule.

What is wrong

  • The pill now takes the caret from Chat: An opening pill calls overlay_request_focus. If the pointer rests on the Character for the hover delay while the user types in Chat, keyboard focus moves to the pill. The old gate prevented that. ADR-0039 lists two drafts as the cost but leaves out the focus move.
  • No live run: Dropping the reset on Chat close from #1489 changes the path where you Summon, close Chat, then hover, and nothing ran that path on screen. chat-close-pill-type.sh covers it on macOS, and this PR edits its copy. Nobody has run the new X11 "Chat open" verify step yet.

Soft-FIX

  • Add the focus move to ADR-0039's Consequences so the tradeoff is on record.
  • Get a live chat-close-pill-type pass on macOS at this tip.

Non-blocking

  • The ADR overstates the stuck-hover cost: Since #1565, every frame calls enterSprite or leaveSprite from the Shell's hit test. The hold clears when the cursor leaves, even if :hover sticks.

Verified on this box: the quick-message JS suites pass 65 of 65. The bin unit tests pass except four Secret Service and GTK settings tests that need a desktop session. An X11 live probe stalled before the first frame, so live behavior is still unproven.

— Cursor agent (Architect), on @omesser's behalf.

@omesser
omesser force-pushed the fix/qm-pill-ignores-chat branch from 9e37c21 to e3a3b7f Compare October 20, 2026 12:28

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft Open

Tip: e3a3b7fd

What changed

  • Closed overlay skips becomeKeyWindow: The panel class now runs NSPanel's default only while a pill is open, so a sprite click no longer leaves the web view holding the keyboard.
  • Hand-back to Chat: A pill that opens over Fidget's own window remembers that window's number, and closing the pill makes it key again.
  • Scenario: chat-close-pill-type.sh adds a pill step with Chat open. It also waits for TextEdit's text area through a new ax role command, and for Fidget to log the sprite click before typing.

What is wrong

  • ADR-0039 still leaves out the caret move: The new sentence covers closing a pill over Chat, not opening one. If the pointer rests on the Character while the user types in Chat, the keyboard still moves to the pill, and Consequences doesn't say so.
  • Nothing asserts the hand-back to Chat: After the chat-open Escape, the scenario only waits for the close line, then sets Fidget frontmost and sends Cmd+W. A pill that stepped aside instead would most likely pass too, so the new window path has no live proof.
  • No two-display run: The becomeKeyWindow skip runs on every display, and the PR body says the DELL rerun is still pending.

Soft-FIX

  • Add the caret move to ADR-0039's Consequences.
  • On the chat-open Escape, wait for the app: hand back window trace line, which FIDGET_TRACE_BUBBLE=1 already prints in this scenario, not just the close line.
  • Run chat-close-pill-type on two displays at this tip.

Non-blocking

  • Conflict with #1694: Both PRs rewrite the FRONT_BEFORE_PILL swap in hand_back_keyboard. Whichever lands second should drain FRONT_WINDOW_BEFORE_PILL only while holding, as #1694 does for the pid. Otherwise a Stay keeps -1 with no window, and the next close steps aside to nothing.

Verified on this box: the scenario passes bash -n and shellcheck. The macOS code can't build here, so live proof rests on the author's three single-display passes.

— Cursor agent (Architect), on @omesser's behalf.

Chat's window state was pushed to every overlay each frame so a hover could be
suppressed while Chat was up. The pill now depends only on the pointer, its own
state and its dismissal latch; the placement wire carries no Chat status.

A Summon or Send still holds the pill down until the pointer leaves, which is a
pointer rule rather than a Chat rule.

Docs, the cues/playground pages and the verify-fidget guide carry the new rule.
A closed overlay still ran NSPanel's becomeKeyWindow default after tao keyed it, so on the built-in display a sprite click left the web view holding the keyboard. Skip that default while no pill is open.

When the pill opens over Fidget's own Chat, remember the key window so closing the pill returns the keyboard to Chat instead of stepping aside. The chat-close-pill-type scenario now leaves Chat open for a pill, and waits for TextEdit's text area before typing.
… Chat

The opening pill's caret move was the one cost ADR-0039 left out: a pointer
resting on the Character while someone types in Chat moves their next word to
the pill. The consequence now says so, and the sticky-hover cost the old text
claimed is corrected against #1565's Shell-driven enter and leave.

The chat-open step now waits for the `app: hand back window` line, so a close
that stepped aside instead of returning the keyboard to Chat fails the run.

Rebased onto #1694: the remembered window drains only while holding, as its
pid does.
@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Follow-up at f0412322

Addressed the two Soft-FIX findings and the #1694 conflict.

Live: chat-close-pill-type PASS 3 consecutive runs at this tip on the built-in Retina display (one display), with app: hand back window holding=true window=680 logged at the chat-open close. Unit suites: 64/65 JS (1 skipped), 928 bins, 625 + 23 core, clippy clean, pre-commit green.

Still open: the two-display rerun after the rebase (this box has one display) and the X11 "Chat open" guide step (no X server).

— OpenCode agent, on @omesser's behalf.

The repository's comment bar is three lines. The becomeKeyWindow note, the
hand-back drain note and the playground cue note now fit it; the history they
carried is in the pull request.

The ADR states the latch rule at decision level rather than narrating the
frames that implement it, and names the gone-window case beside the hand-back
to Chat.
omesser

This comment was marked as outdated.

@omesser
omesser marked this pull request as draft October 21, 2026 17:17
Windows remembered only another app's window, so a pill opened over Chat
stepped aside on close. It now remembers every foreground window except
the overlay. The macOS choice of which window to restore lives in
pill_focus, with the Stay and gone-window cases beside it.
The bool hand-back still means the same thing on every OS. The scenario
banner no longer names the commit that timed the earlier pass.
@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Follow-up at b7364a81

Addressed the Soft+Hard fix list on b290cf68.

  • Windows remembers Chat. A pill remembers every foreground window except the overlay, so closing it over Chat or Settings returns the keyboard there. the_overlay_or_no_window_is_never_remembered covers Chat, the overlay, and no window.
  • The macOS window choice is plan_hand_back. A hand-back over Chat restores that window, a Stay keeps the app and the window, and a gone window steps aside. Fidget's own window is a window number. Pid -1 is gone.
  • ADR-0039 names Wayland as the OS that still leaves the keyboard with the compositor. macOS, Windows and X11 return it to the window that was in front.
  • chat-close-pill-type.win.ps1 case 8 opens Chat and requires the Escape hand-back to name Chat's window.

cargo test -p fidget --bins passed 932, with 0 failed and 7 ignored. Clippy and pre-commit are clean. Case 8 has not been run on a Windows desktop.

— Grok Build, on @omesser's behalf.

@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Follow-up at 4076eebf

Merged main after #1738 and #1748. Git followed the scenario move, and case 8 is now in scripts/scenarios/manual-only/chat-close-pill-type.win.ps1. The verify-fidget guide points at that directory.

— Grok Build, on @omesser's behalf.

Linux and Windows clippy build the bin without the overlay panel, so the
plan looked unused.
omesser

This comment was marked as outdated.

@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Follow-up at 85a79c98

Ubuntu and Windows clippy failed because plan_hand_back is only called from the macOS overlay panel. Those items are now allowed on the other hosts, the same way hand_back already is off Windows.

— Grok Build, on @omesser's behalf.

omesser

This comment was marked as outdated.

omesser

This comment was marked as outdated.

omesser

This comment was marked as outdated.

A pill that moves to the other display was remembering the overlay it
left. Windows now skips every overlay and still remembers Chat. The
macOS close stores whatever pill_focus says to keep, and the two-display
trace accepts the window field.
@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Follow-up at 2184e016

Addressed the gate on 85a79c98.

  • Windows skips every overlay when a pill remembers the front window, and still remembers Chat. the_overlay_or_no_window_is_never_remembered covers the other display's overlay.
  • remembered_after says what a Stay keeps and what a hand-back spends. The macOS close stores that result.
  • pill-two-displays.sh matches the trace line that now includes window=0.
  • hand_back is allowed only on macOS, where it is unused. X11 still calls it.

X11 still skips only the overlay that asked. That hole is older than this pull request.

— Grok Build, on @omesser's behalf.

omesser

This comment was marked as outdated.

@omesser
omesser marked this pull request as ready for review October 21, 2026 18:03
…front

X11 compared the active window with the overlay that took the keyboard, so the overlay on the other display could be remembered. It now skips every overlay, and Chat is still remembered.
@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

X11 now skips every overlay when a pill remembers the front, the same rule Windows already used. Chat and Settings are still remembered. Wayland still has no X window to remember. f65c021e.

— Grok Build, on @omesser's behalf.

omesser

This comment was marked as outdated.

Both remember paths ask is_overlay_label, which uses the same prefix as overlay_label.
@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Windows and X11 now share is_overlay_label, next to overlay_label. Handle mapping stays per platform. aa2c1155.

— Grok Build, on @omesser's behalf.

@omesser omesser left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soft+Hard — tip aa2c1155 — Cleared

Axis Verdict
Soft Pass
Spec Pass (provisional)
Hard Pass
Total Cleared

This push takes the one item from my gate at f65c021e. Nothing is open.

Prior items

  1. The overlay list was built twice (Soft): fixed. OVERLAY_PREFIX now sits next to overlay_label, which builds the label from it, and is_overlay_label is the one predicate both hand-backs call: overlay_request_focus in main.rs (Windows) and remember_foreground in platform.rs (X11). Handle mapping stays per platform, as asked. Outside tests, no production code spells out "overlay-" any more. The macOS-only dead_code allow on is_overlay_label is right, since macOS doesn't call it outside tests.

Soft — Pass

  • The new test an_overlay_label_is_the_prefix_chat_and_settings_do_not_share checks that overlay labels match and that a Chat label and settings don't, so a label-scheme change that breaks the predicate fails here. The delta is otherwise just the two call sites switching to it.

Spec — Pass (provisional)

  • No behavior change in this push, so ADR-0039 and the PR body still match the code.
  • Windows case 8, the macOS two-display run and the guide's X11 "Chat open" step still haven't run on real desktops. They're manual-only, so they aren't merge conditions, and Spec stays provisional.

Hard — Pass

  • Ran on this box at the tip: cargo test -p fidget --bins passed 927, including the new label test and the_overlay_or_no_window_is_never_remembered. I skipped the tests that need a desktop session (Secret Service and GTK double-click settings), same as earlier gates. cargo clippy -p fidget --bins -- -D warnings is clean. This box compiles the X11 call site.
  • CI at the tip: build passed. ubuntu, windows, macOS and renderer were still running when I gated. This clear depends on the windows job, the only one that compiles the Windows call site.

Earlier reviews

The Soft Open reviews from Cursor agent (Architect) at 3346d3ac and e3a3b7fd are unchanged. Their two-display rerun is still a live hardware follow-up, not a merge condition.

Fix list

Fix list empty.

— Cursor agent (P. Architect), on @omesser's behalf.

@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

The live runs the last gate left provisional are not filed on an issue. This pull request closed none.

  • macOS, two displays. scripts/scenarios/manual-only/pill-two-displays.sh. Passed on this Mac after the merge. One sprite dragged to the other display, a pill opened on each, the last close logged app: hand back Restore holding=true remembered=73756 window=0 alive=true, and wander landed in TextEdit. Evidence: /var/folders/jv/_f59qsz50s3f5ygmv5w1xh0h0000gn/T/fidget-scenario-pill-two-displays-20261021-214614-9FZC. No issue.
  • Windows case 8. scripts/scenarios/manual-only/chat-close-pill-type.win.ps1, the Chat-open step: Escape must hand the keyboard back to Chat's window, then Chat closes. Not run. No issue. fix(windows): Hand typing back to the previous window when the quick message pill closes #1577 is closed and covers the older "hand typing back to the previous window" work, not this case.
  • X11 Chat open. The verify-fidget guide step: Summon, move the pointer off the sprite, hover again, and the pill still opens. Not run. It needs a Linux desktop. No issue. X11: a click on the sprite right after launch can leave the keyboard with Fidget #1578 is open and is a different run: a sprite click right after launch can leave the keyboard with Fidget, seen from chat-close-pill-type.x11.sh.

chat-close-pill-type.sh on macOS already passed three times on the built-in display at f0412322. No issue asks for a rerun.

— Grok Build, on @omesser's behalf.

@omesser

omesser commented Oct 21, 2026

Copy link
Copy Markdown
Owner Author

Both open live runs now pass on main.

  • Windows case 8. chat-close-pill-type.win.ps1 at 8eb8637a on DESKTOP-UQIE144: all 8 cases passed, exit 0, in 17 s. In case 8, the pill's close logged overlay: hand back Restore to 0xe0ba6 -> 1, Chat's own window rather than Notepad's, and Chat closed. An earlier attempt failed at startup ("no frame in 3 s") because a fullscreen game was running. With the game closed, Fidget was ready in about 1.9 s.
  • X11 Chat open. The verify-fidget step at 0d815fe8, on Xvfb with xfwm4: 4 of 4 runs passed, 2 with a compositor and 2 without. After a Summon, moving off the sprite and hovering again opened the pill, both while Chat was open and after it closed. A stray Poke click seen after Summon is filed as X11: a phantom click right after Summon triggers a Poke #1762.

— Cursor agent (P. Coder), on @omesser's behalf.

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.

1 participant