Skip to content

codev doctor: Tower env check misses custom ports and costs ~2 ps spawns per shellper #1628

Open

Description

@waleedkadous

Two follow-ups on the Tower Environment check added in PR #1626 (#1219). Both are non-blocking and were surfaced by that PR's CMAP review; filing so they are tracked rather than left in a PR body.

1. Only the default port is inspected

doctor() calls getProcessesOnPort(DEFAULT_TOWER_PORT). A Tower on any other port reports Tower not running and is silently never checked — which is a poor failure mode for a check whose entire value is catching the invisible case.

2. The session scan is spawn-heavy

findShellperPids() + readProcessEnv costs two ps invocations per shellper, and it runs unconditionally. On the machine this was developed on (71 shellpers) that is ~142 process spawns per codev doctor run.

ps accepts a comma-separated pid list, so both readings can be batched into one ps ww -o pid=,command= -p a,b,c plus one ps eww -o pid=,command= -p a,b,c, and the argv-subtraction can then be done per pid. That turns ~142 spawns into 2.

Deliberately left out of #1626: it was already drawing scope-limit review comments, and this is a rarely-run diagnostic where correctness mattered more than latency.

Context

The check exists because Claude Code session markers inherited by Tower make every agent it spawns unresumable, and because shellpers survive afx tower stop — so a Tower restarted clean can still have contaminated agents under it. See #1219.

Activity

  1. added
    area/tower
    on Sep 5, 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