Skip to content

fix(core): release an already detached missing worktree registration - #3426

Merged
integry merged 2 commits into
mainfrom
fix/release-detached-missing-worktree-registration
Nov 9, 2026
Merged

integry merged 2 commits into
mainfrom
fix/release-detached-missing-worktree-registration

Conversation

@integry

@integry integry commented Nov 8, 2026

Copy link
Copy Markdown
Owner

Why

Releasing the operator-held follow-up handoff on #3423 (POST /api/admin/followup-handoffs/integry/propr/3423/release) answered {"released":false,"reason":"worktree_holds_unpublished_work"}. The held worktree directory had been deleted by the host sweep, the clone's local labels-fix had zero commits ahead of origin/labels-fix, and the worktree's Git registration already had a detached HEAD at the PR head. Nothing was unpublished.

releaseBranchFromSettledWorktree handles a missing directory through detachMissingWorktreeRegistration, which returned false when the registration's HEAD was not ref: refs/heads/<branch>. A HEAD that is already a bare commit means the branch is free, which is all the release needs; treating it as a refusal stranded the hold, and with it every later /fix on the PR (predecessor_awaiting_operator).

What

  • detachMissingWorktreeRegistration returns true for a registration whose HEAD is already a detached commit. Everything else is unchanged: a registration still on another branch is left alone, an unknown path is left alone.
  • Regression test in test/settledWorktreeRelease.test.ts: releasing the same missing registration twice succeeds both times.

worktreeLifecycle.integration, followupHandoffOperatorSerialization and followupHandoffRestartQualification still pass.

🤖 Generated with Claude Code

Operator release of a held follow-up handoff asks the settled-worktree
release to free the branch. When the worktree directory is gone, only its
Git registration is consulted; a registration whose HEAD is already a
detached commit (failure cleanup or an earlier release did that) was
reported as "not settled", and the release was refused with
worktree_holds_unpublished_work although the branch was free and nothing
was unpublished. #3423 sat behind such a hold for a day.

The branch is free in that case, which is all a release needs: report it
as released.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@integry integry added the AI label Nov 8, 2026
@integry

integry commented Nov 8, 2026

Copy link
Copy Markdown
Owner Author

/review

@propr-dev

propr-dev Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ AI Code Review Complete requested by @integry

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

🔍 AI Code Review — codex:gpt-6-astra

Overall Evaluation

This focused change fixes the stranded operator release by treating an already detached missing-worktree registration as successfully released. Ready to merge within scope, conditional on the remaining checks passing.

✅ Preserves retained work — The new success path leaves the registration, HEAD, index, and branch untouched; path matching and symbolic-HEAD refusal remain intact.

✅ Tests repeat release — The regression assertion exercises two consecutive releases, followed by checks that the registration survives and the branch can be checked out again.

✅ Retains release verification — The operator still independently checks branch registrations before marking the handoff released.

Review was based on the supplied diff and context; no commands or tests were run. Current checks show no failures and five pending.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

No suggestions.

Score

The implementation directly addresses the reported failure with a minimal change and targeted regression coverage. The supplied caller protections remain intact; final CI completion is pending.

Score: 9/10


🤖 Review Details

  • Model: GPT-6 Astra
  • Time: 18s
  • Tokens: 31,020 (30,716 in / 304 out)
  • Cost: $0.21

View Task


💡 Next step: Comment /fix to address every F# merge blocker, /fix all for every pending blocker and suggestion, or name records explicitly, as in /fix F3 S5.
F# and S# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. S# suggestions stay optional: they are implemented only when you name them or request /fix all, and they never relax a merge blocker.

🤖 Review by ProPR

@propr-dev

propr-dev Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

CI failed: Full Test Suite Shard 2/4

Please investigate and fix this CI failure.

  • Check: Full Test Suite Shard 2/4
  • Result: failure
  • Commit: 54ea16112303 (54ea16112303dc59adc43edd434b07a269a0cc0d)
  • Details: View CI failure

Failure evidence

.github:11
Process completed with exit code 1.

.github:29641
Process completed with exit code 1.

.github:2
Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@11d5960. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

@propr-dev

propr-dev Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

