Skip to content

fix(server): link codes and guest links require the access they hand out - #41742

Merged
juliusmarminge merged 2 commits into
mainfrom
t3code/link-code-scopes
Nov 23, 2026
Merged

juliusmarminge merged 2 commits into
mainfrom
t3code/link-code-scopes

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

What changes

  • Getting a link code through a linked environment now requires the scopes of the access level you pick, in addition to access:write.
  • Creating a guest link now requires orchestration:read in addition to access:write.
  • The link dialog in Settings offers linking through another environment only when your session there holds the access you picked. Otherwise it asks for an address and a pairing code, as it does for any other machine.

Clients paired with the default grant hold all of these scopes and see no difference. Only clients paired with a custom scope list are affected.

Both rules live in clientRpcRequiredScopes, which the server's RPC middleware enforces and the clients read for UI availability. There is no wire change.

Docs

docs/internals/04_environment-auth.md now states what access:write covers, docs/internals/06_t3-connect.md notes that approving a T3 Connect device needs access:write alone, and docs/user/remote-access.md mentions the access requirement for linking through another environment.

Tests

  • A new case in apps/server/src/auth/RpcAuthorization.test.ts covers both RPCs through the scope middleware: refused without the scopes, handled with them.
  • One case in apps/server/src/peer/PeerClientPairing.test.ts is removed because it exercised the service with a session the RPC layer no longer admits.
  • vp run check:changed passes locally. The dialog change was not exercised in a browser.

Claude Fable 5.2, Claude Code in T3 Code.

🤖 Generated with Claude Code

Getting a link code through a linked environment now requires the scopes
of the access level requested, and creating a guest link requires
orchestration:read, in addition to access:write. The link dialog offers
linking through another environment only when the session holds them.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 23, 2026
@github-actions

github-actions Bot commented Nov 23, 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 0 B (0.0%) 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.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 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.2 KiB 1.2 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 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 832e359 · PR result: 852e548 · 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.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 9de47a1 and 852e548.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The changes update RPC scope requirements for peer-link pairing and guest-share creation. The settings dialog checks pairing permission before using a through-environment route. Related authorization tests and documentation are updated.

Changes: Pairing authorization

Layer / File(s) Summary
RPC scope requirements and authorization tests
packages/contracts/src/clientRpcPermissions.ts, apps/server/src/auth/RpcAuthorization.test.ts, apps/server/src/peer/PeerClientPairing.test.ts
Pair-link required scopes now include access-write and the scopes for the requested access level. Guest-share creation requires access-write and orchestration-read. Tests cover authorization outcomes, and a pairing test is removed.
Through-environment permission check
apps/web/src/components/settings/LinkedEnvironmentsSettings.tsx
The dialog uses a through-environment route only when pairing permission is granted for the candidate and selected access level, and the target has not already failed. Otherwise, it uses the existing non-through flow.
Authorization and linking documentation
docs/internals/04_environment-auth.md, docs/internals/06_t3-connect.md, docs/user/remote-access.md
The documentation updates scope requirements for credential-returning routes and device approval. It also describes pairing at a chosen access level and the requirements for linking through another environment.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#40036: Both PRs cover linking through another environment and the permission needed to offer that route.

Suggested reviewers: macroscopeapp, maria-rcks

Merge Risk: Minimal · previous review 9de47

This change makes link codes and guest links require the access they hand out, and the dialog falls back to manual pairing when the session lacks that access. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Description check Inconclusive The description covers the change, scope, and verification. It states what changes and why, links the related docs, and lists tests and checks run. It names the model and harness used, as the template… Add a Problem section with the expected behavior and reproduction steps. Link the issue that shows the bug, or explain why a small fix needs no issue. Keep the note that the dialog change was not exercised in a browser, and describe any man…
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title names the main change: link codes and guest links now require the access they grant. It matches the changeset's scope rules in clientRpcRequiredScopes, the dialog gating, and the related doc…
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: Title check

Explanation

The title names the main change: link codes and guest links now require the access they grant. It matches the changeset's scope rules in clientRpcRequiredScopes, the dialog gating, and the related docs and tests. It follows a conventional commit format in plain language.

Full details: Description check

Explanation

The description covers the change, scope, and verification. It states what changes and why, links the related docs, and lists tests and checks run. It names the model and harness used, as the template asks. The Problem section is absent, and the Scope section does not link an issue or explain why none is needed. The Verification section notes the dialog change was not tested in a browser, which is a gap the template asks to state.

Resolution

Add a Problem section with the expected behavior and reproduction steps. Link the issue that shows the bug, or explain why a small fix needs no issue. Keep the note that the dialog change was not exercised in a browser, and describe any manual check for it if one can be run.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
Fix failing CI checks

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 58b7878 and 9de47a1.

Files selected for processing: 7

  • apps/server/src/auth/RpcAuthorization.test.ts
  • apps/server/src/peer/PeerClientPairing.test.ts
  • apps/web/src/components/settings/LinkedEnvironmentsSettings.tsx
  • docs/internals/04_environment-auth.md
  • docs/internals/06_t3-connect.md
  • docs/user/remote-access.md
  • packages/contracts/src/clientRpcPermissions.ts
Files with no reviewable changes: 1

  • apps/server/src/peer/PeerClientPairing.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@juliusmarminge
juliusmarminge merged commit 7dd35d3 into main Nov 23, 2026
39 checks passed
@juliusmarminge
juliusmarminge deleted the t3code/link-code-scopes branch November 23, 2026 23:45
chomamateusz-agent added a commit to chomamateusz/t3code that referenced this pull request Nov 24, 2026
0005 machine filter: persisted state follows upstream's removal of the changed-files expansion state (pingdotgg#41317).
0007 project row: uiStateStore follows pingdotgg#41317; Sidebar.tsx keeps upstream's buildSidebarProjectPickerEntries import (pingdotgg#41554).
0008 new threads in the filter: Sidebar browser test imports merged with upstream's environments mocks (pingdotgg#41554).
0015 read/unread: Mark unread also requires a runtime that is not running, upstream's rule from pingdotgg#41365, for card and menus.
0020 ask-only links: link codes require the access they hand out (pingdotgg#41742), with ask needing orchestration:read; a question leaves a send-recreated worktree's setup for the next ordinary turn (pingdotgg#30773); linked-question delivery test waits for completed runs (pingdotgg#41362).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant