Skip to content

feat(remote-peers): support two-level @ remote host delegation menu - #1244

Merged
iruriQ merged 1 commit into
mainfrom
feat/remote-peer-at-host-delegation
Nov 26, 2026
Merged

iruriQ merged 1 commit into
mainfrom
feat/remote-peer-at-host-delegation

Conversation

@iruriQ

@iruriQ iruriQ commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator

Stacked PR: Based on #1240 (feat/remote-peer-at-harness) so this diff isolates Step 2 cleanly; retarget to main after #1240 merges.

Summary

Add a two-level @ / # remote host delegation menu that lets users either pick a reachable remote host directly (without pinning a Harness) or drill into that host to lock both --host and --harness in one mention chip.

Changes

  • Carrier contract (packages/shared-contracts/src/delegation-mention.ts, remote-peers.ts, index.ts):
    • Add subagent://codexhost-remote/<encodedHostId>[/<harnessId>] carrier (path-based, no ? query params, backward-compatible with subagent://codexhost.<harnessId>), deduplicated by (hostId, harnessId) so local and remote mentions of the same Harness coexist in one prompt.
    • Define browser-safe schemas for codexhost/delegation/remoteHosts and codexhost/delegation/hostHarnesses.
  • Host Runtime rewrite (packages/host-runtime/src/delegation-mention-rewrite.ts):
    • Rewrite remote host + Harness mentions into explicit delegate start --host <hostId> --harness <id> --cwd <remote-path> instructions (with a project list --host <hostId> reminder when no remote path is provided).
    • Rewrite host-only mentions into instructions to pick a suitable Harness via harness list --host <hostId> before delegating.
  • Peer perspective translation (packages/web-server/src/peer-thread-links.ts):
    • Translate outbound/inbound subagent://codexhost-remote/... links across paired peers using peerNodes / nodeId, collapsing self-targeted host+Harness mentions to subagent://codexhost.<harnessId>.
  • Reachability & on-demand Harness discovery (packages/web-server/src/peer-host-manager.ts, main.ts):
    • Register codexhost/delegation/remoteHosts (returns connected delegation-capable peers from local, or local + mutually paired peers listed in manifest.peerNodes from a remote Peer session; excludes self, unpaired peers, and SSH remotes).
    • Register codexhost/delegation/hostHarnesses (reads local or cached Peer ChHarnessCatalog on demand when drilling in).
  • Two-level @ menu & chip icons (apps/web-ui/):
    • Extend ui-input-trigger (types.ts, controller.ts, MenuView.tsx) and ui-conversation (draft-editor.ts, keymap.ts) with drillExclusive, custom drillLabel, and ArrowRight / ArrowLeft drill navigation alongside Tab and row chevron / breadcrumb clicks.
    • Add apps/web-ui/packages/client/ui-codexhost/src/client/remote-host-delegation.tsx wired from harness-discovery.tsx, plus localized copy (locales.ts) and host/remote-harness chip icons in ReferenceIcon.tsx.
  • Documentation (docs/product/multi-remote-peers.md): Document the two-level remote host @ delegation menu and outbound perspective translation.

Demo Screenshots

Level 1 — @ shows local Agents and reachable Remote Hosts (click/Enter picks host only; Tab / → / › expands)

Level 1 Remote Hosts @ menu

Level 2 — Exclusive drill-down with breadcrumb header, host-only option, and Peer-scoped Harness icons

Level 2 Mac Studio Agents submenu

Verification

  • npx vitest run --config tests/vitest.config.js packages/shared-contracts/test/delegation-mention.test.ts packages/host-runtime/test/delegation-mention-rewrite.test.ts: 17/17 passed.
  • node --import tsx --test packages/web-server/test/peer-thread-links.test.ts packages/web-server/test/peer-host-manager.test.ts packages/web-server/test/remote-sessions.test.ts: 62/62 passed.
  • ui-input-trigger/test/lexicon-notifications.test.ts: 2/2 passed.
  • node tools/check-boundaries.mjs, Web UI build.ts (43/43 client plugins + Vite shell), tsc --noEmit on touched files, and prettier: passed.
  • Chrome Playwright end-to-end verification (pageerror = 0): verified Level 1 display, › chevron drill to exclusive Level 2 breadcrumb view, ArrowLeft back to Level 1, typed @stu + ArrowRight drill clearing query, [@Mac Studio · Antigravity](subagent://codexhost-remote/remote-peer%3Apeer-studio/antigravity) submission, [@Home Mini](subagent://codexhost-remote/remote-peer%3Apeer-home) host-only submission, and [@本机 · Codex](subagent://codexhost-remote/local/codex) from a remote Peer B session.
  • Full-repo npm run lint, typecheck, and test are deferred to PR CI.

@coderabbitai

coderabbitai Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@iruriQ
iruriQ changed the base branch from feat/remote-peer-at-harness to main November 26, 2026 16:24
@iruriQ
iruriQ merged commit 9647b1e into main Nov 26, 2026
7 of 8 checks passed
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