✅ Applied the requested follow-up changes in commit b253a0f

Summary of Changes

The shard 2/4 failure was one test still checking the old behaviour, not a bug in the fix.

Cause: test/followupHandoffWorktreeRestore.integration.test.ts, case 4 ("releasing a deleted worktree reports nothing to release instead of throwing"), deletes a worktree after detaching its HEAD. It then expected releaseSettledWorktree to return false. That false is exactly what this PR changes: when the operator release gets false, it answers worktree_holds_unpublished_work, which is what stranded #3423. With the fix the call returns true, so the old assertion failed (true !== false).

Change: I updated that test to the new behaviour. An already-detached missing registration now releases (true), the branch still shows no registrations, and after git worktree prune the call still returns false, because a path Git has no registration for is still left alone. I also renamed the test to say what it now checks. The production code is unchanged.

Verification: I ran these suites locally with scripts/run-test-suite.mjs, after rebuilding packages/core, and all pass:

  • followupHandoffWorktreeRestore.integration (the one that failed in CI)
  • settledWorktreeRelease, worktreeLifecycle.integration, followupHandoffOperatorSerialization, followupHandoffRestartQualification
  • four other suites that detach a worktree and call the release: followupHandoffReviewBlockers, followupHandoffRecovery, followupHandoffFindings, followupHandoffCancelledClaims

I didn't run the rest of shard 2/4 locally; the CI log showed this as the only failing test.

No preview, since nothing here is visible to a user.


🤖 Implementation Details

  • Model: Claude Opus 5.5 (medium)
  • Requested By: @propr-dev[bot]
  • Time: 7m 11s
  • Tokens: 1,254,010 (1,248,879 in / 5,131 out)
  • Cost: $0.59

Undo Changes • View Task Execution


💡 ProPR Slash Commands
Command Description Example
/merge Merge target branch into this PR and resolve conflicts /merge
/review Request an AI code review /review or /review claude-sonnet
/fix Address review blockers, or blockers and suggestions with /fix all /fix, /fix all, or /fix F3 S5
/switch Change the AI model for this PR /switch claude-opus
/use Override the model for a single follow-up run /use claude-sonnet
/ultrafix Loop review→fix cycles until score goal is met /ultrafix or /ultrafix goal=8 max=10

🤖 Generated by ProPR
Processing comment ID: 6729056080✓

…ehaviour, not a bug in the fix.

The shard 2/4 failure was one test still checking the old behaviour, not a bug in the fix.

**Cause:** `test/followupHandoffWorktreeRestore.integration.test.ts`, case 4 ("releasing a deleted worktree reports nothing to release instead of throwing"), deletes a worktree after detaching its HEAD. It then expected `releaseSettledWorktree` to return `false`. That `false` is exactly what this PR changes: when the operator release gets `false`, it answers `worktree_holds_unpublished_work`, which is what stranded #3423. With the fix the call returns `true`, so the old assertion failed (`true !== false`).

**Change:** I updated that test to the new behaviour. An already-detached missing registration now releases (`true`), the branch still shows no registrations, and after `git worktree prune` the call still returns `false`, because a path Git has no registration for is still left alone. I also renamed the test to say what it now checks. The production code is unchanged.

**Verification:** I ran these suites locally with `scripts/run-test-suite.mjs`, after rebuilding `packages/core`, and all pass:
- `followupHandoffWorktreeRestore.integration` (the one that failed in CI)
- `settledWorktreeRelease`, `worktreeLifecycle.integration`, `followupHandoffOperatorSerialization`, `followupHandoffRestartQualification`
- four other suites that detach a worktree and call the release: `followupHandoffReviewBlockers`, `followupHandoffRecovery`, `followupHandoffFindings`, `followupHandoffCancelledClaims`

I didn't run the rest of shard 2/4 locally; the CI log showed this as the only failing test.

No preview, since nothing here is visible to a user.

PR: #3426
Comment by: @propr-dev[bot] (ID: 6729056080)
Model: Claude Opus 5.5
@integry
integry merged commit a125b9c into main Nov 9, 2026
42 checks passed
@integry
integry deleted the fix/release-detached-missing-worktree-registration branch November 9, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants