Skip to content

feat(ops): per-tab Clear All on the Operations page (#1017) - #1146

Merged
vybe merged 1 commit into
devfrom
feature/1017-ops-clear-all
Jun 11, 2026
Merged

vybe merged 1 commit into
devfrom
feature/1017-ops-clear-all

Conversation

@vybe

@vybe vybe commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a per-tab Clear All button to the Operations page (Needs Response / Notifications / Resolved) with a confirmation dialog stating the fleet-global blast radius; hidden when the active tab is empty; badges and feeds update immediately via one WebSocket event per bulk op.
  • Three new bulk endpoints, all scoped to the caller's accessible agents (tri-state contract: admin = no filter, empty set = no-op):
    • POST /api/operator-queue/bulk-cancel {ids} — cancels only the items the operator actually saw (race-safe vs the 5s sync loop), returns {cancelled, skipped}
    • POST /api/operator-queue/clear-resolved — hides terminal rows via a new cleared_at column (migration operator_queue_cleared_at). Deliberately not a DELETE: the sync loop re-creates DB-missing items whose agent-file entry still says pending (always true for expired items, and for cancelled ones inside the propagation window). Actual deletion deferred to the retention sweep (Add operator_queue retention sweep to cleanup_service #1142)
    • POST /api/notifications/dismiss-all — pending + acknowledged → dismissed in one statement
  • Closes two adjacent reliability gaps the bulk feature would have amplified:
    • sync write-back now propagates cancelled/expired status into agent queue files, so agents stop waiting on cleared items
    • respond-vs-bulk-cancel race returns 409 instead of a silent 200 that never recorded the response
  • Both bulk ops are audit-logged (new AuditEventType.OPERATOR_QUEUE / NOTIFICATION).
  • Resolved feed now also shows cancelled/expired items (previously they vanished from the UI entirely).

Changes

Backend: routers/operator_queue.py, routers/notifications.py, db/operator_queue.py, db/notifications.py, db/schema.py + db/migrations.py (cleared_at), database.py, services/operator_queue_service.py, services/platform_audit_service.py
Frontend: views/Operations.vue, stores/operatorQueue.js, stores/notifications.js, utils/websocket.js, components/operator/ResolvedCard.vue
Docs: architecture.md, feature flows operating-room.md + agent-notifications.md

Test Plan

  • New suite passes: pytest tests/test_ops_clear_all.py -v (20 tests — scoping isolation between users, tri-state accessible-set incl. zero-agent no-op, idempotency, 409 conflict marker, hide-not-delete + list exclusion, responded-row delivery survival, oversized-ids 422)
  • Existing suites unaffected: test_operator_queue.py + test_notifications.py (85 passed)
  • Migration verified on a populated local DB (schema_migrations row + column present)
  • Manual UI verification via Playwright: confirm dialogs per tab, clear executes, empty state appears, button hides, NavBar badge drops without refresh, audit rows written

Follow-ups filed: #1142 (operator_queue retention sweep), #1143 (NavBar notification badge capped at 1 — pre-existing).

Closes #1017

🤖 Generated with Claude Code

Bulk clear actions for the Operating Room queue and agent notifications:

- POST /api/operator-queue/bulk-cancel — cancels only the ids the operator
  actually saw (race-safe vs the 5s sync loop); per-id accessible-agent
  scoping; returns {cancelled, skipped}
- POST /api/operator-queue/clear-resolved — hides terminal rows
  (acknowledged/cancelled/expired) via a new cleared_at column. NOT a
  DELETE: the sync loop re-creates DB-missing items whose agent-file entry
  still says pending (always true for expired, and for cancelled inside
  the propagation window). Deletion deferred to the retention sweep (#1142)
- POST /api/notifications/dismiss-all — pending+acknowledged → dismissed
  in one statement, same accessible-set the list endpoint uses
- Sync write-back now propagates cancelled/expired status into agent queue
  files (in-place flips only) so agents stop waiting on cleared items
- Respond-vs-bulk-cancel race now returns 409 instead of a silent 200
  that never recorded the response
- One audit-log entry + one WS event (operator_queue_cleared /
  notifications_cleared) per bulk op; stores refetch on receipt
- Operations.vue: per-tab Clear All button (hidden when empty) with
  blast-radius confirmation; Resolved feed now shows cancelled/expired
- Tests: tests/test_ops_clear_all.py (20 tests — scoping isolation,
  tri-state accessible-set, idempotency, 409 marker, hide-not-delete)

Closes #1017

Co-Authored-By: Claude Fable 5 <[email protected]>
@github-actions

Copy link
Copy Markdown

⚠️ Nightly unit-suite check skipped — merge conflict against dev.

Resolve by running git merge dev locally and pushing the result. The next nightly run will re-test once the conflict is gone.

@vybe
vybe merged commit 8edb948 into dev Jun 11, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant