mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-18 07:12:47 +03:00
docs(cli-rs): record the pair --remote channel deviation
TS writes the remote route into its own build channel's config, so pair --remote times out when OPENCODE_CHANNEL differs (decision O-39).
This commit is contained in:
@@ -179,7 +179,8 @@ fn consent(local: &Local, config: &Info, yes: bool) -> anyhow::Result<bool> {
|
||||
}
|
||||
|
||||
/// 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<String> {
|
||||
let attempt = async || -> Option<String> {
|
||||
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);
|
||||
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user