Skip to content

🧪 [test] dispatch: wait for fixture workers before cleanup - #60

Merged
EricTechPro merged 1 commit into
mainfrom
codex/dispatch-cleanup
Oct 14, 2026
Merged

EricTechPro merged 1 commit into
mainfrom
codex/dispatch-cleanup

Conversation

@EricTechPro

Copy link
Copy Markdown
Owner

Note

⏳ In review · round 1 · ✅ 3/3 AC · hosted checks pending

Problem

  • Where: macOS Python 3.12 safety checks on main
    • a. Run tests/test_skill_dispatch.py
    • b. Halt the legacy runner after its owned fake worker starts
    • c. Remove the test's temporary directory during teardown
  • Who: Package contributors and CI
  • What happened: The halt and preservation assertions passed, but teardown only sent TERM to the fake worker and returned. Its asynchronous shutdown could still write while TemporaryDirectory removed the folder, causing Directory not empty.
  • Evidence: Failed main safety run.

Solution

  • Wait for the owned fixture worker to exit before directory cleanup. Reap it when it is a child; treat an exited orphan zombie as unable to write.
  • Avoid sending another TERM when its handler already started. Bound shutdown waits and escalation to the recorded worker PID, checking its unique fixture command identity before signalling.
  • Add a controlled delayed shutdown and a teardown observer that proves the worker finished and is no longer running before filesystem cleanup.

Acceptance criteria

  • A delayed shutdown finishes before the temporary directory is removed.
    ↳ The existing legacy launcher test fails against the old cleanup with fixture directory cleanup raced the owned worker shutdown; the fixed fixture passes.
  • Production halt, unrelated process and preserved evidence assertions remain intact.
    ↳ All eight real dispatch/setup tests pass; the unrelated worker remains alive through the halt assertions, and lock/approval bytes remain unchanged.
  • Teardown waits are bounded and signals stay scoped to the owned fixture worker.
    ↳ Only its recorded PID with matching unique fixture command is signalled; wait/reap precedes TemporaryDirectory cleanup.

Iteration history

Lane Done Time Details
🔨 builder ✅ Oct 13 PDT controlled old-cleanup red witness; fixed dispatch8 green

Risk

🟢 Low · one test fixture changed. The production runner, readiness gates and runtime fixtures are untouched. Real process shutdown is observed on the existing Linux/macOS safety platforms; no paid host or live board was run.

- Reap or observe owned worker exit before deleting its temporary directory.

- Avoid duplicate TERM and bound own-PID escalation with fixture identity checks.

- Controlled old-cleanup witness fails; dispatch8 and all57 safety suites pass.
@EricTechPro
EricTechPro marked this pull request as ready for review October 14, 2026 06:27
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@EricTechPro
EricTechPro merged commit 52a6b4c into main Oct 14, 2026
13 checks passed
@EricTechPro
EricTechPro deleted the codex/dispatch-cleanup branch October 14, 2026 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant