Skip to content

chore: remove unused background task queue subsystem - #43

Merged
haasonsaas merged 1 commit into
mainfrom
chore/remove-unused-task-queue
Jul 25, 2026
Merged

chore: remove unused background task queue subsystem#43
haasonsaas merged 1 commit into
mainfrom
chore/remove-unused-task-queue

Conversation

@haasonsaas

Copy link
Copy Markdown
Contributor

Summary

The repo shipped a full background task-queue subsystem (in-memory + Redis backends, retries, dead letters, adaptive auto-requeue, worker heartbeats, remediation playbooks, PagerDuty escalation, /tasks* admin endpoints) that nothing in the application uses — grep confirms enqueue() was only ever called from tests. The actual workload engine (scheduler.py / procedure_runner.py) never touches the queue, so this was pure operational surface area: ~2,100 lines of code, 18 settings knobs, a Redis dependency, and a docker-compose service with no callers.

Deleted (grep-verified as queue-only):

  • agent_pm/storage/tasks.py, agent_pm/storage/redis.py — queue + Redis state/dead-letter storage
  • agent_pm/tasks/playbooks.py — remediation playbooks (only called from the queue worker)
  • agent_pm/clients/pagerduty_client.py — only used by playbooks
  • agent_pm/observability/dashboard.py — queue-health helper, only fed /tasks/health
  • All /tasks* endpoints and queue startup/shutdown wiring in app.py
  • Queue-only Prometheus metrics (task_queue_*, task_dead_letter_*) in observability/metrics.py
  • task_queue_* (18 knobs), pagerduty_*, and redis_url settings (redis_url was only read by the deleted Redis storage)
  • redis / fakeredis dependencies (fakeredis wasn't even imported anywhere), uv lock regenerated
  • redis docker-compose service + REDIS_URL/TASK_QUEUE_BACKEND env wiring
  • Queue/Redis/playbook tests, incl. tests/test_tasks_api.py which only exercised the deleted endpoints

Kept (live, separate features):

  • agent_pm/tasks/sync.py + agent_pm/storage/syncs.py — connector sync records behind /sync/status
  • agent_pm/scheduler.py + agent_pm/procedure_runner.py — the actual cron/procedure engine
  • clients/slack_client.py — used by procedures
  • tests/storage/test_database.py — remains, so the CI storage-tests job is unchanged and still justified

Test plan

  • uv run ruff check . — pass
  • uv run ruff format --check . — pass
  • uv run mypy agent_pm — pass (67 files)
  • uv run pytest -q — 120 passed
  • Repo-wide grep: no remaining references to task queue / dead-letter / pagerduty / redis outside uv.lock history

The task queue (in-memory + Redis backends, retries, dead letters,
adaptive auto-requeue, worker heartbeats), its /tasks* admin endpoints,
remediation playbooks, and the PagerDuty client were infrastructure
without a workload: grep confirmed enqueue() was only ever called from
tests, and the real workload engine (scheduler/procedure_runner) never
touches the queue.

Remove the queue, its Redis storage, playbooks, PagerDuty client,
queue-health dashboard helper, queue-only Prometheus metrics, the
task_queue_*/pagerduty_*/redis_url settings, redis/fakeredis
dependencies, the redis docker-compose service, and the dedicated
tests. Connector sync records (/sync/status) and the procedure
scheduler are separate live features and stay.
@haasonsaas
haasonsaas merged commit f712567 into main Jul 25, 2026
6 checks passed
@haasonsaas
haasonsaas deleted the chore/remove-unused-task-queue branch July 25, 2026 02:23
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