Skip to content

Show a paired Mac's Bot's last message, photo and unread dot - #907

Open
sambitcreate wants to merge 1 commit into
claude/project-thread-awyxuffrom
claude/project-thread-awyxuf-pr2
Open

sambitcreate wants to merge 1 commit into
claude/project-thread-awyxuffrom
claude/project-thread-awyxuf-pr2

Conversation

@sambitcreate

Copy link
Copy Markdown
Owner

Requested by sbt · project thread

Stacked on #895. Merge #895 first; GitHub then retargets this PR to main.

Problem

After #895, a paired Mac's Bot rows still differ from this Mac's own Bot rows:

  • An idle Bot shows only its name. Its last message is missing, because the host feed sends no preview.
  • A Bot with a photo shows its shape avatar. The feed lists the photo, but there was no way to read its bytes.
  • A new reply from a paired Mac's Bot shows no unread dot.

Change

PR 2 of the fix plan.

Remote protocol, revision 66 (provisional; re-claim the next free number at merge).

  • New HostFeedBot schema for snapshot.bots and bot.upsert: the Bot summary without issueCount, plus the revision-52 needsYou, failed and lastReplyAt, plus an optional preview (one line, at most 140 characters, no control or format characters).
  • parseAidenRemoteHostFeedBot checks these rows in the fixture parser. The fixture gains a bot.upsert with a preview.
  • iOS and Android contract tests move to 66. Phones don't read the host feed, so no app code changes.

Host.

  • Host-feed Bot rows now come from BotLiveProjection.summary, the cached summary the Bot list already uses. inboxSignals is removed.
  • Deliberate change: the host feed was transcript-free (Inbox follow-up, 2026-11-02). It now reads a closed Bot's transcript once per newest entry, through the existing summary cache, so every row gets lastReplyAt and a preview, not just Bots with an open feed. The plan, .memory/inbox-sidebar.md and the API doc record the change.

Desktop client.

  • New peer binary operation botAvatar → GET /bots/{botId}/avatar/{assetRevision}.
  • useRemoteBotPhoto reads a listed PNG photo once per revision, checks its type and size against the row, and shows it in the row and the remote chat title. BotAvatar takes a photoUrl.
  • Rows show the preview after Needs you, Thinking… and stop status, in the same order as local rows. The preview is the row's accessible description.
  • Unread dot: a per-device record in local storage (renderer/lib/remote-bot-seen.ts) of the newest reply each remote Bot's chat showed here. It compares only host times with each other. Replies from before the record began are not unread. Opening the chat clears the dot. The dot component is shared with local rows (BotUnreadDot).
  • Feed rows are untrusted, so the client clips the preview again and validates the photo asset.

Docs: docs/aiden-remote-api-v1.md (new "Bot row previews, revision 66" section), docs/aiden-on-the-go-remote-access.md (paired-computer Bots), docs/plans/inbox-sidebar-plan.md, .memory/bot-chat-activity.md and .memory/inbox-sidebar.md.

Screenshots

Bots sidebar with the Studio paired. Scout has a photo and is running. Jester has a reply this Mac hasn't shown. Ledger's reply was already seen. Chief of Staff waits on an approval, so Needs you shows instead of its preview.

Before (#895) After
Light
Dark

Scope

A feature (PR 2 of 5). Still to come: plan, access-request and memory cards in remote Bot chats plus load older (PR 3), Needs you on phones (PR 4), and the same Bot signals from the headless server (PR 5). The headless server's host feed doesn't send previews yet; the desktop shows those rows as before.

Verification

  • npm run type-check: clean. eslint on the touched files: clean.
  • test:bots, test:peer-hosts (184), test:remote-chat, test:bot-runtime (624): all pass.
  • test:aiden-remote minus aiden-remote-service.test.ts (which needs IPv6, missing in the cloud container): 1217 pass, 0 fail.
  • New behavioral tests:
    • Revision-66 host-feed Bot rows: fixture, mutations (long, multi-line, control characters, issueCount, false flags) and the Ajv HostFeedBot schema.
    • The host's row preview is one plain clipped line.
    • The real ChatSidebar shows a paired Mac's Bot's last message and photo, and a new reply shows a dot until its chat opens.
    • The seen record: replies from before it began are not unread, the seen time only moves forward, it survives a reload, and it keeps only the newest 200.
    • botAvatar route and binary result.
  • Screenshots come from a temporary Playwright Electron spec under xvfb with mocked peer-host IPC. The spec is not committed.

AI disclosure

Written with Claude Code.

Checklist

  • I tested these changes locally and reviewed the diff myself
  • Related docs / tests are updated where behavior, settings, or contracts changed
  • No unrelated refactors or changes are included

Generated by Claude Code

Host feed Bot rows (Remote revision 66, provisional) carry a one-line
preview and always come from the Bot list's cached summary, so every
row has its last reply time. A new peer binary operation reads a Bot's
photo avatar. The Bots sidebar shows the preview under the name, the
photo, and a dot for a reply this Mac hasn't shown yet; the remote
chat title shows the photo too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6REg8PpdXdPfTkkCKZJ
@sambitcreate sambitcreate self-assigned this Nov 24, 2026

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Important

The unread watermark can be wrong under ordinary clock skew and can advance before a reply is displayed; both should be fixed before merge.

Reviewed changes I reviewed the complete initial diff for the remote Bot row preview, photo, and unread-state feature.

  • Host projection and revision 66 — Host-feed Bot rows now carry cached summary previews and reply times under a strict HostFeedBot contract.
  • Remote avatar transport — A bounded binary peer operation reads the listed PNG avatar revision for sidebar rows and chat titles.
  • Desktop row presentation — Remote rows follow local priority ordering for Needs you, running, stopped, and preview states with matching accessibility copy.
  • Unread persistence — A new renderer-local record tracks per-host Bot reply watermarks and drives the shared unread dot.
  • Cross-client contracts and documentation — Shared fixtures, native revision checks, API guidance, plans, memory, and focused behavioral tests were updated.

Pullfrog  | ⚠️ this action is pinned to a commit SHA, which freezes the cleanup step — switch to @v0 or keep the SHA fresh with Dependabot | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using GPT Sol | 𝕏


/** A reply newer than the newest one its chat showed here, or than the record's start when it never showed one. */
export function isRemoteBotUnread(seen: RemoteBotSeen, key: string, lastReplyAt: number | undefined): boolean {
return lastReplyAt !== undefined && lastReplyAt > (seen.seenReplyAt[key] ?? seen.since);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fallback compares a timestamp from the paired host with since, which is initialized from this Mac's Date.now(). With ordinary clock skew, an ahead host marks every existing reply unread on first use, while a behind host can suppress all new dots until its clock catches up; establish the first-seen baseline in that host's clock domain instead.

Technical details
# Keep unread baselines in the host clock domain

## Affected sites
- `renderer/lib/remote-bot-seen.ts:28-29` — a fresh record seeds `since` from this Mac's clock.
- `renderer/lib/remote-bot-seen.ts:60-61` — a paired host's reply timestamp is compared against that local value.

## Required outcome
- Never compare a paired host's `lastReplyAt` with this Mac's wall clock.
- Existing replies must start read, while later reply timestamps from that same host can become unread.
- Cover both an ahead host and a behind host with independent behavioral assertions.

## Suggested approach
- Establish an initial per-host or per-Bot watermark from an observed host timestamp, or carry an authoritative host-clock baseline through the feed.

// The open Bot's newest reply is on screen, so it is not unread when the person leaves.
const open = selected ? groups.flatMap(({ host, bots }) => bots.filter((bot) => `${host.id}/${bot.id}` === selected))[0] : undefined;
React.useEffect(() => {
if (selected && open?.lastReplyAt !== undefined) markRemoteBotSeen(selected, open.lastReplyAt);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This records the feed's newest reply as seen as soon as route selection changes, but useRemoteBotSession starts an independent async read and may still have view === null, an older snapshot, or a failed read. The dot can therefore disappear for a reply the chat never rendered; advance seen state from the newest reply actually present in admitted session entries, and remove the equivalent feed-only write in RemoteBotChatView.

Technical details
# Do not mark a feed reply seen before the session displays it

## Affected sites
- `renderer/components/remote-bots-section.tsx:70-75` — selecting a route advances seen state directly from the host-feed row.
- `renderer/main/remote-bot-chat-view.tsx:142-148` — mounting the chat independently advances the same watermark before `useRemoteBotSession` has loaded.
- `renderer/lib/hosts/use-remote-bot-session.ts:20-35` — the follower is created in an effect and asynchronously reads/subscribes, so its displayed view is not synchronized with the feed effect.

## Required outcome
- Advance the watermark only to the newest finished reply actually admitted to the rendered remote session snapshot.
- A failed/slow read, an older session snapshot, or leaving while a reply is still streaming must not claim that reply as seen.

## Suggested approach
- Derive the shown reply time from `live.view?.snapshot.entries` after the session view exists, mirroring the local Bot chat's `botLastReplyAt(snapshot.entries)` invariant.

This branch has not been deployed

No deployments
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