Skip to content

fix(cmd): repair-refs also removes a branch whose tip is not a commit - #869

Queued
ThomasK33 wants to merge 4 commits into
mainfrom
repair-refs-non-commit-branch-tips
Queued

ThomasK33 wants to merge 4 commits into
mainfrom
repair-refs-non-commit-branch-tips

Conversation

@ThomasK33

@ThomasK33 ThomasK33 commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Why

A repository with a branch at a blob, a tree or an annotated tag fails every hydration, so git reads of it answer 500. #860 stops new ones. A repository that an older build already wedged stays wedged, because repair-refs removed only refs that git can never lock.

What changed

  • openstorage repair-refs reads the object type of each refs/heads/ tip from the repository's packs in the blob store. It lists a branch at a blob, a tree or an annotated tag, and --yes deletes it with the same compare-and-swap as before.
  • A tip whose object the packs do not hold is listed under its own heading and never deleted. The command then exits with an error.
  • The runbook, cli.md and the cmd README describe both kinds of ref.

Scope

  • The ref store changes only. Objects and packs stay.
  • No new flag. A repository with a branch now needs the blob store URL (or --data-dir), because the tip types come from the packs. A repository with no branch still needs the database URL only.
  • A missing pack stays an operator task: the command reports the branch and does not guess.

Blast Radius

Operator command only. A run downloads the registered packs of the repository into a temporary directory under $TMPDIR and removes it when the command ends. A delete touches only the refs that the list shows, under the old guards: the default branch is kept, a lost compare-and-swap is reported and not retried, and a dry run changes nothing.

Verification

  • New tests on SQLite, S3-WAL and PostgreSQL plant a branch at a blob, a tree and an annotated tag in the ref store. An in-process node answers ls-remote and clone with 500, the dry run lists the three, --yes deletes them, and clone works after. Tags at a blob stay, a missing tip is kept, and a lost compare-and-swap keeps its ref.
  • Dogfood on a node built before fix(githttp): refuse a branch tip that is not a commit before the ref store takes it #860 with the new binary: three pushes leave three branches in the ref store, ls-remote and clone answer 500, the dry run lists them, --yes deletes them, and ls-remote and clone work.
  • A run that ends by an error, a canceled context, SIGINT or SIGTERM removes its temporary directory. Tests send the real signals to the test process, and a probe sends them to the real binary. A blob URL that cannot be opened is an error, not a panic.
  • All 19 mutants of the new logic and its cleanup make a test fail.
  • Lint, the docs gate and both fingerprint gates pass.

Generated with xum • Model: anthropic:claude-sonnet-5-5 • Thinking: xhigh

A branch at a blob, a tree or an annotated tag stops every hydration of its
repository. The command now reads the object type of each branch tip from the
repository's packs and lists such a branch. With --yes it deletes the branch
with the same compare-and-swap as before. A tip whose object the packs do not
hold is listed and kept.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-sonnet-5-5` • Thinking: `xhigh`_

Change-Id: I0dc87a68a183e78117ce2f9298acae9569d91bd8
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T04:30:10.847789Z 435d3c1 Manual request
🔒 Security Review ✅ Completed 2026-11-14T04:31:14.945072Z 435d3c1 Manual request
ℹ️ 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 53cc003709

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 53cc003709

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

SIGINT and SIGTERM now cancel the run, so the temporary directory of packs is
removed. The runbook names the right list-packs flag, and its list rules no
longer contradict each other. Tests pin the cleanup on every way a run ends.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-sonnet-5-5` • Thinking: `xhigh`_

Change-Id: I72f1c54e09a40be645f64abf5e57f4d8462db99b
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 088f57e578

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 088f57e578

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

blob.Open returns a typed nil with its error, so the deferred close called
Close on it and the command panicked. The command now keeps the store only
after a good open. The tests end a run by a canceled context, SIGINT and
SIGTERM, each within 10 seconds, and the runbook rule for the list reads right.

_Generated with [`xum`](https://github.com/coder/xum) • Model: `anthropic:claude-sonnet-5-5` • Thinking: `xhigh`_

Change-Id: I476b43bbdfd4ec572f9c6339a791434c64ad4e87
Signed-off-by: Thomas Kosiewski <tk@coder.com>
…t-branch-tips

Change-Id: I30900eb4023493334b2fa4b9dbc348001a94dae9
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33

Copy link
Copy Markdown
Member Author

@codex review

@ThomasK33

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 435d3c1f30

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

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 435d3c1f30

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@ThomasK33
ThomasK33 added this pull request to the merge queue Nov 14, 2026
Any commits made after this event will not be merged.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant