Skip to content

feat(bots): choose which of my devices can reach each bot - #1118

Merged
TheAnimatrix merged 6 commits into
masterfrom
issue-1114-bot-device-access
Nov 13, 2026
Merged

TheAnimatrix merged 6 commits into
masterfrom
issue-1114-bot-device-access

Conversation

@TheAnimatrix

Copy link
Copy Markdown
Collaborator

Problem

Any device linked to the owner's account that has read or chat access could list every personal bot on a computer, read its chat and memory, message it, stop its work and answer its cards; with write access it could create and change bots. A shared laptop with the account signed in reached every bot, including one that can shut down the owner's servers. What bots may do on a computer was already limited (What bots may do here); which devices may reach a bot was not.

Change

Two controls, both kept and enforced on the bot's own computer:

  • About → Devices, one row per bot: All my devices (every existing bot keeps this, and a new bot starts on it), Only this computer, or Chosen devices, ticked from the owner's device list. Its tooltip says what a device left out sees: nothing. Stored in <profile>/bots/device-access.json (BotDeviceAccessStore), not in bots.db, so no database version moves.
  • Settings → Devices → Bots on this computer, one switch under each device (phones too), on by default. Off, that device reaches no bot here, whatever each bot says. Stored as a bots column on net_node_policy, added the way the editor switch was (default on, no version bump); also mousse-cli bridge limits <node> --bots on|off.

