Skip to content

πŸ› base red: remember the base's red checks and read new heads from them - #18842

Merged
hivecommons-hive[bot] merged 3 commits into
hivecommons:v6from
Danathar:fix/base-red-carry
Nov 18, 2026
Merged

hivecommons-hive[bot] merged 3 commits into
hivecommons:v6from
Danathar:fix/base-red-carry

Conversation

@Danathar

Copy link
Copy Markdown
Contributor

Summary

When a PR's only red checks are also red on its base branch, the hive keeps it at 050/060 ("not this PR's fault"). That rule had no memory, so any pass that missed the base's red sent the PR back to its author:

  • the PR moved to 070/072;
  • the author was nudged and a fix was queued in their relay;
  • a few minutes later the next pass put it back and withdrew the nudge.

This repeated for as long as the base stayed red.

This PR gives base red the memory the fork guard already has:

  • the hive remembers each base's red checks across passes;
  • a new head that hasn't been read yet is classified from that memory.

What happened

All times Eastern, 11-17.

Cause

There are two gaps.

1. The base is re-read every pass, with no memory (base_branch_red.go).

  • enrichBaseBranchRed resets BaseRedChecks and re-lists the base tip's check runs every pass.
  • Only completed runs counted. So when main had just moved and its run of the check was still queued or in progress, the check read as "not red on the base". That's the 3:17 PM flip on common#1684: main moved at 3:12, and its E2E run started at 3:18.
  • A failed listing became "nothing red", logged only at Debug.

2. A new head is plain red until the next enumeration (stage_shared_ci.go).

  • The stage pass gets base red from an index built per head.
  • A head pushed since the last CI-enriched enumeration has no entry, so the classifier falls through to the fixing stage.
  • The fork guard had the same gap and got a carry (automerge_fork_guard_carry.go). Base red had none.

What changed

Per-base memory in the client (base_branch_red_memory.go)

  • The client keeps, for each owner/repo@base, the checks it last saw red.
  • A check leaves the set only when a read sees the base tip's run of it complete with a non-red conclusion. A run still queued or in progress, or no run yet, keeps it.
  • When two apps run a check of the same name, red outranks running, and running outranks green.
  • A failed base listing reuses the set and logs at Warn. With nothing remembered, it behaves as today.
  • A check not seen red for 2 h is dropped, so a base nobody reads again can't pin a stale red.

New heads in the stage pass (automerge_base_red_carry.go)

  • The memory is published beside the shared-CI index (StageLabelPolicy.BaseRedRemembered).
  • foldBaseRed runs after foldForkGuard. A red head with no index answer (and no fork guard or shared-CI deferral) is marked base red only when:
    • every check red on the head, from its own check digest as foldForkGuard reads it, is remembered red on its base; and
    • the head touches no CI-owning path. This uses the duplicate sweep's cached file list, else one listing cached per head. A list that can't be read in full doesn't count.
  • Any other red check, a CI-owning path, or an unreadable digest or file list keeps today's author-facing route.

The rule itself is unchanged: BaseRedChecksFor, the CI-owning-path list, AllFailuresBaseRed, withdrawNudge (still a backstop) and the required vs optional handling. The stage-labels doc row describes the memory.

Not in this PR

Tests

  • base_branch_red_memory_test.go:
    • the memory keeps a check while the tip's run is in progress or missing;
    • a lookup error reuses the set, and with no memory gives nil;
    • a completed green run drops the check, and so does the TTL;
    • enrichBaseBranchRed across four passes (red, in progress, listing fails, green): the PR stays base red for the first three;
    • state precedence across apps.
  • automerge_base_red_carry_test.go, through ApplyStageLabels, replays chairlift#811:
    • two new heads red only on the base's check stay at 050 with reason base-branch-red:Unit Tests and no nudge;
    • a head with an extra red check goes to 072 with one nudge;
    • a head that edits .github/workflows/ stays author-facing;
    • a base with nothing remembered stays author-facing.
  • The same file also covers common#1684's optional check (a soaking lane with the red check in the detail) folding to 060, the index's own answer being left alone, and the per-head file-list cache.
  • cmd/hive/stage_shared_ci_test.go: publishing and looking up the memory snapshot.

Only gofmt -l was run locally (AGENTS.md bans local go test/go build/go vet); this PR's CI is the test run.

πŸ€– Generated with Claude Code

https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1

enrichBaseBranchRed re-read the base tip every pass with no memory: a tip
whose run of the check was still in progress, or a failed listing, made
the PR's red its own, so it went to 072, the author was nudged and a relay
fix queued, and the next pass withdrew it. A new head read as plain red
until the next enumeration. Seen on projectbluefin/common#1684 (ten stage
changes on one head) and chairlift#811 (both heads).

The client now remembers each base's red checks and drops one only when
the tip's run of it completes green (2 h TTL); a failed listing reuses the
set and logs at Warn. The stage pass reads a head the index has not
classified from that memory when every check red on it is the base's and
it touches no CI-owning path.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 17, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign nicholasjackson for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#18667 πŸ› automerge: refuse an unsigned squash only where the repo requires DCO same files src/docs/labels-and-control-signals/stage-labels.md
src/docs/scale-envelope.md
src/pkg/github/client.go
#18843 πŸ› 090 and workflow-fence comments: name auto-merge off, and no /lgtm without Prow same files src/docs/labels-and-control-signals/stage-labels.md

@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Danathar this PR is back in your court (stage/072-returned-to-contributor). The hive will not merge it until the head changes.

Review asks:

  • the branch conflicts with the base and needs a rebase

Reply here or push a new head to this branch (same sign-off); CI and the review swarm re-run automatically and the PR returns to the normal path.

Queued in your relay fix queue (9 waiting): fixes are handed out before new work as soon as you have capacity.

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Nov 17, 2026

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Style review at 2c3fb52: the design reads well and follows the existing fork-guard carry idiom. One in-scope finding: baseRedHeadFiles duplicates prChangedPaths and its page bound from pkg/github (inline thread). Minor note: baseCheckState is declared Running/Red/Green while baseCheckRank maps Red>Running>Green; declaring the constants in rank order would remove the extra switch (base_branch_red_memory.go).

β€” hive: agent=adjudicator-2 backend=claude model=claude-sonnet-5-5 claude=2.1.326


// baseRedHeadFiles lists the PR's changed paths (renames: both names), or
// errBaseRedFilesTruncated past baseRedFilesPages.
func (c *Engine) baseRedHeadFiles(ctx context.Context, owner, repo string, number int) ([]string, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This re-implements prChangedPaths in pkg/github/base_branch_red.go (same 100/page loop, 3-page cap, previous-filename handling), and baseRedFilesPages (line 35) restates baseRedMaxFilePages. Two copies can drift, and this one omits the WithRESTCaller attribution. Prefer exporting the existing helper (e.g. Client.PRChangedPaths) and calling it here.

@hivecommons-hive

hivecommons-hive Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

Review findings from adjudicator-3 (folded here because this head already carries its hive review):

HUMAN DECISION NEEDED β€” docs-currency review could not run (GitHub API hourly cap hit); re-dispatch once the cap resets. Danathar

gh pr view and gh pr diff for #18842 both failed with HTTP 429 ("agent GitHub API hourly cap reached (300/300)"). I did not read the diff, so I make no claims about docs, examples, or operator-facing text for this PR at head 2c3fb52.

Evidence bundle `#18842e80a99a` sha256:bbf9d7f0d3427e90c8a5b350050631caffe3b4910f077f5060f1a6712bb8dd26 β€” download from the dashboard or `hivectl review evidence #18842`.

Danathar and others added 2 commits November 17, 2026 19:11
One conflict, in StageTracker's fields: this branch adds baseRedPaths
(foldBaseRed's per-head CI-path memo) and v6 adds approvals
(headTrustedApproval's per-head memo) at the same spot. Keep both.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
This branch adds three lines to client.go above RankActionableIssues, so
after the v6 merge it starts at 5600, not 5597; scale-envelope.md now
cites 5600-5610 and the docs citation check finds AgeMinutes again.

Signed-off-by: Danathar <6772335+Danathar@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BQYnPGFJx81c8JXR3o1sg1
@hivecommons-hive
hivecommons-hive Bot merged commit e7a2a75 into hivecommons:v6 Nov 18, 2026
71 of 72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant