Skip to content

fix(desktop): Bot Mode Cloud alias identity survives hosted handoff and Cloud-only rosters - #92860

Merged
teknium1 merged 1 commit into
mainfrom
fix/bot-mode-cloud-alias-identity
Aug 23, 2026
Merged

teknium1 merged 1 commit into
mainfrom
fix/bot-mode-cloud-alias-identity

Conversation

@teknium1

@teknium1 teknium1 commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #89131 — Bot Mode now keeps a per-profile Cloud alias's friendly identity ("Moxie") after the alias hands off to the hosted backend, and renders the configured alias instead of generic "Hermes" when Cloud is the only active source.

Root cause

A Desktop per-profile alias routes to a remote backend's root profile: the route reads { connectionId: C, profile: 'moxie', targetProfile: 'default' }. Once the hosted backend answers the roster itself, the row's identity is (C, 'default') — a different key than the alias's meta (C::moxie / 'moxie'). Nothing bridged the two:

  • botRosterMeta intentionally never let remote rows borrow local meta ("two defaults must not share a title"), so the backend row lost the alias title on the first roster refresh after activation — regressing to the raw Cloud hostname / @default-… identity.
  • In Cloud-only mode, the sole rich default row hit displayName's untitled-default fallback and rendered as generic Hermes.

Fix

Introduce a connection-exact alias index (aliasRouteIndex) rebuilt from the credential-free host.profileRoutes() inventory on every roster fetch, keyed by (connectionId, targetProfile) — never a bare name. Only genuine aliases (profile !== targetProfile) participate.

  • displayName: a backend row claimed by an alias reads as the alias name (title, when set, still wins) — never "Hermes" or a hostname-derived label.
  • botRosterMeta: the claimed row resolves the alias's meta (v2 C::moxie key, then legacy v1 moxie key) when it has none of its own — the one sanctioned, route-proven exception to "remote rows never borrow local meta".
  • botFriendlyNames: the alias name/title rides the claimed row so @moxie keeps resolving in mentions after handoff.

Safety properties, aligned with the fail-closed design settled in #88680 / #90006:

  • same-named default rows on other connections never borrow the identity (index is keyed by connection);
  • two aliases claiming the same backend row fail closed (neither wins);
  • the local default and un-aliased remote defaults keep existing behavior byte-for-byte;
  • feature-detected and best-effort: no host.profileRoutes (older desktops) → empty index → prior behavior; a failed route read keeps the last good index.

Tests

New tests/cloud-alias-identity.test.mjs (7 source-shape tests, vm-exec pattern) covering: identity persistence across the hosted handoff (v2 and legacy v1 meta keys), the Cloud-only "sole bot labeled Hermes" reproduction, no cross-connection leakage, ambiguous-alias fail-closed, the alias row not self-claiming, mention resolution after handoff, and index refresh dropping stale claims.

  • Full plugin suite: 418/418 pass (node --test tests/*.test.mjs)
  • Sabotage-verified: disabling the alias claim fails 3 of the new tests
  • node --check plugin.js clean

Credit

Huge thanks to @TheAirick for the controlled candidate testing on #89131 — the isolated live test that proved correct Cloud routing while pinpointing the residual identity regression, and the clean-install Cloud-only reproduction that narrowed the failure to identity propagation rather than the alias/default collision.

Infographic

Cloud alias keeps its name

A Desktop per-profile alias (e.g. moxie with a Cloud override) routes to a
remote backend's root profile: route { connectionId, profile: 'moxie',
targetProfile: 'default' }. Once the hosted backend answers the roster
itself, the row's identity is (connection, 'default') — a different key
than the alias meta — so the friendly name regressed to the raw Cloud
hostname after activation, and Cloud-only rosters showed generic 'Hermes'
instead of the configured alias (#89131).

Add a connection-exact alias index built from the credential-free route
inventory, keyed by (connectionId, targetProfile). displayName,
botRosterMeta, and botFriendlyNames consult it so the claimed backend row
reads as the alias (and its title/meta), while:

- same-named defaults on OTHER connections never borrow the identity
- two aliases claiming one backend row fail closed
- the local default and un-aliased remote defaults keep existing behavior

Evidence: @TheAirick's controlled candidate testing on #89131.
@github-actions

github-actions Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 3378ab5 — fix(desktop): Bot Mode keeps Cloud alias identity after host

⚠️ Warnings

OSV vulnerability scan · View job

7 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 1m43s vs 3m20s (-48.5%). 1 job(s) slower, 5 faster,

  • OSV scan / Scan lockfiles / osv-scan: +14.0s
  • JS & TS checks / JS & TS checks: -6.0s
  • Detect affected areas: -3.0s
  • OSV scan / Emit review status: -1.0s
  • Check no committed infographics / check-no-committed-infographics: -1.0s

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) area/profiles Multi-profile isolation, HERMES_HOME scoping labels Aug 23, 2026
@teknium1
teknium1 merged commit 3638961 into main Aug 23, 2026
32 checks passed
@teknium1
teknium1 deleted the fix/bot-mode-cloud-alias-identity branch August 23, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/profiles Multi-profile isolation, HERMES_HOME scoping comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bot Mode drops per-profile Cloud alias and starts inert local backend

2 participants