Skip to content

Platform capability: IdeServerHost (IDE server find/env/spawn/liveness/stop) #1890

Open

Description

@amrmelsayed

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

  • :104 buildIdeServerEnv (node-first PATH; Windows env keys are case-insensitive)
  • :149 ideServerSpawnable (Windows: JS launcher under Node, else the .cmd shim resolver)
  • :209 killProcessGroup (POSIX group SIGKILL vs Windows killSessionTree)
  • :248 runIdeServerCommand detached (POSIX only)

packages/codev/src/agent-farm/servers/ide-server.ts

  • :120 isPortListening (Windows: TCP accept vs lsof)
  • :140 spawnIdeServerProcess
  • :373 stopIdeServerUnlocked (SIGTERM per listener vs stopWindowsIdeServer)
  • :433 stopUnreadyIdeServer (group kill vs tree kill)

Adjacent:

  • packages/codev/src/agent-farm/commands/ide.ts:123 findOnPath (hand-written PATH scan vs findOnHostPath)

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 / forceHostPlatform seam from src/__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.

Follows #1658 / PR #1859. Not part of that PR.

Activity

  1. added
    area/tower
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions