Skip to content

Commit d449045

Browse files
suleimanshclaude
andcommitted
The teardown test waits for the branch to go, which is now the last thing teardown does (#1650)
The second run in the test commits nothing and its tip is already on origin under the first run's branch, so it now takes the no-push path and its branch is deleted after the checkout. The test only waited for the checkout to vanish, then removed the repo under a `git branch -D` still writing into `.git` — ENOTEMPTY on CI. It now waits for the branch's absence and asserts it, and that nothing was pushed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 0b77bb5 commit d449045

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

packages/the-framework/src/daemon.test.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,27 @@ fs.appendFileSync(${JSON.stringify(join(cwd, 'started.log'))}, agentId + '\\n')
371371
// accumulated per failed session until a human noticed.
372372
const failedId = await runWith('failed', 2)
373373
assert.equal(await archived(failedId), true, "a failed run's history is copied too")
374-
assert.equal(await worktreeGone(failedId), true, 'and its checkout goes too, since the remote has its branch')
374+
assert.equal(await worktreeGone(failedId), true, 'and its checkout goes too')
375+
// This run committed nothing, and its tip — the init commit — is already on origin under the
376+
// first run's branch. So nothing is pushed and the branch goes with the checkout (#1650): the
377+
// branch's absence is the last thing teardown does, so it is what the test waits on before
378+
// pulling the repo out from under the daemon.
379+
for (let i = 0; i < 600; i++) {
380+
const gone = await git(['show-ref', '--verify', '--quiet', `refs/heads/tf-agent-${failedId}`], cwd).then(
381+
() => false,
382+
() => true,
383+
)
384+
if (gone) break
385+
await new Promise(r => setTimeout(r, 20))
386+
}
387+
await assert.rejects(
388+
() => git(['show-ref', '--verify', '--quiet', `refs/heads/tf-agent-${failedId}`], cwd),
389+
'a run that committed nothing leaves no branch behind',
390+
)
391+
await assert.rejects(
392+
() => git(['rev-parse', '--verify', `refs/remotes/origin/tf-agent-${failedId}`], cwd),
393+
'and nothing of it was pushed',
394+
)
375395

376396
ac.abort()
377397
await done

0 commit comments

Comments
 (0)