GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): delegated MCP tokens no longer renew themselves by juliusmarminge · Pull Request #26352 · pingdotgg/t3code

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Oct 28, 2026

Copy link
Copy Markdown
Member

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.

All reactions
@juliusmarminge @claude
fix(server): delegated MCP tokens no longer renew themselves
854d8fc
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Oct 28, 2026
macroscopeapp[bot]
macroscopeapp Bot approved these changes Oct 28, 2026
View reviewed changes
@macroscopeapp

macroscopeapp Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: pingdotgg/t3code
  • Branch: t3/mcp-token-liveness
  • File: .coderabbit.config.ts
  • Commit: 854d8fc
  • Layers: Repository TS config
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 28acfcc1-dae0-4981-81d3-21804f2d4ddd
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: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the primary change: delegated MCP tokens no longer renew through resolution requests.
Description check Passed 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 Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed 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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 29, 2026
feat(server): upgrade Skofo to full v0.1.5 with linked-machine delegation AIdoesmyjob/t3code#11
Draft
Reconcile main with reviewed stable v0.1.5 and linked-machine delegation AIdoesmyjob/t3code#12
Merged
GigaZoro pushed a commit to GigaZoro/CodeShip that referenced this pull request Oct 30, 2026
@juliusmarminge @claude Andrii Kucheriavyi
fix(server): delegated MCP tokens no longer renew themselves (upstream …
ce56f46
…pingdotgg#26352)

Cherry-picked from pingdotgg#26352

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai coderabbitai Bot mentioned this pull request Nov 5, 2026
fix(server): refresh MCP credentials only from trusted lifecycle #30589
Open
@juliusmarminge juliusmarminge closed this Nov 10, 2026
@juliusmarminge GitCafe Production

juliusmarminge commented Nov 10, 2026

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@coderabbitai coderabbitai Bot mentioned this pull request Nov 11, 2026
fix(server): MCP tokens still expire after the clock steps back #34532
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] approved these changes

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.

Projects

None yet

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.

1 participant

@juliusmarminge
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.