Add tenant-discriminated claims for a shared queue - #1
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22f3a41a83
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71c1b5997c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Why
Basic Memory Cloud needs one shared agent queue while PGQ retains tenant admission and fairness. A PGQ worker must execute one ready Absurd batch for its selected tenant without creating a queue/table set per tenant.
What Changed
discriminatorat spawn, with a(discriminator, task_id)index.claim_taskargument, applied before ordering, limiting, and locking. Cancellation and expired-lease maintenance use the same discriminator.ready_discriminatorsdiscovers ready work and due maintenance without claiming it.Implementation Details
The discriminator belongs to the logical task, so retries and resumed runs preserve it without changing run/checkpoint logic. Omitting the claim discriminator retains queue-wide behavior. This is an admission aid, not an authorization or fairness system; PGQ owns those decisions and holds its slot while awaiting work_batch.
Testing
uv run --directory tests pytest -q --ignore=test_cron_pgcron_e2e.py --ignore=test_build_absurdctl.py: 172 passed.uv run --directory sdks/python pytest -q: 95 passed.Risks / Follow-ups
This fork targets fresh installations; an upgrade migration for existing Absurd queues is not included. SQL and Python SDK must be installed together. Other SDKs retain their existing unfiltered behavior. Full pg_cron container and CLI build tests were not run. Cloud integration and development runtime acceptance remain in basicmachines-co/basic-memory-cloud#1980.
AI Assistance
Implemented, tested, and described with Codex. This PR is against the Basic Machines fork, not an upstream contribution.