Repository navigation
fix(realtime): keep an Available agent unpaused across reconcile and membership saves - #338
Merged
Harol-Reina merged 2 commits intoOct 4, 2026
Conversation
All 22 Verbara.Sdk.Pro.* pins move from 2.17.0-pro together: Pro packages depend on their siblings at the same version, so a partial bump risks NU1605. 2.17.1-pro is a patch with no API change; its queue_members upsert keeps an existing row's paused value on conflict.
…membership saves Every 60 s RealtimeReconciliationService, and every membership save through RealtimeSyncingQueueMembershipStore, re-issued AddQueueMemberAsync, which wrote queue_members.paused = 1. app_queue then skipped an idle Available agent until the agent changed state by hand. Extract AgentPauseCoordinator: the pause rule (!AgentStateMachine.IsRoutable(agent.State) || agent.PendingState is not null) and the per-agent lock, moved out of RealtimeStateBridge. After each voice upsert, the reconciler (once per agent per pass, after its last upsert) and the membership decorator call ConvergeAsync, which re-reads the agent from the undecorated store under that lock and writes SyncAgentPausedAsync (DB only, no AMI). The bridge keeps its event mapping and AMI QueuePause, under the same lock. The coordinator is registered in AddRealtimeSyncingStores, so Program.cs does not grow. The lock is per process: with several API replicas a reconcile on one pod can still race a state change on another (accepted, design R2). Change: queue-members-stay-unpaused-across-reconcile (Verbara.Platform/ADR-0026).
Harol-Reina
deleted the
feat/queue-members-stay-unpaused-across-reconcile
branch
October 4, 2026 12:58
Merged
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.
Host leg of the cross-repo change
queue-members-stay-unpaused-across-reconcile(decision_ref: Verbara.Platform/ADR-0026). The Pro leg shipped as2.17.1-pro(Verbara.Sdk.Pro #185).Defect
Measured in verbara-meta catalog card
PLT-SDK-01. Every 60 s,RealtimeReconciliationServicere-adds every queue member through Pro'sAddQueueMemberAsync, which wrotepaused=1. A membership save did the same. An agent who stayed Available and idle across one tick was paused again inqueue_members. app_queue then stopped offering that agent queue calls while the console kept showing it Available. In 2.25.0 this happens from the first tick. Since the Sdk 2.7.0 cascade, each answered call clears it, so it shows up intermittently.Fix
Verbara.Sdk.Pro.*pins move to2.17.1-pro. Pro's upsert no longer touchespausedon an existing row.AgentPauseCoordinator, which holds:!AgentStateMachine.IsRoutable(agent.State) || agent.PendingState is not null;RealtimeStateBridge.AddQueueMemberAsync, the reconciler andRealtimeSyncingQueueMembershipStorere-read the agent under that lock and callSyncAgentPausedAsyncwith its real state.Verification
The regression tests were written first. Both failed on the unfixed code: only
AddQueueMemberAsyncwas called, with noSyncAgentPausedAsync. Seven mutations were tried (convergence removed, lock bypassed, pending-pause clause dropped, Busy treated as paused, among others), and the tests caught all seven.Lab acceptance: verbara-lab
platform/h159-queue-owner, 2 runs × 20 calls against this branch (before the rebase onto fix(conversations): read message history stored as jsonb #337):Before this fix, the same branch lost 1–14 calls per run.
An independent verifier re-ran each stage. After the rebase onto
4dfb35de(fix(conversations): read message history stored as jsonb #337), the restore against the published 2.17.1-pro, the Release build, the 33 unit-test assemblies and the Invariant Gates were re-run, all green. CodeQL branch gate: 0 results on added lines.Rollback
Revert this PR. Pro goes back to 2.17.0-pro and the re-pause comes back. There is no schema or configuration change.
🤖 Generated with Claude Code