Repository navigation
fix(bots): close three ways a Bot gets a shell - #321
Merged
Merged
Conversation
Only the Claude adapter applies a Bot's tools, so moving a Bot's thread to another provider handed it a shell. t3_thread_configure switched a Bot's own thread with no card, and bot_update carded a Bot moving any Bot. - t3_thread_configure refuses a provider or instance change on any Bot's thread, and any change to another Bot's thread. A Bot may still change its own model within its instance. - bot_update refuses a provider change from a Bot caller. Other callers keep the approval card. - bot_update adds an "Agent mode: X → Y" line to its card when modelSelection changes the agent's own mode. T3 cannot rank those modes, so any change asks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
bot_create let a Bot put a new Bot on another provider instance, such as Codex, which ignores the Bot's tools. One helper, refuseBotProviderChange, now holds the rule for t3_thread_configure, bot_update and bot_create: only the user moves a Bot to another provider, in the UI. A Bot that omits modelSelection in bot_create now gets its own model, not its thread's, so leaving it out never asks for another provider. Co-Authored-By: Claude Opus 5.5 <[email protected]>
If the Bot store couldn't be read, the turn ran as a plain thread, with the default tools and Bash. The resolver now fails the turn instead when the session works inside the Bots root, where every Bot and check-in thread works. That needs no store read. Other threads still run as plain threads, so a store fault can't stop ordinary work. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegojohnsonl
force-pushed
the
fix/bot-shell-escapes
branch
from
November 30, 2026 01:50
7a7421d to
84cf070
Compare
Only the Claude adapter applies a Bot's tools, and a new thread gets the default set, Bash included. So a Bot without Bash could get a shell by starting work elsewhere, including through a linked environment. The rule has one home in McpToolAccess: an explicit list of the tools and actions that start work (delegate_task, create_threads, t3_thread_launch, t3_thread_transfer fork, schedule_task create or enable, run_scheduled_task_now), and one check before each listed call, whether it runs here or goes to a linked environment. - Work in the calling Bot's own thread stays allowed, such as an mcp_event subscription. The check finds a scheduled task's thread through ScheduledTaskService and refuses when it can't tell. - A forwarded start from a Bot without Bash is always refused. - merge_back and status stay allowed: merge_back only queues context into an existing thread's next turn. - t3_workflow needs no entry: no thread can call it, and a test holds that. Revert this one commit to undo Fix 3. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegojohnsonl
force-pushed
the
fix/bot-shell-escapes
branch
from
November 30, 2026 04:26
84cf070 to
e42bfe4
Compare
This was referenced Nov 30, 2026
diegojohnsonl
added a commit
that referenced
this pull request
Nov 30, 2026
A Bot's session only saw its SOUL.md, roster and tools as they stood when the session started. Turn start now compares that setup with what the native session last saw. Anything that changed reaches the provider once, as one <bot-update> part on the inline-context path, so every provider gets it with no adapter change. - The record maps each tracked section to its digest, keyed by the native session id in bots.sqlite. It is written only after the provider accepts the prompt. - A session's first turn records the baseline and sends nothing. - Only the setup a Bot doesn't write itself is tracked: identity, SOUL.md, HEARTBEAT.md (primary only), roster, tools, MCP servers and skills. NOW.md and MEMORY.md are not tracked. - The read keeps #321's fail-closed rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegojohnsonl
added a commit
that referenced
this pull request
Nov 30, 2026
A Bot's session only saw its SOUL.md, roster and tools as they stood when the session started. Turn start now compares that setup with what the native session last saw. Anything that changed reaches the provider once, as one <bot-update> part on the inline-context path, so every provider gets it with no adapter change. - The record maps each tracked section to its digest, keyed by the native session id in bots.sqlite. It is written only after the provider accepts the prompt. - A session's first turn records the baseline and sends nothing. - Only the setup a Bot doesn't write itself is tracked: identity, SOUL.md, HEARTBEAT.md (primary only), roster, tools, MCP servers and skills. NOW.md and MEMORY.md are not tracked. - The read keeps #321's fail-closed rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegojohnsonl
added a commit
that referenced
this pull request
Nov 30, 2026
Merges feat/bots at 488ac5c: #321, #323, #325, #328, #332, #337 and the #327 back-merge. - #328's card_request and upstream's handoff_request (pingdotgg#44774) both stay: in the contracts turn-item unions, the Orchestrator's command routing, the run-recovery exclusions, the MCP item summaries, and the web and mobile timelines. The handoff request keeps its own item status and does not use #328's pending-request record. - Mobile's ThreadFeed keeps #328's single request-card switch and adds the handoff card to it, so the per-type activity-group helpers stay removed. - The budget test leaves out tools hidden outside Bots (#328) and tools hidden from threads or limited to linked callers (upstream). - #321's Bot-starting-work test layer gets the HandoffImport, ThreadHandoff and ThreadImportService mocks. Upstream's thread handoff and import made the project and orchestrator toolkits require them. Git merges the file cleanly, so it isn't flagged. - Translation catalogs take both sides' keys, ordered as gt generate puts them. - The agent context budget is the measured value: upstream's sizes, plus the 46 bytes feat/bots adds to the MCP tool list. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegojohnsonl
added a commit
that referenced
this pull request
Nov 30, 2026
A Bot's session only saw its SOUL.md, roster and tools as they stood when the session started. Turn start now compares that setup with what the native session last saw. Anything that changed reaches the provider once, as one <bot-update> part on the inline-context path, so every provider gets it with no adapter change. - The record maps each tracked section to its digest, keyed by the native session id in bots.sqlite. It is written only after the provider accepts the prompt. - A session's first turn records the baseline and sends nothing. - Only the setup a Bot doesn't write itself is tracked: identity, SOUL.md, HEARTBEAT.md (primary only), roster, tools, MCP servers and skills. NOW.md and MEMORY.md are not tracked. - The read keeps #321's fail-closed rule. Co-Authored-By: Claude Opus 5.5 <[email protected]>
diegojohnsonl
added a commit
that referenced
this pull request
Dec 1, 2026
) * ✨ feat(bots): tell a Bot's running session when its setup changes A Bot's session only saw its SOUL.md, roster and tools as they stood when the session started. Turn start now compares that setup with what the native session last saw. Anything that changed reaches the provider once, as one <bot-update> part on the inline-context path, so every provider gets it with no adapter change. - The record maps each tracked section to its digest, keyed by the native session id in bots.sqlite. It is written only after the provider accepts the prompt. - A session's first turn records the baseline and sends nothing. - Only the setup a Bot doesn't write itself is tracked: identity, SOUL.md, HEARTBEAT.md (primary only), roster, tools, MCP servers and skills. NOW.md and MEMORY.md are not tracked. - The read keeps #321's fail-closed rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ✨ feat(bots): tell a Bot when someone else changed its NOW.md or MEMORY.md The Bot works from the copies of NOW.md and MEMORY.md that its session started with. When someone else edits one of them, the next turn's <bot-update> now carries one line telling the Bot to re-read that file, without the file's contents. - The Bot's own edits don't trigger the notice. When the provider turn ends, the session's record takes the Bot's NOW.md and MEMORY.md as seen. A new afterProviderTurn hook in finalizeRootRun runs this before the run settles, so a queued turn can't start first. - The recording runs only after the provider accepted that turn's prompt. - The shared instructions now say to read NOW.md or MEMORY.md fresh before editing them. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ♻️ refactor(bots): record what a Bot session saw only when its turn ends The poteto review found that a prompt the provider dropped after accepting it lost its update, because the accept-time write had already counted it as seen. The turn-end write records the same setup plus the Bot's own edits, so it is now the only write. It is still armed only after the provider accepts the prompt, and it skips a turn whose prompt was dropped. A crash mid-turn now re-sends that turn's update once instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 💬 feat(bots): tell Bots to hand longer work to delegate_task Bots now read one more line in their shared instructions, under "Coding work". It tells them to hand work that takes more than a few tool calls to delegate_task with a complete brief, say in one sentence what's running, and end the turn. That keeps the chat for decisions and short results. Co-Authored-By: Claude Opus 5.5 <[email protected]> * ♻️ refactor(bots): cut the Bot setup update to its smallest form This poteto pass trims the B and C change and its test without changing what a Bot is told. - The Tools section and its name list are gone. Claude already reopens its query with a new tool set, and other providers don't apply Bot tool limits (#326). - Section hashes use Effect's Hash.string instead of the Digest service, which drops the extra layer requirement. The system prompt now reads its identity, SOUL.md and roster from the same sections the update compares. - record logs its own failures, so the turn-end hook is a plain condition. A turn with no pending update also arms it, so a slash-command turn records the Bot's own edits too. - The one behavior test reuses the primaryBot fixture and waitForIdle, and checks the four prompts in one assertion. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 💡 chore(bots): fix a stale comment and name the Bot in a log line Review 2 nits N1 and N2. The botUpdateSession comment now matches when the session is set, and the record warning names the Bot. Co-Authored-By: Claude Opus 5.5 <[email protected]> * 🐛 fix(bots): link a Bot's skills only where its profile resolves The merge with feat/bots moved #343's skill linking into readBotSetup, so pendingBotUpdate linked skills on every turn for every provider. A Codex Bot whose links failed would stop from its second turn. Linking goes back beside readBotSetup in resolveBotHarnessProfile, as on feat/bots. The skills notice still compares names from the Bot record. Its test moves into BotService.test.ts's harness and shrinks to one behaviour test. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Goal: a Bot's
toolslist should actually take Bash away. Only the Claude adapter applies a Bot's tools. A Bot could still get a shell in four ways: move a Bot to another provider, pick an ACP agent's own "yolo" mode, start work in a new thread or a linked environment, or run while its profile couldn't be read.What changed
Four commits, in order:
only the user moves a Bot to another provider).t3_thread_configurerefuses a provider change on a Bot's thread, and any change to another Bot's thread.bot_updaterefuses a provider change from a Bot.bot_update's card showsAgent mode: X → Yfor any agent-mode change.one rule keeps Bots on the user's chosen provider).refuseBotProviderChangeinmcp/botCaller.tsis the single check behindt3_thread_configure,bot_updateandbot_create. A Bot can't put a new Bot on another provider. A Bot that omitsmodelSelectioninbot_creategets its own model.a Bot's turn stops when its profile can't be read). If the Bot store can't be read and the session works inside the Bots root, the turn fails. Every Bot and check-in thread works in its folder there, so recognizing one needs no store read. Other threads run as before.a Bot without Bash can't start threads or tasks). The rule has one home inMcpToolAccess.ts: theWORK_STARTSlist and one check, run before every listed call, whether it runs here or goes to a linked environment.delegate_task,create_threads,t3_thread_launch,t3_thread_transferfork,schedule_taskcreate or enable, andrun_scheduled_task_now.ScheduledTaskServiceand refuse when they can't tell.merge_backandstatusstay allowed.Scope
To revert Fix 3, run
git reverton commit 4 alone. I checked that it reverts cleanly, typechecks and passes its tests.The user decided these are handled by Bot instructions, not code:
t3_thread_sendorbot_messageto a thread that has Bash. Forwardedt3_thread_sendisn't on the list either.t3_project_updateandt3_worktree_handoff.Tradeoffs
WORK_STARTS. It's one explicit list next to its check, not a per-tool annotation.McpToolAccessTestkit.layerNoBots.Blast Radius
This affects Bot callers of the listed tools,
bot_create, and Bot turns when the Bot store fails. Non-Bot callers behave as before; the table test covers them.Verification
linked t3_thread_launch … expected 'ran') and passes now.bot_createand fail-closed tests fail without their fixes and pass with them.vp run check:changed origin/feat/botspasses: format, lint, knip, graphql, typecheck for 3 packages, and tests in 16 files.🤖 Generated with Claude Code, Claude Opus 5.5, in T3 Code.