Skip to content

Feat/r13 GitHub branch writer r1 - #83

Open
nulleimy wants to merge 8 commits into
mainfrom
feat/r13-github-branch-writer-r1
Open

nulleimy wants to merge 8 commits into
mainfrom
feat/r13-github-branch-writer-r1

Conversation

@nulleimy

Copy link
Copy Markdown

Change rationale

Affected scope

Evidence

Risk

Rollback

Governance approvals

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a9340c243

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +487 to +491
update = writer.update_ref(
repository,
branch=branch,
new_sha=new_head_sha,
force=False,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use an actual expected-head compare-and-swap

Setting force=False only requires the update to be fast-forward; it does not atomically require the branch to still equal head_sha. If another actor force-resets the PR branch to an ancestor after the final get_ref check but before this PATCH, GitHub accepts new_head_sha as a fast-forward and this stale authorized write silently reverses that concurrent reset. Use an API operation with an atomic expected-head predicate, such as createCommitOnBranch(expectedHeadOid: ...), rather than treating a non-force ref update as compare-and-swap.

Useful? React with 👍 / 👎.

Comment on lines +493 to +496
except Exception as exc:
raise GitHubBranchWriteError(
"GitHub branch compare-and-swap update failed; expected HEAD may be stale"
) from exc

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Classify uncertain ref-update failures as ambiguous

If the PATCH reaches GitHub and updates the ref but the response is lost, times out, or contains invalid JSON, update_ref raises even though the mutation may already have occurred. Wrapping every such exception as an ordinary GitHubBranchWriteError incorrectly tells callers this was a failed compare-and-swap instead of an indeterminate write, bypassing the reconciliation behavior represented by GitHubBranchWriteAmbiguousError. Transport or response-processing failures after issuing the mutation must be reported as ambiguous.

Useful? React with 👍 / 👎.

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.

2 participants