revert(ports): roll back reaper port-scan sync and kill-path fixes (#5430, #5325, #5339)

Draft
KI
4mo ago
+17-399

Summary

  • Clean reverts of the three behavioral port commits from the last two weeks: #5430 (recover v2 ports after host-service restart), #5325 (detect ports for terminals without an attached renderer), #5339 (treat untracked port as already-closed on kill).
  • Kept as a draft safety net only — root-causing showed these PRs are not the cause of the "ports missing until workspace selected after update" bug, and reverting them changes nothing in the shipped desktop app.

Why / Context

Ports were not appearing after an app update until the workspace was selected. Investigation traced the real cause: startTerminalReaper is only wired into packages/host-service/src/serve.ts (standalone/CLI entry). The desktop app spawns host-service via apps/desktop/src/main/host-service/index.ts, which never starts the reaper — so the #5325/#5430 reconcile logic never executes in the packaged app. The actual fix is a wiring change in the desktop entry (separate PR).

The UI port PRs (#5350, #5392, #5426) are deliberately not reverted: they have no update-time behavior, and #5392's workspace-item components now host the unrelated running-agents feature (#5414), which a revert would rip out.

Testing

  • bun test in packages/host-service (729 pass) and packages/port-scanner (49 pass)
  • bun run typecheck --filter=@superset/host-service --filter=@superset/port-scanner
  • bun run lint (exit 0)

Notes

  • Do not merge unless the wiring fix proves insufficient; merging restores the pre-#5325 behavior (ports register only on renderer attach), it does not fix the update symptom.

Open in Stage

Summary by cubic

Rolls back recent port-scanning behavior and kill-path tweaks to restore pre-#5325 behavior. Removes the reaper’s boot-time port-scan sync and reverts killPort to error on untracked ports; this does not address the “ports missing until workspace selected after update” issue.

  • Refactors
    • Removed port-scan warm-up and daemon sync from startTerminalReaper; reaper now runs only on the 5-minute interval.
    • Deleted planPortScanSync and its tests; dropped isLiveTerminalSession and getRegisteredTerminalIds.
    • Reverted killPort behavior to return { success: false, error: "Port not found in tracked ports" } when a port is untracked; removed related tests.