Skip to content

πŸ› Activity Monitor: one coherent post-decision state for Let hive decide rows; 060 reviewed in CI / Review - #15186

Merged
clubanderson merged 1 commit into
v5from
fix/decided-state
Oct 29, 2026
Merged

clubanderson merged 1 commit into
v5from
fix/decided-state

Conversation

@clubanderson

Copy link
Copy Markdown
Member

Fixes #15185

Root cause

The row's βœ“ badge, the "deciding" spinner and the stage pill were driven by three unrelated sources (operator-action ledger, in-flight request state, stale 090 lane classification), so a recorded decision left all three on screen; the SPA mapped stage 060 to the merge-gate column; event lines rendered raw lane reasons.

What this does

  • One post-decision projection (stage_tracker_decided.go): deciding β†’ decided + effect pending β†’ landed / timed out (decisions.delegate.effect_timeout). βœ“ is the decision badge (tooltip: who chose Β· what hive decided Β· when Β· next), never a celebration. Pill/chevron/progress text name the recorded verdict (Adopted Β· opening hive copy… at 080, Fixing Β· hive is addressing @Reviewer's review at 070); "Approving…" only for approve (test).
  • Preview before acting: POST …/decide-delegated/plan (dry run, no side effects; openapi + api-reference) β†’ popover Let hive do that / Approve & merge as-is / Cancel; chosen recorded in the trail.
  • Adoption pairs: dimmed Adopted β†’ #N Β· superseded original, ↳ adopted from #N Β· you approved HH:MM chip on the copy; a closed original renders as one dimmed cached-title line (never a blank numbered row; field names aligned with ✨ Adoption: close the original first when superseding, reopen if the hive's copy failsΒ #15154 close-first adoption).
  • Decision wins over stale label: any recorded decision lifts needs-human + 045/085 stage labels in the same write (liftDelegatedParkLabels, pr_decision_operator.go); a decided row never projects into 085.
  • Shared stage vocabulary (stage_tracker_vocabulary.go + STAGE_TRACKER_STAGE_PHRASE) with a guard test over rendered event lines (/stage\/\d{3}|\b0\d{2} [a-z-]+\b/); "covers it β€” covers it" dedup.
  • 060 reviewed β†’ CI / Review column as Review passed Β· CI in progress / checks unreadable / soak Nm remaining (RouteHuman's recorded reason); Merge gate column starts at 080. Table test over every stagelabels label's column + phrase. The engine already moves 060β†’080 (AuthorSideDone β†’ AwaitingMergeAdmission) before merging, so no engine change.
  • Wording: the author's clanker (glossary + JS mirror + docs; test asserts no "author's hive"); no-effect popover uses local relative time and the in-tracker Approve & merge as maintainer action when available.
  • Docs: dashboard-sections.md (decision lane state machine, legend), changelog.d/fixed-decided-state.md.

Notes

Tests

go test ./pkg/dashboard/ ./pkg/github/ ./pkg/delegatedecision/ ./pkg/stagelabels/ ./pkg/authorkind/ green after rebase on v5; node fixture tests for the three states, preview popover, adoption pair, closed original, vocabulary guard, 060 column; Go tests for the plan route, projection, label lift.

@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

@kubestellar-prow kubestellar-prow Bot added dco-signoff: yes Indicates the PR's author has signed the DCO. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added author/human A person pushed this PR themselves dco All commits are DCO signed-off stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 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
#15134 πŸ› Delegated decision on a capability gap: model the blocker, stop the un-park/re-park loop, name the missing App permission CONFLICT dashboard/openapi.json
src/docs/api-reference.md
src/docs/labels-and-control-signals.md
src/pkg/dashboard/api.go
src/pkg/dashboard/static/index.html
#15282 πŸ“– docs: make Hive guides easier to follow same files src/docs/contributor-relay.md
src/docs/dashboard-sections.md
src/docs/labels-and-control-signals.md
#15104 πŸ› Activity Monitor: Rebase, then merge as maintainer; fixer owns parked conflicting PRs; dismiss self-inflicted changes_requested CONFLICT src/pkg/dashboard/stage_tracker.go
src/pkg/dashboard/static/index.html
#15290 πŸ› dashboard: merge toast renders above the chat button same files src/pkg/dashboard/static/index.html
#15287 πŸ“– docs: clarify rework push detection without a nudge same files src/docs/dashboard-sections.md
src/docs/operator-reference.md
#15253 πŸ› decision toast: issue decisions no longer read as 'approved for merge' CONFLICT src/pkg/dashboard/delegated_decision_effect.go
src/pkg/dashboard/stage_tracker_row_actions_test.go
src/pkg/dashboard/static/index.html
#15236 πŸ› Prefer covering PR progress in Activity Monitor messages same files src/pkg/dashboard/stage_tracker.go

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

Security perspective β€” one low-severity audit-trail finding; no exploitable issue.

Dry-run /plan writes an audit record for 090 rows, attributed to nobody. planDelegatedDecision (src/pkg/dashboard/api_repo_item_decide_delegated_plan.go:98-108) calls s.delegatedHumanMergeOutcome(repoFull, number, itemType, "", mergerRole, in, req) with an empty user. That function unconditionally emits s.audit.LogRecord(user, auditRepoItemDecisionDelegated, …) (src/pkg/dashboard/delegated_decision_human_merge.go:104-105). So every preview of a Ready for human merge PR lands in the audit log as a repo_item_decision_delegated event with no actor β€” indistinguishable from a real delegated decision β€” contradicting the file comment ("nothing is executed, commented, audited or recorded", plan.go:100-102), the openapi description and api-reference.md ("writes nothing"). Per #15185 the preview must have no side effects. Suggested fix: keep the shortcut pure and audit only in the real path.

--- a/src/pkg/dashboard/delegated_decision_human_merge.go
+++ b/src/pkg/dashboard/delegated_decision_human_merge.go
@@ func (s *Server) delegatedHumanMergeOutcome(repoFull string, number int, itemType, user string, mergerRole bool, in delegatedecision.Input, req delegatedDecisionRequest) (delegatedOutcome, bool) {
-	s.audit.LogRecord(user, auditRepoItemDecisionDelegated, auditDetail("repo", repoFull, "number", strconv.Itoa(number), "type", itemType,
-		"verdict", string(d.Verdict), "rule", d.Rule, "actions", "", "noop", "human-merge:"+code, "policy", delegatedecision.PolicyName, "decision", d.Text), "", repoFull, number)
+	// Audit only when a person actually asked (the /plan preview passes
+	// user == "" and must leave no trace).
+	if user != "" {
+		s.audit.LogRecord(user, auditRepoItemDecisionDelegated, auditDetail("repo", repoFull, "number", strconv.Itoa(number), "type", itemType,
+			"verdict", string(d.Verdict), "rule", d.Rule, "actions", "", "noop", "human-merge:"+code, "policy", delegatedecision.PolicyName, "decision", d.Text), "", repoFull, number)
+	}
 	return delegatedOutcome{Decision: &d, Notes: []string{"ready for human merge (" + code + "); nothing written"}, Result: &res}, true

Checked and fine: /plan mirrors the real route's gates (delegateDecisionEnabled, canToggleRepoHold, merger-role derivation incl. ownerRoleVerifiedHeader, MaxBytesReader) at plan.go:62-93 vs api_repo_item_decide_delegated.go:221-267; plan text is rendered through hiveDialogEscape (static/index.html, stageTrackerDelegatePlanDialog); chosen rides the same truncateOperatorNote path as the pre-existing comment note (operator_actions.go:299-305); Approve & merge as-is re-enters the existing decide:merge-now row action, so server-side merge authorisation is unchanged.

β€” hive: agent=ci-maintainer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@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 (head 55a6956)

Preview is not side-effect free on 090 rows β€” src/pkg/dashboard/api_repo_item_decide_delegated_plan.go:109-115 calls s.delegatedHumanMergeOutcome(...) for the 090 shortcut, and that helper unconditionally writes s.audit.LogRecord(user, auditRepoItemDecisionDelegated, …) (src/pkg/dashboard/delegated_decision_human_merge.go:100-101). planDelegatedDecision passes user == "", so every preview of a Ready for human merge row lands an repo_item_decision_delegated audit entry attributed to system (audit.go:238-240) with noop=human-merge:* β€” indistinguishable from a real press. That contradicts the header comment ("nothing is executed, commented, audited or recorded", plan.go:100-102) and the PR body's "dry run, no side effects". TestDelegatedDecisionPlanReadyForHumanMergeUsesShortcut (plan_test.go) checks comments/labels but not the audit log, so it doesn't catch this. Low severity (prior-decision detection reads PR comments, not the audit log β€” delegated_decision_effect.go delegatedPriorDecisionState), but it pollutes the trail the issue asks operators to trust.

Fix: hoist the audit write out of the helper into the one caller that actually decides.

--- a/src/pkg/dashboard/delegated_decision_human_merge.go
+++ b/src/pkg/dashboard/delegated_decision_human_merge.go
@@ func (s *Server) delegatedHumanMergeOutcome(...) (delegatedOutcome, bool) {
-	s.audit.LogRecord(user, auditRepoItemDecisionDelegated, auditDetail("repo", repoFull, "number", strconv.Itoa(number), "type", itemType,
-		"verdict", string(d.Verdict), "rule", d.Rule, "actions", "", "noop", "human-merge:"+code, "policy", delegatedecision.PolicyName, "decision", d.Text), "", repoFull, number)
 	return delegatedOutcome{Decision: &d, Notes: []string{"ready for human merge (" + code + "); nothing written"}, Result: &res}, true
--- a/src/pkg/dashboard/api_repo_item_decide_delegated.go
+++ b/src/pkg/dashboard/api_repo_item_decide_delegated.go
@@ func (s *Server) decideDelegatedOne(...) delegatedOutcome {
 	if out, ok := s.delegatedHumanMergeOutcome(repoFull, number, itemType, user, mergerRole, in, req); ok {
+		s.audit.LogRecord(user, auditRepoItemDecisionDelegated, auditDetail("repo", repoFull, "number", strconv.Itoa(number), "type", itemType,
+			"verdict", string(out.Decision.Verdict), "rule", out.Decision.Rule, "actions", "", "noop", "human-merge", "policy", delegatedecision.PolicyName, "decision", out.Decision.Text), "", repoFull, number)
 		return out
 	}

(and add an audit-length assertion to the 090 plan test).

Checked and fine: projection ordering (buildStageTracker β†’ applyOperatorActions β†’ applyDecidedProjection β†’ stageTrackerResolveLinkedPRs, stage_tracker.go:2000-2003) β€” the closed-original StageTrackerLinkedPR survives stageTrackerResolveLinkedPRs because entries not in prs keep their fields (stage_tracker.go:2715-2745); decidedVerbs keys match the ledger constants (operatorActionApprove == "approve" == VerdictApprove); delegatedParkLabels covers both 045 (NeedsDecisionStageLabel) and 085 for PRs; liftPRDecisionParkLabels only removes labels present on the PR.

β€” hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Failing checks:

  • test (rest 2/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.

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 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 β€” delta re-review at 0557f27 (delta vs 99bd3ee is the v5 rebase; api_repo_item_decide_delegated_plan.go is byte-identical, so both prior findings stand).

1. Preview contradicts the action for untrusted-author 090 PRs (the PR's headline case). planDelegatedDecision goes straight to the 090 shortcut (api_repo_item_decide_delegated_plan.go:111), but the real path runs delegatedHumanMergeDecision first (api_repo_item_decide_delegated.go:491-497) and only falls back to delegatedHumanMergeOutcome when that returns ok=false. For a 090 PR held on untrusted author with a merger role, the popover says Hive would: recommend only / I can't merge this while Let hive do that approves (delegated_decision_human_merge.go:214-222) or adopts / returns-to-author (:183-203). TestDelegatedDecisionPlanReadyForHumanMergeUsesShortcut (_plan_test.go:88-101) pins the wrong answer with the exact input (prForeign, 090 label, author-association reason, X-Hive-Role: merger) that decideDelegatedOne decides.

2. Still present β€” dry run writes an audit record with an empty user. delegatedHumanMergeOutcome unconditionally calls s.audit.LogRecord(user, auditRepoItemDecisionDelegated, …) (delegated_decision_human_merge.go:105); the plan passes "" as user (_plan.go:111) despite the doc comment "nothing is executed, commented, audited or recorded" (_plan.go:101-103). Every preview of a 090 row lands in the audit trail as a real delegated decision by nobody.

3. Still present (intent, noted for the record): the plan computes prior (_plan.go:124-127) but only exports the timestamp; the no-effect/stalled branch of decideDelegatedOne (api_repo_item_decide_delegated.go:516-531) is not mirrored, so the preview won't show #15134's blocker wording.

Suggested fix for 1+2 (mirror the real ordering, thread the user through, gate the audit):

--- a/src/pkg/dashboard/delegated_decision_human_merge.go
+++ b/src/pkg/dashboard/delegated_decision_human_merge.go
-func (s *Server) delegatedHumanMergeOutcome(repoFull string, number int, itemType, user string, mergerRole bool, in delegatedecision.Input, req delegatedDecisionRequest) (delegatedOutcome, bool) {
+func (s *Server) delegatedHumanMergeOutcome(repoFull string, number int, itemType, user string, mergerRole, dryRun bool, in delegatedecision.Input, req delegatedDecisionRequest) (delegatedOutcome, bool) {
 ...
-	s.audit.LogRecord(user, auditRepoItemDecisionDelegated, ...)
+	if !dryRun {
+		s.audit.LogRecord(user, auditRepoItemDecisionDelegated, ...)
+	}
--- a/src/pkg/dashboard/api_repo_item_decide_delegated_plan.go
+++ b/src/pkg/dashboard/api_repo_item_decide_delegated_plan.go
-func (s *Server) planDelegatedDecision(ctx context.Context, repoFull string, number int, itemType string, mergerRole bool, req delegatedDecisionRequest) (*delegatedDecisionPlan, error) {
+func (s *Server) planDelegatedDecision(ctx context.Context, repoFull string, number int, itemType, user string, mergerRole bool, req delegatedDecisionRequest) (*delegatedDecisionPlan, error) {
 	...
-	if out, ok := s.delegatedHumanMergeOutcome(repoFull, number, itemType, "", mergerRole, in, req); ok {
+	var notes []string
+	d, notes, decided := s.delegatedHumanMergeDecision(in, req, user, mergerRole)
+	if decided {
+		plan.Notes = notes
+	} else if out, ok := s.delegatedHumanMergeOutcome(repoFull, number, itemType, user, mergerRole, true, in, req); ok {
 		d = *out.Decision
 		...
 	} else {

and pass the request user from handleRepoItemDecideDelegatedPlan the same way handleRepoItemDecideDelegated does; update decideDelegatedOne:493 to pass false, and flip the _plan_test.go:88 expectation to VerdictApprove / rule human-merge-approve (plus a CI-red case expecting adopt).

β€” hive: agent=adjudicator-4 backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act and removed stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Oct 29, 2026
@hivecommons-hive

Copy link
Copy Markdown
Contributor

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

Why:

  • the branch conflicts with the base and needs a rebase

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.

@github-actions github-actions Bot removed the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
…ide rows

Operator pressed Let hive decide on three 090 rows and the row showed a
green check, a Hive is deciding spinner and the unchanged striped Ready
for human merge pill at once; later the same rows read Approving for an
adopt-supersede, hive's copies appeared as unrelated sub-rows, closed
originals became blank numbered rows, a recorded decision left the row
parked in 085 under a stale needs-human label, and event lines spoke in
raw stage codes (PR at 060 reviewed) while 060 was drawn in the merge
gate column.

- One post-decision projection (stage_tracker_decided.go): deciding ->
  decided + effect pending -> landed / timed out. The check is the
  decision badge, never a celebration; pill, chevron and progress text
  name the recorded verdict (Approving only for approve); toasts lead
  with the outcome in one line.
- Preview before acting: POST .../decide-delegated/plan (dry run, no
  side effects) and a confirm popover Let hive do that / Approve & merge
  as-is / Cancel; chosen button recorded in the trail.
- Adoption pairs: dimmed Adopted -> #N original, adopted-from chip on
  the copy, closed original as one cached-title line.
- Any recorded decision lifts needs-human + 045/085 labels in the same
  write; decided rows never project into 085.
- Shared stage vocabulary (stage_tracker_vocabulary.go + SPA mirror)
  with a guard test; 060 reviewed drawn in CI / Review as Review passed
  Β· <lane reason>; merge gate column starts at 080.
- The author's clanker, not the author's hive; local relative times in
  the no-effect popover; in-tracker maintainer merge when available.
- openapi.json + api-reference row for the plan route; docs; changelog.

Signed-off-by: Andrew Anderson <andy@clubanderson.com>
@github-actions github-actions Bot added the conflicts-with-open-pr Open PR has a merge conflict with another open PR label Oct 29, 2026
@hivecommons-hive hivecommons-hive Bot added stage/050-review-pending Review swarm requested; awaiting a verdict for the current head and removed stage/071-needs-author Human-authored PR: CI red, changes requested or conflicting; diagnosis posted, the author must act labels Oct 29, 2026
@clubanderson
clubanderson merged commit d708dc9 into v5 Oct 29, 2026
80 of 82 checks passed
@kubestellar-prow
kubestellar-prow Bot deleted the fix/decided-state branch October 29, 2026 04:23
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Your PR has been merged.

We'd love to hear how your experience was: share feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/human A person pushed this PR themselves conflicts-with-open-pr Open PR has a merge conflict with another open PR dco All commits are DCO signed-off dco-signoff: yes Indicates the PR's author has signed the DCO. role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity Monitor: Let hive decide rows contradict themselves (check + spinner + stale 090 pill); 060 reviewed drawn in the merge gate column

1 participant