Repository navigation
Description
✅ RESOLVED 2026-06-05 — APScheduler on a PostgreSQL job store. Celery/Celery Beat rejected. See the decision comment below and
docs/planning/TARGET_ARCHITECTURE.md§Scheduling + Key Open Questions #4 (now marked Resolved). Job-store wiring folds into the PostgreSQL migration (#300). Closed as completed.
Summary
Decide whether the target-architecture scheduling layer is Celery Beat + workers (full distributed task queue) or APScheduler backed by a PostgreSQL job store (persistence without the full Celery stack).
Context
docs/planning/TARGET_ARCHITECTURE.md §"Scheduling" originally named Celery Beat as the target. After the 2026-06-05 coordination revision (push actor-model → pull / work-stealing, Epic #1045 / #1081), task execution moved onto the agents' own worker pools — leaving the scheduler with only "enqueue a queued row on a cron tick." The doc now commits to APScheduler on a PostgreSQL job store in both §Scheduling and Key Open Questions #4.
Decision (resolved)
APScheduler + PostgreSQL job store. Celery/Celery Beat rejected. Full reasoning in the decision comment. Redundancy comes from a Redis-lock leader election over a second APScheduler instance — no broker / worker processes / result backend / routing config. PgBouncer (a downstream consequence of Celery prefork workers) is avoided; PostgreSQL is the only non-negotiable new service.
Follow-up
- Job-store wiring (SQLite → PostgreSQL jobstore) folds into Configurable database backend: SQLAlchemy Core abstraction (SQLite + PostgreSQL) #300 (PostgreSQL backend) — no separate migration ticket needed.
Historical notes (pre-resolution)
- Strong prior on APScheduler+PG: most Trinity deployments are single-node; Celery's redundancy benefit doesn't pay for itself. ✅ confirmed.
- Counter-prior: replica groups (Replica groups: horizontal scaling for single agents #927) implies multi-node eventually. Addressed — pull's atomic row-claim is itself the competing-consumer primitive, so replicas pull the same queue without Celery.
- Sprint A's bug: APScheduler max_instances=1 causes skipped executions despite agent having parallel slots #132 already moved APScheduler to true fire-and-forget.
Compatibility with the actor-model destination— superseded: the actor/mailbox model was replaced by pull on 2026-06-05; scheduler fires are durablequeuedrows, not mailbox messages.
🤖 Generated with Claude Code
Activity
docs(target-arch): cross-reference tracking issues for open questions
Keesan12 commentedon May 26, 2026
This looks like a coordination or scheduling contract issue. I’d make the envelope or schedule semantics visible in one place before layering on more behavior. I’d make the schedule semantics visible in one place and add a boundary test for the drift case. That keeps the fix reviewable and avoids trading one hidden failure for another. If this is useful, I can help turn it into a compact repro checklist or PR shape.
vybe commentedon Jun 5, 2026
Under pull (#1081) the scheduler becomes "just a producer that enqueues a
queuedrow" and never dispatches to or blocks on an agent — which weakens the distributed-redundancy case for Celery. Decision stays p3 and orthogonal to the coordination model, which only requires that triggers result in a durable queued row.vybe commentedon Jun 5, 2026
Resolved 2026-06-05 — APScheduler on a PostgreSQL job store. Celery/Celery Beat rejected.
Decision driven by the 2026-06-05 coordination revision (push actor-model → pull / work-stealing; Epic #1045, umbrella #1081):
queuedrow on a cron tick" — it never dispatches to or blocks on an agent.SET NX EX) over a second APScheduler instance, without Celery's operational surface.Recorded in
docs/planning/TARGET_ARCHITECTURE.md§Scheduling and Key Open Questions #4 (now Resolved). Job-store wiring (SQLite → PostgreSQL jobstore) rides #300, not a separate ticket. Closing as completed.docs(target-arch): trim stack — APScheduler+PG over Celery, defer PgB…