Commit Graph

2 Commits

Author SHA1 Message Date
bf3e453160 fix(handlers/admin_queue): remove unused db import
Resolves CI build failure on PR #1950:
  internal/handlers/admin_queue.go:8:2: "github.com/Molecule-AI/molecule-monorepo/platform/internal/db" imported and not used

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 02:22:16 +00:00
a1b803ca7a fix(admin/a2a_queue): add drop-stale endpoint for post-incident queue cleanup
Issue #1947: after incidents, PM agents inherit hour-old TASK-priority
queue items from ICs that were correctly reporting "X is broken" while
X was actually broken. Once X is fixed those items are stale noise —
PMs spend ~5 min each writing "thanks, the issue is resolved".

Adds:
- DropStaleQueueItems() in a2a_queue.go: UPDATE ... SET status='dropped'
  for queued items older than maxAgeMinutes. Uses FOR UPDATE SKIP LOCKED
  to stay concurrency-safe with concurrent drain calls.
- AdminQueueHandler in admin_queue.go: POST /admin/a2a-queue/drop-stale
  (AdminAuth, ?max_age_minutes=N, &workspace_id=<id>). Returns {dropped: N}.
- admin_queue_test.go: HTTP-level tests for param validation and response shape.
- Router registration for the new endpoint.

Usage during incident recovery:
  curl -X POST /admin/a2a-queue/drop-stale?max_age_minutes=120
  # scoped to one workspace:
  curl -X POST /admin/a2a-queue/drop-stale?max_age_minutes=120&workspace_id=<uuid>

Closes #1947.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 02:08:35 +00:00