Skip to content

[Feature] Remote Link: Route-to intent syncs from Home, materializes per device (Aside etc.), and is editable per device from the CLI #8274

Closed

Description

@lidge-jun

Summary

When a machine joins a Home as a Remote Link Child, which clients are routed into OpenCodex ("Route to": Codex, Claude, Claude Desktop, Grok, Aside, OpenCode, Pi, ...) should follow the Home by default, and each client's config should be materialized on the Child for that Child (its own paths, OS, listener port, installed clients, and Aside accounts). A person should also be able to see and change this per device from the CLI, the way ocx fallback --device already works.

Today only codex and claude can be selected for a Child (selectedClients, max 2). Every other integration is refused on the Child as Home-owned. The Home's own integration commands only write the Home's files, so a Child cannot get Aside, Claude Desktop, Grok, or any file integration without hand-editing.

Observed 2026-11-07 (two real Children, OpenCodex 2.98.0)

Home: macOS, juns-MacBook-Pro. Children: parkjs101 (macOS) and parkjs-win (Windows 11, Git Bash over OpenSSH).

  1. Both Children came up with selectedClients: ["codex","claude"]. There was no way to ask for Aside.
  2. On the Child, the integration commands are refused:
    • ocx integration client status --client aside printed This machine is a Remote Link Child managed by Home ... GET /api/client-integrations/aside/profiles runs on the Home, not on this Child.
    • ocx inspect client-config --client aside was refused the same way for GET /api/client-config.
  3. On the Home, ocx integration client enable --client aside can only target the Home's own ~/.aside/u/<id>/models.json. Those <id> slots are per machine: the Mac Child has u0 and u1, the Windows Child has only u0, and the people behind them differ.
  4. Workaround used: run ocx inspect client-config --client aside on the Home, then copy the providers.opencodex block (baseUrl http://127.0.0.1:10100/v1, opencodex-loopback, 23 models) into each Child's Aside models.json by script. It works, but nothing owns it now: there is no journal, no refresh when the catalog changes, and no clean removal on disconnect.
  5. The Home catalog and the Aside block drift apart. The Home-generated Aside block had command-code/deepseek-deepseek-v4.1-flash-fast, while the Child's /v1/models serves command-code/deepseek/deepseek-v4.1-flash-fast. A per-device materialization built from the Child's own served catalog would not drift.
  6. Related breakage: ocx disconnect on parkjs-win (and on clisu-oracle) failed with "Codex journal restore was partial" and left rotation: recovery-required. Home sync then skipped the Child with child-link-mismatch:disconnect_pending. The cause was that the user had edited ~/.codex/config.toml after injection (model, hooks, trusted projects, Computer Use paths), so the whole-file injectedConfigHash no longer matched.
    • Recovery that worked: write originalConfig back byte-for-byte, then ocx disconnect (restored: true), then re-apply the user's later edits, then restart the service, then ocx link add again from the Home.
    • Extra trap: after disconnect, the service-owned process kept running with role:"client". ocx restart and ocx service restart both kept it alive, so ocx link add failed with Child restart preflight (409, child_restart_unsupported). Killing the process was needed.
    • Materializing more clients on a Child makes this restore path matter more, so it is part of the acceptance criteria below.

Design

Two layers

1. Route intent (Home-owned, synced to Children by default)

  • Per client: on | off, plus client policy knobs that are decisions rather than facts, such as --model-names alias|routed.
  • Aside account selection is expressed as all | none | [Aside userId...]. Never use numeric u/N, because slot numbers differ per machine.
  • It never contains paths, ports, profile slot ids, or credentials.
  • Follow the precedent of src/link/codex-settings.ts ([Bug]: Remote Link Child does not inherit the Home's model settings, dashboard or management CLI #6957): a versioned HomeRouteIntentDocument, served on a new authenticated link read GET /v1/link-management/route-intent. Each Child receives only its own effective view: Home defaults merged with that device's overrides.
  • Digest: add appliedRouteIntentDigest to the link peer report next to appliedCodexSettingsDigest, and show it in ocx link status.

2. Device materialization (Child-owned, local writes)

  • The Child's own server applies the intent to the Child's own files, using:
    • its own listener URL (127.0.0.1:<child port>);
    • its own OS paths (Windows C:\Users\..., macOS ~/Library/...);
    • its own installed-client detection;
    • its own Aside accounts.json, so all means every local Aside profile and a userId list matches by userId;
    • its own catalog, so model ids come from what this Child serves.
  • It reuses the existing writer, ownership, snapshot, and journal machinery (src/integrations/*, src/clients/config-export.ts) unchanged. These are local writes on the Child, not relayed writes, so the read-only link-management boundary from [Bug]: Remote Link Child does not inherit the Home's model settings, dashboard or management CLI #6957 is unchanged.
  • Apply on connect, when the intent digest changes (on the existing sync tick), on catalog change (refresh model lists), and on ocx sync.
  • Apply is idempotent and per client. Possible per-client outcomes are current, stale, not_installed, conflict, and failed, and they are reported back to the Home in the peer report.
  • conflict never overwrites without an explicit --overwrite-conflict from a person.

Precedence (same model as ocx fallback)

Device override (--device) > Home default > built-in default (codex, claude on; everything else off).

For backward compatibility, ocx connect --clients codex,claude and the link-join default become the initial device override. selectedClients stays readable but is derived from the effective intent. Drop the max-2 limit, or move it to the intent layer.

CLI

ocx route already exists (combo/policy), so this adds a to sub-noun:

ocx route to status [--device <alias|id|all|this>] [--json]
ocx route to <client> on|off [--device <alias|id>] [--accounts all|none|<userId,...>] [--model-names alias|routed] [--json]
ocx route to <client> inherit --device <alias|id>     # drop the device override
ocx route to sync [--device <alias|id|all>]            # Home: ask Child(ren) to reapply; Child: apply now
  • On the Home, writing without --device sets the Home default, which also applies to the Home itself. The existing ocx integration native|client enable/disable become aliases of that and keep working.
  • On a Child:
    • status and sync work locally.
    • on|off is refused with the existing refusal text plus the exact Home command: ocx route to aside on --device parkjs-win.
    • Open question: should we allow a local-only override (see below)?

Example status output:

DEVICE       CLIENT     INTENT        SOURCE   APPLIED        TARGET
home         codex      on            default  current        ~/.codex/config.toml
home         aside      on            default  current        u0,u1,u2
parkjs101    aside      on            default  current        u0,u1  (2 local profiles)
parkjs-win   aside      on            default  current        u0
parkjs-win   grok       on            default  not_installed  -
parkjs-win   pi         off           device   -              -

GUI

The Route page gets a device selector (Home or each Child) that renders the same matrix and the same inherit action. If the backend and CLI land first, this can be a follow-up PR.

Disconnect / journal (must hold for every materialized client)

  • Restore by removing the keys OpenCodex owns (openai_base_url, experimental_realtime_ws_base_url, model_catalog_json, managed blocks), not by requiring a byte-identical whole file. Edits the user made after injection must survive disconnect.
  • rotation: recovery-required must have a documented command path out, not a hand-edit.
  • After ocx disconnect, the service-owned runtime must come back as standalone (ocx service restart must actually replace a role:"client" process), so ocx link add passes child_restart_unsupported without killing processes by hand.

Acceptance criteria

  • A fresh Child linked with ocx link add gets every Home-default client materialized locally, with Child paths and the Child port, and no manual step.
  • Aside on a Child: one providers.opencodex entry per local Aside profile (or per the userId selection). Model ids come from that Child's catalog, and the entry refreshes on catalog change.
  • ocx route to status --device all on the Home shows intent, source, and the applied outcome for every device. JSON is a versioned schema (ocx.route-to/1).
  • ocx route to <client> on|off|inherit --device X on the Home is applied on Child X within one sync tick, or immediately with ocx route to sync --device X.
  • On a Child, writes are refused with the exact Home command to run. status and sync work.
  • Clients that are not installed report not_installed. A conflicting block reports conflict and is never overwritten without the explicit flag.
  • Disconnect restores each client by keys, so post-injection user edits survive. Regression tests cover the 2026-11-07 scenario (edited config.toml, then disconnect, then relink) on Windows and POSIX.
  • After disconnect, ocx service restart brings the runtime back as standalone, and ocx link add succeeds without killing processes by hand.
  • The [Bug]: Remote Link Child does not inherit the Home's model settings, dashboard or management CLI #6957 boundary is unchanged: no new write path from Child to Home, and the link management read list stays default-deny.

Open questions (with a recommended default)

  1. Should a Child have a local-only override (ocx route to <client> off --local), reported to the Home as source: local? Recommended: yes, but off only, so the person at the Child can opt a client out on their own machine without the Home turning it back on. on stays Home-only.
  2. Should the Home materialize for itself through the same path, so that Home is just device home? Recommended: yes, so there is a single code path.

Observed by the maintainer on 2026-11-07 while linking parkjs101 and parkjs-win.

Activity

  1. added
    enhancement
    cli
    on Nov 7, 2026
  2. coderabbitai commented on Nov 7, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #7484 - feat(link): parity on apply — restart the Child runtime, record and report the apply (OCX-6) [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. simon-ami commented on Nov 10, 2026

    @simon-ami

    This looks close to what I need: one Linux Home managing providers and models, with my Mac as a full Remote Link Child.

    #8416 seems to cover syncing models and applying harness configurations locally on the Child.

    Is there a follow-up planned for dashboard support? I'd like to easily enable, disable, and refresh integrations for my Mac's installed harnesses (Pi, OpenCode, etc.) without using the CLI.

    Whether this is done from the Home or Child dashboard doesn't matter to me. The goal is simple GUI-based management of Child integrations.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    clienhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions