Repository navigation
Description
Problem
Spec 1658 Plan Amendment 2 (PR #1859) moved the per-platform launch, path, process and shellper-transport logic behind four capabilities under packages/codev/src/lib/platform/ (one accessor each, POSIX moved verbatim, Windows behind adapters, contract test per implementation). The IDE server's lifecycle was left out under Amendment 2 rule 6 (single call site gets no interface), so it still forks on isWindows() at eight sites, plus one adjacent lookup. Together they form one coherent lifecycle (find, env, spawn, liveness, stop) and are the next capability candidate named in the round-3 integration review on #1859.
Sites (at PR #1859 head 19c1e02)
packages/codev/src/agent-farm/lib/ide-version.ts
:104buildIdeServerEnv(node-first PATH; Windows env keys are case-insensitive):149ideServerSpawnable(Windows: JS launcher under Node, else the.cmdshim resolver):209killProcessGroup(POSIX group SIGKILL vs WindowskillSessionTree):248runIdeServerCommanddetached(POSIX only)
packages/codev/src/agent-farm/servers/ide-server.ts
:120isPortListening(Windows: TCP accept vslsof):140spawnIdeServerProcess:373stopIdeServerUnlocked(SIGTERM per listener vsstopWindowsIdeServer):433stopUnreadyIdeServer(group kill vs tree kill)
Adjacent:
packages/codev/src/agent-farm/commands/ide.ts:123findOnPath(hand-written PATH scan vsfindOnHostPath)
Proposed shape
An IdeServerHost capability: lib/platform/ide-server-host.ts (interface + accessor) with .posix.ts and .windows.ts implementations covering find, env, spawn, liveness and stop. Same rules as Amendment 2:
- No behaviour change on any platform. POSIX code moves verbatim (frozen object); Windows adapts the existing Windows modules.
- One accessor:
if (isWindows()) return windowsIdeServerHost; return posixIdeServerHost; - Contract test per implementation, using the
useHostPlatform/forceHostPlatformseam fromsrc/__tests__/helpers/host-platform.ts. - POSIX CI plus a Windows workflow dispatch on the final head.
Expected effect: the eight forks go away (product isWindows() sites 56 to about 48). The exact method set is the builder's call once the sites are read together; the list above is the inventory, not the interface.
Verification
- Contract tests green on both implementations; POSIX CI green; Windows dispatch green.
- Owner's manual scenario 15a (IDE server start, open from the dashboard link, stop) on Windows, plus the same path on macOS.
Out of scope
- The cwd-first bare executable lookup hardening (separate follow-up, release blocker).
- The remaining one-off
isWindows()sites tabled in Plan Amendment 2 section A2.5.
Activity