Skip to content

feat(lazurio): a Personal Environment links out, and nothing links into it - #219

Merged
immakermatty merged 1 commit into
mainfrom
lazurio/linked-environments-outbound-only
Nov 18, 2026
Merged

immakermatty merged 1 commit into
mainfrom
lazurio/linked-environments-outbound-only

Conversation

@immakermatty

@immakermatty immakermatty commented Nov 17, 2026 •

Copy link
Copy Markdown

Status: ready for review.

Rebased on the 0.1.10 main (after the exchange in #222, 73c56da2). Agreed with the release thread on 2026-11-18: R4b ships in the first preview of the 0.1.10 line; it is merged only after review of its exact head.

Target release: the first preview of the 0.1.10 line, on top of the rebuild #222 (which does not contain this change). In the rebuild's overlay it is its own row: row 38 (35 to 37 are taken by #214 and #216), feat(lazurio): a Personal Environment links out, and nothing links into it.

Why

Decisions 0246, 0157 and 0091 with their addenda of 2026-11-17 in Lazurio/LazurioPlatform docs/decision-register.md: T3 Code on a Personal Environment may link to the T3 Code of its owner's Work Environments; a link goes one way, and no link leads into a Personal Environment. T3 Code and its standard tools otherwise stay as they are.

Today withoutLinkedEnvironments (apps/server/src/lazurio/buddySurfaceGuards.ts) forces linkedEnvironmentsEnabled off on Buddy's T3 Code (T3CODE_LAZURIO_BUDDY=1). That turns off both directions, so Buddy cannot link out to a Work Environment either. And an ordinary T3 Code on a Personal Environment (for example once Buddy is a thread of Chat, #214) has no inbound guard at all once the beta is on.

What changes

  • New apps/server/src/lazurio/inboundLinks.ts with two decorators, wired in server.ts:
    • refuseInboundLinkRegistration(McpOAuth.layer): a registration with the peer-link software_id gets invalid_client_metadata with the reason "That machine is a Personal Environment, and nothing links into one. Link from it instead." The linking side shows it as pairing_rejected with that text.
    • refuseLinkedClients(McpOAuth.layerMcpClientAuthenticator): a linked client on /mcp is not admitted (401). A link made before the guard existed reports capability_denied ("link it again"), and linking again is refused at registration.
  • How the server knows it is a Personal Environment: Machines write a root-owned, world-readable handover to every hosted Environment, /etc/lazurio/lazurio.machine.json (schema lazurio.machine.v1). It refuses links in when machine.kind is personal-vm or relationships.zone is personal, and always on Buddy's T3 Code (Buddy runs only on Personal Environments). The kind is read once when the layers are built.
    • No handover means the machine is not a Lazurio Environment, so upstream behaviour applies (laptops, desktop, dev).
    • A handover it cannot read or parse, or of a kind other than workspace-vm and personal-vm, fails closed and refuses links in, with a warning in the log.
  • withoutLinkedEnvironments is removed. Buddy's T3 Code reads linkedEnvironmentsEnabled from its stored settings like any T3 Code (default off). Links out (PeerLinks, PeerForwarding, RemoteDelegation, an agent's link request through PeerLinkRequests) stay upstream's.
  • apps/server/src/cli/environment.ts is byte-identical to upstream v0.1.9 again and leaves the CI allowlist.
  • Overlay docs: row 25 no longer claims linked Environments are off, there is a new row 38 and its target-stack entry, the CI allowlist comments are updated, and the release contract checks the new seams.

What does not change

  • Work Environments (workspace-vm) behave exactly as on main, and so does anything without the handover.
  • No change to the Linked environments beta, to pairing codes, tokens, T3-Mode-Limit or linkFence, or to any client, contract or wire format.
  • Nothing turns the beta on. Turning it on and pairing are the Platform's job in a separate change.
  • Not in scope: changing how waiting and remote delegation behave while a question is pending. That is a separate proposal still awaiting a decision.

PeerLinkRequests is outbound

The task listed link requests as inbound. Reading apps/server/src/peer/PeerLinkRequests.ts, a link request is an agent on this machine asking its user to link this machine to another one: the answer goes to PeerLinks.link. That is a link out, so it stays allowed on a Personal Environment. A linked peer cannot reach it, because /mcp refuses linked clients.

Verification

  • vp test run src/lazurio/inboundLinks.test.ts: 12 passed. Real sockets, the production McpOAuth.layer and layerMcpClientAuthenticator behind the decorators, PeerLinks linking from another environment:
    • a Personal Environment links out to a Work Environment and calls a tool there;
    • linking into a Personal Environment is refused (pairing_rejected with the reason) and no session is created there;
    • a link that skipped the registration guard is refused on /mcp (capability_denied);
    • which handovers refuse: nine cases, including none, work, personal, zone-only, unknown kind, unparseable and Buddy.
    • With the guard short-circuited to "allow", 8 of the 12 fail.
  • vp test run src/peer/ src/auth/McpOAuth.test.ts src/lazurio/ src/mcp/McpHttpServer.test.ts: 46 files, 622 passed, 15 skipped.
  • node --test scripts/lazurio-release-contract.test.mjs: 53 passed.
  • vp run check:changed: format, lint, knip, graphql and typecheck (41 packages) pass. In the tests, src/provider/AgentContextBudget.test.ts fails with codexAdditionalContextBytes 8838 vs the committed 7327, and it fails the same way on the clean base cf662620ad, so it is not caused by this change.
  • No browser check: there is no visible surface, and a refused link already shows the server's reason in the existing pairing UI.

CI note

