Skip to content

push: stop before object transfer when required negotiation fails - #141

Open
friel-openai wants to merge 5 commits into
codexfrom
af/codex/required-push-negotiation
Open

friel-openai wants to merge 5 commits into
codexfrom
af/codex/required-push-negotiation

Conversation

@friel-openai

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

Copy link
Copy Markdown

A failed push negotiation currently produces a warning and continues to pack-objects. Add push.negotiate=required so negotiation failures stop the push before ref update commands, pack construction, or upload. false remains the default and true remains best effort; command-line configuration can explicitly override required.

The first commit fixes fetch --negotiate-only when no commits are shared: after a complete NAK-only exchange, stop once there are no more haves instead of sending an empty extra request. Preserve the first request containing only explicit negotiation includes. Only server ACKs identify common commits; a valid empty result succeeds and can still produce a large push pack.

Required mode also rejects transports that bypass send_pack(). Both WebDAV entry points stop before object transfer, including mixed deletion/update batches. Remote-helper export stops before fast-export. A helper using push must advertise push-negotiate-required, promising to enforce the inherited configuration. remote-curl advertises that capability and either uses native negotiation or rejects WebDAV. Successful helper connect takeover retains native negotiation. Supported transports may skip negotiation when there are no negotiation tips.

git version --build-options advertises feature: push-negotiate-required so callers can detect enforcement across transports without inferring support from a version number. The marker does not promise server compatibility.

The topic starts at the admitted tb/codex/explicit-haves source prerequisite. The four runtime/test commits are unchanged by the ancestry correction. A separate CI preparation commit retains the exact workflow versions already published in codex and permitted by ci_workflow_pins_are_reviewed(), so this source branch satisfies the full-commit-SHA action policy.

Validation:

  • Developer build, shell test lint, and whitespace checks passed.
  • 174 tests passed on the corrected source across t5549, t5556, t5702, t5801, and t5802, including smart HTTP and unauthenticated WebDAV.
  • A local candidate combining this topic with the existing fixes from PR142 and PR143 passed 304 tests across those suites plus t5540 and t0610. It changes no files beyond the original runtime patches and the independent fixes. This Linux validation does not replace native Windows checks or exact staging CI.
  • Earlier validation on integrated codex passed 71 SHA-256 tests and 61 reftable tests, with unsupported DAV cases skipped.
  • Regressions failed before their fixes. Tests cover HTTP 400/500, protocol v0/v1, missing wait-for-done, malformed acknowledgments, cancellation, common/empty results, explicit overrides, and unsupported helper/DAV transfers. Failure assertions check that packing/export/upload never starts and destination refs remain unchanged.
  • The normal propose-plan --no-push diagnostic accepted the corrected ancestry and effective writer approval. No plan or release was published by that diagnostic.

Current-source CI completed with 39 successful jobs, six failures and two skips. All Windows and macOS variants passed. Five failed jobs report the existing t5540.18 and t5550.15/.16/.20 URL-credential failures; Debian12 reports t5559.15 HTTP2 half-auth clone failure and its dependent test16. ASan and leaks report those HTTP tests without a sanitizer finding. The ordinary HTTP implementation and failing fetch fixtures are unchanged from this topic’s prerequisite. These failures remain separate from this change; the complete CI matrix is not green.

The independent fixes address WebDAV authentication, t5540.18, and concurrent reftable writers, t0610.48. The source branches and reviews remain separate. This topic PR is review-only; normal plan admission and successful full staging CI are still required before publication.

Codex Task: codex://threads/01a13b71-995e-71f3-86ec-81ad7df43f1b

-frielbot

@friel-openai friel-openai added the git Changes to the Git project label Oct 14, 2026
@friel-openai
friel-openai force-pushed the af/codex/required-push-negotiation branch from 6097c6d to a1e201c Compare October 14, 2026 17:50
@friel-openai
friel-openai marked this pull request as ready for review October 14, 2026 18:07
@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-14T18:13:26.938777Z a1e201c 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.

@friel-openai friel-openai changed the title send-pack: stop before packing when required negotiation fails push: stop before object transfer when required negotiation fails Oct 14, 2026
When no commits are shared, negotiate_using_fetch() receives a valid NAK
for all available haves, then sends another request with no haves. A
server can answer that empty request with a packfile section, which the
client rejects while expecting acknowledgments.

Stop before sending another request once the negotiator is exhausted.
Keep the first request even when add_haves() reports zero, because it
may contain explicit negotiation-include commits. Only server ACKs are
returned as common commits; a completed NAK-only exchange returns an
empty set successfully.

Cover both negotiation algorithms, a first request containing only
included commits, and HTTP response cleanup. Keep total_rounds equal
to the number of requests sent and balance the round trace regions.

Signed-off-by: Friel <[email protected]>
A failed push negotiation currently emits a warning and proceeds to
construct a pack. Users who rely on negotiation to avoid an expensive
pack have no way to require it to succeed.

Accept push.negotiate=required and abort when the negotiate-only fetch
fails, before sending ref update commands or starting pack-objects.
Keep false as the default and true as best effort, including existing
boolean spellings and command-line configuration overrides.

Successful negotiation can return no common commits. It does not impose
a pack-size limit. Unsupported negotiation, transport errors and an
interrupted fetch remain failures. Document these distinctions and test
that failures start no pack-objects process and leave the target ref
unchanged, while common and no-common pushes succeed.

Signed-off-by: Friel <[email protected]>
Exercise HTTP 400 and 500 responses during the negotiation POST, with
successful receive-pack discovery. Best-effort negotiation continues,
while required negotiation aborts before pack-objects and leaves the
pushed ref absent.

Also cover required negotiation success, an unsupported wait-for-done
capability, and a malformed acknowledgments section. Reuse the existing
one-time response modifier so the fixtures need no new server handler.

Signed-off-by: Friel <[email protected]>
WebDAV and remote-helper push/export can bypass send_pack(), so checking
push.negotiate there alone can still allow an unsupported transport to
upload objects. Share the configuration parser and reject required mode
before entering http-push or starting fast-export. Check direct http-push
before HTTP initialization as well, including mixed deletion/update
batches that could otherwise partially update refs.

Require push helpers to advertise push-negotiate-required before sending
them updates. remote-curl advertises the capability because it now either
uses send-pack's negotiation or rejects WebDAV. Successful helper connect
takeover continues through native negotiation. Boolean settings retain
their existing behavior.

Advertise feature: push-negotiate-required in version --build-options so
callers can distinguish complete enforcement from a version that ignores
the configuration on some transports. Document the helper contract and
cover unsupported helpers, connect fallback/takeover, export, and WebDAV
with small generic regressions.

Signed-off-by: Friel <[email protected]>
@friel-openai
friel-openai force-pushed the af/codex/required-push-negotiation branch from 27c328e to 530474a Compare October 16, 2026 05:10
The explicit-haves source prerequisite predates the CI updates already
published in codex. Its unpinned actions are rejected before checkout by
the repository's full-commit-SHA policy.

Use the exact check-style, check-whitespace, and main workflow versions
already accepted by ci_workflow_pins_are_reviewed(). This also retains the
reviewed Debian image and Windows SDK setup. Keep workflow permissions
and the controller's admission policy unchanged.

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

git Changes to the Git project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants