Skip to content

Commit cd53c71

Browse files
cameroncookecodex
andcommitted
fix(benchmarks): Harden Claude UI process cleanup
Detach timed Claude commands before process-group termination and fix RocketSim preflight launch detection for direct app/path commands. Co-Authored-By: OpenAI Codex <noreply@openai.com>
1 parent 3dccc3b commit cd53c71

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

src/benchmarks/claude-ui/__tests__/preflight-commands.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ describe('Claude UI benchmark preflight commands', () => {
2222
expect(preflightCommandsWithFocusResign({ commands })).toBe(commands);
2323
});
2424

25+
it('detects simple and path-based RocketSim launch commands', () => {
26+
expect(
27+
preflightCommandsWithFocusResign({
28+
commands: ['open RocketSim', 'open /Applications/RocketSim.app'],
29+
simulatorId: 'SIM-123',
30+
}),
31+
).toEqual([
32+
'open RocketSim',
33+
"open -a Simulator --args -CurrentDeviceUDID 'SIM-123'",
34+
'open /Applications/RocketSim.app',
35+
"open -a Simulator --args -CurrentDeviceUDID 'SIM-123'",
36+
]);
37+
});
38+
2539
it('shell-quotes simulator IDs used by the focus command', () => {
2640
expect(
2741
preflightCommandsWithFocusResign({

src/benchmarks/claude-ui/harness.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function runCommand(opts: {
228228
cwd: opts.cwd,
229229
env: opts.env ?? process.env,
230230
stdio: ['pipe', 'pipe', 'pipe'],
231-
detached: opts.terminalJsonResultGraceMs !== undefined,
231+
detached: opts.terminalJsonResultGraceMs !== undefined || opts.timeoutMs !== undefined,
232232
});
233233

234234
const clearTerminalResultTimer = (): void => {

src/benchmarks/claude-ui/preflight-commands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function shellSingleQuote(value: string): string {
1717
}
1818

1919
function isRocketSimAppLaunchCommand(command: string): boolean {
20-
return /^\s*open\s+.*(?:^|\s)RocketSim(?:\.app)?\s*$/.test(command);
20+
return /^\s*open\s+(?:.*(?:\s|\/))?RocketSim(?:\.app)?\s*$/.test(command);
2121
}
2222

2323
export function preflightCommandsWithFocusResign(opts: {

0 commit comments

Comments
 (0)