Repository navigation
Description
Goal
Give Tanner's Grok Bots (Financial Manager, Computer Manager, and later others) a reliable send-and-return path: a bot hands build and debug work to a Codex (or other) thread in T3 Code on the Linux PC, then gets a result that wakes the bot that asked. This should use the official T3 Code MCP, not the T3 Tots local helpers, so it does not depend on a desktop shell or a long-lived local API watcher.
This issue is the setup and verification spec. Product additions discussed in the Nov 19 plan (role on launch, nested parent threads, owner-granted approval relay) stay tracked here and in #494; they are not required to start the official-MCP trial.
What broke before (do not repeat)
On 19 Nov 2026, Financial Manager used T3 Tots (t3ctl / t3listen) and a Grok Bot webhook routine ("T3 questions to chat") for return pings.
Evidence:
t3listenconnected to T3's local API and watched 1,100+ threads. The first finish ping was missed because the listener lost its connection around 4:39 PM MST and did not recover before the thread finished at 4:43 PM MST. A restart briefly worked, then the log filled withT3 stopped answering; reconnecting(77 of 102 lines) until 5:15 PM MST, when the log stopped.- A later comment on this issue (20 Nov 2026, 00:15 UTC) recorded the sharper failure: Server runs out of JavaScript heap about 100 s after each start (v2.12.161) #497 heap crashes were caused by
t3listen. On each question or approval it fetched the thread's full legacy snapshot (GET /api/orchestration/threads/:id), about 170–180 MB for a long thread. Several in a row ran the server out of heap four times. The process was stopped with the owner's OK. Upstream/fork PR fix(server): bound full thread snapshot reads #502 caps that endpoint at 8 MiB; official MCP reads are bounded, so this class of problem should go away once bots stop usingt3listen. t3tots-listen.serviceis now disabled and inactive. That is intentional until the test plan below passes.
Decided design (use this)
- Connect the official T3 Code MCP over the T3 Connect public HTTPS URL (
https://<environment-address>/mcp). Use Settings → Sharing & access or the command palette Use T3 Code in another app (MCP). Hosted Grok Bots cannot finish OAuth over a plain-HTTP Tailscale or LAN address. Sign-in lasts 30 days; revoke in Sharing & access. Access level remains the owner's earlier choice: Auto. - Send:
t3_thread_launchin the right project, with an explicitprojectId, a Codex (or role-selected) model, a self-contained prompt, and a tagged title:[FM] …or[CM] …. Do not usecreate_threadsordelegate_taskfrom an outside agent. - Short jobs: follow with
t3_thread_wait/t3_thread_readin the same turn. Note:t3_thread_waitis documented in the Nov 19 plan as timing out at about 45 seconds per call; retry or end the turn rather than spinning. - Long jobs: launch, end the turn, then collect the result by a scheduled
t3_thread_read(ort3ctl watchonly as a temporary fallback). One routing routine maps the title/project tag to the owner bot and wakes it (SendToAgent). - Official event webhooks (
io.modelcontextprotocol/events,events/subscribe) may replace the scheduled read only after T3 is upgraded to ≥ 0.1.12-nightly.20261123.5138 (or a later stable that includes PR #41141) and Grok Bot is proven to support MCP Events. Subscriptions last at most one hour (default 15 minutes), go only to publichttps, and must be renewed. The current desktop build is 0.1.10-v2.12.169, which should already havet3_thread_launch/wait/read(shipped in v0.1.0) but should not be assumed to have MCP Events webhooks. - Approvals and questions: command approvals stay owner-controlled in T3 unless and until the owner-granted relay permission from the 19 Nov decisions is built. Money and direction questions still go to the owner. Routine questions may be answered by the bot only when the owner has said so.
Non-goals
- Do not re-enable
t3tots-listen.service, and do not run always-ont3listen, until section C of the test plan passes and the owner explicitly says to enable it. - Do not use
t3ctl's local session token as the long-term path. Official MCP sign-in is the replacement. - Do not implement
delegate_taskfor outside agents (rejected in the Nov 19 plan). - Do not read Grok Bot conversations through a private gateway (Research: talk to Grok Bot bots as T3 threads in their own sidebar section #485).
- Mobile is out of scope.
- Do not change upstream
pingdotgg/t3codefrom this issue; work stays in this fork.
Test plan
Nothing persistent is enabled until the relevant gate passes. Use only a scratch project or a scratch thread. Do not point trials at finance or app repos. Leave t3tots-listen.service disabled.
A. Official MCP, no listener (first gate)
- Add the T3 MCP connector at Read only; list projects and read one existing thread.
- Raise to the agreed access level (Auto).
- Launch five scratch jobs: instant success; a ~2-minute job; a deliberate failure; a question that needs an answer; a T3 restart mid-job.
- Pass: the requesting bot gets the result or question every time; T3 stays responsive;
~/.t3growth stays under about 1 GB. - Fail: OAuth cannot complete (for example a non-https redirect T3 rejects), T3 hangs, or results never come back.
B. Wake path
- On 0.1.10, do not expect MCP Events. Time
t3_thread_waitfor short jobs and a scheduledt3_thread_readfor long jobs only. - Only after an upgrade to ≥
0.1.12-nightly.20261123.5138: subscribe to MCP Events (thread.run_settled,thread.needs_input) with a test routine webhook. - Confirm delivery, renewal before expiry, and recovery after a Grok or T3 restart (handle
truncatedand reread). - Pass: every finish and question wakes the right path; subscriptions stay alive.
- Fail: Grok Bot cannot call
events/subscribe, events are missed, or the subscription expires and is not renewed. Keep the scheduled-read fallback.
C. t3listen only as a later, optional trial (not at login)
- If tried at all: run
t3listenby hand, not as a systemd unit, and only for scratch-project events. - Five cases: finish, question, failure, T3 restart, 30 minutes idle.
- Fail the trial if
T3 stopped answeringrepeats, if a finish is missed, if T3 becomes unresponsive, or if heap use climbs the way Server runs out of JavaScript heap about 100 s after each start (v2.12.161) #497 described. - Stop it afterwards. Do not
installthe service until that stays clean at the current thread volume, and only with a new owner yes.
D. Multi-bot routing
- Two tagged threads,
[FM]and[CM]. - Pass: one router wakes only the owning bot.
- Fail: both bots are woken, or the wrong bot is woken.
Risks
t3listenwatching 1,000+ threads and fetching unbounded legacy snapshots can knock T3's local API over and exhaust heap (Server runs out of JavaScript heap about 100 s after each start (v2.12.161) #497).- Official MCP Event webhooks need a newer T3 than 0.1.10, a public HTTPS receiver, and hourly renewal. Grok Bot support for
events/subscribeis unverified. - Grok Bot connectors are account-wide: one T3 sign-in and access level is shared by every bot.
t3_thread_waitis short; do not treat it as a long poll for multi-hour Codex jobs.- Hosted Grok must use the T3 Connect URL, not Tailscale HTTP.
- T3 data under
~/.t3is still large (see the separate cleanup audit). Do notVACUUMstatev2.sqlitewhile T3 is open. - A compromised bot at Auto can still start threads and spend provider quota. It cannot accept command approvals unless the relay permission is built and granted.
Links
- Docs: Outside agents
- T3 Code v0.1.0 (MCP launch / wait / read): https://github.com/pingdotgg/t3code/releases/tag/v0.1.0
- PR #33196 — Use T3 Code in another app (MCP) wizard
- PR #40774 — MCP Events poll / stream
- PR #41141 — MCP Events webhooks, in Nightly 0.1.12-nightly.20261123.5138
- Theo, MCP overhaul / cmd+k MCP: https://x.com/theo/status/2114930248852881782 https://x.com/theo/status/2119948325705462260
- Julius, MCP works with Grok: https://x.com/jullerino/status/2107887846648635705
- Related in this fork: Server runs out of JavaScript heap about 100 s after each start (v2.12.161) #497 (heap), fix(server): bound full thread snapshot reads #502 (8 MiB cap), Research: talk to Grok Bot bots as T3 threads in their own sidebar section #485 (other direction), Five roles with light and heavy levels instead of eight roles #494 (roles and levels)
Earlier comments on this issue
The Nov 19 Designer plan, owner decisions, and #494 overlap remain in the comments and still apply, with two updates from this revision: (1) official "T3 calls the bot" webhooks now exist upstream as MCP Events, but not on 0.1.10; (2) t3listen is not a safe return path and must stay disabled until section C passes.
Original issue
Goal (owner, 2026-11-19)
The owner's Grok Bot bots should be able to act as orchestrators of T3 work. A bot plans and talks with the owner; it delegates the actual work to T3 subagents on Codex and Claude, chosen by the model-tier roles (#486), so that it uses less Grok Bot capacity. The bots should feel built into T3, not bolted on.
What already happens
A Grok Bot started a thread in the finance project today. It used T3 Tots, a homemade helper kit in ~/t3-tots, made 2026-11-02, version 1.4.30:
t3ctl: a 667-line Node client. It reads~/.t3/userdata/server-runtime.jsonand calls T3's local API with a bearer token from~/t3-tots/token. The token has the scopesorchestration:readandorchestration:operateand expires 2027-01-31.- Commands:
projects,models,new --project --model --effort --title --prompt-file,pending --thread,answer. - Other files:
t3listen,t3q.py,thread-match.jsandsurvey.js. - Behavior: the bot shows each child question to the owner as a card. It decides routine ones itself only when told to, never decides money or direction questions, and never accepts a command approval without the owner's explicit yes.
Official pieces that exist
- T3's MCP server for outside agents (
docs/user/outside-agents.md): sign-in with an access level, plust3_thread_launch,t3_thread_waitandt3_thread_read.- Outside agents cannot call
delegate_taskorcreate_threads, nor the other tools that "act as" an inside thread.
- Outside agents cannot call
- Grok Bot custom MCP servers: per the Research: talk to Grok Bot bots as T3 threads in their own sidebar section #485 research, Grok Bot officially supports adding a custom MCP server "by URL or by a command" (docs.x.ai/grok-bot/computer-and-apps). A server on a private network needs the owner's approval.
- Grok Bot webhook routines: the official way in. One per bot; a POST starts a run.
- Research: talk to Grok Bot bots as T3 threads in their own sidebar section #485: the earlier research decided not to read bot conversations through Grok Bot's private gateway, because of its Terms of Service. That decision stands. This issue is the other direction: the bot calls T3.
Questions for the Designer
- Replace
t3ctl. Can the bots use T3's official MCP connection instead? Cover reachability (localhost vs the bot's cloud computer: T3 Connect or Tailscale), sign-in, and the access level. - Gaps for an outside orchestrator.
- Role-based delegation, with tiers and model notes, for outside callers.
- Children's questions and approvals routed to the bot.
- Results reaching the bot without polling, for example T3 calling the bot's webhook routine when a child finishes or asks.
- Visibility in T3: a representative parent thread per bot, perhaps in a Grok Bot sidebar section, so the owner sees each bot's children nested under it. This would also cover part of Research: talk to Grok Bot bots as T3 threads in their own sidebar section #485's wish.
- Smallest design. What is the smallest design that makes this feel built in? It should reuse the existing outside-agent MCP, delegation and pending-request machinery, not add a parallel system.
- Saving Grok usage. What instruction text or skill should the bot get, so it delegates by role and does little work itself?
- Security. Cover the access level, token lifetime, and what a compromised bot could do. Keep the owner's approval rules: money and direction questions and command approvals go to the owner.
Done when
A plan on this issue covering the findings, options with trade-offs, a recommendation, owner decisions to make, done criteria, and a task split. No code until the owner approves.
Mobile is out of scope.
Activity
tannerpolley commentedon Nov 19, 2026
Plan (Designer, 2026-11-19)
Short answer. The bots can drop
t3ctland use T3's official connection for outside agents (its MCP server) for almost everything they do today, with no T3 code. Three small T3 additions then make it feel built in: launch by role, nest a bot's threads under one thread per bot, and (second step) have T3 call the bot's webhook routine. Fulldelegate_taskfor outside callers is not worth building.Method: read-only. T3 code and docs, the
~/t3-totsscripts (never thetokenfile), and the Grok Bot docs. Nothing was run against Grok Bot and no bot was messaged, so every Grok Bot behaviour below is from its docs and marked where unverified.Findings
1. T3 Tots is a published kit, not a homemade one. Its
manifest.jsonnamesgithub.com/Deepusleepy/t3-totsat v1.4.30, and the installedt3ctlmatches the manifest's checksum. What it does here:EnvironmentAuth.ts:84).t3ctl:507) and records them as created by the user from the web app (t3ctl:390,:506). T3 cannot tell the bot's messages from yours.--user-approvedflag that the bot itself passes (t3ctl:226,:317).t3q.pyreads T3's database file directly, andcleanup/scan.pyscans the disk (out/du-root.txtand others show it ran).t3listencan post thread events to a webhook routine, but there is nolisten.json, so nothing notifies a bot today.2. What an outside agent can already do in T3 (checked in code):
orchestrator_capabilitiesworks for outside agentst3_thread_launchwith an explicit model. It has noroleinputt3_thread_wait, at most 45 seconds per call (OrchestratorMcpService.ts:167), thent3_thread_readt3_pending_requestlists and reads any thread's requests, and answers questionsDelegatedRequestRouting.ts:228). Only the owner, or a T3 parent thread, can acceptdelegate_task,task_status,create_threads/mcp. The redirect address must behttpsorhttp://localhost(McpOAuth.ts:108).roleDefaultTarget), callst3_thread_launchwith adelegatedFromparent, and follows witht3_thread_wait(peer/RemoteDelegation.ts). The web app already nests such a thread under its parent and shows a "delegated from" chip (client-runtime/src/state/threadShell.ts:431). The server keepsdelegatedFromonly for linked environments (Orchestrator.ts:3960).3. Grok Bot facts (apps and connectors, routines, private networks, approvals):
httpsaddress: T3 Connect. Tailscale on the bot's computer needs the Enterprise-only setup scripts or a hand install that is lost when the computer is rebuilt.200means started. Each run spends usage; limit 200 runs an hour per routine.httpsaddress or togrokbot://mcp/oauth/callback(seen in Research: talk to Grok Bot bots as T3 threads in their own sidebar section #485). T3 refuses the second today. Also unverified: whether Auto Review shows an approval card for each T3 call.Answers to the five questions
t3ctl: yes. Add T3's MCP URL as a custom connector, sign in once, pick the access level. The bot then needs no command execution on the desktop and no token file.Options
delegate_taskfor outside agentsRecommended design
Step 0: trial, no code (owner, about 15 minutes). Turn on T3 Connect, add the connector in Grok Bot, approve at the chosen level, and ask one bot to list roles, start one Investigator thread in a scratch project, wait and read it. This settles the redirect address, the approval cards and whether Grok Bot copes with T3's long tool list. If the redirect is
grokbot://, allowing that one address inMcpOAuth.parseRedirectjoins Step 1.Step 1: built in (Option C).
roleont3_thread_launch. It picks the model from the live role with the sameroleDefaultTargetlinked environments use, and records the role on the thread, so the sidebar titles the row by role.role: "orchestrator"then gives a bot a real T3 Orchestrator that delegates with everything T3 already has.delegatedFromnaming a thread in this environment. Each bot gets one idle thread (launched with no message) in a "Grok Bot" project, placed in a "Grok Bot" sidebar section; its workers nest under it. Limit the parent to a top-level thread that was itself created through MCP.threadShell.ts:261skips them).docs/user/outside-agents.md, with the skill text.Step 2: callback (Option D). Per bot thread, the owner pastes the routine's URL and key in Settings. T3 posts a small body (event, thread id, title, status, link; no content) when a nested thread settles, fails, or opens a question or approval. The bot cannot set the address itself, or a hijacked bot could point T3 anywhere. Build it as an outbox effect so it retries and survives restarts.
Step 3: retire T3 Tots. Revoke its token (
t3 auth session revoke) and set Grok Bot's "Execution on this computer" to Never allow.Two things to check in Step 1 before promising them: nesting across projects (the worker lives in the finance project, its parent in the Grok Bot project), and that a nested worker then leaves its own project's list.
Skill text for the bots (draft)
Security
/mcp.t3ctluses.Owner decisions
Done criteria
docs/user/outside-agents.mdcovers the setup; the T3 Tots token is revoked.Task split
roleand localdelegatedFromont3_thread_launch, contract change, focused tests inOrchestratorMcpToolkit.integration.test.ts. Tool descriptions are model-facing: run the free checks inevals/mcp-tool-use.docs/user/outside-agents.md.test-t3-app.Out of scope: mobile, reading bot conversations (#485), and any use of Grok Bot's private gateway.
tannerpolley commentedon Nov 19, 2026
Owner decisions (2026-11-19)
Ordering with #494: the roles become five, with routine and complex levels. Step 1's
roleinput ont3_thread_launchshould take the role and level shape #494 settles. Build Step 1 after #494 merges, or in the same contracts pass, to avoid two migrations of the role ids.tannerpolley commentedon Nov 19, 2026
Overlap with #494 (from the #494 Designer, 2026-11-19)
The #494 plan is posted there. What it means for this issue:
routineand acomplexlevel.delegate_taskgains an optionallevel; omitted means complex. Whatever tool outside orchestrators get should take the sameroleandlevelpair and call the same resolver through a service method.modelRoleslist inorchestrator_capabilitiesbecomes ten entries withlevelin place ofprofile, and ids such asdesigner-routine. Code against role and level only, not the old ids (implementor-fast,checker,investigator), though those names keep resolving as aliases.packages/provider-core/src/server/orchestrationInstructions.ts, the orchestrator tool descriptions andpackages/contracts/src/orchestratorMcp.ts. Recommended order: Five roles with light and heavy levels instead of eight roles #494 first, so the bot's instructions teach five roles and two levels once.orchestratorrole. Five roles with light and heavy levels instead of eight roles #494 dropscheckerandinvestigatoras thread roles; please do not add a sixth.tannerpolley commentedon Nov 20, 2026
More evidence for retiring T3 Tots (2026-11-19): #497's heap crashes came from T3 Tots'
t3listen, which runs as the user servicet3tots-listen.service, enabled at login, withRestart=on-failure.On every question or approval event, it fetches the thread's full legacy snapshot (
GET /api/orchestration/threads/:id). That is about 170–180 MB for a long thread, and several in a row ran the server out of heap four times. With the owner's OK, the orchestrator stopped the process (PID 1830127).PR #502 caps that endpoint at 8 MiB. The official MCP connection in Step 1 uses bounded reads, so this whole class of problem goes away once the bots switch.
[-]Grok Bot bots as outside orchestrators that delegate to T3 workers[/-][+]Grok Bot → Codex send-and-return via official T3 Code MCP[/+]tannerpolley commentedon Nov 23, 2026
T3 Code status: Paused
Issue: #492 Grok Bot → Codex send-and-return via official T3 Code MCP
Thread: thread:delegated-task:milestone-issue%3Athread%3Adelegated-task%3Arepository-handoff%253A421f7a75-1bf7-49e2-abb0-448fcf274ea0%3A8%3A6501071848%3Afirst
Model: claude-opus-5-5
Branch: issue-492-grok-bot-codex-send-and-return-via
Updated: 2026-11-23T22:08:31.124Z
tannerpolley commentedon Nov 23, 2026
T3 Code closeout: working
Issue: #492 Grok Bot → Codex send-and-return via official T3 Code MCP
Thread: thread:delegated-task:milestone-issue%3Athread%3Adelegated-task%3Arepository-handoff%253A421f7a75-1bf7-49e2-abb0-448fcf274ea0%3A8%3A6501071848%3Afirst
Model: claude-opus-5-5
Branch: issue-492-grok-bot-codex-send-and-return-via
Completed: 2026-11-23T23:33:18.467Z
check:changedhas passed format, lint and the first knip pass, and is still running the typechecks and nearby tests. The job wakes me when it finishes, so I'll stop here.Verified since the reboot:
--context) shows my tool-text changes add about 25 tokens of descriptions and about 190 tokens of schema across the 105 tools. It needed node 26; the shell's node 22 crashes on a regex in the eval grader.All work is in local commit
7b74a87b94; nothing is pushed yet. Oncecheck:changedpasses I'll push the issue branch, open the draft PR withCloses #492, and start the reviewer.tannerpolley commentedon Nov 23, 2026
T3 Code closeout: working
Issue: #492 Grok Bot → Codex send-and-return via official T3 Code MCP
Thread: thread:delegated-task:milestone-issue%3Athread%3Adelegated-task%3Arepository-handoff%253A421f7a75-1bf7-49e2-abb0-448fcf274ea0%3A8%3A6501071848%3Afirst
Model: claude-opus-5-5
Branch: issue-492-grok-bot-codex-send-and-return-via
Completed: 2026-11-23T23:33:18.740Z
The machine rebooted, which cancelled the handler test run before it reported anything. No code was lost.
7b74a87b94on the issue branch, not pushed. The commit hooks (format, lint, knip) passed.b6w4z6sb3. The machine is idle after the reboot, so they should be quicker this time.check:changed, then push the issue branch, open the draft PR withCloses #492, and start the review child.The handler test job wakes me when it finishes.
tannerpolley commentedon Nov 24, 2026
T3 Code closeout: done
Issue: #492 Grok Bot → Codex send-and-return via official T3 Code MCP
Thread: thread:delegated-task:milestone-issue%3Athread%3Adelegated-task%3Arepository-handoff%253A421f7a75-1bf7-49e2-abb0-448fcf274ea0%3A8%3A6501071848%3Afirst
Model: claude-opus-5-5
Branch: issue-492-grok-bot-codex-send-and-return-via
Completed: 2026-11-24T00:15:19.121Z
Step 1 of #492 is merged into
main, and the issue closed automatically.PR: #621 (ready, not draft), merged with
--rebaseMerge SHA:
aa557db63f0fa0fa97aa068bb20594426bfe9e3a, the tip ofmain. The PR head wasc29a86e104e5before GitHub rebased it.What bots can do now:
roleandlevelinstead of picking a model, and the thread is titled by role.Check results:
b6w4z6sb3--context)vp run check:changedmainvp run i18n:checkFixes along the way:
main(17 commits ahead) gave conflicts in the contracts, translations and budget files. I resolved them and re-measured the budget.Review: four rounds in this worktree. I fixed every important finding:
Each dismissed nit and its reason is in the PR body. One open nit: the switch also appears on linked-environment rows, where it does nothing.
Not done:
falseentries, which is harmless.PR #621, head c29a86e, checks: no CI on the fork, local
check:changedandi18n:checkpassed; reviews: four in-worktree rounds, all important findings fixed; merged as aa557db.