Skip to content

feat(server): tailnet device access syncs across devices - #172

Merged
jayleaton merged 1 commit into
mainfrom
feat/tailnet-device-access
Oct 30, 2026
Merged

jayleaton merged 1 commit into
mainfrom
feat/tailnet-device-access

Conversation

@jayleaton

Copy link
Copy Markdown
Owner

Linked tailnet devices had no way to limit or cut off one of them. Access was fixed when a link was made.

This adds a device policy that every device replicates. Entries merge last-writer-wins by hybrid logical clock, so any order of gossip converges.

  • Enforcement: /mcp narrows each device session to the lower of its token and the device's current entry on every request, so a change applies without re-linking.
  • Revoke: ends the device's sessions and its link everywhere the policy reaches. Its handshakes are refused, and the scan skips it. Any full-access machine can restore it.
  • Who can write: a write counts only if its author is full access on the receiving side and is not the device it names. A revoked or limited device cannot widen itself, even relayed through another device.
  • Shared settings (autoLink, defaultAccess, requireCapability) moved into the same replica.
  • RPC: tailnetDevices.setAccess is wired.
  • MCP:
    • t3_environment_links lists devices with origin, access and status.
    • t3_environment_device_access sets access or revokes/restores through the same service method. It is full-access only, refused for linked work, and hidden while links are off.

Tests:

  • policy merge converges for every order of the same writes;
  • a changed level applies to the next request;
  • a revoke on one machine cuts the device off on another;
  • self-restore is refused, both directly and relayed;
  • policy from a limited device is ignored;
  • restore lets the device link again;
  • the tool refuses below-full-access callers and linked work.

The MCP tool list grows by 604 bytes, so this needs the agent-context-increase label.

Opus 5.5 via Claude Code (Doug B)

🤖 Generated with Claude Code

Each device keeps a replica of what every tailnet device may do, merged
last-writer-wins by hybrid logical clock. Requests are held to the narrower
of the token and the current entry, revoking ends a device's sessions and
refuses its handshakes everywhere, and any full-access machine can restore
it. Writes from revoked or limited devices, or about the writer itself, are
ignored. t3_environment_links lists devices, and t3_environment_device_access
sets access over the same service method as the RPC.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jayleaton jayleaton added the agent-context-increase Approves a measured increase to the agent context budget label Oct 30, 2026
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Oct 30, 2026
@github-actions

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 5.0 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 21.6 KiB — 24.4 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 5.0 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.8 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.3 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 21.9 KiB — 24.4 KiB ✅
Claude Live turn messages — 2 — 8 ✅

Baseline: unavailable · PR result: b37fe6c · 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.

@jayleaton
jayleaton changed the base branch from feat/tailnet-devices-link to main October 30, 2026 10:55
@jayleaton
jayleaton marked this pull request as ready for review October 30, 2026 10:55
@jayleaton
jayleaton merged commit 06f0654 into main Oct 30, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-context-increase Approves a measured increase to the agent context budget size:XL vouch:trusted PR 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