Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

CLI end to end: two tests wait for the state they read (#1208)

Dee11f26b024c9a
diff --git a/cli/e2e/twodaemons.e2e.ts b/cli/e2e/twodaemons.e2e.ts
index 1faaf8fbd..e9dcebbb8 100644
--- a/cli/e2e/twodaemons.e2e.ts
+++ b/cli/e2e/twodaemons.e2e.ts
@@ -150,8 +150,12 @@ describe('two daemons on one computer', () => {
await dev.start()
const installed = () => [join(release.env.HOME!, '.claude', 'settings.json'), join(release.env.CODEX_HOME!, 'hooks.json')]
.map((file) => readFileSync(file, 'utf8'))
+ // A daemon installs its hooks just after it reports ready (readiness does not wait on hook maintenance, #1166),
+ // so the entries are read until they are that daemon's.
+ const owns = (daemon: IsolatedDaemon) => until(`the installed hooks to name port ${daemon.port}`,
+ () => installed().every((file) => file.includes(`--port ${daemon.port} `)), 20_000, 100)
// The precondition of the incident: the entries every engine started from here on runs are the dev daemon's.
- for (const file of installed()) expect(file).toContain(`--port ${dev.port} `)
+ await owns(dev)
const atRelease = await LocalClient.connect(release)
const atDev = await LocalClient.connect(dev)
@@ -180,7 +184,7 @@ describe('two daemons on one computer', () => {
// And the other way round: restarted, the release daemon owns the entries; a new dev agent reaches dev.
atRelease.close()
await release.restart()
- for (const file of installed()) expect(file).toContain(`--port ${release.port} `)
+ await owns(release)
const later = await create(dev, atDev, 'claude', 'dev-later')
await turn(atDev, later.id, 'a dev turn after the release daemon restarted')
await reachedOnlyItsOwn(dev, release, later, 'claude')
diff --git a/cli/e2e/updateHostile.e2e.ts b/cli/e2e/updateHostile.e2e.ts
index 91e1813f5..fd38ac5dd 100644
--- a/cli/e2e/updateHostile.e2e.ts
+++ b/cli/e2e/updateHostile.e2e.ts
@@ -616,7 +616,11 @@ describe.skipIf(!DISKFULL)('an update on a disk that fills', () => {
// safe mode. The build before would too: the master keeps the update on trial and tries again,
// backing off. Before, it rolled back (the rollback freeing the room the build before needed) and
// remembered a good build as bad.
- await until('the master to try the new bundle again for want of room', () => count(machine.log().slice(from), 'had no room to start') >= 2, 150_000, 100)
+ // The volume is kept full until then. The master may be writing its lean bundle out as the volume fills: what
+ // it had written is given back when that write fails (leanBundle.ts leaves no half behind), and with that
+ // room the core starts and the update simply stays up, which is right and is not this test (a slow macOS
+ // runner, 2026-10-12).
+ await until('the master to try the new bundle again for want of room', () => { fill(); return count(machine.log().slice(from), 'had no room to start') >= 2 }, 150_000, 100)
expect(machine.log().slice(from)).toContain('could not start on the new bundle for want of room on the disk (listen ENOSPC')
expect(machine.log().slice(from)).not.toContain('the updated core failed')
expect(IsolatedDaemon.alive(master), 'the master outlives a full disk in the middle of an update').toBe(true)