Repository navigation
✨ feat(bots): resolve and show Bot icons from their rules (#692) - #347
Conversation
Add resolveBotIcon, a pure evaluator that picks a Bot's timeline image or rule shape from its icon rules, with the next moment the result can change, and botLeftForYouSinceMs for the leftOnDelivered minute 0. Add the start time parser and short formatter for the editor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A thread never visited now counts as read for leftOnDelivered, through the same unread check the Bot list uses. resolveBotIcon no longer takes the Bot's status, since each rule's start time already says whether it applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ed time (pingdotgg#692) A stored rule order can hold fewer than three rules, or none, and the lastCalled shape time can be 0. Pin that only rules in the order are used, an empty order shows the Default Icon, and a 0 time holds at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
BotAvatar now resolves a Bot's icon rules wherever it knows the Bot: a timeline image or rule shape replaces the Default Icon in the one slot, re-resolved once at each boundary instead of on a tick. The next timeline image loads ahead, and a stored image stays up until the next one loads. Muted Bots keep their Default Icon, now grayed out. Editors opt out. The roster's workingSince, deliveredAt and erroredAt now reach the client through ScopedBotEntry, and botIconInputs turns them and the Bot thread's shell into each rule's minute 0. The evaluator uses the contract types. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
notFrost
left a comment
There was a problem hiding this comment.
Review (Lukas, lead engineer): approved, merging into feat/bot-icon-timeline. Posted as a comment because this account can't formally approve. I retargeted this PR from feat/bot-icon-timeline-server after #348 merged.
Checked against issue pingdotgg#692 and phase3-contract.md §2–3:
- Evaluator (
resolveBotIcon):- Muted shows the Default Icon (D29).
- The mode follows the Default Icon's kind (D28).
- Image mode walks the order and skips empty timelines and rules before their first entry (D10/D27).
- Shape mode skips unset shapes, and a shape equal to the default (D32).
lastCalledwaits forlastCalledShapeAfterMinutes. nextChangeAtMsis computed from the holding rule and the rules ahead of it.- Short or empty
orderand a zero threshold are pinned by tests.
- Times:
workingSince,deliveredAtanderroredAtpass throughScopedBotEntry, which is nowBotRosterEntry & { environmentId }.leftOnDeliveredminute 0 is the oldest blocking request, or an unread delivery or error. It usesisUnreadSinceVisit, now shared with the sidebar'shasUnreadResult, so a null visit counts as read and the two can't disagree.lastCalledcomes fromshell.updatedAt(D20).
- Display:
- The avatar re-resolves once per boundary through
useNowAfter, with no tick (AGENTS.md:156). It uses server-clock offsets. - Only the next image is prefetched.
- The last loaded image is held to avoid a flash.
- Muted adds
grayscale. - Editors opt out with
defaultIconOnly.
- The avatar re-resolves once per boundary through
- Scope: 15 files. The mobile change is a test fixture only, needed by the widened
ScopedBotEntry, which is acceptable.
Run locally on a merge of 5fe331a564 into feat/bot-icon-timeline @ fd9ccfe750 (Windows):
vp run typecheck → 44/44 successful, exit 0
vp lint --report-unused-disable-directives <15 changed files> → exit 0
vp run knip:check → exit 0
client-runtime: vp test run (full package) → 206 files, 3042 tests passed
web: vp test run src/components/bots src/state → 31 files, 137 tests passed
web (env -u NODE_ENV): BotAvatar.browser, BotDetailsPanel.browser,
sidebarMode.logic, botAvatarPaint → 4 files, 16 tests passed
mobile: use-composer-command-menu.select → 1 file, 3 tests passed
Not blocking, noted for phase 4 / QA:
- Stale image.
StoredBotImagekeeps the last loadedsrcwhen the new reference's URL resolves tonull, so an image that disappears keeps showing until remount instead of falling back. Worth a look when the editor can delete timeline images. - No desktop run yet. That was blocked until #348 stored
iconRules. It's the next step, on the integration branch.
E2E: Bot icon rules (pingdotgg#692) on
|
| # | Case | Result |
|---|---|---|
| 1 | Image mode, lastCalled at 0m and 1m |
PASS |
| 2 | workDuration while working, then fallback |
PASS |
| 3 | leftOnDelivered after a real reply, cleared by a visit |
PASS |
| 4 | Shape mode rule shape, plus D32 | PASS |
| 5 | Muted shows the Default Icon in grayscale | PASS |
| 6 | GIF in a timeline is refused | PASS |
1. Image mode: lastCalled [0m: A, 1m: B], Default Icon "D"
Bot created 19:16:08Z. At 19:16:52 the DOM showed A. At 19:17:38 it showed B, with the same page-load marker, so there was no reload.
| 0m | 1m |
|---|---|
![]() |
![]() |
2. workDuration [0m: W]
Run started 19:26:48. Mid-run read-back: status: working, workingSince: 2026-12-01T19:26:48.378Z, and the sidebar showed W. The run ended with workingSince: null and deliveredAt: 19:28:33.895Z, and by 19:28:53 the sidebar was back to the Default Icon.
| working | ended |
|---|---|
![]() |
![]() |
3. leftOnDelivered [0m: L]
The Deliverer thread was visited once at 19:21:27, then left. The reply landed with deliveredAt: 19:24:54.322Z. Viewed from a different thread at 19:25:56, the sidebar showed L. At 19:26:11, after opening the Deliverer thread, it showed the Default Icon.
| delivered, unvisited | after visit |
|---|---|
![]() |
![]() |
Bonus (D23): an earlier run that failed, with erroredAt: 19:22:35.662Z and the thread unvisited, also showed L:

4. Shape mode
Default Icon circle, ruleShapes.lastCalled: "star", lastCalledShapeAfterMinutes: 1. The star showed once that minute had passed.

D32: an update with ruleShapes.workDuration: "circle" (the Default Icon's shape) was stored as null:
bots.update response icon: circle ruleShapes: {"workDuration":null,"leftOnDelivered":null,"lastCalled":"star"}
bots.get read-back icon: circle ruleShapes: {"workDuration":null,"leftOnDelivered":null,"lastCalled":"star"}
5. Muted
After bots.update {muted: true}, Imagey showed its Default Icon D with opacity-70 grayscale, even though its timeline would otherwise show B. The read-back kept both lastCalled entries.

6. GIF refused
The typed RPC client refuses before sending (Schema validation failed). Sent raw over the WebSocket, the server refuses it too:
{"_tag":"Exit","requestId":"1","exit":{"_tag":"Failure","cause":[{"_tag":"Die","defect":
"Expected a string matching the RegExp ^avatar:[\da-f]{64}\.(?:webp|png|jpeg|gif)$
at ["iconRules"]["timelines"]["workDuration"][0]["image"]
Expected a string matching the RegExp ^data:image\/(?:png|jpeg|webp);base64,
at ["iconRules"]["timelines"]["workDuration"][0]["image"]"}]}}
A read-back afterwards showed the Bot's rules unchanged. The refusal comes back as a payload-decode Die, not a typed BotRpcError. That is how Effect RPC handles a bad payload, and the client schema blocks it first, so this is not a bug.
No bugs found.
🤖 Generated with Claude Code
|
Verification note (Lukas): I checked the E2E screenshots from
I accept the GIF refusal arriving as a payload-decode failure: the typed client blocks it first, and the server refuses it and leaves the rules unchanged. An Electron-shell pass is deferred to the final integrated check before the custom-nightly PR ( |






Part of https://github.com/notFrost/sophie/issues/692 (phase 3, display). Stacked on
feat/bot-icon-timeline-server.Problem
A Bot's icon rules (image timelines and rule shapes) exist in the contract, but nothing on the client turns them into the icon you see.
Change
client-runtime/botIconRules.ts):resolveBotIconpicks a timeline image, a rule shape or the Default Icon, and returnsnextChangeAtMs, the next moment the result can change. It's pure and walks the Bot's own order. Short or empty stored orders work.botIconInputsturns the roster entry and the Bot thread's shell into each rule's minute 0.botLeftForYouSinceMsandisUnreadSinceVisitcompute the unread check.hasUnreadResultin the Bot list now uses the same check, so the icon and the list always agree.botIconDuration.ts): parse15m,16hor2dand format back. Nothing uses them yet; they are for the editor in phase 4.workingSince,deliveredAtanderroredAtnow reachScopedBotEntry.BotsIndexexposesbotByKey.BotAvatar: when it knows the Bot (owner), it shows the rule's glyph in the one slot (D6).botIconStateAtom) that holds through changes that leave the rules and start times alone.nextChangeAtMsthroughuseNowAfter, converting server clock to client clock. There is no tick.upcomingBotIconImage), and a stored image stays up until the next one has loaded.grayscaleon top ofopacity-70(D29).defaultIconOnlyprop keeps the Default Icon in the Profile preview and the identity picker.Scope
lastCalledreads the quiet shell'supdatedAt, which can lag by up to one run while the Bot streams.iconRules. SoworkDurationandleftOnDelivered(from deliveries and errors) can't apply yet, and no Bot has rules yet.vp lintfound the wrongoxlintup the tree. A local junction to the worktree's pinned oxlint fixed it; the junction is not committed.Verification
The browser tests ran with
NODE_ENVunset, because this shell exportsNODE_ENV=productionand React's production build has noact.Desktop run: skipped. The base branch's
BotStorehas noiconRulescolumn, andBotService.updatekeeps the stored value. So neither an API call nor SQL against an isolated database can give a Bot rules without server changes. Until stage 2,BotAvatar.browser.test.tsxcovers the integrated behaviour:lastCalledtimeline at0mand1mshows the first image, then swaps exactly at the minute, with one timer and no tick;defaultIconOnlykeep the Default Icon, withgrayscalewhen muted.Model: Claude Opus 5.5 via Claude Code in T3 Code.
🤖 Generated with Claude Code