Repository navigation
✨ feature: persist Activity Monitor operator actions - #15004
thatguywob wants to merge 1 commit into
Conversation
Record row action outcomes in a capped dashboard-owned ledger and expose retained history and tracker summaries. Include selected rows in bulk retry requests and record delegated decisions after completion. Hive-Run: hivecommons#14996 Hive-Plan: activity-monitor-operator-ledger Hive-Spec: issue-14996#scope Signed-off-by: thatguywob <thatguywob@users.noreply.github.com>
|
[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 |
|
@thatguywob this PR is back in your court ( Failing checks:
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. Your relay session received this as a |
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #14992 (your owner-authored ledger + badge, Fixes #14991) or the hive split #15004 (server, Closes #14996) + #15003 (UI, Closes #14998) is the operator-action ledger that lands on v5 — they implement the same /data/operator-actions.json ledger with incompatible wire shapes and cannot both merge.
Conclusion: this PR and #14992 implement the same feature — a server-side operator-action ledger at /data/operator-actions.json, keyed repo#number, capped at 20, surfaced as last_operator_action / operator_action_count on tracker rows and via a new GET /api/repos/{owner}/{repo}/items/{number}. Both add src/pkg/dashboard/operator_actions.go and operator_actions_test.go and wrap the same handlers (hold, decision, decide-delegated, accept-triage, send-to-human). I read both diffs in full; they are not byte-duplicates — they conflict on the wire shape, so only one can land.
Verified differences (this PR → #14992):
OperatorAction.Outcomeis free-text:"ok"on success, else the responseerrorstring / status text (operator_actions.goobserveOperatorAction). #14992 uses a closed vocabularypending|applied|no-op|failed|superseded-by-state-changeplus a separatedetail.- Head field is
headhere vshead_shain #14992; this PR has notargetand no derivedstate/followed[]. operator_action_countis emitted unconditionally here (json:"operator_action_count"),omitemptyin #14992.- #15003's UI (sibling of this PR) hard-codes
action.outcome !== 'ok'⇒ "action failed" (static/index.html,+76), so it is bound to this PR's shape and would mislabel every success if #14992's server shipped instead.
What I checked and found fine in this PR: actor attribution via X-Hive-User matches the existing handlers (api.go:811, api.go:1342); the read-modify-rename is serialized under a package mutex and an unreadable ledger is never overwritten (appendOperatorAction); attachOperatorActions is hooked into the tracker response build.
Issue lineage, from the PR bodies: #14992 cites the owner request in #14991 verbatim and covers (c) badge + trail end to end; #14996/#14998 appear to be the hive's split of that same request. If #14992 is preferred, this PR and #15003 can be closed as superseded. If the split is preferred, #14992 should be closed and the two hive PRs merged in order (#15004 before #15003). I have not closed anything.
— hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88
Open PR overlap checkBase branch: Conflicts are checked with every PR merged onto the current tip of
|
There was a problem hiding this comment.
Decision needed: @clubanderson should decide whether #15004 (+ its UI consumer #15003) or the owner-authored #14992 is the operator-action ledger that lands; both create src/pkg/dashboard/operator_actions.go with incompatible last_operator_action shapes.
Conclusion: the ledger implementation is correct and conservative (never overwrites an unreadable file, tmp+rename, storage failure never fails the action), but it collides with #14992 and the head is red on a spec-parity test.
1. Collides with #14992. Both PRs create src/pkg/dashboard/operator_actions.go / operator_actions_test.go, use /data/operator-actions.json, register GET /api/repos/{owner}/{repo}/items/{number}, and add last_operator_action + operator_action_count to StageTrackerItem. The record shapes differ: here OperatorAction (operator_actions.go:18-25) is {action, actor, at, note, outcome, head, stage}; #14992 emits {…, state, stage_at, followed[], head_sha, detail, target} with server-derived state. #15003 consumes this shape (action.stage, action.outcome, action.at), so the realistic choice is "this pair" vs "#14992". A maintainer should pick; I have not closed anything.
2. dashboard/openapi.json not updated — TestOpenAPISpecCoversEveryRegisteredRoute fails on every dashboard shard (openapi_route_parity_test.go:388, "495 registered, 485 documented, 1 problem"). The spec has …/items/{number}/hold (dashboard/openapi.json:28207) but no entry for the new bare …/items/{number} GET. Add the path (the issue's check-api-reference-citations.sh --fix covers api-reference.md only, not the OpenAPI spec).
3. Low — lock scope. newOperatorAction (operator_actions.go:97-112) runs s.buildStageTracker(...) while holding s.statusMu.RLock(). buildStageTracker doesn't touch statusMu, so no deadlock, but the two existing callers (delegated_pr_context.go:85-93, stage_tracker.go handleStageTracker) snapshot s.status under the lock and build outside it. Same pattern would keep write-lock holders from stalling on a full tracker rebuild per operator click.
Body vs diff: matches — hold/decision/decide-delegated/accept-triage/send-to-human are wrapped, bulk rescan carries selected items, GET returns newest-first. Nothing else verified worth raising.
— hive: agent=reviewer-2 backend=copilot model=claude-fable-5.1 copilot=1.0.88
Closes #14996
Activity Monitor actions now retain their operator and outcome in
/data/operator-actions.json, capped at 20 entries per item. Tracker rows exposelast_operator_actionandoperator_action_count;GET /api/repos/{owner}/{repo}/items/{number}returns retained history newest first.Hold/release, decisions, triage acceptance and send-to-human record success and error responses without allowing a storage failure to fail the action. Delegated decisions record their final job outcome. Bulk retries still perform one rescan, now carrying the selected items so each row receives a ledger entry. Entries capture the row's head and stage before mutation and retain comments or supersession references.
Added tests for persistence, retention, item isolation, corrupt-ledger preservation, tracker summaries, head/stage snapshots, handler success and failure, storage failure tolerance, the GET route and bulk retries. Go tests are delegated to CI per AGENTS.md; changed Go files pass
gofmt -l. Ran the issue-requestedbash src/scripts/check-api-reference-citations.sh --fix(142 citations updated, none unresolved). Includes the changelog fragment and API documentation.— hive: backend=codex
🐝 Hive Agent:
contributor| SHA:39858f993