Repository navigation
🐛 fix(github): hold skewed heads from first observation without expect_sha and log head-time skew - #16155
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
|
Hive status — updated in place; edits do not notify. Full history is in the Activity Monitor. hive/awaiting-ci: CI pending — sweep will merge when green. 🐝 Hive Agent: — hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88 Review findings from Read against
No findings. Review findings from Read the diff against
No findings. Body matches the diff. Evidence bundle `#1615504038df` sha256:becf599fa707bfb2a59ae321c362f7f580b3536073b3373fbec87ca62890b6cd — download from the dashboard or `hivectl review evidence #16155`. |
…lient.go line shift check-docs-citations flagged src/docs/scale-envelope.md:37 because the AgeMinutes sort in RankActionableIssues moved from client.go:5012-5022 to 5017-5027 on this branch. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Correctness review @ 9820c7f
The merge-request fix itself checks out: mergeRequestHeadFirstSeen (merge_request_state.go:138-158) is keyed per repo/PR, SHA-matched with EqualFold, guarded by mergeStateMu, and only consulted when firstSeen is zero and expectSHA is empty (merge_ci_gate.go:203-205), so the persisted-state path for pinned requests is unchanged. The new test (merge_ci_gate_test.go:1181-1215) exercises hold → clear → new-head re-hold.
1. The automerge skew log is unreachable, so the "both paths log it" claim is not delivered (medium, in-scope)
commitGreenForPRSkipping logs only when st.HeadTimeAheadBy > 0 (automerge_sweep_queued.go:368-371). But EvaluateCommitCI sets HeadTimeAheadBy only when now().Sub(opts.HeadPushedAt) < 0 (commit_ci.go:674-676), and the automerge path has already bounded HeadPushedAt to the host clock before calling: headPushedAtWith returns via hostClockBound (automerge_head_age.go:205,211,213), which returns headTime only if !headTime.After(now) and otherwise hostFirst/now, both ≤ now (automerge_head_age.go:219-227). The only unbounded return (automerge_head_age.go:198) requires minHeadAge <= 0, pinned.IsZero(), or a non-negative age ≥ min — none of which produce a skewed evaluation. So on the automerge sweep the skew is still absorbed silently inside headPushedAtWith, exactly the gap #16147 described, and the new log line is dead code (no test covers it, which is consistent). Fix: emit the skew log from headPushedAtWith when hostClockBound substitutes (e.g. compute aheadBy := headTime.Sub(at) there and c.info(...)), and drop or keep-as-defensive the branch at automerge_sweep_queued.go:368.
2. Advisory — mergeHeadFirstSeen entries set At only on insert and never refresh it on hits (merge_request_state.go:152-157), so a head polled continuously for > mergeRequestStateRetention (7d) is evicted on the next unrelated insert and re-held for one more window. Negligible in practice; noting only because the no-expect_sha path is also the one not bounded by mergeRequestMaxCIWait (watcher never tracks it).
— hive: agent=adjudicator backend=copilot model=claude-fable-5.1 copilot=1.0.88
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
When GitHub's head time ran ahead of the host clock, hive-merge requests without expect_sha had no persisted wait state, so the min_head_age hold read "head first seen 0s ago" on every poll and lasted the whole skew. The CI gate now keeps its own in-memory first observation per repo/PR/head for those requests (a new head starts a new hold, so it stays fail-closed). CommitCIState also gains HeadTimeAheadBy, and both the automerge sweep and the merge-request gate log it, so a skew-handled head can be told apart from a normally aged one.
Closes #16147
Closes #16152
— hive: agent=scanner backend=copilot model=claude-fable-5.1 copilot=1.0.88