-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathreproduce_stability_bug.ts
More file actions
53 lines (42 loc) · 1.8 KB
/
reproduce_stability_bug.ts
File metadata and controls
53 lines (42 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import { spawn, execSync } from 'child_process';
import { waitForStability } from './tmux_utils.js';
const TEST_SESSION = 'gemini-test-stability';
async function main() {
// 1. Setup test session
try {
execSync(`tmux kill-session -t ${TEST_SESSION} 2>/dev/null`);
} catch (e) {}
execSync(`tmux new-session -d -s ${TEST_SESSION} -n main`);
const target = `${TEST_SESSION}:0.0`;
console.log(`Test session started: ${target}`);
// 2. Start a "user cursor moving" simulator in background
// This moves the cursor every 2 seconds.
// waitForStability SHOULD FAIL to find stability if it cares about cursor.
// If it returns true (stable) while cursor is moving, it confirms the bug.
const typer = spawn('bash', ['-c', `
# Type some text first so we have something to move over
tmux send-keys -t ${target} "Hello World"
sleep 1
for i in {1..15}; do
tmux send-keys -t ${target} Left
sleep 2
done
`], { stdio: 'inherit' });
console.log("Cursor simulator started (moving every 2s)...");
console.log("Waiting for stability (requirement: 10s stable)...");
const startTime = Date.now();
const isStable = await waitForStability(target, 10000, 1000, 20000); // Wait up to 20s
const duration = Date.now() - startTime;
console.log(`waitForStability returned: ${isStable} after ${duration}ms`);
// Cleanup
typer.kill();
execSync(`tmux kill-session -t ${TEST_SESSION}`);
if (isStable) {
console.error("FAIL: Detected stability while user was moving cursor! (Bug Confirmed)");
process.exit(1); // We want to see this fail to confirm the bug
} else {
console.log("PASS: Did not detect stability (timeout as expected).");
process.exit(0);
}
}
main();