Skip to content

Seed a remote Bot's default look with its handle (#84) - #85

Merged
Birfy merged 2 commits into
mainfrom
fix-84-remote-bot-look
Oct 15, 2026
Merged

Birfy merged 2 commits into
mainfrom
fix-84-remote-bot-look

Conversation

@hsliuustc0106

Copy link
Copy Markdown
Collaborator

Closes #84.

Problem

A friend's Bot (e.g. 代码审查官 @bot-2a758c0f.danyang.home) rendered with a randomly generated mascot: the chat record is created with no look (remote-chat.js), so lookOf/colorOf seeded from the record's session id. That seed was arbitrary (per record), different from remoteSpeaker's no-record fallback (remote:<handle>), changed on delete/re-add, and unrelated between the two homes.

Fix

One shared seed: a remote Bot's generated look derives from its handle (normalized: no @, lowercased), not its session id.

  • characters.js: new remoteSeed(handle); lookSeed(bot) picks the handle for remote records, else the id. colorOf/lookOf seed from it.
  • cells.js remoteSpeaker: the no-record fallback bot uses the same seed string, so the record and fallback renders agree.
  • mark.js re-exports remoteSeed.

Every consumer (sidebar, header, message leads, @-mention chips, the mention CSS in index.js) funnels through lookOf, so one handle now yields one look everywhere — stable across re-add and identical in the friend's home, which runs the same derivation. A color/avatar the owner sets on the record (friend chat → Settings → avatar editor; update-bot already accepts it for remote records) still wins.

Out of scope (noted in the issue): carrying the friend side's actual look over the wire — that needs Bot Social server support for member profile fields.

Verification

Fail-without-change: the two new tests in inbound-ui.test.js (record-vs-fallback look equality; @/case normalization + stored-look precedence) were red on the unfixed tip (e53bb70-tree, before commit), green after.

Tip SHA: 6fb41ef3eaba6bba47138b4d74a68f88d665a02b

Ran at that tip:

  • npm test — 621 pass, 0 fail
  • node scripts/build-client.mjs --check — client.js matches src/client
  • node scripts/ds-bot-patches.mjs generate && check — 10 patches apply cleanly; core == ds-bot + patches
  • npm run lint — 0 errors; 21 warnings, same count as main (the one in a touched file, mark.js:71, is on a pre-existing line this PR does not modify); arch-docs OK (ds-bot-core.md invariant 9 added)

Not run: smoke test (no index.js/src/host/ change), Desktop app, a real two-home check against Bot Social.

@hsliuustc0106

Copy link
Copy Markdown
Collaborator Author

CI note: the pull_request Test run did not start for this PR (same quirk as #2). The Test workflow was dispatched manually on the PR head — run 38715983477, success at 6fb41ef3eaba6bba47138b4d74a68f88d665a02b (tests + client --check + patches check + lint/arch-docs). If the required check does not register on the PR, re-run via dispatch or push an empty commit to retry the pull_request event.

A friend's Bot had no look of its own in this home: the chat record is
created without color or avatar, so the client derived one from the
record's session id — arbitrary per record, different from the
no-record fallback in remoteSpeaker (which seeds remote:<handle>),
changed by a delete/re-add, and unrelated between the two homes.

Derive the default from the handle instead (normalized: no @, lower
case) through one shared remoteSeed helper used by colorOf/lookOf and
the remoteSpeaker fallback. One stable look per friend's Bot on every
surface and in both homes; a color or avatar the owner sets on the
record still wins. Carrying the friend side's real look over the wire
needs Bot Social member-profile fields and stays out of scope (#84).

Tests fail-without-change: the record-vs-fallback equality and the
@/case normalization tests were red on the unfixed tip.
@hsliuustc0106
hsliuustc0106 force-pushed the fix-84-remote-bot-look branch from 6fb41ef to ccebfd3 Compare October 15, 2026 09:58
@hsliuustc0106

Copy link
Copy Markdown
Collaborator Author

Rebased onto origin/main (9034e9e, PRs #77/#78/#82). One real conflict: remoteSpeaker in cells.js — #82's remoteBotTitle name computation kept, this PR's remoteSeed(handle) fallback id on top; generated client.js and the patch series regenerated. New tip ccebfd3; Test workflow dispatched on it: run 38716904753, success (643 tests, client --check, 11 patches, lint 25 warnings = main's count, arch-docs OK).

@Birfy
Birfy enabled auto-merge October 15, 2026 10:06
@Birfy
Birfy merged commit 9aa3f53 into main Oct 15, 2026
5 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.

A friend's Bot renders a random per-record look: unstable on re-add, inconsistent with the no-record path, different in each home

2 participants