Repository navigation
test(agents): await native dispatch in delivery nonce regressions - #2631
Conversation
Co-authored-by: forge <WyJmb3JnZSIsImRlZmF1bHQiXQ@agents.commonly.invalid> Agent-Model: codex/gpt-6.1-sol/medium
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Native dispatch and acknowledgement waits backend/__tests__/unit/services/agentEventService.deliveryNonce.test.js |
Adds helpers to wait for an exact native run call count and for a run’s acknowledgement. Updates delivery and sweep tests to await these events before checking state, and keeps selected mocked runs pending. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Other
Possibly related PRs
- Team-Commonly/commonly#2558: Adds wake and digest delivery paths and updates the same test suite for native dispatch and digest handling.
Merge Risk: 
Minimal · up to a64fa
-
The identified second-sweep concern does not affect this test scenario. No actionable merge-blocking issue remains after normal checks.
Pre-merge checks: 
4
-
Full details: Title check
-
Explanation
The title "test(agents): await native dispatch in delivery nonce regressions" names the main change: the delivery nonce regression tests now await native dispatch and acknowledgement instead of asserting immediately. It matches the file-level summary and the PR objectives, and it uses a conventional test(...) prefix. The title is specific and not vague.
Full details: Description check
-
Explanation
The description explains the cause (native dispatch is fire-and-forget, so immediate call-count assertions and short delays race the real Mongo reads and acknowledgement writes), lists the test-only corrections, and gives verification evidence. It matches the changes in the raw summary and the PR objectives. It also includes a non-essential attribution line, which does not make it off-topic.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
lilyshen0722
left a comment
There was a problem hiding this comment.
TIER 0 PRESS CHECK at a64fa6f.
This PR changes one test file, backend/tests/unit/services/agentEventService.deliveryNonce.test.js, with no production code. Every CodeRabbit thread is answered (cr-unanswered: 0), and CI at this head is green.
GATE: PASS
Written by Forge, a Commonly agent — https://commonly.me/v2/pods/6a692a1be833c668acdb84cf
Cause
Native dispatch is intentionally fire-and-forget. It awaits folded/raw digest reads before invoking
runAgent, so enqueue/garbageCollect returning proves a claimed delivery, not an invoked runner. Several nonce tests asserted call counts immediately or gave the real Mongo reads only 500 ms. Late-settle tests also assumed twosetImmediateticks were sufficient for acknowledgement writes. Some sweep mocks resolved immediately, allowing terminal writes to race the next test's database cleanup.Test-only correction
No production files change. Tier 0: CodeRabbit threads answered and green CI before operator press.
Proof
--runInBand --detectOpenHandles, without--forceExit.MONGOMS_EXP_NET0LISTEN=trueso Mongo gets an OS-assigned free port on this shared machine; an earlier control attempt hit another process on port 9010 and was excluded from the tally.git diff --checkpasses. Only this test file changes. Local repeat logs:/tmp/nonce-repeat-01.logthrough20.logand/tmp/nonce-repeat-results.json.