[Bug]: omo-native doctor.test.ts reads the host process table and an inherited OMO_CODING_AGENT_DIR

Author: code-yeongyuCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbug

Summary

Four packages/omo-native/test/doctor.test.ts cases fail when the suite runs on a machine that is itself running omo, or inside an omo session. The doctor child they spawn is not isolated from the host:

  1. It reads the real host process table. bin/lib/doctor.js staleEngineReport defaults options.list to listProcesses (ps), so every live engine on the host becomes a WARN engine pid ... started before this payload was installed line in the fixture's doctor output.
  2. It can read the real agent dir. run() in the test sets only SENPI_CODING_AGENT_DIR (env: { ...process.env, SENPI_CODING_AGENT_DIR: fixture.agentDir }). An inherited OMO_CODING_AGENT_DIR outranks that variable, so a run launched from an omo session points doctor at the developer's real agent dir, not at the fixture's settings.json. This is the same class as #8967.

Failing cases (reproduced on untouched dev 1b3bb502b)

  • settings contain the legacy package entry > string shape / object shape: expected WARN duplicate @code-yeongyu/omo-senpi, which is absent.
  • settings JSON is malformed > diagnostics warn and continue.
  • SENPI_CODING_AGENT_DIR points to an alternate agent directory > reads settings from that directory first.

The captured doctor stdout contains the host's WARN engine pid <n> (age ..., tty ...) lines, and the fixture's settings warnings are missing.

Expected

The doctor tests never observe the host: the process list is injected (or the spawned doctor is pointed at an empty fake), and every agent-dir environment lane (OMO_CODING_AGENT_DIR, SENPI_CODING_AGENT_DIR, PI_CODING_AGENT_DIR) is set to the fixture, so the suite passes identically inside and outside an omo session.

Acceptance criteria

  • bun test packages/omo-native/test/doctor.test.ts passes when run from an omo session with live engines on the host.
  • No doctor test output contains a host pid.

Found while verifying #9148 (not caused by it).

Source: code-yeongyu/oh-my-openagent