[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:
- It reads the real host process table.
bin/lib/doctor.jsstaleEngineReportdefaultsoptions.listtolistProcesses(ps), so every live engine on the host becomes aWARN engine pid ... started before this payload was installedline in the fixture's doctor output. - It can read the real agent dir.
run()in the test sets onlySENPI_CODING_AGENT_DIR(env: { ...process.env, SENPI_CODING_AGENT_DIR: fixture.agentDir }). An inheritedOMO_CODING_AGENT_DIRoutranks that variable, so a run launched from an omo session points doctor at the developer's real agent dir, not at the fixture'ssettings.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: expectedWARN 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.tspasses 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