diff --git a/packages/cli-rs/crates/cli/src/commands/pair.rs b/packages/cli-rs/crates/cli/src/commands/pair.rs index 694d44f1da8..97538077e1b 100644 --- a/packages/cli-rs/crates/cli/src/commands/pair.rs +++ b/packages/cli-rs/crates/cli/src/commands/pair.rs @@ -179,7 +179,8 @@ fn consent(local: &Local, config: &Info, yes: bool) -> anyhow::Result { } /// The tunnel URL of the service, once the tunnel is attached: the service attaches it in the -/// background, so poll `/api/info` every second for up to 3 minutes. +/// background, so poll `/api/info` every second for up to 3 minutes. The route is read from this +/// client's channel (parity/deviations/C41-pair-remote-channel.md). async fn remote_url(local: &Local, client: &Client) -> anyhow::Result { let attempt = async || -> Option { let route = local.config().read().ok()?.remote?.route; @@ -215,11 +216,7 @@ mod tests { let text = links( &["http://127.0.0.1:4096".into(), "http://[::1]:4096/".into()], "abc", - 600, - ); - assert_eq!( - text, - "\n Open a link to connect. Links work once and expire in 10 minutes.\n\n http://127.0.0.1:4096/auth/connect/abc\n http://[::1]:4096/auth/connect/abc\n\n" + 600 work once and expire in 10 minutes.\n\n http://127.0.0.1:4096/auth/connect/abc\n http://[::1]:4096/auth/connect/abc\n\n" ); assert!(links(&[], "abc", 90).contains("expire in 2 minutes.\n\n (no server URLs)\n")); let remote = links(&["https://x.example/base".into()], "abc", 600); diff --git a/packages/cli-rs/parity/deviations/C41-pair-remote-channel.md b/packages/cli-rs/parity/deviations/C41-pair-remote-channel.md new file mode 100644 index 00000000000..4a5754d06e6 --- /dev/null +++ b/packages/cli-rs/parity/deviations/C41-pair-remote-channel.md @@ -0,0 +1,21 @@ +# C41: `pair --remote` when the client and TS channels differ + +TypeScript: `opencode pair --remote` turns remote access on and then reads the route from the service config +of its own build channel, so it always finds the route it just wrote. + +Rust: `opencode-rs pair --remote` turns remote access on by running the TS `opencode service set remote true` +(`opencode_service::delegate::enable_remote`). The TS binary writes the route into its own build channel's +config. The Rust client then reads the config of its own channel (`OPENCODE_CHANNEL`, else `latest`). When the +two channels differ, that config has no route, and the command polls until it fails after 3 minutes: + +``` +Timed out waiting for the remote tunnel; run `opencode pair --remote` again to retry. +``` + +With a release `opencode` and the default channel, both read and write `service.json`, and the command works. +To use a TS build of another channel, set `OPENCODE_CHANNEL` to that channel (for example +`OPENCODE_CHANNEL=oc-opentui-next`). + +Reason: the route belongs to the TS binary's config, and the Rust client has no reliable way to learn which +channel a TS binary was built for. Decision O-39 in `decisions.md` accepts this. No P-CLI case covers it, +since the cases run both clients on the same channel.