Skip to content

fix(gateway): keep touches from pausing a task before its background display opens - #135

Merged
DIYgod merged 1 commit into
mainfrom
fix/background-task-paused-after-touch
Nov 15, 2026
Merged

DIYgod merged 1 commit into
mainfrom
fix/background-task-paused-after-touch

Conversation

@DIYgod

@DIYgod DIYgod commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Refs #131

What happened

A touch on the phone's own screen is meant never to pause a task that works on a background display (README; takeOver only notes personAt then). But takeOver decided that by l.bg != nil, whether the display was open at that moment. It is not open:

  • while phone_connect is still opening it (a few seconds on a real phone), and
  • after the phone dropped and came back (Wi-Fi ADB drops; setOffline sets l.bg = nil and the next call opens another).

A touch in either window took the byInput path for an own-screen task: d.person = true, the task paused. Since person control belongs to the device and only Hand back clears it, the next background task (phone_connect without own_screen) also started paused, with "The person is in control…; call phone_handoff", and only Hand back in the desktop app cleared it: the state in #131.

A touch after phone_release, with no task holding the phone, does not pause anything (tested); Release ends the lease at once, so there is no lingering lease there.

Change

  • lease.background(): the task works on a background display, open or still to open (l.bg != nil || l.bgWanted && !l.bgOff). takeOver uses it, so such touches only note personAt.
  • readyScreen: when the display then fails to open and the task falls to the phone's own screen, a person who used that screen in the last minute keeps it until they hand it over, as leaveForPhone already does when an app refuses the display. Without this the fix would let an agent take a screen the person was just touching.

Unchanged on purpose: the Take over button, and a touch during a task on the phone's own screen, keep the person in control across tasks until Hand back (the issue asks that an explicit Take over never be cleared automatically).

Tests

TestBackgroundTaskAfterTouches (internal/gateway/bgperson_test.go), with a fake Android phone that has background displays:

Case Without the fix With it
touch right after release passes passes
touch with no task (also through the driver's watcher) passes passes
touch while the display opens fails: connect paused, next task paused passes
touch while the phone was away (display gone) fails: user_took_over, next task paused passes
touch while a display that fails opens (pauses, by the old path) passes: paused, the person's screen untouched
Take over with no task / during a background task paused until Hand back same
touch during an own-screen task, then a background task paused until Hand back same

extraDev gets a bgOpening hook to touch while a display opens. make check passes.

Not done

The issue's request, a Hand back control in Pinky on the Android phone, is left to the owner.

Suggested release notes

  • EN: On Android, touching the phone while an agent's task was opening its background display, or just after the phone reconnected, no longer pauses that task and the agent's next tasks until you click Hand back.
  • 中文:在 Android 上,智能体的任务正在打开后台显示器时,或手机刚重新连上时,你碰一下手机,不会再让这个任务以及之后的任务一直暂停、非要点「交还」才能继续了。

🤖 Generated with Claude Code

…display opens

A touch on the phone's own screen paused a background-display task, and
put the person in control until Hand back, whenever the task's display
was not open at that moment: while phone_connect was still opening it,
or after the phone dropped (as Wi-Fi ADB does) and before the next call
opened another. Person control outlives the task, so the next task on a
background display started paused too, and only Hand back on the
computer cleared it (#131).

A touch now counts as use of the phone's own screen for any task meant
to run on a background display, open or still to open. When the display
then cannot open and the task moves to the phone's own screen, a person
who used that screen in the last minute keeps it until they hand it
over, as when an app refuses the display. The Take over button, and a
touch during a task on the phone's own screen, still pause until Hand
back, across tasks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DIYgod
DIYgod merged commit 0326b80 into main Nov 15, 2026
3 checks passed
@DIYgod
DIYgod deleted the fix/background-task-paused-after-touch branch November 15, 2026 01:35
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