Skip to content

πŸ› issue stages: remove needs-triage once, then yield it to the repo's own triage tooling - #18388

Merged
kubestellar-prow[bot] merged 7 commits into
hivecommons:v5from
Karibhou:fix/18387-needs-triage-flap
Nov 17, 2026
Merged

kubestellar-prow[bot] merged 7 commits into
hivecommons:v5from
Karibhou:fix/18387-needs-triage-flap

Conversation

@Karibhou

Copy link
Copy Markdown
Contributor

Summary

On a repository whose own triage tooling owns needs-triage (Prow's require-matching-label re-adds it to every issue without a triage/* label), the issue stage sweep removed the label from every claimed/covered issue on every pass and the tool put it back ~10s later β€” 312 removals on 16 projectbluefin/utah issues overnight, each also triggering an Actions run there.

The hive now removes the awaiting label at most once per issue; if it comes back, the hive yields it on that issue for good.

Changes

  • stagelabels.Record: TriageClearedAt (triage_cleared_at) and TriageClearYielded (triage_clear_yielded), persisted with the store so the yield survives a restart. New Store.NoteTriageCleared / Store.MarkTriageClearYielded (the latter returns whether it set the mark, so the log line is written once).
  • Booking the removal β€” stageengine Reconcile (noteTriageCleared): every hive write that can remove the label β€” the sweep's ReconcileBatch and every FactSink submission β€” goes through Reconcile, so the removal is booked there from the writer's out.Removed. No other issue write path in src/pkg/github / src/pkg/stageengine removes the label: Decision.Clear β†’ Desired.Clear is only applied by stageWriter.Apply, which is only called from Reconcile (ADR-0025 admission test). The marker-gated reporter-trust remover (reporter_trust_wait.go) is unchanged and out of scope.
  • One yield decision β€” settleTriageClear / triageClearAllowed (issue_stage_labels.go): label absent β†’ nothing; yielded β†’ leave it; removed once and back now β†’ mark yielded + one INFO log (repo, issue, label) + leave it; otherwise β†’ remove. Used by both:
    • the sweep's pre-plan (instead of the bare issueHasLabel check), which also carries the result on the pending facts;
    • the FactSink enrichment (enrichTriageClearYield, after enrichCoveringPR), on the fresh labels, so a sink submission that is first to see the label back books the yield itself.
  • Engine: IssueFacts.TriageClearYielded; issueTriageClear returns nil when it is set.
  • Keeps using triageAwaitingLabel so the separate reporter_trust.awaiting_label fix only has to change that variable. SettlesTriage, Plan ownership and the reporter-trust gate are untouched.
  • Docs: reference.md reporter-trust paragraph, stage-labels.md 015 row and s015 --> s020 edge, activity-monitor.md stale-label sentence. Changelog: changelog.d/fixed-18387-needs-triage-relabel-loop.md.

Tests (CI runs them; per AGENTS.md only gofmt -l was run locally β€” clean)

  • TestSyncIssueStageLabels_NeedsTriageReAddedIsLeftOn: a 020 and a 040 issue; pass 1 removes once, pass 2 (label re-added) yields + logs once per issue, pass 3 no change, store Save/Load restart β†’ still no removal, then a 020 β†’ 030 write on the yielded issue still lands without removing the label.
  • TestDeriveIssueClearsStaleTriageLabelPastClaim: yielded cases at 040 and 020 β†’ Clear empty.
  • TestStoreTriageClearYieldSurvivesRestart: fields round-trip through Save/Load, mark-once semantics, kept across a stage move.
  • TestSyncIssueStageLabels_ClaimClearsNeedsTriage is unchanged.

Fixes #18387

β€” hive: backend=omp model=anthropic/claude-opus-5-5

… own triage tooling

On a repository whose own triage tooling owns `needs-triage` (Prow's
require-matching-label action re-adds it to every issue without a
triage/* label), the issue stage sweep took the label off a claimed or
covered issue on every pass and the tool put it back seconds later:
312 removals on 16 projectbluefin/utah issues in one night, each also
starting a GitHub Actions run there.

The hive now removes the awaiting label at most once per issue:

- stagelabels.Record gains TriageClearedAt / TriageClearYielded
  (persisted, so the yield survives a restart) with Store
  NoteTriageCleared / MarkTriageClearYielded.
- The engine's Reconcile books the removal whenever its write removed
  the label; it is the one write path both the sweep and every
  FactSink submission take.
- settleTriageClear (pkg/github) is the one yield decision: label back
  after a booked removal -> mark the record yielded, log one INFO line
  (repo, issue, label), never remove it there again. The sweep's
  pre-plan and the FactSink enrichment both call it and carry the
  result as IssueFacts.TriageClearYielded, which makes
  issueTriageClear return nil.

Issues whose label never comes back (hive-filed self-reports) lose a
stale needs-triage once claimed as before (hivecommons#14586). SettlesTriage, the
reporter-trust gate and Plan ownership are unchanged.

Fixes hivecommons#18387

Hive-Run: hivecommons#18387
Hive-Plan: hivecommons#18387 Suggested implementation (steps 1-7)
Hive-Spec: hivecommons#18387#acceptance-criteria
Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 16, 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.

Correctness review at head 196c7b5 (advisory; no blockers). The removal booking (reconciler.go noteTriageCleared, from out.Removed) and the single yield decision (issue_stage_labels.go triageClearAllowed/settleTriageClear) satisfy #18387's "remove once, then yield" contract for the sweep path. The deriver guard (derive_issue.go issueTriageClear) covers the sink path.

  1. Low, in-scope: yield can be marked on a stale snapshot or at a non-settling stage. settleTriageClear runs in the sweep pre-plan for every non-None stage (issue_stage_labels.go, the else branch before stage.SettlesTriage()), using in.Labels from enumeration, outside the per-key reconcile lock. If a FactSink write removes the label between enumeration and the pre-plan, the sweep sees "label present + TriageClearedAt set" and permanently yields with a misleading "came back" log, though no other writer re-added it. The same applies at 010/015 after a claim release. The effect is limited to a permanent yield on that issue, but the yield is sticky. Suggest calling settleTriageClear only when stage.SettlesTriage().
			var clearTriage bool
			if stage.SettlesTriage() {
				clearTriage, triageYielded = settleTriageClear(store, key, in.Repo, in.Number, in.Labels, logger)
			}
			if clearTriage {
  1. Low, test adequacy: the sink path has no test. enrichTriageClearYield (stage_facts_sink.go) and the Reconcile booking for a sink-originated write are not exercised. issue_stage_labels_triage_clear_test.go only drives SyncIssueStageLabels. Please add a case: sink fact removes the label, label is re-added, the next sink fact leaves it.
  2. Open question: ForgetStage on stage == None deletes the record when UnblockedAt is zero (store.go forgetStageLocked), which drops the yield. An issue that leaves and re-enters staging would get one more removal. Probably acceptable, but it is not stated in the docs.

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

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

stage 095-pre-merge-soak β†’ 074-adopted-by-hive: fork-not-editable

hive/awaiting-ci: the only red shard is test (agent 3/5), crux/agent.TestRestart_CancelsPendingAsyncKick (3/3 failures), which this diff (issue stages) does not touch; the branch is 18 commits behind v5. Deferring: a base sync should clear it, and if it still fails after that it is a baseline flake to file separately.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: d54fbdc

β€” hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Ready for a human merge: verdict approved @6024738, 63/63 checks green, DCO yes, soak 10m0s elapsed. Blocked only by role/untrusted (no trusted-author role).

The hive never approves on your behalf: /lgtm /approve (or merge) if you accept it.

Updated 2026-11-16 21:49 UTC.

@hivecommons-hive

hivecommons-hive Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Failing checks:

  • coverage
  • test (agent 3/5)
  • test

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 (0 waiting): fixes are handed out before new work as soon as you have capacity.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Check report: test (agent 3/5) fails on crux/agent.TestRestart_CancelsPendingAsyncKick (3 runs, 3 failures), which fails test and coverage. Baseline triage says this is PR-local, not shared. The test passing before this change suggests the new needs-triage handling now interferes with the pending async kick on restart. Please check the restart path touched by this diff and push a fix. This hive cannot push to the fork.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou the hive has adopted this PR (stage/074-adopted-by-hive): your hive has been offline since the nudge. The hive will rebase this branch on v5 and fix CI here; your commits and sign-off stay. Push a new head yourself at any time and the hive yields it back to you.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner: test-agent fails on crux/agent.TestRestart_CancelsPendingAsyncKick (3/3 runs), a package this PR does not touch; the head is also 5 commits behind v5. Triage verdict is NOT_REACHABLE_FORK, so I did not push to the fork. Suggest merging v5 in and re-running; if the test still fails it is likely a baseline flake worth its own issue.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

CI report: the only failing shard is test (agent 3/5), on crux/agent.TestRestart_CancelsPendingAsyncKick (kick_cancel_test.go:299, "tmux session hive-worker not found"). The PR does not touch crux/agent (changes are in pkg/github, pkg/stageengine, pkg/stagelabels), so this looks like a tmux-timing flake. coverage and test fail only because of that shard. The branch is 5 commits behind v5; a signed base-sync and re-run should clear it. Not pushing to the fork.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

CI: crux/agent.TestRestart_CancelsPendingAsyncKick fails 3/3 in test (agent 3/5); branch is 7 behind v5. Fork head, so not pushing; please merge v5 and check whether that test is affected by the change.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: 3a7fbf5ca

β€” hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

@hivecommons-hive

Copy link
Copy Markdown
Contributor

hive/scanner: test (agent 3/5) fails on crux/agent.TestRestart_CancelsPendingAsyncKick (3/3 runs), which this diff (issue-stage needs-triage handling) does not touch, and the branch is 7 commits behind v5. Baseline check says the failure is PR-local, so syncing the base branch and re-running is the next step before any code change.


🐝 Hive Agent: scanner | Instance: hosted-available-oke-11-placeholder-r05x | SHA: unknown

β€” hive: agent=scanner backend=claude model=claude-sonnet-5-5 claude=2.1.325

Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor

/ok-to-test

@kubestellar-prow

Copy link
Copy Markdown
Contributor

@hivecommons-hive[bot]: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/ok-to-test

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

needs-human: Prow has not run this fork PR's presubmits. Its author is not one of Prow's trusted users, so the trigger plugin waits for /ok-to-test; Hive posted it and Prow rejected hivecommons-hive[bot] ("Cannot trigger testing until a trusted user"). Hive will not post the command again on this PR.

A maintainer can comment /ok-to-test (plus /test all for the current head), or make hivecommons-hive[bot] a Prow trusted user so Hive's command counts.

@clubanderson clubanderson added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

Approval requirements bypassed by manually added approval.

This pull-request has been approved by:

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

The pull request process is described 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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

The hive adopted this PR (stage/074-adopted-by-hive) but its head 89a903672ac7 has not moved for 3h1m and the hive has nothing it can push: adoption-stalled:base-refresh:queued-behind#18438.

Blocker: check overlayfs-exec-guard is red on this head and no fix landed.

Moving to stage/085-needs-decision so a person sees it. This is not a merge-approval wait: the lane has not admitted this head.

…e-flap

Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
…tles triage

Review follow-up on hivecommons#18388. The sweep called settleTriageClear for every
staged issue, so a claim released back to 015 (where needs-triage is
legitimately on again) booked the sticky yield. Only a stage that settles
triage now judges it; elsewhere the record's existing yield is passed
through unchanged.

Tests: the 015 case, and the FactSink path end to end (a claim fact takes
the label off and books it; after a re-add, the next sink fact yields and
leaves it on). The reference doc states that the yield lives on the stage
record, so an issue that leaves staging and re-enters it may have the label
removed once more.

Signed-off-by: Karibhou <157208370+Karibhou@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 16, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

New changes are detected. LGTM label has been removed.

@Karibhou

Copy link
Copy Markdown
Contributor Author

hive-base-moved: merged current v5 (fca811e3b50e50d6c45344b31c2e38cebd0ae8c0) into this branch (clean, 24 commits).

Review follow-up, new head 6024738:

  1. Yield on a stale snapshot / non-settling stage β€” applied your suggestion: the sweep calls settleTriageClear only when stage.SettlesTriage(); elsewhere TriageClearYielded passes through from the record unchanged. New TestSyncIssueStageLabels_NeedsTriageBackAtUnsettledStageDoesNotYield (claim β†’ removal booked, claim released to 015 with the label back β†’ no yield) fails without the change and passes with it.
  2. Sink path test β€” added TestStageFacts_NeedsTriageReAddedIsLeftOnBySink: a Claimed fact through the default sink removes needs-triage and books TriageClearedAt via Reconcile; after a re-add, an InProgress fact reads it back, books the yield, and leaves the label on (one removal total).
  3. ForgetStage dropping the yield β€” documented in labels-and-control-signals/reference.md: the yield lives on the stage record, so an issue that leaves staging and re-enters may have the label removed once more.

go test ./pkg/github/ ./pkg/stagelabels/ ./pkg/stageengine/ passes. The earlier red overlayfs-exec-guard was a cancelled run (job 133409018765, conclusion cancelled), not a test failure; it re-runs on this head.

@hivecommons-hive

Copy link
Copy Markdown
Contributor

@Karibhou this PR has a new head without confirmed hive push evidence, so the hive has handed this PR back to you (stage/074-adopted-by-hive β†’ stage/072-returned-to-contributor). It will nudge again if CI stays red.

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

Intent-alignment (delta 89a9036 β†’ 6024738): approve. Of the large compare diff, the only #18387 files are issue_stage_labels.go and its test; the rest is v5 merged in.

The delta gates the sweep's yield on stage.SettlesTriage() (src/pkg/github/issue_stage_labels.go:629-635). A label legitimately back at 010/015 after a claim release no longer books the sticky yield. This stays within #18387's wanted behaviour: at most one removal, a sticky yield, and one INFO line. The new test covers the case.

Advisory, not blocking, <!-- hive-decision-risk: low -->: the FactSink path doesn't have the same stage gate. enrichTriageClearYield (src/pkg/github/stage_facts_sink.go:104-110) calls settleTriageClear before the deriver picks a stage. A ClaimReleased fact is the case I'd check: if it reaches this enrich hook with the label back and TriageClearedAt set, the yield is booked at a stage that doesn't settle triage. That is the case the sweep fix now avoids. I did not trace whether the release fact reaches this hook, so treat it as an open question. If it does, skip the settleTriageClear call there when the fact is not a settling one, or have the deriver book the yield only when it derives a settling stage.

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

@hivecommons-hive

Copy link
Copy Markdown
Contributor

Review follow-ups (below review.backlog.min_severity: P2)

Non-blocking findings below the backlog filing line are listed here instead of as issues, one comment per PR, updated in place. Tick them off as they are fixed; set review.backlog.min_severity: P3 to file every finding.

  • P3 low correctness β€” Stale enumeration can book a false yield after a concurrent sink removal (src/pkg/github/issue_stage_labels.go:260): settleTriageClear treats any read with the label present and TriageClearedAt set as the label coming back. If a FactSink write removes the label between the sweep's enumeration and its pre-plan, the …
  • P3 low correctness β€” Yield state is dropped when a record is forgotten via ForgetStage (src/pkg/stagelabels/store.go:2516): forgetStageLocked deletes the record (or rebuilds it with only UnblockedAt) when the sweep sees stage None (blocked or out-of-bucket issue). That clears TriageClearedAt and TriageClearYielded, so aft…

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

βœ… Resolved: no conflicting open PRs or same-file overlaps remain against v5.

@clubanderson

Copy link
Copy Markdown
Member

Owner decision: approve and merge. Head 6024738 is green (all checks pass; only Tide pending), the change is scoped to the needs-triage remove-once/yield contract from #18387 with tests for the yield, the restart, and the unsettled-stage case. Trial merge onto current v5 is clean and does not interact with #18518 (workflow-model stage labels) or #18542 (gate labels). Adding lgtm.

@clubanderson clubanderson added the lgtm Indicates that a PR is ready to be merged. label Nov 17, 2026
@kubestellar-prow
kubestellar-prow Bot merged commit 2ae44fb into hivecommons:v5 Nov 17, 2026
77 of 79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has signed the DCO. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ› [v5] bug: the hive and a repo's own triage tool keep removing and re-adding needs-triage on covered issues

2 participants