Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
64a5b6c
feat(link): let a Remote Link carry an explicit, exclusive SSH route
lidge-jun Nov 13, 2026
a12b7a9
test(link): pass the route argument in the observe inspection mock
lidge-jun Nov 13, 2026
0c47081
test(link): keep explicit-route fixtures free of address-shaped strings
lidge-jun Nov 13, 2026
deccc81
test(link): compare every builder's route-less argv to the pre-route …
lidge-jun Nov 13, 2026
d068328
fix(link): restart a tunnel whose explicit route changed in links.json
lidge-jun Nov 13, 2026
a1eb4bf
docs(link): say that an explicit route's ProxyCommand must not hold a…
lidge-jun Nov 13, 2026
ef1f3c7
docs(link): note that an older CLI rejects status rows of exclusive l…
lidge-jun Nov 13, 2026
51de887
Merge dev after #8615 landed (squash b1b6dcae8) into the explicit-rou…
lidge-jun Nov 13, 2026
a3ab8a5
feat(cli): advertise link.route/1 in ocx capabilities --contracts
lidge-jun Nov 13, 2026
57b29c4
feat(link): journal ocx link add --operation-id with reserved ids and…
lidge-jun Nov 13, 2026
f371b21
feat(link): refuse a Child with a full ocx install under --require-ep…
lidge-jun Nov 13, 2026
e2ad6b3
feat(link): serialize revoke per alias and journal ocx link revoke --…
lidge-jun Nov 13, 2026
8862a31
feat(link): read and resolve link operations through the management API
lidge-jun Nov 13, 2026
f46d943
feat(link): drive link operations from the CLI
lidge-jun Nov 13, 2026
64c9db6
docs(link): document the operation journal; test the journal file and…
lidge-jun Nov 13, 2026
50c91ab
fix(link): settle interrupted operations from their own marks; keep p…
lidge-jun Nov 13, 2026
8bcbcea
feat(cli): advertise link.operation/1 in ocx capabilities --contracts
lidge-jun Nov 13, 2026
aa96ea6
Merge the explicit-route line after #8615 landed (51de887c9) into fea…
lidge-jun Nov 13, 2026
422a3ca
fix(link): purge a fresh plant when the reserved key issue is uncertain
lidge-jun Nov 13, 2026
11cd17f
fix(link): keep apply and revoke of one alias apart; replay a Child r…
lidge-jun Nov 13, 2026
d6f0eec
fix(link): key the per-alias operation set without case; purge advice…
lidge-jun Nov 13, 2026
e7840b4
fix(link): give residual guidance by kind, for both plant locations
lidge-jun Nov 13, 2026
fb68c26
fix(link): name the USERPROFILE plant location; keep residual advice …
lidge-jun Nov 13, 2026
c9b1a15
docs(link): list every managed plant location in the residual guidanc…
lidge-jun Nov 13, 2026
3a3283d
fix(link): label the Windows plant purge commands as Command Prompt c…
lidge-jun Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions docs-site/src/content/docs/guides/remote-link.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,14 @@ The Child uses the Home computer's providers and provider credentials through th

```text
ocx link probe <alias> [--proxy-command <cmd> --ssh-user <user> --ssh-port <port>] [--exclusive] [--json]
ocx link add <alias> [--plant] [--expect-fingerprint SHA256:…] [--proxy-command <cmd> --ssh-user <user> --ssh-port <port>] [--exclusive] [--json]
ocx link add <alias> [--plant] [--expect-fingerprint SHA256:…] [--proxy-command <cmd> --ssh-user <user> --ssh-port <port>] [--exclusive] [--operation-id <id>] [--require-ephemeral] [--json]
ocx link port [--json]
ocx link issue --alias <alias> --tunnel-port <port> [--json]
ocx link status [--json]
ocx link diagnostics [--limit <n>] [--since <iso-time|epoch-ms>] [--json]
ocx link revoke --link-id <id> [--json]
ocx link revoke --link-id <id> [--operation-id <id>] [--json]
ocx link operations [--operation-id <id>] [--json]
ocx link operations resolve --operation-id <id> --yes [--json]
ocx link reconnect --link-id <id> [--json]
ocx link routes --link-id <id> [--json]
ocx link routes add --link-id <id> --route <alias> [--position <n>] [--json]
Expand All @@ -211,7 +213,9 @@ ocx link capture status [--json]
ocx link policy [--updates off|notify|auto-when-idle] [--catalog-fanout auto|manual] [--child-codex-restart never|app-server-when-idle] [--idle-after-minutes <1-60>] [--json]
```

An explicit, exclusive route is for callers that set up the SSH path themselves, such as a hub that provisions a disposable machine. `ocx link add <alias> --proxy-command <command> --ssh-user <user> --ssh-port <port> --exclusive` passes that ProxyCommand, user and port to ssh on the command line for every command and tunnel of the link, so a later edit of `~/.ssh/config` cannot move the link to another path, and the link then refuses `ocx link routes` edits. The command must start with an absolute path and use only letters, digits and `. _ / : @ + , = -` in words separated by single spaces; `%` tokens, quotes and shell characters are refused. `--exclusive` alone keeps the link to its one alias without changing how ssh reaches it.
An explicit, exclusive route is for callers that set up the SSH path themselves, such as a hub that provisions a disposable machine. `ocx link add <alias> --proxy-command <command> --ssh-user <user> --ssh-port <port> --exclusive` passes that ProxyCommand, user and port to ssh on the command line for every command and tunnel of the link, so a later edit of `~/.ssh/config` cannot move the link to another path, and the link then refuses `ocx link routes` edits. The command must start with an absolute path and use only letters, digits and `. _ / : @ + , = -` in words separated by single spaces; `%` tokens, quotes and shell characters are refused. Never put a token, password or private key in the command: every local user can see it in the process list, and it is stored in the tunnel's pidfile and shown by `ocx link status --json`. `--exclusive` alone keeps the link to its one alias without changing how ssh reaches it.

A provisioning caller can also journal an enrollment: `ocx link add <alias> --expect-fingerprint <fp> --operation-id <id>` records the link and key ids it will create before changing anything, and a repeat of the same command returns the recorded outcome (`committed`, `failed_clean`, `residual` or `unknown`) instead of enrolling again. `--require-ephemeral` refuses a Child that has any full OpenCodex install before anything is planted or changed. `ocx link revoke --operation-id <id>` journals a revoke the same way, and `ocx link operations` lists the journal; `ocx link operations resolve --operation-id <id> --yes` records that a residual or unknown operation was cleaned up or accepted.

`ocx link status` needs the local admin token on a listener that only this machine can reach. When the public listener is bound to a non-loopback address, for example a Hub on `0.0.0.0`, no TCP listener qualifies: the hub management listener is reached through Tailscale Serve, so it refuses the raw admin token for link routes. On macOS and Linux the proxy therefore also opens a private Unix socket, `<OPENCODEX_HOME>/run/control-<port>.sock`, in a directory only your user can enter, and `ocx link status` uses it automatically. The socket answers only `GET /api/link/status` and still requires the admin token. Windows and runtimes older than this change keep the TCP path, where the read returns `403` on such a Hub.

Expand Down
9 changes: 8 additions & 1 deletion scripts/test-layout/layout-clients.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,5 +229,12 @@
"link-explicit-route-paths.test.ts": "clients",
"link-route-edit-exclusive.test.ts": "server",
"link-enrollment-explicit-route.test.ts": "server",
"cli-link-explicit-route.test.ts": "cli"
"cli-link-explicit-route.test.ts": "cli",
"link-alias-lock.test.ts": "clients",
"link-enrollment-operation.test.ts": "server",
"link-full-install-census.test.ts": "clients",
"link-revoke-operation.test.ts": "server",
"link-operations-routes.test.ts": "server",
"cli-link-operation.test.ts": "cli",
"link-operations-journal.test.ts": "clients"
}
14 changes: 11 additions & 3 deletions skills/ocx/references/01_management_surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ These answer in the CLI head and never reach the proxy, so they work with nothin
| [agents-routing](01_surface_agents-routing.md) | 68 |
| [integrations](01_surface_integrations.md) | 41 |
| [observe-system](01_surface_observe-system.md) | 105 |
| [access-remote](01_surface_access-remote.md) | 48 |
| [access-remote](01_surface_access-remote.md) | 50 |
| [lab](01_surface_lab.md) | 21 |

## Read-only capabilities
Expand Down Expand Up @@ -1531,6 +1531,14 @@ Original invocation order. These headings preserve links to the previous single-

[State-changing task](01_surface_access-remote.md#ocx-link-routes-order)

### `ocx link operations`

[Read-oriented task](01_surface_access-remote.md#ocx-link-operations)

### `ocx link operations resolve`

[State-changing task](01_surface_access-remote.md#ocx-link-operations-resolve)

### `ocx link activity clear`

[State-changing task](01_surface_access-remote.md#ocx-link-activity-clear)
Expand Down Expand Up @@ -1621,6 +1629,6 @@ Original invocation order. These headings preserve links to the previous single-

## Counts

- declared capabilities: 393
- of those, state-changing: 246
- declared capabilities: 395
- of those, state-changing: 247
- head-resolved invocations: 2
49 changes: 46 additions & 3 deletions skills/ocx/references/01_surface_access-remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Use these declarations to choose a task, then check its flags and authority before execution.
Non-mutating probes may still contact providers, consume quota or refresh caches.

Declared capabilities: 48.
Declared capabilities: 50.

### `ocx link probe`

Expand All @@ -34,7 +34,7 @@ State-changing: yes. JSON mode: `payload`.

### `ocx link add`

Usage: `ocx link add <alias> [--expect-fingerprint SHA256:…] [--proxy-command <cmd> --ssh-user <user> --ssh-port <port>] [--exclusive] [--json]`
Usage: `ocx link add <alias> [--expect-fingerprint SHA256:…] [--proxy-command <cmd> --ssh-user <user> --ssh-port <port>] [--exclusive] [--operation-id <id>] [--require-ephemeral] [--json]`

Connect an SSH Child to this Home after confirming its fingerprint.

Expand All @@ -53,6 +53,8 @@ State-changing: yes. JSON mode: `payload`.
| `--ssh-user` | string | SSH user of the explicit route: a letter or _ then up to 31 letters, digits, ., _ or -. |
| `--ssh-port` | number | SSH port of the explicit route, 1 to 65535. |
| `--exclusive` | boolean | The link keeps exactly its alias as its one route and refuses route edits. |
| `--operation-id` | string | Journal the enrollment under this id (1-128 letters, digits, . _ : -): reserved ids, a mark per Home effect and the outcome; a repeat with the same id and parameters replays it. Needs --expect-fingerprint. |
| `--require-ephemeral` | boolean | Refuse (409 full_install_present) a Child where any runnable full ocx exists, before any plant, key or Child change. |
| `--json` | boolean | Emit the verified link result as JSON. |

- Requires loopback admin authority on the Home. Without a fingerprint, requires a TTY and explicit yes after showing the offered fingerprint. Never prints the link key.
Expand Down Expand Up @@ -135,7 +137,7 @@ Drives no management route.

### `ocx link revoke`

Usage: `ocx link revoke --link-id <id> [--force --yes] [--json]`
Usage: `ocx link revoke --link-id <id> [--force --yes] [--operation-id <id>] [--json]`

Revoke a link credential and remove its link record.

Expand All @@ -151,6 +153,7 @@ State-changing: yes. JSON mode: `envelope`.
| `--json` | boolean | Emit the revoked link id as JSON. |
| `--force` | boolean | Explicitly skip remote disconnect while retiring the local link; requires --yes. |
| `--yes` | boolean | Confirms force only; refused without --force. |
| `--operation-id` | string | Journal the revoke under this id; a purge records the Child's purged:true as its receipt, and a repeat replays the outcome even after the link is gone. |

- Requires a valid link ID and loopback admin authority. Explicit force additionally requires --yes.
- Ordinary revoke always emits {linkId} JSON; forced revoke has human output or a JSON cleanup receipt. Already-revoked link_not_found is idempotent success.
Expand Down Expand Up @@ -963,6 +966,46 @@ State-changing: yes. JSON mode: `payload`.

- The list must name exactly the current routes (route_order_mismatch otherwise), so no route enters unproven. A reorder does not move a running tunnel. Requires loopback admin authority on the Home.

### `ocx link operations`

Usage: `ocx link operations [--operation-id <id>] [--json]`

List or read the enrollments and revokes journalled under an operation id.

State-changing: no. JSON mode: `payload`.

| Method | Route |
|---|---|
| GET | `/api/link/operations` |
| GET | `/api/link/operations/{id}` |

| Flag | Value | Meaning |
|---|---|---|
| `--operation-id` | string | Read one operation. |
| `--json` | boolean | Emit {operations} or the one entry as JSON. |

- Each entry names its reserved link and key ids, the intent and completion of every effect and its outcome: open, committed, failed_clean, residual (the Child may still hold an enrollment or a plant) or unknown. Committed and failed_clean entries stay 30 days; residual and unknown entries stay until resolved, then 30 days. Requires loopback admin authority on the Home.

### `ocx link operations resolve`

Usage: `ocx link operations resolve --operation-id <id> --yes [--json]`

Mark a residual or unknown link operation resolved.

State-changing: yes. JSON mode: `payload`.

| Method | Route |
|---|---|
| POST | `/api/link/operations/{id}/resolve` |

| Flag | Value | Meaning |
|---|---|---|
| `--operation-id` | string | The residual or unknown operation. |
| `--yes` | boolean | Confirms that the Child is clean or the loss is accepted. |
| `--json` | boolean | Emit the resolved entry as JSON. |

- Changes nothing on the Child or in links.json: it records the resolution, and the entry's 30 days of retention start then. operation_not_resolvable (exit 5) for any other state, operation_not_found (exit 4). Requires loopback admin authority on the Home.

### `ocx link activity clear`

Usage: `ocx link activity clear --link-id <id> [--json]`
Expand Down
16 changes: 16 additions & 0 deletions src/cli/capabilities-access-remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ export const ACCESS_REMOTE_CAPABILITIES: readonly Capability[] = [
mutates: true, json: "payload",
details: ["The list must name exactly the current routes (route_order_mismatch otherwise), so no route enters unproven. A reorder does not move a running tunnel. Requires loopback admin authority on the Home."],
},
{
command: ["link", "operations"], summary: "List or read the enrollments and revokes journalled under an operation id.",
usage: "ocx link operations [--operation-id <id>] [--json]",
routes: [{ method: "GET", path: "/api/link/operations" }, { method: "GET", path: "/api/link/operations/{id}" }],
flags: [{ name: "--operation-id", value: "string", summary: "Read one operation." }, { name: "--json", value: "boolean", summary: "Emit {operations} or the one entry as JSON." }],
mutates: false, json: "payload",
details: ["Each entry names its reserved link and key ids, the intent and completion of every effect and its outcome: open, committed, failed_clean, residual (the Child may still hold an enrollment or a plant) or unknown. Committed and failed_clean entries stay 30 days; residual and unknown entries stay until resolved, then 30 days. Requires loopback admin authority on the Home."],
},
{
command: ["link", "operations", "resolve"], summary: "Mark a residual or unknown link operation resolved.",
usage: "ocx link operations resolve --operation-id <id> --yes [--json]",
routes: [{ method: "POST", path: "/api/link/operations/{id}/resolve" }],
flags: [{ name: "--operation-id", value: "string", required: true, summary: "The residual or unknown operation." }, { name: "--yes", value: "boolean", required: true, summary: "Confirms that the Child is clean or the loss is accepted." }, { name: "--json", value: "boolean", summary: "Emit the resolved entry as JSON." }],
mutates: true, json: "payload",
details: ["Changes nothing on the Child or in links.json: it records the resolution, and the entry's 30 days of retention start then. operation_not_resolvable (exit 5) for any other state, operation_not_found (exit 4). Requires loopback admin authority on the Home."],
},
{
command: ["link", "activity", "clear"], summary: "Clear one link's held activity so automatic and activity-gated Child restarts may run again.",
usage: "ocx link activity clear --link-id <id> [--json]",
Expand Down
Loading
Loading