Skip to content

mingw: let reftable retry reads of tables pending deletion - #143

Open
friel-openai wants to merge 2 commits into
codexfrom
af/codex/reftable-delete-pending
Open

friel-openai wants to merge 2 commits into
codexfrom
af/codex/reftable-delete-pending

Conversation

@friel-openai

@friel-openai friel-openai commented Oct 14, 2026 •

Copy link
Copy Markdown

On Windows, a reftable deleted by compaction can remain in STATUS_DELETE_PENDING while a handle is open. CreateFileW() reports ERROR_ACCESS_DENIED, which becomes EACCES in mingw_open_existing(). Reftable then aborts the read instead of rereading tables.list after compaction.

Report ENOENT when CreateFileW() fails with the specific native status STATUS_DELETE_PENDING. This lets reftable's existing missing-table retry work. Other permission errors and the existing O_CREAT | O_EXCL handling are unchanged. Add deterministic tests that retain a descriptor across deletion and require REFTABLE_NOT_EXIST_ERROR, using both default and legacy Windows deletion.

The source branch starts from verified public master (b8242b093d9e), rather than a generated codex tip. The fix and regression patch is unchanged by this ancestry correction (git range-diff reports equality). A separate commit retains the three exact CI workflow blobs accepted by the controller. The review target remains codex; this is a review-only topic PR.

The investigation started with t0610.48 failing to resolve HEAD while validating #141. That PR changes send-pack/fetch-pack negotiation and unrelated tests; it does not change reftable, update-ref, or Windows file operations. The failing command performs a local reference update and does not call the changed negotiation code.

Before the fix, deterministic Windows tests reproduced STATUS_DELETE_PENDING, EACCES, and a failed reftable reload during compaction. With the fix, the permanent default/legacy deletion tests pass. A separate temporary test also confirmed that POSIX deletion exposes the same native status before the deleting handle closes, and that the corrected open reports ENOENT. The original failing job did not record its native error, so its connection to this bug remains an inference. Temporary diagnostics and compaction callbacks are excluded from this PR.

The same base tree passed Windows CI on October 5. Its concurrent-writer test did not deterministically retain a deleted table in the pending state. mingw_open_existing() and its access-denied handling originated in a270cb1540, authored by Patrick Steinhardt. The new regression covers that missing state without relying on scheduling.

Validation: Windows Make and Meson CI both passed t0610 on the previous source, including the permanent default/legacy deletion regressions. The corrected source also passes Windows Make t0610, the Linux DEVELOPER build, all 93 local t0610 tests, 29 reftable stack unit tests, and git diff --check. Standalone topic CI remains prerequisite-dependent; the combined validation below is green.

Standalone source CI exposes existing HTTP failures that this Windows-only change does not affect: WebDAV and dumb-HTTP authentication, covered by #142 and its #126 prerequisite, and Debian 12 HTTP/2 authentication. The latter is already quarantined for affected curl versions by 003e6089a2, which is present in generated codex but absent from this topic's master ancestry. The same HTTP/2 failure reproduces on #141's unchanged prerequisite. These failures are not evidence of a reftable regression, and the standalone matrix is not fully green.

A CI-only combined candidate tests #141, #142, this PR, and their declared HTTP prerequisites, including the existing Debian quarantine and its gzip-authentication prerequisite. All 306 local tests across t0610, t5540, t5549, t5550, t5556, and t5702 pass on that composition with curl 8.23. Combined CI completed successfully: 45 jobs passed, two expected jobs were skipped, and none failed. The candidate leaves topic source ancestry intact and contains no release or controller workflow; it does not publish a Git release.

This changes client error handling only. Repository formats and the compaction protocol are unchanged, so clients can be updated independently. Reverting restores the read failure for pending deletion.

The tested candidate is 2006a35b7b78c1024e56f1658f7f1190f4b76a7c, assembled from public master b8242b093d9e941a34460d715e3ce616a34ac3fe with these exact sources: explicit-haves prerequisite a3eae730133768ea334731d2f48a80aff724fb5d, #141 772653bcb2b069505961b0b10604b0abf5a13062, HTTP redirect prerequisite b81ca645fdf0bf70789691823f9d7a4abbb05697, gzip authentication prerequisite 50f753ee38ef84de2fc22ca5cdde6698f0479f85, Debian HTTP/2 quarantine 003e6089a2598e2f37eb2326ab3947836ebb86c0, #142 0ad3526206bbe3c820e9aced7832c6d3e2c9e7ac, and #143 b1013cd9c374194c94a35889dca67d7ca57fdb7a. This validates the combined source; human review and normal controller staging remain required.

-frielbot

Codex Task: codex://threads/01a13b95-2df7-75a1-bc99-4266c08d7d89

@friel-openai friel-openai added git Changes to the Git project flake Fixes flaky or unrelated failing tests fix-it-friel CI repairs owned by Friel labels Oct 14, 2026
@friel-openai
friel-openai marked this pull request as ready for review October 14, 2026 20:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T20:32:26.377674Z caf74e2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

CreateFileW() returns ERROR_ACCESS_DENIED when a file is pending deletion.
With legacy deletion, another open descriptor can keep a deleted reftable
in this state. A reader that obtained tables.list before compaction then
fails with EACCES instead of rereading the updated list.

Map STATUS_DELETE_PENDING to ENOENT when opening an existing file. Keep
other access-denied errors unchanged, as well as the existing EEXIST
mapping for O_CREAT | O_EXCL. Resolve RtlGetLastNtStatus before CreateFileW
so loading the function cannot overwrite the status being inspected.

Add a regression that deletes a file while retaining an open descriptor
and checks that reftable reports REFTABLE_NOT_EXIST_ERROR. Exercise both
default and legacy deletion without timing-dependent concurrent processes.

Signed-off-by: Friel <[email protected]>
Starting the topic from master restores workflows with unpinned action references. Retain the exact workflow blobs accepted by ci_workflow_pins_are_reviewed() so the source branch keeps the CI configuration used to validate the fix.

Signed-off-by: Friel <[email protected]>

This branch has not been deployed

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

Labels

fix-it-friel CI repairs owned by Friel flake Fixes flaky or unrelated failing tests git Changes to the Git project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant