[Bug]: `t3 thread list|show` issue a full-access session for a read, and a killed CLI leaves it active for 30 days
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- On a machine that runs the T3 Code background service, run
t3 auth session list --jsonand note the sessions. - In another terminal, run
t3 thread show <threadId>(ort3 thread list), and list sessions again while it runs. There is a new session labelledt3 thread cli, with full access. - Run
t3 thread show <threadId>again and kill it with SIGKILL before it returns. - List sessions again. The
t3 thread clisession from step 3 is still active, and it stays active until it expires 30 days later.
Expected behavior
- A read does not write to the auth store. If a session is needed,
listandshowissue a read-only one.EnvironmentAuth.issueMcpClientSessionalready acceptsaccess: "read-only", whichmcpClientScopesmaps to[orchestration:read]. - A CLI session that is never revoked does not outlive the command by much. A TTL measured in minutes, not 30 days, would limit the harm of a killed CLI.
Actual behavior
withThreadTools in apps/server/src/cli/thread.ts (lines 231-242 on main at 2dd207a) runs for every t3 thread subcommand (list, show, send, start). It issues an MCP client session with access: "full-access", then revokes it in the release step of Effect.acquireRelease. The issued session:
- carries
orchestration:read,orchestration:operate,settings:writeandsource-control:write; - has the 30-day
MCP_CLIENT_SESSION_TTL(apps/server/src/auth/EnvironmentAuth.ts:79).
So every read creates a full-access session and then revokes it. A CLI that is killed, or that loses its machine, before the release step runs leaves a full-access credential active for 30 days. On two machines we found 12 such t3 thread cli sessions, each left behind by an earlier CLI run.
Impact
Minor bug or occasional failure
Version or commit
0.1.9-nightly.20261110.4465 (7171fdd). The same code is on main at 2dd207a.
Environment
Linux (systemd user service) and macOS (desktop app), headless CLI use from agents.
Workaround
Callers revoke leftover t3 thread cli sessions with t3 auth session revoke <id>. Agents that only read use a read-only MCP client session instead of the CLI.