Skip to content

t/lib-httpd: fix apply-one-time-script race under concurrent requests - #156

Open
friel-openai wants to merge 2 commits into
codexfrom
af/codex/http-one-time-script
Open

friel-openai wants to merge 2 commits into
codexfrom
af/codex/http-one-time-script

Conversation

@friel-openai

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

Copy link
Copy Markdown

Concurrent requests to the one_time_script test CGI can return an empty response after another request removes one-time-script. This causes intermittent HTTP 500 failures while a partial-clone fetch obtains a missing promisor delta base.

Backport upstream 59454646906c, retaining its author and exact patch. apply-one-time-script.sh now uses response files named for each process. A request serves a rewritten response only if rewriting changes its response and it successfully removes one-time-script; a losing request serves its original response. The upstream t5567 regression uses FIFOs to pause a passthrough request while a modifying request completes. Register it in Meson as well as Make.

The observed failure is macOS Meson t5616.50 while validating #155. Apache recorded ./one-time-script: No such file or directory, a second failed removal, and an empty CGI response. The failing fetch was still in index-pack while requesting a missing promisor base; #155 changes OID propagation after do_fetch_pack_v2() returns. The helper is byte-identical in #155, its public-master base and codex, and its deterministic regression fails on the unchanged base. This is an existing fixture race, not a fetch-pack bookkeeping regression.

The shared response files and removal after output originated in 3374292e5556 and were retained by the later Perl and shell conversions. Existing HTTP tests relied on the scheduler to overlap these requests. t5567 forces that overlap and checks complete, separate responses with empty stderr, preventing a passing run from hiding the same race.

Validation: the new regression fails before the helper correction with the same missing-script and failed-removal errors, then passes after it. All 178 focused tests pass across t5567, HTTP-enabled t5616, t5703, t5702 and t5537; the DEVELOPER=1 build and git diff --check pass. The stable patch ID matches upstream.

This review-only topic starts from public master at b8242b093d9e941a34460d715e3ce616a34ac3fe and targets generated codex. A separate commit retains the three exact reviewed CI workflow blobs accepted by the controller. No Git production code or repository format changes. No release or controller workflow is added to this topic.

A CI-only combined candidate tests the same backport on codex at 9fe64f46bdef176eabbc4e7f1f15c8e4f8dbc325, including its existing HTTP authentication corrections. Candidate ebacd2fa48a2e66e8831a78283aad471c4409315 excludes release and controller workflows. This leaves the review topic's ancestry intact. Combined CI completed successfully: 45 jobs passed, two expected jobs were skipped, and none failed. The initial Fedora package-download failure passed on a focused retry of that job; no source change or successful-job rerun was needed. This validates the combined candidate; human review and normal controller staging remain required.

Standalone source CI has the existing WebDAV and dumb-HTTP authentication failures: t5540.18 and t5550.15, .16, and .20. Logs for the SHA-256, breaking-changes, leaks, ASan/UBSan and Meson jobs confirm the same four failures. Standalone checks settled with 87 successes, seven expected skips and those five failed jobs. Those endpoints do not use apply-one-time-script.sh, and their source/tests are unchanged from this topic's base. The existing fixes in #126 and #142 are in the combined codex candidate but absent from the standalone public-master ancestry. The new t5567 regression and t5616 pass in the failed jobs. The standalone matrix is not fully green.

-frielbot

Codex Task: codex://threads/01a1606c-756a-7150-8e8f-f8d37a933158

mmontalbo and others added 2 commits October 21, 2026 21:50
apply-one-time-script.sh is a test helper that executes a
"one-time-script" responsible for modifying the response normally
returned by git-http-backend. apply-one-time-script.sh should run
"one-time-script" once and return a modified response once. However,
sometimes a race between multiple concurrent requests causes
apply-one-time-script.sh to misbehave and return multiple modified
responses or an empty response that results in:

  fatal: ... The requested URL returned error: 500
  fatal: could not fetch <oid> from promisor remote

This can be seen in the flaky failure of t5616.47 on the macOS CI
runners.

Fix the logic that checks if "one-time-script" has returned its modified
response by chaining "rm one-time-script" with its execution. This
ensures a racing script does not also have the opportunity to execute
"one-time-script".

Add t/t5567-one-time-script.sh to verify the race is fixed. Implement a
stub "git-http-backend" that intentionally invokes a concurrent request,
and check that only one modified response is returned without error.

Signed-off-by: Michael Montalbo <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
(cherry picked from commit 5945464)
Signed-off-by: Frielbot <[email protected]>
@friel-openai friel-openai added fix-it-friel CI repairs owned by Friel flake Fixes flaky or unrelated failing tests git Changes to the Git project labels Oct 21, 2026 — with ChatGPT Codex Connector
@friel-openai
friel-openai marked this pull request as ready for review October 21, 2026 22:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 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-21T22:49:20.638146Z bccb440 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.

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.

2 participants