Repository navigation
fix(cms): queue concurrent selected content runs reliably - #89
Merged
Merged
Conversation
Co-Authored-By: Codex <[email protected]>
snowopsdev
marked this pull request as ready for review
September 5, 2026 03:54
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: 116a212e54
ℹ️ 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".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
E2E-006: two editors starting selected content runs concurrently can lose one launch. The second request fails with PostgreSQL SQLSTATE 40001, even though selected runs are intended to queue behind existing work. Discovery and onboarding retain their rule allowing only one active run.
Why This Change Was Made
The launch transaction already takes a transaction-scoped advisory lock before checking active runs and creating the run plus job. Under SERIALIZABLE isolation, the lock query establishes a snapshot before waiting; a waiting transaction retains that stale snapshot after the previous launcher commits, causing a serialization failure. Use READ COMMITTED so the statements following lock acquisition see the latest committed state. The advisory lock, atomic run/job transaction, and active-run checks remain in place.
User Impact
Concurrent selected launches queue successfully. Operators do not need to retry a rejected launch caused by another editor starting work at the same time. The queue continues executing content runs under its existing concurrency key. No schema or public API changes are involved.
Evidence
A regression using a real article and migration-built isolated Postgres database failed against baseline 56c0731: one of two selected launches was rejected with SQLSTATE 40001, reporting read/write dependencies among transactions. The regression passes at 116a212. The selected-run regression plus existing admin exclusion, snapshot, and readiness checks pass 4/4. Both workspace typechecks, scoped ESLint, and git diff --check pass.
Bounded local workflow stress ramped concurrency through 1, 2, 5, 10, and 20. Each attempt made 38 launches, with two attempts totaling 76 operations and no retries. The measured attempt completed in 376.20 ms (101.01 launches/s), with p50/p95/p99 latencies of 51.11/131.10/136.79 ms, n=38, zero errors, and exactly 38 run records plus 38 queued jobs. Additional scenarios verified admin/selected queue pairing, duplicate run IDs without orphan jobs, and rollback plus retry after an injected enqueue failure. All provider behavior was mocked; this measures launch throughput rather than model generation.
Material risk: correctness continues to depend on launch callers using this shared advisory-lock transaction. This change does not protect independent database writers that bypass the launch function, and does not introduce recovery for worker process crashes. The campaign stress harness and generated artifacts are excluded from this PR.