Skip to content

flaky: TestSubprocessClaudeBackgroundStatesAndCleanup/timeout races the record write #500

Description

@rianjs

TestSubprocessClaudeBackgroundStatesAndCleanup/timeout in internal/llm (now internal/llmadapters after #499) is flaky. Two independent failures on 2026-07-11, both on code that did not touch the LLM subprocess path:

  1. CI static-smoke job on PR test(configcmd): byte-exact config show --json goldens (477.1) #495 (test-only config goldens): the subtest failed; the full test job passed on the same commit; a rerun passed.
  2. Local full-suite run during refactor(runlifecycle): extract pure run-lifecycle helpers (475.3) #498 verification:
--- FAIL: TestSubprocessClaudeBackgroundStatesAndCleanup (0.34s)
    --- FAIL: TestSubprocessClaudeBackgroundStatesAndCleanup/timeout (0.05s)
        subprocess_test.go:388: ReadFile(record): open .../TestSubprocessClaudeBackgroundStatesAndCleanuptimeout.../001/records.jsonl: no such file or directory

Immediately re-running the test (-count=2) passed.

The shape of the failure — the timeout subtest killing the fake subprocess before it has flushed records.jsonl — suggests a race between the timeout-triggered cleanup and the helper process's record write, i.e. the test asserts on a file the child may not have created yet when the timeout fires quickly. Worth either synchronizing the fake's record write with the parent's expectation or tolerating a missing record file in the timeout case, whichever matches the intent of the assertion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions