GeezerVison is showing github.com — fix(server): delegated MCP tokens no longer renew themselves by juliusmarminge · Pull Request #26352 · pingdotgg/t3code
Conversation
Problem
McpSessionRegistry.resolve wrote lastAliveAt every time it accepted a delegated provider bearer token, and lastAliveAt is also what expires the token. Anyone holding a token that had not yet expired could keep it alive forever just by calling /mcp (for example, calling t3_thread_read over and over to keep reading conversations). That contradicts the policy in the registry's own doc comment: "a trusted provider turn can refresh the token its subprocess still holds; MCP requests cannot." (CWE-613, security scan finding https://git.cafe/pingdotgg/t3code/issues/30)
Fix
resolve now only checks liveness and never renews it. Only touch renews a token, and only the server-side turn lifecycle calls touch:
RunExecutionService calls touchActiveMcpThread when a provider turn starts.
- After the turn is accepted, it keeps calling it every hour until the provider event stream ends.
Against the 24h window, that keeps long-running active turns alive without help from MCP traffic. A token whose session has stopped taking turns now expires 24h after the last trusted touch, however often it is used.
The new test in McpSessionRegistry.test.ts uses TestClock. It shows that the token stays valid under repeated touch calls, and that it expires once the liveness window passes after the last touch, even with resolve called throughout. The test fails on main.
Model: Claude Opus 5.5, harness: Claude Code (in T3 Code)
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Approved at 854d8fc
Macroscope's review found this PR approvable — MCP bearer-token requests no longer extend their own lifetime; trusted provider activity continues to renew credentials. This restores the documented expiration policy without changing the 24-hour window or access scopes.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Recent review info
-
Run configuration
-
Commits
-
Reviewing files that changed from the base of the PR and between 9bc4138 and 854d8fc.
Files selected for processing: 2
-
apps/server/src/mcp/McpSessionRegistry.test.ts
apps/server/src/mcp/McpSessionRegistry.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
Walkthrough
-
McpSessionRegistry.resolve no longer refreshes token liveness. The tests use controlled time to check that touch refreshes liveness and that a token expires when no touch occurs within the liveness window.
Changes: MCP session liveness
| Layer / File(s) |
Summary |
Resolution and expiration checks apps/server/src/mcp/McpSessionRegistry.ts, apps/server/src/mcp/McpSessionRegistry.test.ts |
resolve returns a valid token's scope without updating lastAliveAt. The test setup supports an optional clock, and the new test checks that touches keep the token resolvable while resolution without touches does not prevent expiration. |
Priority: Normal
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Suggested reviewers: willsheldon, t3dotgg
Merge Risk: Minimal · up to 854d8
-
Tokens expire without trusted touches while active turns remain refreshed. No merge-blocking risk was identified.
Pre-merge checks: 4
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly and concisely describes the primary change: delegated MCP tokens no longer renew through resolution requests. |
| Description check |
 |
The description clearly explains the problem, the fix, the security impact, the linked issue, the verification test, and the agent used. It uses a "Fix" heading instead of "Change" and does not explic… |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Description check
-
Explanation
The description clearly explains the problem, the fix, the security impact, the linked issue, the verification test, and the agent used. It uses a "Fix" heading instead of "Change" and does not explicitly document maintainer approval or an approval exemption, but the required information is mostly present.
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Thread transfer impact
✅ Thread transfer remains within every enforced ceiling.
| Provider |
Metric |
Main baseline |
This PR |
Impact |
PR ceiling |
|
| Codex |
Total thread wire |
5.0 KiB |
5.0 KiB |
−6 B (−0.1%) |
6.8 KiB |
✅ |
| Codex |
Thread snapshot wire |
3.8 KiB |
3.8 KiB |
0 B (0.0%) |
4.9 KiB |
✅ |
| Codex |
Live turn WebSocket wire |
1.3 KiB |
1.2 KiB |
−6 B (−0.5%) |
2.0 KiB |
✅ |
| Codex |
Live turn WebSocket decoded |
21.6 KiB |
21.6 KiB |
0 B (0.0%) |
24.4 KiB |
✅ |
| Codex |
Live turn messages |
2 |
2 |
0 (0.0%) |
8 |
✅ |
| Claude |
Total thread wire |
5.0 KiB |
5.0 KiB |
0 B (0.0%) |
6.8 KiB |
✅ |
| Claude |
Thread snapshot wire |
3.8 KiB |
3.8 KiB |
0 B (0.0%) |
4.9 KiB |
✅ |
| Claude |
Live turn WebSocket wire |
1.3 KiB |
1.3 KiB |
0 B (0.0%) |
2.0 KiB |
✅ |
| Claude |
Live turn WebSocket decoded |
21.9 KiB |
21.9 KiB |
0 B (0.0%) |
24.4 KiB |
✅ |
| Claude |
Live turn messages |
2 |
2 |
0 (0.0%) |
8 |
✅ |
Baseline: 9bc4138 · PR result: 854d8fc · Source CI: success
Scenario and decoded snapshot size
10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
- Codex decoded thread snapshot: 108.5 KiB
- Claude decoded thread snapshot: 108.8 KiB
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 29, 2026
|
Thanks for the earlier fix, @juliusmarminge. Closing this older PR as a duplicate of #30589 by @mahruskazi, which addresses the same token-liveness bug with a more recent update. This branch has been inactive for over a week and main has changed the affected files since its base.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:S
10-29 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|