Stop the QA-only cleanup test from failing at random on a fast terminal-agent exit (GST-3830) (#4823)

The QA-only cleanup test's missing-terminal case now waits for the
terminal agent to publish its port before it deletes the agent's record,
so it no longer fails at random in CI.

Why: a red test should mean something broke, and this race turned the
merged-tree check for #4803 red twice in a row.

Nothing to do.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-25 07:54:11 +00:00
1 parent 789e9badaa
commit 47189a18e2
2 files changed
+3 -1

No files matched your search

@@ -0,0 +1 @@
**The QA-only cleanup test no longer fails at random in CI.** Its missing-terminal case now waits until the terminal agent has published its port before removing the agent's record, so it always checks that cleanup refuses when a terminal's record is gone but its port file is left behind.
+2 -1
View File
@@ -106,6 +106,7 @@ fs.writeFileSync(${JSON.stringify(path.join(dir, 'port'))}, String(server.port))
restore = () => spy.mockRestore();
}
if (scenario === 'missing-terminal') {
await waitFor(() => fs.existsSync(path.join(stateDir, 'terminal-port')));
fs.unlinkSync(agentFile);
fs.writeFileSync(path.join(stateDir, 'browse-daemon.log'), '[browse] terminal-agent exit remains unconfirmed: fixture\n');
}
@@ -134,7 +135,7 @@ Bun.spawnSync = (...args) => {
const started = performance.now();
const errors = { 'ack-only': 'settlement deadline exceeded', 'replaced-state': 'daemon state was replaced',
'terminal-mismatch': 'terminal ownership is unconfirmed', 'chromium-mismatch': 'Chromium ownership is unconfirmed',
'missing-terminal': /terminal identity is unavailable \(record absent; terminal-port .*daemon log terminal-agent lines: \[browse\] terminal-agent exit remains unconfirmed: fixture\)/,
'missing-terminal': /terminal identity is unavailable \(record absent; terminal-port present; .*daemon log terminal-agent lines: \[browse\] terminal-agent exit remains unconfirmed: fixture\)/,
'unrecorded-terminal': new RegExp(`terminal identity is unavailable \\(record absent; terminal-port absent; running fixture agents: ${stray?.pid}; daemon ${daemon.pid} alive`),
'unlisted-agents': 'terminal agent identities are unavailable',
'blocked-identity': 'owned worker settlement deadline exceeded' };