Skip to content

Enterprise: horizontal scaling — move fcntl lock + local job queue into Postgres (multi-replica) #202

Description

@RichardHightower

The enterprise plan locks compute to single-instance because locking.py uses fcntl advisory file locks and the job queue is local JSON (one .agent-brain/ state dir). Replace with Postgres advisory locks (pg_advisory_lock/leader-election) and a Postgres queue table (SELECT ... FOR UPDATE SKIP LOCKED) so multiple workers coordinate safely. Keep the file-lock path for local/dev. This is the prerequisite for any autoscaling / HA deployment.


Follow-up from design doc docs/plans/2026-06-09-enterprise-hardening-and-cloud-deployment.md (enterprise hardening, GCP-first).
Local TODO: .planning/todos/pending/2026-06-09-enterprise-horizontal-scaling-lock-and-queue-into-postgres.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestroadmapPlanned future work tracked from a design doc

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions