8000 feat(mesh): compute nodes run the assistant's code on a sandbox gateway of their own by adeelahmad · Pull Request #607 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

feat(mesh): compute nodes run the assistant's code on a sandbox gateway of their own - #607

Merged
adeelahmad merged 3 commits into
mainfrom
claude/project-thread-6dqeie
Oct 18, 2026
Merged

adeelahmad merged 3 commits into
mainfrom
claude/project-thread-6dqeie

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Description

Before: a machine could join as a compute node, but it ran nothing. The code sandbox's node seam (#572) had no nodes to offer, so the assistant's code always ran on this machine.

After: a compute node runs the assistant's code.

  • A compute node's install line (Settings › Nodes) now ends with LENS_NODE_SANDBOX=1. That also starts an OpenShell gateway on the node, using the sandbox profile of docker-compose.node.yml, and the setting is kept in the node's .env for later runs.
  • lens node hands Lens the gateway's client certificate once (PUT /api/v1/mesh/node/sandbox), and Lens keeps it sealed. Each beat then reports whether the gateway answers.
  • Lens reaches the gateway over the mesh only, through the node's relay on 7443, which Nebula's firewall opens to the primary alone. The connection uses mutual TLS, checked against the name the gateway's certificate was made for.
  • Once a compute node has a gateway, sandbox_nodes lists it, and run_python and run_bash can run on it.
  • Removing the node takes it away from the assistant again, and an undo brings it back.
  • The Nodes page says whether each compute node's gateway runs.

How:

  • mesh.sandbox_gateway checks and seals the certificate. mesh.gateway_driver builds the sandbox's Driver for a node. mesh.offer_sandboxes calls sandbox.register_nodes while a compute node has a gateway; it runs on that hand-over, on remove and undo, and on each compute node's beat (which also covers a restarted API).
  • sandbox.OpenShell can now take a certificate held in memory and check the gateway against a name rather than its address. OpenShell's client takes neither, so its channel is swapped for one that does; the client is pinned below 0.2.
  • mesh_node.Gateway reads the certificate from the sandbox-key volume, sends it again only when it changes, and checks the gateway's port.

Motivation and Context

Part of the Nebula network with a Nodes settings page: remote sandboxes on compute nodes over the mesh. Follows #553, #591, #595 and #602.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests:
    • test_mesh_compute.py, including a real mutual-TLS round trip against the fake gateway, with a stranger's certificate refused;
    • settings-mesh.test.tsx.
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/mesh.md "Compute nodes", docs/assistant.md).
  • Users need more than the title: changelog.d/mesh-compute.md.

Done questions (AGENTS.md)

  • Goal: code runs on compute nodes over the mesh, which is part of the original ask. Merges on green CI.
  • Agents: the assistant gets sandbox_nodes and node on run_python and run_bash. Nodes are managed over /api/v1/mesh and MCP.
  • Zero setup: the compute node's install line starts the gateway. Nothing to edit.
  • Fewest clicks: no new clicks. Adding a Compute node as before is all it takes.
  • Configurable: the sandbox's existing settings (image, limits, network) apply to nodes too.
  • Light: the primary is unchanged. The gateway runs only on compute nodes.
  • Private and secure:
    • nothing of Lens's goes to the node;
    • the gateway's key is sealed on the primary;
    • the gateway is reached over Nebula plus mutual TLS only;
    • the threat model has a new entry point and P-MESH is extended.
  • Cost: no model calls. Runs on the node are in the activity ledger as sandbox.run, naming the node.
  • User decides: nothing runs on a node unless an admin added it as Compute. Defaults are unchanged.
  • Upgrades: no stored-data change beyond a new optional field on a schemaless table.
  • Honest: docs/mesh.md lists what's built and says the mesh hasn't been tried between two real machines yet.
  • Tests, docs and make openapi output updated.
  • Open standards: TLS and gRPC. OpenShell is Apache-2.0 and already an optional extra.
  • Refine later (docs/mesh.md):
    • compute nodes' load on the Nodes page;
    • picking a compute node by itself when this machine has no gateway (a Raspberry Pi primary).
  • Reuse: reuses feat(sandbox): run the assistant's code on compute nodes #572's register_nodes seam, the primary's gateway compose services, the sidecar's relay and settings.seal.

Generated by Claude Code

…ay of their own

A compute node's install line has LENS_NODE_SANDBOX=1, which starts an
OpenShell gateway there. lens node hands Lens the gateway's client
certificate once (PUT /api/v1/mesh/node/sandbox, kept sealed) and reports
whether the gateway answers; Lens reaches it over the mesh only, through
the node's relay on 7443, with mutual TLS checked against the gateway
certificate's name, and registers the install's compute nodes with the
code sandbox while one has a gateway.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTrHPwWHtEvFJFq3M1YpH4
…way runs

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTrHPwWHtEvFJFq3M1YpH4
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GTrHPwWHtEvFJFq3M1YpH4
@adeelahmad
adeelahmad merged commit a196e79 into main Oct 18, 2026
21 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-6dqeie branch October 18, 2026 13:41
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

0