Skip to content

feat: a bot that replied stays marked unread in the sidebar - #107

Merged
httpsphl merged 2 commits into
mainfrom
feat/unread-replies
Oct 2, 2026
Merged

httpsphl merged 2 commits into
mainfrom
feat/unread-replies

Conversation

@httpsphl

@httpsphl httpsphl commented Oct 2, 2026 •

Copy link
Copy Markdown
Owner

What

The owner could not tell from the sidebar whether a bot had answered: it only went back to Ready. Now a bot that replied since the owner last looked at its chat is marked unread, as in a messaging app:

  • The name is in bold.
  • The preview and the time are highlighted.
  • An accent dot sits at the end of the row.

The mark stays until the chat is opened.

  • Daemon: Bot.lastReplyAt is the newest reply's time. The conversation line may already be a tool or another bot's message by then, so this comes from its own query, with a partial index (0013_reply_index.sql). The chat store's tests move to chat/tests.rs so chat.rs stays short.
  • App:
    • The marks are kept in store/seen.ts. replyAt is filled from lastReplyAt and from each new reply item.
    • While the chat is open and the window is in sight, replies count as seen as they arrive.
    • With the sidebar hidden, its button shows a quieter dot that does not move.
    • The first start with this version counts older replies as seen (botloft.seenSince), so the update does not mark every bot at once.
  • Spec: sections 11 (lastReplyAt) and 15.1 (sidebar) are updated.

Checks

  • pnpm check: 270 tests pass. The new unread.test.tsx covers four cases:
    • a reply marks the bot, and a newer item after it does not hide the mark;
    • a reply in the open chat is seen;
    • a reply from before the app opened is marked;
    • replies from before the first start are not marked.
  • Rust: cargo fmt and clippy -D warnings pass. The new store test passes, and bots.list returns lastReplyAt (tests/chat.rs, tests/rpc_crews_bots.rs).
  • Preview: the rows of the bots that replied show the mark, and it clears when their chat is opened.

Still to see

  • With real bots, check that the mark appears when a bot answers while another chat is open, and when it answers with the app closed.

`Bot.lastReplyAt` is the newest reply item's time, read apart from
`lastActivity` because the conversation line may already be something
else (a tool, another bot's message). The app uses it to mark a bot
unread. A partial index keeps the lookup per bot cheap; the chat store's
tests move to their own file to keep chat.rs short.
A bot that only went back to Ready gave no sign that it had said
something. Now a reply newer than the owner's last look at that chat
marks the row as in a messaging app: name in bold, preview and time
highlighted and a dot at the end, until the chat is opened. Every reply
counts, from `lastReplyAt` and from each new reply item, even with other
items after it. With the chat open and the window in sight, replies are
seen as they come. With the sidebar hidden, its button shows a quieter
dot. A first start with the marks counts older replies as seen.
@httpsphl
httpsphl merged commit 10f55b7 into main Oct 2, 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