tests: a job's note kept for a closed session, without the race
ci / check (push) Canceled after 0s

"keeps its note until the session is resumed" started `sleep 0.5` and counted
on the turn taking less than that before /new. On a loaded machine (load 7 on
two cores) the turn took longer, the job ended while the session was still
open, and its note went in as a turn instead of waiting. The command now
waits for a file written after /new.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
HomerandClaude Opus 5.5 committed 2026-10-27 21:55:14 +00:00
1 parent 89ceeec159
commit eacf84fd67
1 file changed
+3 -1
+3 -1
View File
@@ -164,7 +164,8 @@ describe("in an app", () => {
const store = new Store(join(dir(), "s.db")) const store = new Store(join(dir(), "s.db"))
const a = app( const a = app(
[ [
{ chunks: [toolCall(0, "t1", "bash", JSON.stringify({ command: "sleep 0.5; echo late", background: true, description: "later" }))] }, // It ends once the session is no longer open (the file below), however slow the turn was.
{ chunks: [toolCall(0, "t1", "bash", JSON.stringify({ command: "until [ -e go ]; do sleep 0.05; done; echo late", background: true, description: "later" }))] },
{ chunks: [delta({ content: "Running." })] }, { chunks: [delta({ content: "Running." })] },
{ chunks: [delta({ content: "Back, and it finished." })] }, { chunks: [delta({ content: "Back, and it finished." })] },
], ],
@@ -173,6 +174,7 @@ describe("in an app", () => {
const first = a.engine.sessionId! const first = a.engine.sessionId!
await a.turns.prompt("start it") await a.turns.prompt("start it")
a.newSession() a.newSession()
writeFileSync(join(a.project.root, "go"), "")
const job = await ended(a.registry, first, "job1") const job = await ended(a.registry, first, "job1")
expect(job.note).toContain("late") expect(job.note).toContain("late")
expect(a.registry.get(first, "job1")!.note).toStartWith(MARKS.command) expect(a.registry.get(first, "job1")!.note).toStartWith(MARKS.command)