Skip to content

fix(desktop): outline froze on the first click; panel opens as a desktop tool starts - #189

Merged
httpsphl merged 1 commit into
mainfrom
fix/desktop-outline-hang
Oct 5, 2026
Merged

httpsphl merged 1 commit into
mainfrom
fix/desktop-outline-hang

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 5, 2026

Copy link
Copy Markdown
Owner

Two problems the owner reported after installing #187/#188:

  • The border stayed at the window's old place, and a gray "Botloft background service is not responding" box was stuck over the desktop.
  • The desktop panel never opened by itself.

Cause 1: a lock waiting on itself (#187)

outline_cursor::follow held the MOTION mutex, then called moving(), which locked MOTION again. That deadlocked the outline's thread the first time the bot acted at a point. After that:

  • the outline stopped following its window;
  • Windows replaced the hung layered window with its opaque gray ghost.

Fix:

  • moving() is now computed from the guard already held (still()).
  • DisableProcessWindowsGhosting() on the outline thread, so a busy overlay can never cover the screen in gray.
  • A unit test calls follow on a thread with a 2 s timeout; this would have hung before.
  • The real-window outline test now also draws the cursor before moving the window.

Cause 2: the panel opened late, after the first desktop.changed

useFollowBot now also opens the desktop panel when a desktop_* tool starts running in the chat (chat.item, status running), with the same 2-minute rule. App test added.

Checked live on this PC (owner away; dev daemon, Haiku bot with the whole desktop):

  • the panel opened by itself;
  • the outline drew in the bot's color, with the "Scout •••" cursor while typing;
  • after the window was moved mid-turn, the outline followed it and the cursor glided to Save, with no ghost and no freeze.

The screenshots needed a dev copy without WDA_EXCLUDEFROMCAPTURE, which keeps the overlays out of captures.

Incident during the test

Windows 11 Notepad reuses one window with tabs. The bot typed into the owner's unsaved note in the active tab. Value.SetValue clears Notepad's undo, so Ctrl+Z could not help. I restored the text from the bot's own reading of it, which was 46 characters and not clipped. The only unknown is whether the original separators were line breaks or spaces. The owner has been told. From then on, tests used a test-only app.

…pens as a tool starts

The cursor's follow() held its lock and then called moving(), which took
the same lock again: the outline's thread waited on itself forever at
the bot's first action with a point. The outline stopped following its
window, and Windows turned the frozen window into a gray "not
responding" ghost over the owner's screen. moving() is now worked out
under the lock already held, and the daemon turns off window ghosting so
a busy outline can never cover the screen.

The desktop panel also opens as soon as a desktop tool starts in the
chat, not only after the first reading or action came back.
@httpsphl
httpsphl enabled auto-merge October 5, 2026 02:55
@httpsphl
httpsphl merged commit 160c728 into main Oct 5, 2026
7 of 8 checks passed
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