To a device that is left out, the bot does not exist. Every bot method a device can call goes through one wrapper in RemoteBots.ts (remoteBotMethods's method), which checks the device's switch and the bot's choice before the call is admitted and again as it runs. A method added to the table later is held to it without any extra code. A hidden bot gets word for word the same answer as a missing one (stream_unknown). A device whose switch is off gets the same refusal as when Share bots is off (forbidden, setting_off), the same for every bot id. The one check is createBotReach in src/mms/bridge/remote/botReach.ts.

Every other path by which a bot shows on another device, and how it is closed:

Path How
Bot methods (bots.get, bots.chat.list, bots.chat.attachment, bots.memory.list, bots.chat.send, bots.chat.stop, bots.work.stop, bots.chat.markRead, bots.asks.answer, bots.personal.pause, bots.personal.resume, bots.create, bots.update, bots.reminders.cancel, bots.schedules.remove, bots.permissions.revoke, bots.memory.forget) The wrapper above. An ask, reminder, message, work or attachment id is always looked up inside the bot the call names, which the device must reach.
A phone's lists (bridge.lists.open): bot list, unread counts, last message, live chip, and the notifications the phone makes from them Each device now opens lists of its own (mousse:lists:<node>), with only the bots it reaches. Only that device may read the stream (ThreadStreamAdapter.boundReader, checked in NodeStreamAuthority.canRead), so a guessed or leaked stream id reads nothing. They push again as soon as a choice or switch changes.
The shared lists stream that phones opened before this change (a phone may still hold its id) Lists only the bots every device of the account reaches.
Another computer's private lists Only the bots that computer reaches.
A bot's own threads (home, work, context) in thread lists, search, snapshots, activity, routed calls Already answered as if they did not exist (botOwned); unchanged.
"Started by " on a thread a bot started (phone thread results, routed results, thread snapshots and metadata, private thread streams) Named only to a device that reaches the bot; any other gets startedByBot: { botId: "", name: "a bot" } and no launcher (withHiddenBots), and the app shows "Started by a bot". A stream any device may read names the bot only when every device reaches it.
Disk usage (storage.usage from a phone) A bot's threads are counted without a name for every device (they are named after the bot and its work).
Automations a bot made Already never shared with other computers (jobSharedWithComputers); unchanged.
Desktop notifications, device activity, Settings, the computer's limits Local to this computer only; unchanged.
Routed calls from another computer bots.*, bridge.* and settings.* never route; unchanged.
Group chats, Spaces, exports, sync Personal bots take no part in them; memory export is local.

Who can change it. Only this computer's own window and its command line. bots.devices.get and bots.devices.set are local methods that refuse a call through Bridge or from any client but the app window and the CLI. They are not in a device's table and never route. bridge.policy was already local. A device's bots.update takes only a name and a look. A device's bots.create keeps the new bot within that device's reach and changes no other bot. A request id that names a bot made earlier is answered only if the device reaches that bot. No bot tool, agent tool or MCP tool changes either control.

Already under way. A device taken off a bot, or switched off, gets nothing at its next call, and its lists drop the bot at once. A message it sent that is still queued is not delivered: its chat turn is cancelled and the chat says "Not delivered: the device it came from can no longer reach me." Its cards are no longer answerable from it. Work the bot is doing, and a turn already running, carry on, because they are the owner's.

Fails closed. A bot with no stored choice reaches every device. A choice or file that can't be read means only this computer; About says so in the row's tooltip, and the next change puts the unreadable file aside. A device removed from the account leaves every bot's list. A device switch reads as off for any stored value but 1.

Versions. An update keeps every bot on every device and every device's switch on. A newer device talking to an older home computer sees what it always did: the choice lives and is enforced only on the home computer, so nothing asks an older one to enforce it. An older phone talking to a newer home computer is held like any other device; it opens its lists as before and gets its own stream back. An older build on the home computer itself (a downgrade) ignores the file and the column, so every device reaches every bot again while it runs.

docs/bots.md has a new section, "Two layers", that puts this beside What bots may do here and says what it does not do. docs/GLOSSARY.md has the two terms.

Teammate work. #869 rewrites the Devices page. The switch here is its own component (DeviceBotsRow), so #869 only needs one added line where it renders a device's detail. #868 (Teams access decision) and #871 (message authors) touch routed calls between people, not a person's own devices; there is no overlap. Lines touched outside the bridge, the stored choice, the two settings surfaces and the docs: BotOwnerTurn gains node (definition.ts); two lines in BotEngine.ts keep it on a queued chat turn; BotChatService.ts passes it on and gains withdrawQueued; MmsProfileServices.ts holds the store; MousseMainService.ts registers the two local methods; registerGuiIpc.ts and platform.ts allow them for the window; ThreadStartedByBar.tsx shows "Started by a bot". Nothing in src/mms/run/mcp/appTools/, botAuthority.ts or src/mms/harness/ (#1101, #1097). No bots.db migration (#1108 takes v7). No bot chat view files (#1104).

How to review

  1. src/shared/bots/personal/deviceAccess.ts and src/mms/bots/definitions/BotDeviceAccessStore.ts: the choice and how it is stored and read.
  2. src/mms/bridge/remote/botReach.ts: the one test, and the "Started by" scrub.
  3. src/mms/bridge/remote/RemoteBots.ts: the wrapper. This is where the risk is.
  4. src/mms/bridge/BridgeProfileService.ts, MmsListsSource.ts, ThreadStreamAdapter.ts, nodeAuthority.ts: per-device lists and their reader binding.
  5. MmsBackend.ts, MmsThreadSource.ts, OwnerRoutes.ts, privateSources.ts: thread results and disk usage.
  6. src/mms/bots/deviceMethods.ts, nodePolicy.ts, database.ts, NetService.ts: who may change what.
  7. Renderer: BotDevices.tsx, DeviceBotsRow.tsx, ThreadStartedByBar.tsx.

Verification

Tier 5 (permissions and networking). Teammate review is needed before merge.

Named tests, run from PowerShell on Windows at 5bb72bbfd:

  • New: tests/net/bridge/remote/botDeviceAccess.test.ts (15). It runs every device method against a bot the device reaches, a bot it may not reach and a bot that does not exist, and checks that the last two answer the same, before admission and as the call runs. It also covers: the device switch for every method and for the lists; a device on one bot's list reaching another bot through the first bot's ids; lists per device and the shared lists; a queued message withdrawn while running work carries on; cards; every way to change the choice from a device refused (table, routing, bots.update and bots.create keys, the local methods called through Bridge or from other clients); a device's bots.create; storage after an update, unreadable files and entries, and removed devices; "Started by"; disk usage. Removing the reach check in the wrapper makes the method table and the create test fail.
  • New: tests/net/bridge/remote/botDeviceSessions.test.ts (1). Over real Net sessions, a full owner profile with its Bridge and two joined phones: the left-out phone gets the missing-bot answer and no call reaches the bot; the switched-off phone is refused; each phone's lists stream is its own, and the other phone's subscription to it is refused with forbidden.
  • New: tests/renderer/botDeviceControls.test.ts (5), mounting About and the real Devices page; tests/net/store/nodePolicyMigration.test.ts (+2, the column on an older database and an older build's writes).
  • Updated: tests/net/bridge/nodePolicy.test.ts (the defaults list now has bots: true), tests/renderer/botAboutPanel.test.ts (Runs on lists Devices), tests/renderer/botThreadsUi.test.ts (+1, "Started by a bot").
  • Also run, passing: bots, lists, privateLists, remoteQuestionsAndDeltas, composer, boundedStreams (bridge/remote); privateAccess, owner, streams, release, privateThreads, deviceActivity, editorAsk, table, ids (bridge/routed); net (cli), privateThreads, threadListPushes, botThreads, botThreadsDaemon, botChat, botsProtocolV2, browserViewAccess, botLanes, botNoModelNames, deviceAccessRows, netDevicesRefresh, newBotDialog, botsSection, netDevices. 304 + 182 tests passed in all.
  • Fails here and on master at 71f2792 alike (Windows folder locks and no SIGKILL exit signal), not from this change: three cases of tests/net/bridge/remote/remote.test.ts ("keeps an accepted actual MMS turn running…", "records an actual child SIGKILL…", "installs a display snapshot larger…").
  • npm run typecheck passes.
  • By hand, in the Linux sandbox: the development app with a bot (no provider set up, so no model was called) and a second development home joined over Net as "Tablet", asking for the bot every 3 seconds. Tablet saw the bot. Chosen devices with Tablet unticked: it got stream_unknown, the same as for a bot that does not exist. Ticked again: it saw the bot. Bots on this computer off for Tablet: forbidden for both. Screenshots below.

Not checked: the phone app itself (it is not in this repository). That an older phone simply uses the new lists stream that bridge.lists.open returns is inferred from the protocol and was not seen on a phone. Not checked on macOS. A bot thread already in the trash may still be named in disk usage.

Security review, as the left-out device. What I tried, and the result:

  • Each of the 17 device methods with the hidden bot's id: the missing-bot answer, before admission and as the call runs (tests).
  • Guessed ids: the bot's id answers as missing. Its home or work thread id fails in every thread method, as before. A stream id of another device's lists gets forbidden (session test). An attachment, reminder, ask or work id is looked up inside the bot named, which must be reached.
  • A notification or push already sent: it can't be taken back. What the phone already holds (cached lists, chat and earlier stream records) stays on it. The shared lists stream's earlier records still list bots as they were then. A device that only knows that stream's id from before sees no bot hidden since.
  • Searching for the bot's name or its words: the bot's own threads are not searchable from a device. A thread the bot started is searchable like any thread of the owner's, and its transcript names the bot ("By , your bot: …"). That text is not changed (see Notes).
  • A device on bot A's list asking about bot B through A's ids: refused (test).
  • A device on the list with a narrower limit: feat(bots): "Use your threads" lets a bot read, start and message its owner's threads #1074's rules still apply. Its message holds the turn to its limit, and only a Full access device may Allow "use your threads" (existing tests pass).
  • Changing the list or the switch from a device: bots.update and bots.create refuse extra keys. settings.set, bridge.policy and bots.devices.* are not in a device's table and never route. Another computer's command line talks to its own service. The local methods refuse a routed call or any client but the window and the CLI (tests).
  • Two profiles on the home computer: each profile has its own devices, switches, bots and file, so a device joined to one profile reaches nothing of the other's.
  • Not a barrier: a device that may work on this computer's threads, or open terminals or an editor here, can run commands that read the bot's data on disk. The docs say so.

Notes

Decisions the owner may want to change: New bot is left as it was (a new bot starts on every device; narrow it in About); a device switched off gets the "doesn't share its bots" refusal rather than the missing-bot answer; a thread a bot started keeps the bot's name in its own transcript lines, because changing a thread's text per device would change what ordinary threads show.

Closes #1114

@TheAnimatrix

Copy link
Copy Markdown
Collaborator Author

About: a new Devices row under Runs on, All my devices (every existing bot keeps this):

About: a new Devices row under Runs on, All my devices (every existing bot keeps this)

Its three choices:

Its three choices

Chosen devices with Tablet unticked: Tablet now gets the same answer as for a bot that does not exist:

Chosen devices with Tablet unticked: Tablet now gets the same answer as for a bot that does not exist

Tablet ticked: it reaches the bot again:

Tablet ticked: it reaches the bot again

Settings, Devices: Bots on this computer under each device, on by default (the Older than this device row is the scripted test device reporting 0.0.0):

Settings, Devices: Bots on this computer under each device, on by default (the Older than this device row is the scripted test device reporting 0.0.0)

Switched off: Tablet reaches no bot here:

Switched off: Tablet reaches no bot here

TheAnimatrix added a commit that referenced this pull request Nov 13, 2026
@TheAnimatrix

Copy link
Copy Markdown
Collaborator Author

What the second device (Tablet, a development home joined over Net) saw while the owner changed the controls, asking every 3 seconds:

2026-11-13T18:39:15.699Z Server keeper → present: Server keeper | a bot that does not exist → absent: stream_unknown
2026-11-13T18:40:37.542Z Server keeper → absent: stream_unknown | a bot that does not exist → absent: stream_unknown
2026-11-13T18:41:23.002Z Server keeper → present: Server keeper | a bot that does not exist → absent: stream_unknown
2026-11-13T18:41:26.029Z Server keeper → absent: forbidden | a bot that does not exist → absent: forbidden

In order: every device; Chosen devices without Tablet; Tablet ticked again; Bots on this computer off for Tablet.

…ces reach a bot

A saved result asked for by request id is checked against the bot it named, and a device that left the account or is blocked here has its queued messages withdrawn.
@TheAnimatrix
TheAnimatrix merged commit 1a961fa into master Nov 13, 2026
7 checks passed
@TheAnimatrix
TheAnimatrix deleted the issue-1114-bot-device-access branch November 13, 2026 19:13
@TheAnimatrix

Copy link
Copy Markdown
Collaborator Author

One review pass found two gaps, fixed in the last commits before merge. A saved result of an earlier bot call, asked for by request id, is now checked against the bot it named, and is refused when that is no longer known and the device is held from any bot. A device that left the account or is blocked on this computer has its queued messages withdrawn. A new case in botDeviceAccess.test.ts covers the saved result. With master merged in, npm run typecheck passes and the changed test files pass (110 tests). Three cases in remote.test.ts and one timing case in net/sync/integration.test.ts fail on master on Windows too.

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.

Choose which of my devices can reach each personal bot

1 participant