Repository navigation
Renew environment links before their 30-day credential expires - #106
Merged
nullStack65 merged 2 commits intoNov 19, 2026
Merged
Conversation
A link's credential is a 30-day MCP client session on the peer with no refresh path, so every link lapsed 30 days after pairing. The linking side now sweeps hourly and, inside a link's last 20 days, calls the new link-only t3_link_renew tool. The peer signs the same session again with a later expiry, so the link fence, idempotency keys and incarnation stay the same and no pairing code is needed. A link that cannot renew sends the watcher one alert, through the model alert outbox, until it renews. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion - Key a link's renewal alert by its session here, so linking again alerts fresh. - Count an alert as reported only once queued; a delivered one keeps the link quiet, and one that left the outbox undelivered lets the next failure alert. - An expired link is not retried; it alerts once that it needs linking again. - One link's defect no longer stops the sweep; a replaced link's renewal logs as not kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Review findings from the single bot review round (Fable 5.2), and what head
Tests were added for each fix. Typecheck, lint and fmt are clean, and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Links between environments renew their own credential before it expires. Today a link's credential is a 30-day MCP client session on the peer, there is no refresh grant, and nothing renews it, so every link in the fleet mesh lapses about 30 days after it was made (around Dec 18–19, 2026) and cross-machine delegation and the shared inbox stop without warning.
t3_link_renewtool. It is offered only to a linked environment, never to an agent. The handler also refuses outside agents, local agent threads and a link's call made for one of its agent threads. It signs the calling link's same session again with a new 30-day expiry and moves that session row'sexpires_at(SessionStore.renew,AuthSessionRepository.extend,EnvironmentAuth.renewMcpClientSession). Because the session id does not change, the link fence (client:<sessionId>), idempotency keys and the peer's Connections entry stay the same. Only live bearer peer-link sessions renew; a revoked, expired or DPoP session returnscapability_denied. A revocation between the read and the update wins.PeerLinkRenewal). It starts two minutes after startup and then runs hourly. A link with 20 days or fewer left whose peer advertises the newlinkRenewalcapability callst3_link_renew. The new token is stored under the same secret name (PeerLinks.renewed), so the link's incarnation does not change and in-flight work bound to it stays bound. If the link was linked again meanwhile, the stale token is not kept.ModelAlertReactor). A newpeer-link-renewalwatcher alert uses the existing durable outbox, destinations, retry and backoff. Dedupe is keyed by the linked environment and the link's session here in the persistedreportedmap, so linking again starts fresh. A failing link alerts once and stays quiet through later hourly failures while that alert is queued or once it was delivered; it alerts again after a renewal, after linking again, or if the alert left the outbox undelivered. Nothing counts as reported until something was queued. A transient failure (the peer is off or unreachable, or a storage error) is retried quietly and alerts only in the link's last 7 days. A permanent one alerts at once: a revoked session or an older peer withoutlinkRenewal. An expired link is not retried; it alerts once that it needs linking again. One link's failure never stops the sweep for the others. An alert that is still queued when its link renews is dropped.docs/user/remote-access.mdanddocs/internals/remote.md.No setting is added. Renewal is always on, so there is no default to flip in
packages/contracts/src/settings.ts.Tradeoffs
t3_link_renewis offered to sessions marked as peer links, and that mark comes from thesoftware_idthe client declared when it registered over MCP OAuth. Any client that completed a pairing exchange at full trust could therefore renew its own session. Pairing itself is the trust boundary, and revocation on the peer remains the kill switch.Verification
PeerLinkRenewal.test.ts, end to end against a real peer on a socket underTestClock:linkRenewal, and a session revoked on the peer, each produce one failed outcome and leave the expiry unchanged.ModelAlertReactor.test.ts: three failures queue one alert per destination, a renewal clears it, a later failure alerts again, and another link alerts on its own. With no destination nothing is marked; an undelivered alert that left the outbox alerts again; a delivered one stays quiet past the outbox week; linking again (a new session) alerts fresh.PeerLinkRenewal.test.ts: an expired link is not tried against the peer and raises one "link it again" alert naming its session.effect-tsgotypecheck ofapps/server,vp lintandvp fmt --checkon the touched files, plus the peer, auth, mcp, environment, persistence and model-alert suites.Deploy: fleet
🤖 Generated with Claude Code