Fork CI got no macOS runner for a while (#218); since #220 the darwin-arm64 archive builds on the release's own Mac runner, and this head runs it there.

Risks

  • Fail closed on a bad handover. A malformed or unknown-kind handover on a Work Environment would block links into it. That is visible and recoverable, and it keeps the boundary when in doubt.
  • Detection depends on the Machines handover. If Machines stop writing it, Personal Environments fall back to upstream behaviour, but only with the beta on, which only the Platform turns on. Buddy's T3 Code stays covered by T3CODE_LAZURIO_BUDDY either way.
  • Not covered by this change: the /oauth/mcp/authorize and /token steps for a client id signed before this change. A stateless client id can still get a token, but /mcp refuses it. The guard matches the same two gates upstream uses when the beta is off.

Review: @agentrozjedemeai.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread defc2d34-54ad-4a96-84d4-be845ae9934a

🤖 Generated with Claude Code

@agentrozjedemeai

Copy link
Copy Markdown
Collaborator

@immakermatty Předávám vám odpovědnost za PR: před sloučením musí vzniknout tag v0.1.9-lazurio.1 a být sloučeny #214 a #216. Head c198bfa3512cc2fa36e39d60d17ea6621404a412 zatím nemá review; kontroly ještě běží a požadovaný macOS runner čeká. Po splnění pořadí zajistěte review aktuálního headu a zelené povinné kontroly, potom znovu předejte publikaci oprávněnému assignee. PR jsem nereviewoval ani nesloučil.

— Pablo

@agentrozjedemeai agentrozjedemeai removed their assignment Nov 17, 2026

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. No blocking findings.

Non-blocking: The 12 inbound-link tests and 53 release-contract tests passed. check:changed passed formatting, lint, knip, GraphQL and typecheck; its existing AgentContextBudget failure matches the documented base discrepancy. The required macOS build is queued without a runner (#218), and server compatibility is still running; these gates remain to be resolved before merge.

Order and migrations: wait for tag v0.1.9-lazurio.1 and merge #214 and #216 before this PR; the target release is conditional as stated in the PR.

— Pablo

@immakermatty

Copy link
Copy Markdown
Author

Rebased on main faae02aa (after the tag v0.1.9-lazurio.1, #214 and #216), new head 434f29f1. The rebase had no conflicts and the change itself is unchanged.

Verified on 434f29f1 in apps/server: vp test run src/lazurio/inboundLinks.test.ts src/peer src/auth/McpOAuth.test.ts gives 7 files and 97/97 tests.

Please review the exact head 434f29f160. The release that carries it is being agreed with the release thread.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread defc2d34-54ad-4a96-84d4-be845ae9934a

@immakermatty

Copy link
Copy Markdown
Author

Review request withdrawn by agreement with the release thread (T3 thread 57942b76, 2026-11-18).

R4b ships in the first preview of the 0.1.10 line, not in 0.1.9. This PR is not merged before the 0.1.10 main exchange (#222), because that exchange needs main at exactly faae02aa.

After the exchange this branch is rebased on the new main (buddySurfaceGuards.ts changed in the rebuild). Review is requested once, after the last push, an updated description and green required CI.

Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · T3 thread defc2d34-54ad-4a96-84d4-be845ae9934a

@agentrozjedemeai

Copy link
Copy Markdown
Collaborator

@immakermatty Předávám vám odpovědnost za PR: #222 už je sloučené, ale podle vašeho následného zadání je nutné větev rebasovat na nové main a vyřešit konflikt (GitHub nyní hlásí dirty). Po posledním pushi aktualizujte popis, vyčkejte na zelené povinné kontroly a požádejte o nové review přesného headu; potom můžete publikaci znovu přiřadit. Head 434f29f zatím slučovat nelze, tři kontroly dosud běží.

— Pablo

@agentrozjedemeai agentrozjedemeai removed their assignment Nov 18, 2026
…to it

Decisions 0246, 0157 and 0091 (Lazurio/LazurioPlatform, addenda of 2026-11-17): T3 Code on a
Personal Environment may link to its owner's Work Environments; links go one way and none leads
into a Personal Environment. Buddy's T3 Code turned linked Environments off as a whole, which also
stopped its links out.

The server of a Personal Environment now refuses a peer link's registration (McpOAuth.register)
and a linked client on /mcp (McpClientAuthenticator); links out (PeerLinks, PeerForwarding,
RemoteDelegation, an agent's link request) stay upstream's under the Linked environments beta, in
Buddy's T3 Code too. The server knows a Personal Environment from the handover Machines write to
/etc/lazurio/lazurio.machine.json (machine.kind personal-vm or relationships.zone personal), and
Buddy's T3 Code always. Without the file nothing changes; a file it cannot read, or of another
kind than workspace-vm or personal-vm, refuses links in. Work Environments are unchanged.

Overlay row 35; cli/environment.ts is upstream's again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@immakermatty
immakermatty force-pushed the lazurio/linked-environments-outbound-only branch from 434f29f to 5476cce Compare November 18, 2026 19:26

@agentrozjedemeai agentrozjedemeai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. No blocking findings.

Non-blocking: 172 focused server tests and 53 release-contract tests passed. check:changed passed format, lint, knip, GraphQL and typecheck; AgentContextBudget failed with the same values on current main 73c56da. Tests ran with Node 24.22.2; CI uses the pinned Node version. Linux archive CI passed; server/web compatibility is running and the macOS archive is queued, so these gates still need to finish before merge.

Order and migrations: #222 is merged; the target is the first 0.1.10 preview, as described in the PR.

— Pablo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants