fix: restore task processor pipeline and eliminate /ws 403 spam (#91)

The microservices refactoring (PR #88) accidentally dropped handler
registration, zombie reconciliation, and startup drain from app.py.
Every task entering the queue was immediately backlogged with
"No handler for task type" because self._handlers stayed empty.

Restores the three critical blocks from app_backup.py:
- Register handlers for chat_response, thought, internal, bug_report,
  task_request
- Reconcile zombie RUNNING tasks from previous crashes
- Drain all pending tasks on startup before entering steady-state loop
- Re-approve tasks that were backlogged due to missing handlers

Also adds a /ws WebSocket catch-all that accepts stale connections and
closes with code 1008 instead of spamming 403 on every retry, and a
`make fresh` target for clean container rebuilds with no cached state.

Co-authored-by: Alexander Payne <apayne@MM.local>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexander Whitestone
2026-02-28 12:18:18 -05:00
committed by GitHub
parent 79e8a6894a
commit 7b967d84b2
2 changed files with 88 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
.PHONY: install install-bigbrain install-creative dev nuke test test-cov test-cov-html watch lint clean help \
.PHONY: install install-bigbrain install-creative dev nuke fresh test test-cov test-cov-html watch lint clean help \
up down logs \
docker-build docker-up docker-down docker-agent docker-logs docker-shell \
cloud-deploy cloud-up cloud-down cloud-logs cloud-status cloud-update
@@ -59,6 +59,18 @@ nuke:
@sleep 0.5
@echo " ✓ Port 8000 free, containers stopped, caches cleared"
# Full clean rebuild: wipe containers, images, volumes, rebuild from scratch.
# Ensures no stale code, cached layers, or old DB state persists.
fresh: nuke
docker compose down -v --rmi local 2>/dev/null || true
docker compose build --no-cache
mkdir -p data
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d
@echo ""
@echo " ✓ Fresh rebuild complete — Timmy Time at http://localhost:8000"
@echo " Hot-reload active. Logs: make logs"
@echo ""
# Print the local IP addresses your phone can use to reach this machine.
# Connect your phone to the same hotspot your Mac is sharing from,
# then open http://<IP>:8000 in your phone browser.
@@ -254,6 +266,7 @@ help:
@echo " make install-creative install with creative extras (torch, diffusers)"
@echo " make dev clean up + start dashboard (auto-fixes errno 48)"
@echo " make nuke kill port 8000, stop containers, reset state"
@echo " make fresh full clean rebuild (no cached layers/volumes)"
@echo " make ip print local IP addresses for phone testing"
@echo " make test run all tests"
@echo " make test-cov tests + coverage report (terminal + XML)"