Skip to content

Commit 6c9916a

Browse files
authored
feat(runners): publish atomic device runner inventory (#123094)
* feat(runners): publish atomic node inventory # Conflicts: # docs/.generated/plugin-sdk-api-baseline/agent-harness-runtime.json # src/gateway/server-methods/environments.ts # src/gateway/worker-environments/device-provider.test.ts * fix(runners): refresh topology on inventory removal * fix(runners): resolve session host type overlap * fix(protocol): document mobile runner inventory event * fix(runners): project authoritative session host state * docs(nodes): clarify prepared session host status
1 parent 6f99d34 commit 6c9916a

39 files changed

Lines changed: 1065 additions & 225 deletions

‎apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ enum class GatewayMethod(
430430
NodePluginSurfaceRefresh("node.pluginSurface.refresh"),
431431
NodePluginToolsUpdate("node.pluginTools.update"),
432432
NodeSkillsUpdate("node.skills.update"),
433-
NodeProtocolFeaturesUpdate("node.protocolFeatures.update"),
433+
NodeRunnerInventoryUpdate("node.runnerInventory.update"),
434434
NodePendingDrain("node.pending.drain"),
435435
NodePendingEnqueue("node.pending.enqueue"),
436436
NodeInvoke("node.invoke"),
@@ -613,6 +613,7 @@ enum class GatewayEvent(
613613
NodePairRequested("node.pair.requested"),
614614
NodePairResolved("node.pair.resolved"),
615615
NodePresence("node.presence"),
616+
NodeRunnerInventoryChanged("node.runnerInventory.changed"),
616617
NodeInvokeCancel("node.invoke.cancel"),
617618
NodeInvokeInput("node.invoke.input"),
618619
NodeInvokeRequest("node.invoke.request"),

‎docs/nodes/index.md‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -419,15 +419,19 @@ its local installation:
419419
}
420420
```
421421

422-
Restart the node host after enabling this setting. At startup it advertises the
422+
Restart the node host after enabling this setting. At startup it freezes the
423423
exact OpenClaw version, worker-bundle hash, and worker protocol features of its
424-
own installation. The Gateway offers the device as a session host only while
425-
that advertisement is live, and provisioning requires the node and Gateway
426-
versions to match exactly. If they differ, update the node before retrying.
427-
428-
This setting completes device-environment provisioning but does not yet enable
429-
turn launch on the device. The local-install chain adds supervised launch and
430-
workspace transport in subsequent steps.
424+
own installation in the connection handshake, then repeats that build in its
425+
live runner inventory. The Gateway reports prepared session-host eligibility
426+
only while those declarations match, and provisioning requires the node and
427+
Gateway versions to match exactly. If they differ, update the node before
428+
retrying.
429+
430+
This setting completes device-environment provisioning and session-host status;
431+
it does **not** yet make device turn dispatch succeed. The Gateway still returns
432+
`device-runner-transport-unimplemented` until the local-install chain adds
433+
supervised launch and workspace transport. Do not treat the status as proof that
434+
a complete turn can run on the device yet.
431435

432436
See [Anthropic: Claude sessions across computers](/providers/anthropic#claude-sessions-across-computers)
433437
for the Control UI behavior and storage sources.

‎docs/plan/runners.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,22 @@ Isolation on node runners: optional worker-in-docker/podman, same sandbox
207207
axis as gateway-local sessions. Cloud leases keep full-permission-within-the-
208208
box (the machine is the boundary).
209209

210+
Milestone 6 now has the public worker ingress, transport-neutral launch
211+
descriptor, durable node-host supervisor, private launch/status/cancel dialect,
212+
bounded terminal receipts, and the Gateway launch replay/poll/cancel adapter.
213+
A node freezes its optional local worker build in the connection handshake and
214+
repeats it in one atomic, reconnect-scoped private runner inventory with the
215+
supervisor dialect. The Gateway requires those semantic build identities to
216+
match. Public node and environment projections expose only `sessionHost`; a
217+
read-scoped topology invalidation makes clients refetch without exposing the
218+
build. Provider eligibility and new launch selection require the exact handshake,
219+
while status and cancellation reacquire only the current supervisor proof and use
220+
the durable launch identity so an upgrade cannot strand an existing worker.
221+
Node-local opt-in advertises the current installation; default nodes remain
222+
non-hosts. Milestone 7 upgrades this to Gateway-pinned, namespaced bundle bytes.
223+
Slots, isolation, checkouts, workspace transfer, and persistent-runner lifecycle
224+
remain milestone 6 work.
225+
210226
### Trust model (operator-decided, v1)
211227

212228
Cloud workers run full-permission because the box is disposable and

‎scripts/protocol-event-coverage.allowlist.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"node.pair.requested": "Node pairing state is fetched on demand; no push consumer on iOS yet.",
1010
"node.pair.resolved": "Node pairing state is fetched on demand; no push consumer on iOS yet.",
1111
"node.presence": "Node activity is reported by macOS nodes and consumed by gateway routing; iOS has no presence reporter yet.",
12+
"node.runnerInventory.changed": "Session-host placement refresh is a Control UI surface; iOS does not offer device runner placement yet.",
1213
"openclaw.approval.requested": "OpenClaw system-agent config approvals are a web/desktop operator surface; iOS has no operator-approval prompt.",
1314
"openclaw.approval.resolved": "OpenClaw system-agent config approvals are a web/desktop operator surface; iOS has no operator-approval prompt.",
1415
"plugin.approval.requested": "Plugin approval prompts are not implemented on iOS.",
@@ -41,6 +42,7 @@
4142
"node.pair.requested": "Android's bounded operator session lacks operator.pairing; onboarding refreshes node approval with explicit node.list requests.",
4243
"node.pair.resolved": "Android's bounded operator session lacks operator.pairing; onboarding refreshes node approval with explicit node.list requests.",
4344
"node.presence": "Node activity is reported by macOS nodes and consumed by gateway routing; Android has no presence reporter yet.",
45+
"node.runnerInventory.changed": "Session-host placement refresh is a Control UI surface; Android does not offer device runner placement yet.",
4446
"openclaw.approval.requested": "OpenClaw system-agent config approvals are a web/desktop operator surface; Android has no operator-approval prompt.",
4547
"openclaw.approval.resolved": "OpenClaw system-agent config approvals are a web/desktop operator surface; Android has no operator-approval prompt.",
4648
"plugin.approval.requested": "Plugin approval prompts are not implemented on Android.",

‎src/gateway/events.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import type {
66
import { roleScopesAllow } from "../shared/operator-scope-compat.js";
77
import { READ_SCOPE } from "./operator-scopes.js";
88

9+
/** Event name emitted when a node's private runner declaration changes. */
10+
export const GATEWAY_EVENT_NODE_RUNNER_INVENTORY_CHANGED = "node.runnerInventory.changed" as const;
11+
912
/** Event name emitted when a newer OpenClaw version is available. */
1013
export const GATEWAY_EVENT_UPDATE_AVAILABLE = "update.available" as const;
1114

‎src/gateway/gateway-misc.test.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,17 +627,19 @@ describe("gateway broadcaster", () => {
627627
expectSentEvents(adminSocket, ["task"]);
628628
});
629629

630-
it("requires operator.read for node presence broadcasts", () => {
630+
it("requires operator.read for node topology broadcasts", () => {
631631
const { pairingSocket, nodeSocket, readSocket, writeSocket, adminSocket, broadcast } =
632632
makeScopedBroadcastContext();
633633

634634
broadcast("node.presence", { nodeId: "mac-1", lastActiveAtMs: 100 });
635+
broadcast("node.runnerInventory.changed", { nodeId: "mac-1" });
635636

636637
expect(pairingSocket.send).not.toHaveBeenCalled();
637638
expect(nodeSocket.send).not.toHaveBeenCalled();
638-
expectSentEvents(readSocket, ["node.presence"]);
639-
expectSentEvents(writeSocket, ["node.presence"]);
640-
expectSentEvents(adminSocket, ["node.presence"]);
639+
const expectedEvents = ["node.presence", "node.runnerInventory.changed"];
640+
expectSentEvents(readSocket, expectedEvents);
641+
expectSentEvents(writeSocket, expectedEvents);
642+
expectSentEvents(adminSocket, expectedEvents);
641643
});
642644

643645
it("allows plugin.* broadcast events for operator.write and operator.admin", () => {

‎src/gateway/method-scopes.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ describe("core gateway method classification", () => {
866866
expect(isGatewayMethodClassified("node.pluginSurface.refresh")).toBe(true);
867867
expect(isGatewayMethodClassified("node.pluginTools.update")).toBe(true);
868868
expect(isGatewayMethodClassified("node.skills.update")).toBe(true);
869-
expect(isGatewayMethodClassified("node.protocolFeatures.update")).toBe(true);
869+
expect(isGatewayMethodClassified("node.runnerInventory.update")).toBe(true);
870870
});
871871

872872
it("classifies every exposed core gateway handler method", () => {

‎src/gateway/methods/core-descriptors.since.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const CURRENT_TRAIN_METHODS = [
101101
"desktop.launch",
102102
"device.scopes.requestUpgrade",
103103
"device.scopes.waitUpgrade",
104-
"node.protocolFeatures.update",
104+
"node.runnerInventory.update",
105105
"portal.list",
106106
"portal.open",
107107
"portal.close",

‎src/gateway/methods/core-descriptors.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ const CORE_GATEWAY_METHOD_SPECS = [
282282
["node.pluginSurface.refresh", "nodes", "node", "<=2026.7"],
283283
["node.pluginTools.update", "nodes", "node", "<=2026.7"],
284284
["node.skills.update", "nodes", "node", "<=2026.7"],
285-
["node.protocolFeatures.update", "nodes", "node", "2026.8", { advertise: false }],
285+
["node.runnerInventory.update", "nodes", "node", "2026.8", { advertise: false }],
286286
["node.pending.drain", "nodes-pending", "node", "<=2026.7"],
287287
["node.pending.enqueue", "nodes-pending", "operator.write", "<=2026.7"],
288288
// Params-aware: host-sensitive commands raise direct invocation from write to admin.

‎src/gateway/node-catalog.test.ts‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ describe("gateway/node-catalog", () => {
143143
presenceUpdatedAtMs: 125,
144144
},
145145
],
146+
sessionHostNodeIds: new Set(["mac-1"]),
146147
});
147148

148149
expect(getKnownNode(catalog, "mac-1")).toMatchObject({
@@ -162,9 +163,39 @@ describe("gateway/node-catalog", () => {
162163
lastSeenReason: "connect",
163164
paired: true,
164165
connected: true,
166+
sessionHost: true,
165167
});
166168
});
167169

170+
it("does not infer live session hosting from the connect-time build ceiling", () => {
171+
const catalog = createKnownNodeCatalog({
172+
pairedDevices: [pairedDevice()],
173+
pairedNodes: [pairedNode()],
174+
connectedNodes: [
175+
{
176+
nodeId: "mac-1",
177+
connId: "conn-1",
178+
client: {} as never,
179+
declaredCaps: [],
180+
caps: [],
181+
declaredCommands: [],
182+
commands: [],
183+
workerRuns: {
184+
bundleHash: "a".repeat(64),
185+
openclawVersion: "2026.8.12",
186+
protocolFeatures: ["worker-heartbeat-v1"],
187+
},
188+
declaredNodePluginTools: [],
189+
nodePluginTools: [],
190+
nodeSkills: [],
191+
connectedAtMs: 1,
192+
},
193+
],
194+
});
195+
196+
expect(getKnownNode(catalog, "mac-1")?.sessionHost).toBe(false);
197+
});
198+
168199
it("keeps the operator node name across live metadata and reconnects", () => {
169200
const connectedNode = (connId: string, displayName: string) => ({
170201
nodeId: "mac-1",

0 commit comments

Comments
 (0)