[codex] fix(outbox): preserve local FIFO event order - #1321
Merged
Conversation
Co-Authored-By: Paperclip <noreply@paperclip.ing>
kkroo
marked this pull request as ready for review
August 12, 2026 01:32
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Merged
13 tasks
|
@ally head Requested a review from @allyblockcast directly (native GitHub review request, not just this comment) against current head |
There was a problem hiding this comment.
Ally — Consolidated PR Review
Lenses: pr-review-toolkit (code, tests, comments, errors, types) + gstack/review + native-codex.
Reviewed head: a06190e
Critical Issues (0)
Important Issues (0)
Suggestions (1)
- [pr-review-toolkit/tests]
server/src/__tests__/plugin-event-outbox.test.ts:51— make the first insert wait on an explicit promise released after the second insert is scheduled, rather than only onesetImmediateturn. As written, the first insert may complete before the secondlogActivityreaches the outbox, so the test can pass without exercising the out-of-order completion race that the new queue is intended to prevent.
Strengths
- The enqueue tail serializes database insert completion while preserving the detached
publishPluginDomainEventAPI. - Insert failures are logged and swallowed inside each queued operation, so one failed write does not poison subsequent events.
- The regression test checks persisted
seqorder rather than only invocation order.
Recommended Action
- Consider making the delayed-insert test deterministic before relying on it as coverage for the race.
- The implementation is safe to merge.
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.
Thinking Path
Linked Issues or Issue Description
Related: #1031, which protects transactional outbox writes. This is a separate normal detached-publication path.
Bug report:
plugin_event_outbox.seq.logActivityforissue.createdand thenissue.updated, and observe reversed persisted order without this fix.What Changed
seqordering.Verification
pnpm exec vitest run server/src/__tests__/plugin-event-outbox.test.ts --no-file-parallelism --maxWorkers=1pnpm exec vitest run server/src/__tests__/plugin-event-outbox.test.ts server/src/__tests__/plugin-orchestration-apis.test.ts --no-file-parallelism --maxWorkers=1pnpm --filter @paperclipai/server exec tsc --noEmitgit diff --checkRisks
Low operational risk. Ordering is serialized per process only; independent replicas can still interleave database inserts. Transactional callers should continue using the existing atomic/deferred publication paths when they need cross-replica causal coupling. The queue tail adds at most one pending promise per detached event and does not make the activity request await the outbox write.
Model Used
OpenAI Codex (GPT-5 family; exact deployment identifier is not exposed by the runtime), using repository inspection, test execution, and a delegated coding subagent whose local proposal was independently reviewed and validated.
Checklist