Skip to content

fix(ucu): a tab the user may be looking at stays open, and a Dock click brings them what the agent has out of sight - #37

Draft
betoxf wants to merge 2 commits into
mainfrom
fix/the-user-gets-what-they-click
Draft

betoxf wants to merge 2 commits into
mainfrom
fix/the-user-gets-what-they-click

Conversation

@betoxf

@betoxf betoxf commented Nov 25, 2026

Copy link
Copy Markdown
Owner

An agent could close the Safari tab the user was looking at, and a click on Safari's Dock icon then brought them nothing.

What happened

On 25 November an agent showed the user its Safari tab with show, and later took that tab away to its private desktop, which closes it in the user's window. The chat's record shows five away calls in 22 minutes. In two of them the tab was the one its window showed, each time after a show.

The user then clicked Safari in the Dock, and reported that nothing happened and that the window seemed to be somewhere else. Safari opens no window at that click while it has one, and the one it had was on the agent's desktop. That part is a reconstruction: nothing logs a Dock click that brings no app forward.

What changes

  • away leaves a tab the user may be looking at. That is the tab its window shows, in a window that has tabs of the user's too, or after the agent showed them the tab. The tab stays open, and the agent goes on in a copy of its page on its desktop.
  • The page comes back into that tab. At show, or when the turn ends, the page uses the tab that stayed open if it is still at its address, so show after show leaves one tab and not a row of them. It comes into a new tab if the user went on in theirs, or if they are looking at theirs and the page has moved on. Nothing changes under their eyes unless the agent shows it to them.
  • A click on Safari's Dock icon opens the agent's page for the user too. ucu-window reports the click, with whether Safari was in front already and whether a window of it was in the user's sight. The server opens each page the chat has away in a tab of the user's own window, in front, and the agent keeps its own. Clicking again opens no second tab, and shows that one again only if Safari was in front already or no window of it was in sight.
  • A click on Chrome's Dock icon brings the chat's window to the user's screen, as show does. An empty one comes only when the user has no Chrome window in sight.
  • A click on the Dock icon of an app that is in front already, with its windows on the agent's desktop, brings them back. Nothing comes forward for such a click, so nothing did before.
  • A press that is held, moved or made with a modifier key is not a click for this: those are the Dock's menu, a drag and other commands.

The agent is told what happened in each case, in the result of its next step.

How it was validated

  • Unit tests: 14 new ones in ucu/tests/test_user_comes.py, with the stand-ins for Safari, Chrome and ucu-window. All 216 unit tests pass with this branch on main at d56e7bd.
  • Without the change: 8 of the first 12 tests failed on main's server. The other 4 are controls that pass either way. The 2 tests added after that were not run that way.
  • ucu-window compiles.

Not verified

  • Nothing ran in a real Safari, Chrome or Dock.
  • ucu-window's part was only compiled. It ignores clicks that name a sender, which every posted click does, so no test can play a Dock click. It needs one click by the user's own hand, planned as a single guided check.
  • Two chats in one browser. Each chat's ucu-window hears the click, so each opens its page. Not run.

Choices a reviewer may want to change

  • The first Dock click puts the agent's page in front even when a window of the user's own is in sight. The user asked that the click never get them nothing. In front for that case is this change's choice.
  • The tab the user gets at a Dock click is a copy by address. What the agent typed in its page is not in it.
  • close still closes a tab the user is looking at, and Chrome's hide still takes the window back while they use it.
  • A click that is released after 0.6 seconds counts as held, and is ignored.

…ck brings them what the agent has out of sight

An agent that had shown the user its Safari tab took that tab `away` again, which closed it in the user's window
while they were looking at it. A click on Safari's Dock icon then brings nothing: Safari opens no window for it
while it has one, and the one it had was on the agent's desktop.

- `away` no longer closes the tab its window shows, in a window that has tabs of the user's too or after the
  agent showed them the tab. The tab stays open, and the agent goes on in a copy of its page on its desktop. When
  the page comes back, at `show` or when the turn ends, it comes into that tab if it is still at its address, so
  show after show leaves one tab and not a row of them. It comes into a new tab if the user went on in theirs, or
  if they are looking at theirs and the page has moved on: nothing changes under their eyes unless the agent shows
  it to them.
- ucu-window reports a plain click on the Dock icon of a browser the chat works in, with whether the browser was in
  front already and whether a window of it was in the user's sight. For Safari the server then opens each page the
  chat has away in a tab of the user's own window as well, in front, and the agent keeps its own. For Chrome the
  chat's window comes to the user's screen, as `show` brings it. Clicking again opens nothing new.
- A click on the Dock icon of an app that is in front already, with its windows on the agent's desktop, brings
  them back to the user. Nothing comes forward for such a click, so nothing did before.
- A press that is held, moved or made with a modifier key is not a click for this.

The server's part has unit tests with the stand-ins for Safari, Chrome and ucu-window. No test covers ucu-window
itself, and its part was only compiled: it ignores clicks that name a sender, so it needs a click by the user's
own hand. Nothing here ran in a real Safari or Chrome.
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