Skip to content

windows runtime (#567): the job fails in teardown while every test passes — a file is still held under the temp dir #1036

Description

@fujibee

The bats (windows-latest, windows runtime (#567)) job fails with both of its tests passing. What fails is the teardown:

ok 1 codex-monitor: windows-native reaches the bridged handoff (#567)
# (from function `teardown_test_env' in file tests/test_helper.bash, line 38,
#  from function `teardown' in test file tests/test_codex_monitor.bats, line 76)
#   `teardown_test_env' failed
# rm: cannot remove '/tmp/tmp.FvPvYCFV64': Directory not empty

bats attributes a teardown failure to the test that ran before it, so the not ok line names a test whose body succeeded. Reading only the test name is misleading here.

The same shape on main, with a different message and a different test

run 33342369448 (main)
  ok 1     codex-monitor: windows-native reaches the bridged handoff (#567)
  not ok 2 launcher: windows-native starts the bridge (#567)
  teardown_test_env failed
  rm: cannot remove '.../db/messages.db':     Device or resource busy
  rm: cannot remove '.../db/messages.db-shm': Device or resource busy
  rm: cannot remove '.../db/messages.db-wal': Device or resource busy

So this is not tied to one test: which of the two tests carries the failure moves, and the rm error text differs — Device or resource busy on the SQLite files in one run, a bare Directory not empty on the temp root in another. Both are the same underlying condition: something still holds a file under the test's temp directory when teardown runs.

Device or resource busy on messages.db, -shm and -wal together points at a SQLite connection that has not closed. The most likely holders are the codex bridge / launcher processes these two tests start, which on Windows keep the file locked after the test body returns. Directory not empty is the same story seen one level up, after the individual unlinks failed.

Why it matters more than a flaky count

The job's exit code is 1 while every test reported ok. A summary that reads test results — or a human reading the last few lines — sees passes. Only the exit status and the # rm: lines say otherwise. A real regression in either of these two tests would look exactly like this in any view that stops at the test list.

Not fixed here

Filed rather than fixed: teardown ordering on Windows for the processes these tests launch is its own piece of work, and it is not what the branch that surfaced this was changing. The branch in question modifies scripts/drivers/types/codex/template.md and nothing in codex-monitor.sh, the launcher, or tests/test_helper.bash.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions