Skip to content

Mark a conversation read only while the person can see it, and whenever a run in it ends - #2192

Merged
guidovizoso merged 3 commits into
mainfrom
mark-read-when-seen
Nov 25, 2026
Merged

guidovizoso merged 3 commits into
mainfrom
mark-read-when-seen

Conversation

@AlemTuzlak

Copy link
Copy Markdown
Contributor

Why

The server is about to tell a person's phone about an answer they asked for and walked away from: a reply, a failure, or a card waiting on them that is still unread 45 seconds after the run ended. "Unread" is what this app says through mark-read, and two things made it say the wrong thing:

  • Read while nobody looked. A conversation open in a window behind others, or in OpenBot Desktop while the person was away from the computer, was marked read as soon as the reply arrived. The person who walked away was never told.
  • Unread while the person watched. Only activity the roster heard about marked the conversation read. A failed run, a card with no words, and any run in a task's thread (which has no row in the list) left the conversation unread while the person was looking at it. They would get a push about what they had just watched.

What changes

  • useMarkOpenChannelRead marks the conversation read only while OpenBot is in front of the person (inSight: page visible and window focused). It marks it once they come back.
  • runEndedIn(channelId): the chat reports every run end in the conversation, however it ended (onRunFinishedEvent and onRunErrorEvent). The open conversation is then marked read when the person can see it, whether or not the roster has a row for it.

The in-sight half is the same change already on the mobile branch. Landing it on main lets the server pin it.

Tests

app/tests/mark-open-channel-read.test.tsx has three new cases:

  • a conversation behind another window stays unread until the window comes back;
  • a run that ends in a conversation the list doesn't hold is marked read;
  • a run that ends while the person is away is marked read once they return, and not before.

All 5 tests pass. tsc and Biome are clean, and the channel-chat tests pass.

🤖 Generated with Claude Code

…er a run in it ends

A conversation open in a window behind others, or in OpenBot Desktop while the person is away, was
marked read the moment a reply arrived, so the server could not tell an answer they walked away from
from one they watched. It is now marked read only while OpenBot is in front of them, and once they
come back.

A run's end marks the open conversation read too, however it ended. Before, only activity the
roster heard of did: a failed run, a card with no words, and any run in a task's thread (which has no
row in the list) left the conversation looking unseen while the person watched it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@guidovizoso guidovizoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The change does what it says: read only while OpenBot is in sight, and on every run end the chat sees, with or without a row in the roster. The three new tests cover those cases.

Two gaps inline, both about a person being told on their phone about something they are reading, or not told about something they did not see.

Smaller notes, no change needed:

  • An answered run now sends two mark-reads (the run end, then the roster hearing the reply), and each intermediate run that ends on a browser tool sends one. Harmless, only more requests.
  • CI: format, lint, types fails on two SVGs under docs/assets, which this PR does not touch.

Comment thread app/src/lib/channels/mark-read.ts Resolved
Comment thread app/src/lib/channels/mark-read.ts Resolved
AlemTuzlak and others added 2 commits November 25, 2026 14:02
… at the moment of marking

From review:

- An open marks the conversation read even when the roster says nothing is unseen. A run that
  ended while the person was in another conversation (a failed one, one that ended on a card with
  no words, any run in a task's thread) never reaches the roster, so reopening it left it unread
  while they read it. This also covers a route that switches conversation without remounting.
- Whether OpenBot is in sight is asked when the mark is made, not taken from the last focus event.
  With focus inside a frame, switching apps sends this window nothing. A mark owed while out of
  sight checks again every second.
- The mark on open waits for the roster's first page, so a page fetched before the mark can't
  report the conversation unseen and mark it a second time.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@AlemTuzlak

Copy link
Copy Markdown
Contributor Author

Thanks, Guido. Both notes are addressed in ef6b671. Lint on this PR also failed on the README's architecture SVGs from #2190, which have no title element; 68c2565 gives them one, so this PR's CI can go green.

@guidovizoso guidovizoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Both notes are fixed in ef6b671: every open marks the conversation read while it is in sight, and the marking asks inSight() itself, with the re-check covering a return that fires no event. The new tests cover each case and CI is green.

Two small things I noticed, neither needs a change here: each mark-read also refetches the attention query on success, so every open and run end now costs one extra read, and the one-second re-check runs for as long as a mark is owed in a background window.

@AlemTuzlak

Copy link
Copy Markdown
Contributor Author

Thanks for the approval, Guido. Both threads are resolved and CI is green, but my account can't merge into main. Could you, or someone with merge rights, squash-merge it? openbot-backend #642 moves its openbot pin to the merge commit right after.

@guidovizoso
guidovizoso merged commit 60b841d into main Nov 25, 2026
23 checks passed
@guidovizoso
guidovizoso deleted the mark-read-when-seen branch November 25, 2026 13:28
davidmckayv added a commit that referenced this pull request Nov 25, 2026
Unreleased gains, from the code of each change since rc.5 (OpenBot main
a9ba3fe to 25d50a1, and the server since rc.5's): a Bot's work folded with a
shimmer on the running step (#2201), long tasks that keep going instead of
stopping as too long (#2184), a push to your phone when a Bot finishes while
you're away and a conversation marked read only while it's seen (#2192), an
invited address with no account signing up (#2187), the version on screen on
OpenBot Cloud (#2197), Setup's model row as the reader's AI (#2185), Admin's
managed-updates and favicon requests (#2186), the screen guide's Open apps and
Every Bot, the pre-upgrade backup of every database with a restore command,
and the API's invitationSignUp and setup checklist wording.

release-policy.json: fromVersions adds v1.2.0-rc.5 and database.from adds its
last migration, 0181_organization_ai_sign_in_credentials.
davidmckayv added a commit that referenced this pull request Nov 25, 2026
Unreleased gains, from the code of each change since rc.5 (OpenBot main
a9ba3fe to 25d50a1, and the server since rc.5's): a Bot's work folded with a
shimmer on the running step (#2201), long tasks that keep going instead of
stopping as too long (#2184), a push to your phone when a Bot finishes while
you're away and a conversation marked read only while it's seen (#2192), an
invited address with no account signing up (#2187), the version on screen on
OpenBot Cloud (#2197), Setup's model row as the reader's AI (#2185), Admin's
managed-updates and favicon requests (#2186), the screen guide's Open apps and
Every Bot, the pre-upgrade backup of every database with a restore command,
and the API's invitationSignUp and setup checklist wording.

release-policy.json: fromVersions adds v1.2.0-rc.5 and database.from adds its
last migration, 0181_organization_ai_sign_in_credentials.
AlemTuzlak added a commit that referenced this pull request Nov 26, 2026
Conflicts:
- mark-read.ts: main's version, the reviewed form of what #2188 carried early (#2192).
- mobile-build.yml: mobile's version (#2203: production builds and store upload) over main's
  preview-only one (#2180).
- app-guidelines.md: mobile's rows for OpenBot Mobile, plus main's web manifest row.
- client-version cases and the mobile test: main's 9.0.0 minimums, with mobile's name OpenBot Mobile.
- CHANGELOG.md: both entries.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants