Skip to content

πŸ› Stop the in-progress sweep stripping workflow-model stage labels - #18518

Merged
hivecommons-hive[bot] merged 2 commits into
v5from
fix/18434-model-stage-label-flap
Nov 16, 2026
Merged

hivecommons-hive[bot] merged 2 commits into
v5from
fix/18434-model-stage-label-flap

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Root cause

On a repository bound to a workflow model, the issue stage comes from the model. The TechDocs model's Accepted state has lifecycle number 20, which maps to the built-in stage/020-claimed label. Two writers disagreed about that label on every enumeration cycle:

  1. SweepInProgressIssues treats stage/020-claimed as a claim trigger. It found no hive:claim start mark, so it removed the label directly ("start mark lapsed").
  2. About 2 seconds later SyncIssueStageLabelsWith derived the issue through the bound model again (Accepted, number 20) and re-added stage/020-claimed.

On cncf/techdocs#395 this produced roughly 298 remove/add pairs, one every 15 minutes. The event log shows each removal followed by the re-add 1 to 3 seconds later.

The default out-of-cycle FactSink was a second writer with the same problem: it was built without WorkflowFor, so a claim or release fact on a model-bound repo derived the built-in stage, and the next sweep would revert it.

Fix

  • SweepInProgressIssues asks the bound model (non-hive-default) whether it derives the trigger label for this issue's state. If it does, the label belongs to the model and is not a claim. The sweep never strips it and does not withhold the issue for it. A live start mark still withholds, and a fetch error still fails closed.
  • StageReconciler stores its WorkflowFor lookup on the client (SetStageWorkflowFor). The default FactSink derives through the same lookup as the sweeps, so every writer reaches the same answer.
  • issueStageInputFrom is factored out of IssueStageInputs so the sweep builds the same facts the stage sync does.

Tests

  • TestModelOwnedStageLabel_ReconcileIsIdempotent runs in-progress sweep plus stage reconcile four times on a model-bound issue at a number-20 state. The first cycle adds the label once. After that there are no adds or removes, and the issue is never withheld.
  • TestModelOwnedStageLabel_UnboundOrOtherStateStillClears: on an unbound repo, or when the model derives a different stage, a lapsed label is still cleared.

Not in this PR

The label still reads "claimed" for a state that means "waiting on the reviewer". Giving model states their own stage/* names needs new plumbing across the label family (Plan, Current, the Store's Stage enum, dashboard bands), so it is deliberately left out here.

Fixes #18434

πŸ€– Generated with Claude Code

@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
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v5

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

PR Title Relation Files
#18501 ✨ Durable one-PR-per-topic claims for long-lived agents same files src/cmd/hive/github_client_config.go
#18505 ✨ Discover agents declared in a managed repo's .hive/agents/ behind owner approval same files src/pkg/github/client.go
#18388 πŸ› issue stages: remove needs-triage once, then yield it to the repo's own triage tooling same files src/pkg/github/issue_stage_labels.go
src/pkg/github/stage_facts_sink.go

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

@clubanderson this PR is held at stage/071-needs-author and the hive will not merge it yet.

Failing checks:

  • test (rest 4/4)

Next: the hive does not push to your branch. Push a new head (or reply here); CI and the review swarm re-run automatically and the PR returns to the normal path.

Evidence bundle `#185188d1f29b` sha256:26b86e30a5f78ba879ead70e8a31752dcc52a921a59ab82642586090a25d6fcc β€” download from the dashboard or `hivectl review evidence #18518`.

A repository bound to a workflow model derives its stage through the
model; TechDocs 'Accepted' (number 20) wears stage/020-claimed. The
in-progress sweep read that as a claim, found no start mark and removed
it; the stage sync re-added it two seconds later, every cycle
(cncf/techdocs#395, ~298 flips).

The sweep now leaves a trigger label the bound model derives for the
issue alone and never withholds the issue for it (a live start mark
still withholds). The default FactSink derives through the same
per-repository model lookup as the sweeps, installed from the
reconciler's options.

Fixes #18434

Signed-off-by: Andy Anderson <andy@clubanderson.com>
The client-hook guard requires every Set* hook to be applied where the
client is (re)built, so a rebuilt client keeps it (#9614).

Signed-off-by: Andy Anderson <andy@clubanderson.com>
@clubanderson
clubanderson force-pushed the fix/18434-model-stage-label-flap branch from e989744 to 8d1f29b Compare November 16, 2026 21:45
@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

@clubanderson

Copy link
Copy Markdown
Member Author

@nate-double-u FYI, this is the fix for the label flapping you reported in #18434.

@hivecommons-hive
hivecommons-hive Bot merged commit 28d2df6 into v5 Nov 16, 2026
92 of 94 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/18434-model-stage-label-flap branch November 16, 2026 22:27
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.

πŸ› bug: labels added and removed multiple times

1 participant