Repository navigation
π Activity Monitor: one coherent post-decision state for Let hive decide rows; 060 reviewed in CI / Review - #15186
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
|
There was a problem hiding this comment.
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}, trueChecked 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
There was a problem hiding this comment.
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
|
@clubanderson this PR is held at Failing checks:
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. |
There was a problem hiding this comment.
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
0557f27 to
91083aa
Compare
|
@clubanderson this PR is held at Why:
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. |
β¦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>
91083aa to
bee6dc2
Compare
|
Thank you for your contribution! Your PR has been merged. We'd love to hear how your experience was: share feedback |
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
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 forapprove(test).POST β¦/decide-delegated/plan(dry run, no side effects; openapi + api-reference) β popover Let hive do that / Approve & merge as-is / Cancel;chosenrecorded in the trail.needs-human+ 045/085 stage labels in the same write (liftDelegatedParkLabels,pr_decision_operator.go); a decided row never projects into 085.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.stagelabelslabel's column + phrase. The engine already moves 060β080 (AuthorSideDoneβ AwaitingMergeAdmission) before merging, so no engine change.dashboard-sections.md(decision lane state machine, legend),changelog.d/fixed-decided-state.md.Notes
Author.Kindunknown inenrichStageFacts.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.