Skip to content

Derive release merge wait from CI duration and refresh a safe main advance once - #172

Merged
unbraind merged 2 commits into
mainfrom
fix/release-merge-wait-fits-ci
Oct 23, 2026
Merged

unbraind merged 2 commits into
mainfrom
fix/release-merge-wait-fits-ci

Conversation

@unbraind

@unbraind unbraind commented Oct 23, 2026 •

Copy link
Copy Markdown
Owner

Daily Release PR #171 exhausted the fixed 30-minute merge wait while required tests were still running. Earlier main advances also aborted otherwise safe release preparation or left the release PR BEHIND.

The job now measures successful test (22) and test (26) jobs from the last 20 successful main push CI runs. It uses nearest-rank p95 plus the larger of 15 minutes or 25%, bounded to 60–120 minutes under an explicit 360-minute job timeout, and records the derivation in the log and job summary. A read-only execution of the workflow measurement step found 40 samples: p95 1,859 seconds plus 900 seconds margin, yielding the 60-minute floor.

A safe main advance during preparation or waiting rebases the release branch once and restarts the full measured wait. A published branch update uses the previous head as its push lease, and the merge API receives the new head SHA. Every intervening commit is checked for package/lock release-version changes or changes to the changelog, manifest or release notes, including changes later reverted. Metadata drift, conflicts, non-ancestor main and a second advance abort.

Validation:

  • npm run release:check and bun run release:check, with isolated HOME and git configuration: 1,045 passed each, zero failures or skips. Exact 100/100/100/100 coverage across 19 authored modules: 11,640 lines/statements, 337 functions and 3,964 branches. Both gates also passed lint, docstrings, zero duplication, privacy, audit, packing, changelog and publish-attestation checks. Independent candidate snapshots produced the same package hash.
  • node --test test/release-merge-policy.test.ts test/daily-release-plan.test.ts test/release-approval.test.ts test/release-workflow.test.ts: 60/60, also executed through the linked pm test runner. The tests execute the workflow's own shell and use real temporary git histories and a real non-git pm tracker.
  • bun test --timeout 600000 test/release-merge-policy.test.ts: 24/24 new regressions.
  • Behavioral revert controls: fixed 30-minute wait failed 2 regressions; bypassed metadata guard failed 8; restored abort-on-main-advance failed 3; removed deadline restart failed 1. All controls were restored before the passing gates.
  • Strict tracked-project health passed with isolated identity. Post-commit privacy audited 6,683 objects with approved identities and no secret or host-path findings.

The new workflow regressions run in the existing CI release gate on Node 22 and 26. CI run 39992427193 passed 4/4 matrix jobs, including 2/2 required checks, on da42c756b9aa1615e26e69527c2f4eea09b7c8e1. The current check rollup is 8 success, 2 skipped and 1 neutral, with no failures or pending checks. Skipped, neutral and unavailable automated reviews do not establish review approval; review remains pending. After merge, the orchestrator dispatches Daily Release.

PM item: pm-github-release-merge-wait (candidate evidence). The item remains in progress and its claim is released for orchestrator verification.

Summary by Sourcery

Make Daily Release waits adaptive to CI performance and safely recover once from eligible main-branch advances.

New Features:

  • Derive the Daily Release merge wait from recent successful CI durations and record the calculation in workflow logs and summaries.
  • Allow one safe main-branch advance to refresh the release branch and restart protected checks and the measured merge wait.

Bug Fixes:

  • Prevent release preparation from timing out while required CI is still running.
  • Prevent safe main advances from leaving the release PR behind or aborting unnecessarily, while failing closed on metadata drift, conflicts, non-ancestor updates, and repeated advances.

Enhancements:

  • Add a 360-minute workflow timeout and enforce head-specific branch updates and merge verification after a refresh.
  • Document the adaptive release wait and main-advance safety policy.

Documentation:

  • Document the adaptive merge wait and one-time safe main refresh behavior for Daily Release.

Tests:

  • Add comprehensive policy and workflow regression coverage using real timing data, shell execution, and temporary Git histories.

Chores:

  • Record the release merge-wait work in project-management history and changelog.

Summary by cubic

Fixes the Daily Release workflow's fixed 30-minute merge wait, which expired while required tests were still running on PR #171. The wait is now derived from measured CI durations, and a safe main advance may refresh the release branch once.

  • The wait is the nearest-rank p95 of successful test (22) and test (26) job durations from the last 20 successful main push runs, plus max(15 min, 25%), bounded to 60–120 minutes under the job's 360-minute timeout; the derivation is logged and written to the job summary.
  • A main advance during preparation or waiting rebases the release branch once and restarts the full measured wait, using the previous head as a push lease and passing the new head SHA to the merge API.
  • Conflicts, release metadata drift (including changes later reverted), non-ancestor main, and a second advance abort; dependency-only changes are eligible.

Validation: npm run release:check and bun run release:check each passed 1,045 tests with exact 100/100/100/100 coverage across 19 modules; the workflow-focused pm test passed 60/60 and the new regressions passed 24/24 under Bun. Four behavioral revert controls failed as expected, and both package dry runs produced the same package hash.

Written for commit 9b9a623. Summary will update on new commits.

View guided diff Turn on auto-fix

@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Sorry @unbraind, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 6 hours and 16 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@coderabbitai

coderabbitai Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 2521df45-6e94-4a30-923c-d772eddee6a2
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Oct 23, 2026

Copy link
Copy Markdown

Reviewer's Guide

The release workflow now derives a conservative merge wait from recent Node 22/26 CI durations and can safely rebase and revalidate a release branch once when main advances, with strict metadata guards, head-specific publishing, deadline restart, and extensive real-git/workflow regression coverage.

Sequence diagram for measured release merge and safe main refresh

sequenceDiagram
    participant Workflow
    participant GitHubAPI
    participant Policy
    participant Git
    participant ReleasePR

    Workflow->>GitHubAPI: gh api successful main push runs
    GitHubAPI-->>Workflow: test (22)/(26) job timings
    Workflow->>Policy: deriveReleaseMergeWait(jobs)
    Policy-->>Workflow: wait_seconds and timing summary
    Workflow->>Git: refresh_release_base
    Git->>Policy: assertSafeReleaseAdvance(base, main)
    Policy-->>Git: safe advance or error
    alt main advanced safely
        Git->>Git: git rebase current_main_sha
        Git->>GitHubAPI: git push --force-with-lease
        Git->>ReleasePR: restart measured merge wait
    else no main advance
        Workflow->>ReleasePR: poll required checks and merge
    end
    ReleasePR-->>Workflow: merged head SHA
    Workflow->>Workflow: verify merged release
Loading

Flow diagram for release merge wait derivation

flowchart TD
    A[Successful main push CI runs] --> B["Collect test (22) and test (26) durations"]
    B --> C[Compute nearest-rank p95]
    C --> D[Add max of 900 seconds or 25% margin]
    D --> E[Bound wait to 60–120 minutes]
    E --> F[Record samples p95 margin and bounds]
    F --> G[Use measured wait for release merge]
    G --> H{Safe main advance?}
    H -- No --> I[Continue polling or merge]
    H -- Yes --> J[Rebase and push with head-specific lease]
    J --> K[Restart full measured wait]
    K --> L[Require checks on new head]
Loading

File-Level Changes

Change Details Files
Derive the release merge wait from recent successful CI durations and expose the calculation.
  • Query the last 20 successful main push CI runs and retain successful test (22)/(26) timings.
  • Compute nearest-rank p95 plus a max(15-minute, 25%) margin, bounded to 60–120 minutes.
  • Persist the measured wait between workflow steps and report samples, p95, margin, bounds, and fallback behavior in logs and the job summary.
  • Set the release job timeout to 360 minutes.
.github/workflows/release.yml
scripts/release-merge-policy.ts
test/release-merge-policy.test.ts
README.md
Allow one safe refresh of the release branch when main advances during preparation or merge waiting.
  • Check intervening commits for release metadata or package/lock version changes, including changes subsequently reverted.
  • Require main to be an ancestor, abort on metadata drift, conflicts, non-ancestor history, or a second advance.
  • Rebase and force-push the release branch with a head-specific lease, update the merge SHA, and restart the full measured wait.
  • Treat stale BEHIND status separately from a newly observed main advance.
.github/workflows/release.yml
scripts/release-merge-policy.ts
test/release-merge-policy.test.ts
README.md
Add comprehensive policy, workflow, and project-management coverage for the release behavior.
  • Exercise timing derivation, API fallbacks, summary output, repository safety checks, metadata detection, refresh behavior, lease handling, deadline restart, and fail-closed paths using temporary git repositories.
  • Record the PM item and release-note entry documenting the change.
test/release-merge-policy.test.ts
.agents/pm/history/pm-github-release-merge-wait.jsonl
.agents/pm/issues/pm-github-release-merge-wait.toon
CHANGELOG.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@unbraind unbraind left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Orchestrator review (built-in Claude review agent, verified by the orchestrator; bots are not waited for since 2026-10-22):

Pre-merge review (codex gpt-6.1-sol read-only review agent; merged by the orchestrator's pipeline after a MERGE verdict and a private-data scan of the added lines).

VERDICT: MERGE
FINDINGS:

  • none
    SUMMARY: The PR derives a bounded merge wait from CI durations and permits one guarded release-branch refresh with a restarted deadline. Tests cover timing fallbacks, reverted metadata changes, conflicts, repeated advances, and refreshed merge SHAs; I reviewed but did not execute them.

@greptile-apps greptile-apps 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.

Your trial has ended. Reactivate Greptile to resume code reviews.

@unbraind
unbraind merged commit 7a1d6e8 into main Oct 23, 2026
11 checks passed
@unbraind
unbraind deleted the fix/release-merge-wait-fits-ci branch October 23, 2026 18:18
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