Skip to content

Commit ec38857

Browse files
author
OMX Demo
committed
Keep autoresearch tests from using the real process table
The remote Node 20 logs still died during the early autoresearch CLI tests, which pointed to another launch-adjacent harness still consulting the real host process table. Those autoresearch integration tests create fake PATH binaries but previously left PID TTY TIME CMD 1941 ? 00:10:15 systemd 1947 ? 00:00:00 (sd-pam) 5798 ? 00:07:35 MainThread 267288 ? 00:00:00 sshd 267290 ? 00:00:00 sshd 285431 ? 00:02:03 python3 285996 ? 00:00:48 chrome 303472 ? 00:00:56 chrome 339815 ? 00:00:11 PM2 v6.0.14: Go 437842 ? 00:00:00 sshd 437890 ? 00:00:00 sshd 680612 ? 00:00:00 clawdbot 680650 ? 00:02:49 clawdbot-gatewa 744476 ? 00:02:56 MainThread 1632351 ? 00:00:00 MainThread 1706678 ? 00:00:16 chrome 1709899 ? 00:00:25 chrome 1763346 ? 00:00:20 MainThread 1873615 ? 00:00:00 zsh 1873618 ? 00:00:00 ps 2107321 ? 00:00:05 chrome 2127476 ? 03:39:42 chrome 2127478 ? 00:00:00 chrome_crashpad 2127480 ? 00:00:00 chrome_crashpad 2127483 ? 00:00:00 chrome 2127484 ? 00:00:01 chrome 2127500 ? 00:00:00 dbus-daemon 2127504 ? 00:05:08 chrome 2127505 ? 00:20:16 chrome 2127518 ? 00:00:15 chrome 2127546 ? 03:13:55 chrome 2127556 ? 00:22:44 chrome 2127557 ? 00:40:32 chrome 2127559 ? 00:01:02 chrome 2127582 ? 00:00:00 at-spi-bus-laun 2127597 ? 00:00:00 dbus-daemon 2127599 ? 00:00:07 chrome 2127600 ? 00:12:53 chrome 2127617 ? 00:21:15 chrome 2127626 ? 00:03:48 chrome 2127636 ? 00:00:00 at-spi2-registr 2127637 ? 00:24:57 chrome 2127639 ? 00:36:40 chrome 2127680 ? 00:01:36 chrome 2127764 ? 00:01:06 chrome 2127784 ? 00:07:18 chrome 2127809 ? 00:01:35 chrome 2127888 ? 00:04:26 chrome 2127913 ? 00:06:34 chrome 2127989 ? 00:06:27 chrome 2128032 ? 00:01:42 chrome 2128042 ? 00:03:04 chrome 2128136 ? 00:05:50 chrome 2128165 ? 00:22:03 chrome 2128189 ? 00:01:41 chrome 2128239 ? 00:02:32 chrome 2128323 ? 00:00:07 chrome 2128345 ? 00:00:07 chrome 2128383 ? 00:00:10 chrome 2128395 ? 00:00:10 chrome 2128416 ? 00:00:10 chrome 2128451 ? 00:01:44 chrome 2128527 ? 00:00:10 chrome 2128552 ? 00:00:10 chrome 2128572 ? 00:00:10 chrome 2128584 ? 00:00:07 chrome 2129647 ? 00:04:29 chrome 2129752 ? 00:02:50 chrome 2129759 ? 00:02:23 chrome 2129761 ? 00:00:07 chrome 2129784 ? 00:09:10 chrome 2129795 ? 00:00:07 chrome 2129808 ? 00:09:14 chrome 2129815 ? 00:02:23 chrome 2129888 ? 00:04:15 chrome 2129925 ? 00:20:38 chrome 2129950 ? 00:13:15 chrome 2129957 ? 00:08:19 chrome 2129981 ? 00:07:45 chrome 2129987 ? 00:00:08 chrome 2130025 ? 00:13:27 chrome 2130059 ? 01:08:08 chrome 2130120 ? 01:08:03 chrome 2130267 ? 00:04:30 chrome 2130291 ? 02:12:59 chrome 2266023 ? 00:34:50 MainThread 2270867 ? 00:37:36 MainThread 2275994 ? 00:00:00 rusty_claude_cl 2285798 ? 00:00:00 rusty_claude_cl 2327451 ? 00:00:00 rusty_claude_cl 2338514 ? 00:00:00 rusty_claude_cl 2377473 ? 00:00:00 rusty_claude_cl 2406284 ? 00:09:53 chrome 2447501 ? 00:00:00 chrome 2448228 ? 00:00:00 chrome 2535673 ? 00:00:22 MainThread <defunct> 2826647 ? 04:13:43 tmux: server 3136573 ? 00:01:41 clawhip 3149348 ? 01:49:30 MainThread <defunct> 3154612 ? 00:00:39 chrome 3164813 ? 01:47:48 MainThread <defunct> 3181229 ? 01:50:11 MainThread <defunct> 3199779 ? 01:51:22 MainThread <defunct> 3219195 ? 01:52:00 MainThread <defunct> 3221609 ? 00:14:59 MainThread 3239922 ? 01:49:28 MainThread <defunct> 3261891 ? 01:49:00 MainThread <defunct> 3289313 ? 00:13:29 MainThread 3385138 ? 00:00:46 MainThread 3385763 ? 00:00:45 MainThread 3418389 ? 00:00:00 MainThread 3421210 ? 00:00:00 MainThread 3527865 ? 00:00:32 chrome 3578106 ? 00:00:45 MainThread 3702482 ? 00:00:02 docker-init 3702697 ? 00:17:27 openclaw-gatewa 3845529 ? 00:00:02 xeroclaw 3857374 ? 01:17:08 MainThread <defunct> 3864725 ? 00:00:00 sh 3864735 ? 00:00:00 MainThread 3865386 ? 1-08:04:59 codex 3883992 ? 00:00:22 screen real, so launch-safe MCP cleanup could still interfere with sibling test-worker fixtures during aggregate runs. This patch stubs PID TTY TIME CMD 1941 ? 00:10:15 systemd 1947 ? 00:00:00 (sd-pam) 5798 ? 00:07:35 MainThread 267288 ? 00:00:00 sshd 267290 ? 00:00:00 sshd 285431 ? 00:02:03 python3 285996 ? 00:00:48 chrome 303472 ? 00:00:56 chrome 339815 ? 00:00:11 PM2 v6.0.14: Go 437842 ? 00:00:00 sshd 437890 ? 00:00:00 sshd 680612 ? 00:00:00 clawdbot 680650 ? 00:02:49 clawdbot-gatewa 744476 ? 00:02:56 MainThread 1632351 ? 00:00:00 MainThread 1706678 ? 00:00:16 chrome 1709899 ? 00:00:25 chrome 1763346 ? 00:00:20 MainThread 1873615 ? 00:00:00 zsh 1873619 ? 00:00:00 ps 2107321 ? 00:00:05 chrome 2127476 ? 03:39:42 chrome 2127478 ? 00:00:00 chrome_crashpad 2127480 ? 00:00:00 chrome_crashpad 2127483 ? 00:00:00 chrome 2127484 ? 00:00:01 chrome 2127500 ? 00:00:00 dbus-daemon 2127504 ? 00:05:08 chrome 2127505 ? 00:20:16 chrome 2127518 ? 00:00:15 chrome 2127546 ? 03:13:55 chrome 2127556 ? 00:22:44 chrome 2127557 ? 00:40:32 chrome 2127559 ? 00:01:02 chrome 2127582 ? 00:00:00 at-spi-bus-laun 2127597 ? 00:00:00 dbus-daemon 2127599 ? 00:00:07 chrome 2127600 ? 00:12:53 chrome 2127617 ? 00:21:15 chrome 2127626 ? 00:03:48 chrome 2127636 ? 00:00:00 at-spi2-registr 2127637 ? 00:24:57 chrome 2127639 ? 00:36:40 chrome 2127680 ? 00:01:36 chrome 2127764 ? 00:01:06 chrome 2127784 ? 00:07:18 chrome 2127809 ? 00:01:35 chrome 2127888 ? 00:04:26 chrome 2127913 ? 00:06:34 chrome 2127989 ? 00:06:27 chrome 2128032 ? 00:01:42 chrome 2128042 ? 00:03:04 chrome 2128136 ? 00:05:50 chrome 2128165 ? 00:22:03 chrome 2128189 ? 00:01:41 chrome 2128239 ? 00:02:32 chrome 2128323 ? 00:00:07 chrome 2128345 ? 00:00:07 chrome 2128383 ? 00:00:10 chrome 2128395 ? 00:00:10 chrome 2128416 ? 00:00:10 chrome 2128451 ? 00:01:44 chrome 2128527 ? 00:00:10 chrome 2128552 ? 00:00:10 chrome 2128572 ? 00:00:10 chrome 2128584 ? 00:00:07 chrome 2129647 ? 00:04:29 chrome 2129752 ? 00:02:50 chrome 2129759 ? 00:02:23 chrome 2129761 ? 00:00:07 chrome 2129784 ? 00:09:10 chrome 2129795 ? 00:00:07 chrome 2129808 ? 00:09:14 chrome 2129815 ? 00:02:23 chrome 2129888 ? 00:04:15 chrome 2129925 ? 00:20:38 chrome 2129950 ? 00:13:15 chrome 2129957 ? 00:08:19 chrome 2129981 ? 00:07:45 chrome 2129987 ? 00:00:08 chrome 2130025 ? 00:13:27 chrome 2130059 ? 01:08:08 chrome 2130120 ? 01:08:03 chrome 2130267 ? 00:04:30 chrome 2130291 ? 02:12:59 chrome 2266023 ? 00:34:50 MainThread 2270867 ? 00:37:36 MainThread 2275994 ? 00:00:00 rusty_claude_cl 2285798 ? 00:00:00 rusty_claude_cl 2327451 ? 00:00:00 rusty_claude_cl 2338514 ? 00:00:00 rusty_claude_cl 2377473 ? 00:00:00 rusty_claude_cl 2406284 ? 00:09:53 chrome 2447501 ? 00:00:00 chrome 2448228 ? 00:00:00 chrome 2535673 ? 00:00:22 MainThread <defunct> 2826647 ? 04:13:43 tmux: server 3136573 ? 00:01:41 clawhip 3149348 ? 01:49:30 MainThread <defunct> 3154612 ? 00:00:39 chrome 3164813 ? 01:47:48 MainThread <defunct> 3181229 ? 01:50:11 MainThread <defunct> 3199779 ? 01:51:22 MainThread <defunct> 3219195 ? 01:52:00 MainThread <defunct> 3221609 ? 00:14:59 MainThread 3239922 ? 01:49:28 MainThread <defunct> 3261891 ? 01:49:00 MainThread <defunct> 3289313 ? 00:13:29 MainThread 3385138 ? 00:00:46 MainThread 3385763 ? 00:00:45 MainThread 3418389 ? 00:00:00 MainThread 3421210 ? 00:00:00 MainThread 3527865 ? 00:00:32 chrome 3578106 ? 00:00:45 MainThread 3702482 ? 00:00:02 docker-init 3702697 ? 00:17:27 openclaw-gatewa 3845529 ? 00:00:02 xeroclaw 3857374 ? 01:17:08 MainThread <defunct> 3864725 ? 00:00:00 sh 3864735 ? 00:00:00 MainThread 3865386 ? 1-08:04:59 codex 3883992 ? 00:00:22 screen in the autoresearch fake-bin scenarios and adds one more selector test to cover the launch-safe branch where an MCP process has a live but unrelated ancestor chain. Constraint: Preserve the production launch-time cleanup behavior while isolating test harnesses from host-wide process discovery Rejected: Remove launch-time cleanup from autoresearch paths | not the root cause and would leave the aggregate CI race untreated Rejected: Rewrite production ancestor heuristics around Node test workers | broader behavior change than needed for the failing PR Confidence: medium Scope-risk: narrow Reversibility: clean Directive: Any CLI integration test that shells into OMX launch/exec flows with a fake PATH should stub PID TTY TIME CMD 1941 ? 00:10:15 systemd 1947 ? 00:00:00 (sd-pam) 5798 ? 00:07:35 MainThread 267288 ? 00:00:00 sshd 267290 ? 00:00:00 sshd 285431 ? 00:02:03 python3 285996 ? 00:00:48 chrome 303472 ? 00:00:56 chrome 339815 ? 00:00:11 PM2 v6.0.14: Go 437842 ? 00:00:00 sshd 437890 ? 00:00:00 sshd 680612 ? 00:00:00 clawdbot 680650 ? 00:02:49 clawdbot-gatewa 744476 ? 00:02:56 MainThread 1632351 ? 00:00:00 MainThread 1706678 ? 00:00:16 chrome 1709899 ? 00:00:25 chrome 1763346 ? 00:00:20 MainThread 1873615 ? 00:00:00 zsh 1873635 ? 00:00:00 ps 2107321 ? 00:00:05 chrome 2127476 ? 03:39:42 chrome 2127478 ? 00:00:00 chrome_crashpad 2127480 ? 00:00:00 chrome_crashpad 2127483 ? 00:00:00 chrome 2127484 ? 00:00:01 chrome 2127500 ? 00:00:00 dbus-daemon 2127504 ? 00:05:08 chrome 2127505 ? 00:20:16 chrome 2127518 ? 00:00:15 chrome 2127546 ? 03:13:55 chrome 2127556 ? 00:22:44 chrome 2127557 ? 00:40:32 chrome 2127559 ? 00:01:02 chrome 2127582 ? 00:00:00 at-spi-bus-laun 2127597 ? 00:00:00 dbus-daemon 2127599 ? 00:00:07 chrome 2127600 ? 00:12:53 chrome 2127617 ? 00:21:15 chrome 2127626 ? 00:03:48 chrome 2127636 ? 00:00:00 at-spi2-registr 2127637 ? 00:24:57 chrome 2127639 ? 00:36:40 chrome 2127680 ? 00:01:36 chrome 2127764 ? 00:01:06 chrome 2127784 ? 00:07:18 chrome 2127809 ? 00:01:35 chrome 2127888 ? 00:04:26 chrome 2127913 ? 00:06:34 chrome 2127989 ? 00:06:27 chrome 2128032 ? 00:01:42 chrome 2128042 ? 00:03:04 chrome 2128136 ? 00:05:50 chrome 2128165 ? 00:22:03 chrome 2128189 ? 00:01:41 chrome 2128239 ? 00:02:32 chrome 2128323 ? 00:00:07 chrome 2128345 ? 00:00:07 chrome 2128383 ? 00:00:10 chrome 2128395 ? 00:00:10 chrome 2128416 ? 00:00:10 chrome 2128451 ? 00:01:44 chrome 2128527 ? 00:00:10 chrome 2128552 ? 00:00:10 chrome 2128572 ? 00:00:10 chrome 2128584 ? 00:00:07 chrome 2129647 ? 00:04:29 chrome 2129752 ? 00:02:50 chrome 2129759 ? 00:02:23 chrome 2129761 ? 00:00:07 chrome 2129784 ? 00:09:10 chrome 2129795 ? 00:00:07 chrome 2129808 ? 00:09:14 chrome 2129815 ? 00:02:23 chrome 2129888 ? 00:04:15 chrome 2129925 ? 00:20:38 chrome 2129950 ? 00:13:15 chrome 2129957 ? 00:08:19 chrome 2129981 ? 00:07:45 chrome 2129987 ? 00:00:08 chrome 2130025 ? 00:13:27 chrome 2130059 ? 01:08:08 chrome 2130120 ? 01:08:03 chrome 2130267 ? 00:04:30 chrome 2130291 ? 02:12:59 chrome 2266023 ? 00:34:50 MainThread 2270867 ? 00:37:36 MainThread 2275994 ? 00:00:00 rusty_claude_cl 2285798 ? 00:00:00 rusty_claude_cl 2327451 ? 00:00:00 rusty_claude_cl 2338514 ? 00:00:00 rusty_claude_cl 2377473 ? 00:00:00 rusty_claude_cl 2406284 ? 00:09:53 chrome 2447501 ? 00:00:00 chrome 2448228 ? 00:00:00 chrome 2535673 ? 00:00:22 MainThread <defunct> 2826647 ? 04:13:43 tmux: server 3136573 ? 00:01:41 clawhip 3149348 ? 01:49:30 MainThread <defunct> 3154612 ? 00:00:39 chrome 3164813 ? 01:47:48 MainThread <defunct> 3181229 ? 01:50:11 MainThread <defunct> 3199779 ? 01:51:22 MainThread <defunct> 3219195 ? 01:52:00 MainThread <defunct> 3221609 ? 00:14:59 MainThread 3239922 ? 01:49:28 MainThread <defunct> 3261891 ? 01:49:00 MainThread <defunct> 3289313 ? 00:13:29 MainThread 3385138 ? 00:00:46 MainThread 3385763 ? 00:00:45 MainThread 3418389 ? 00:00:00 MainThread 3421210 ? 00:00:00 MainThread 3527865 ? 00:00:32 chrome 3578106 ? 00:00:45 MainThread 3702482 ? 00:00:02 docker-init 3702697 ? 00:17:27 openclaw-gatewa 3845529 ? 00:00:02 xeroclaw 3857374 ? 01:17:08 MainThread <defunct> 3864725 ? 00:00:00 sh 3864735 ? 00:00:00 MainThread 3865386 ? 1-08:04:59 codex 3883992 ? 00:00:22 screen unless the test is explicitly validating real process discovery Tested: npx -y -p node@20 -c 'CI=1 npm run build && node --test dist/cli/__tests__/cleanup.test.js dist/cli/__tests__/autoresearch.test.js dist/cli/__tests__/exec.test.js dist/cli/__tests__/resume.test.js dist/cli/__tests__/launch-fallback.test.js dist/mcp/__tests__/server-lifecycle.test.js' Tested: npx -y -p node@20 -c 'CI=1 node --test dist/cli/__tests__/autoresearch.test.js dist/mcp/__tests__/server-lifecycle.test.js' Tested: npx -y -p node@20 -c 'CI=1 node --test dist/cli/__tests__/autoresearch.test.js dist/mcp/__tests__/server-lifecycle.test.js' (repeat loop) Not-tested: Fresh GitHub Actions rerun after push Not-tested: Full local Node 20 suite rerun after this second patch
1 parent 7d86986 commit ec38857

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/cli/__tests__/autoresearch.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ async function initRepo(): Promise<string> {
5454
return cwd;
5555
}
5656

57+
async function installFakePs(fakeBin: string): Promise<void> {
58+
const fakePsPath = join(fakeBin, 'ps');
59+
await writeFile(fakePsPath, '#!/bin/sh\nexit 0\n', 'utf-8');
60+
execFileSync('chmod', ['+x', fakePsPath], { stdio: 'ignore' });
61+
}
62+
5763
describe('normalizeAutoresearchCodexArgs', () => {
5864
it('adds sandbox bypass by default for autoresearch workers', () => {
5965
assert.deepEqual(normalizeAutoresearchCodexArgs(['--model', 'gpt-5']), ['--model', 'gpt-5', '--dangerously-bypass-approvals-and-sandbox']);
@@ -242,6 +248,7 @@ touch -t 202603180000 "$OMX_TEST_REPO_ROOT/.omx/specs/autoresearch-test-launch/r
242248
'utf-8',
243249
);
244250
execFileSync('chmod', ['+x', fakeCodexPath], { stdio: 'ignore' });
251+
await installFakePs(fakeBin);
245252

246253
const result = runOmx(repo, ['autoresearch', '--topic', 'Investigate flaky onboarding behavior', '--evaluator', 'node scripts/eval.js', '--slug', 'test-launch'], {
247254
PATH: `${fakeBin}:${process.env.PATH || ''}`,
@@ -351,6 +358,7 @@ EOF
351358
'utf-8',
352359
);
353360
execFileSync('chmod', ['+x', fakeCodexPath], { stdio: 'ignore' });
361+
await installFakePs(fakeBin);
354362

355363
const fakeTmuxPath = join(fakeBin, 'tmux');
356364
await writeFile(
@@ -459,6 +467,7 @@ perl -0pi -e "s/HEAD_PLACEHOLDER/$head_commit/g" "$candidate_file"
459467
'utf-8',
460468
);
461469
execFileSync('chmod', ['+x', fakeCodexPath], { stdio: 'ignore' });
470+
await installFakePs(fakeBin);
462471

463472
const fakeTmuxPath = join(fakeBin, 'tmux');
464473
await writeFile(
@@ -564,6 +573,7 @@ perl -0pi -e "s/HEAD_PLACEHOLDER/$head_commit/g" "$candidate_file"
564573
'utf-8',
565574
);
566575
execFileSync('chmod', ['+x', fakeCodexPath], { stdio: 'ignore' });
576+
await installFakePs(fakeBin);
567577

568578
const fakeTmuxPath = join(fakeBin, 'tmux');
569579
await writeFile(
@@ -761,6 +771,7 @@ printf '{\\n "status": "abort",\\n "candidate_commit": null,\\n "base_commit"
761771
'utf-8',
762772
);
763773
execFileSync('chmod', ['+x', fakeCodexPath], { stdio: 'ignore' });
774+
await installFakePs(fakeBin);
764775

765776
const result = runOmx(
766777
repo,
@@ -814,6 +825,7 @@ EOF
814825
'utf-8',
815826
);
816827
execFileSync('chmod', ['+x', fakeCodexPath], { stdio: 'ignore' });
828+
await installFakePs(fakeBin);
817829

818830
const result = runOmx(
819831
repo,

src/cli/__tests__/cleanup.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ describe('findCleanupCandidates', () => {
123123
],
124124
);
125125
});
126+
127+
it('keeps detached MCP candidates whose ancestor chain is live but unrelated to Codex or OMX launchers', () => {
128+
const unrelatedAncestorProcesses: ProcessEntry[] = [
129+
{ pid: 701, ppid: 700, command: 'node /repo/bin/omx.js' },
130+
{ pid: 840, ppid: 841, command: 'node /tmp/unrelated/dist/mcp/state-server.js' },
131+
{ pid: 841, ppid: 842, command: 'node worker.js' },
132+
{ pid: 842, ppid: 1, command: 'bash' },
133+
];
134+
135+
assert.deepEqual(findLaunchSafeCleanupCandidates(unrelatedAncestorProcesses, 701), [
136+
{
137+
pid: 840,
138+
ppid: 841,
139+
command: 'node /tmp/unrelated/dist/mcp/state-server.js',
140+
reason: 'outside-current-session',
141+
},
142+
]);
143+
});
126144
});
127145

128146
describe('cleanupOmxMcpProcesses', () => {

0 commit comments

Comments
 (0)