Files
multica/server/internal/handler
Bohan Jiangandmultica-agent 70f900c573 fix: deflake wakeup and squad briefing tests, bound wakeup receipt expiry (MUL-5850) (#8633)
* test(wakeups): accept lock_not_available from losing concurrent dispatchers

dispatch sets lock_timeout 50ms so a contended rule fails fast and Tick
retries it next round. When the winning transaction runs past 50ms, as on
a slow CI runner, the losers get SQLSTATE 55P03. The test asserted every
dispatch returned nil; the contract is one winner and one run.

Co-authored-by: multica-agent <[email protected]>

* fix(wakeups): bound receipt expiry with a materialized batch

DeleteExpiredWakeupReceipts deleted by id IN (SELECT ... LIMIT 1000 FOR
UPDATE SKIP LOCKED). With a nested-loop semi join the planner rescans that
subquery per outer row; each rescan skips rows the DELETE already removed,
so the LIMIT window slides and the statement deletes every expired row.
Plan choice follows table statistics, which made
TestIssueWakeupReceiptExpiryIsBoundedAndKeepsPending flaky. A MATERIALIZED
CTE evaluates the batch once.

Co-authored-by: multica-agent <[email protected]>

* test(squads): refresh the shared runtime heartbeat before briefing claims

The squad briefing claim tests run on the TestMain runtime, whose
last_seen_at is written once at suite start. ClaimAgentTask skips runtimes
unseen for RuntimeClaimFreshnessSeconds (150s); on a slow -race runner this
late file starts past that and the claim returns {"task":null}. Refresh
the heartbeat first, as agent_builder_test does, and keep the response body
for the failure message.

Co-authored-by: multica-agent <[email protected]>

---------

Co-authored-by: multica-agent <[email protected]>
2026-09-21 16:33:16 +08:00
..