Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(devices): keep agent-device from spawning a second T3 app #12241

Closedadinvadim(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/12241/headopened View on GitHub

Showing 5 changed files with 36 additions and 24 deletions (loading 2).

x
0 of 5 viewed, 5 left
17 additions and 21 deletionsapps/desktop/src/app/DesktopApp.tsModified
View file
@@ -34,7 +34,6 @@
import * as DesktopWslBackend from "../wsl/DesktopWslBackend.ts";
​
const DEFAULT_DESKTOP_BACKEND_PORT = 3773;
-const MAX_TCP_PORT = 65_535;
const DESKTOP_BACKEND_PORT_PROBE_HOSTS = ["127.0.0.1", "0.0.0.0", "::"] as const;
​
const makeDesktopRunId = Crypto.Crypto.pipe(
@@ -51,6 +50,9 @@
},
) {
override get message(): string {
+ if (this.startPort === this.maxPort) {
+ return `Desktop backend port ${this.startPort} is already in use on ${this.hosts.join(", ")}. Another T3 Code is already running for this home.`;
+ }
return `No desktop backend port is available on hosts ${this.hosts.join(", ")} between ${this.startPort} and ${this.maxPort}.`;
@@ -80,30 +82,24 @@
} as const;
​
+ // Packaged desktop shares ~/.t3. Scanning to 3774 starts a second backend
+ // that reconciles provider sessions and kills OpenCode/Cursor threads.
const net = yield* NetService.NetService;
- for (let port = DEFAULT_DESKTOP_BACKEND_PORT; port <= MAX_TCP_PORT; port += 1) {
- let availableOnEveryHost = true;
-​