Skip to content

Fix flaky plugin hook env test#20088

Merged
abhinav-oai merged 2 commits intomainfrom
abhinav/fix-plugin-hook-test-flake
Apr 28, 2026
Merged

Fix flaky plugin hook env test#20088
abhinav-oai merged 2 commits intomainfrom
abhinav/fix-plugin-hook-test-flake

Conversation

@abhinav-oai
Copy link
Copy Markdown
Collaborator

The test was flaky because it was checking the right thing in a roundabout way.

What it wanted to prove:

  • plugin hooks receive the right environment variables.

What it actually did:

  1. Run a plugin hook.
  2. Have that hook write those env vars into a temporary env.json file.
  3. After the hook finished, read env.json back from disk.

On Windows, that last file was sometimes not there when the test tried to read it, so the test failed with read env log: file not found. The hook system itself was not what the test failure was directly proving; the test was failing on the extra filesystem side effect it introduced.

The fix is to stop using a temp file as the proof mechanism. The hook now prints the env values in its normal structured output, and the test asserts on the output that the hook engine already captures. So we still verify the same behavior, but without depending on a separate file being created and read back correctly on Windows.

@abhinav-oai abhinav-oai changed the title [codex] Fix flaky plugin hook env test Fix flaky plugin hook env test Apr 28, 2026
@abhinav-oai abhinav-oai marked this pull request as ready for review April 28, 2026 22:10
@abhinav-oai abhinav-oai force-pushed the abhinav/fix-plugin-hook-test-flake branch from bd7f717 to 1b292ff Compare April 28, 2026 22:16
@abhinav-oai abhinav-oai enabled auto-merge (squash) April 28, 2026 22:44
@abhinav-oai abhinav-oai merged commit 3291463 into main Apr 28, 2026
25 checks passed
@abhinav-oai abhinav-oai deleted the abhinav/fix-plugin-hook-test-flake branch April 28, 2026 22:45
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants