Skip to content

Keep route readers scoped to individual operations - #2915

Merged
trissim merged 2 commits into
mainfrom
fix/route-operation-locks
Oct 23, 2026
Merged

trissim merged 2 commits into
mainfrom
fix/route-operation-locks

Conversation

@trissim

@trissim trissim commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Core watch inherited CliCommand.execute's Comms.client scope around its entire stream, blocking route publication until the watcher exited. The watch now waits unlocked and opens a client scope per inbox read and acknowledgment. Watch setup releases its scope before stream.write; the joined worker completes before its poll scope closes. The old MessageBus.watch implementation is deleted and all five direct test consumers migrate to the Comms owner.

Scope changes landed first in d1229ad. Then d0ea169 removed RouteReadersHold, its ten-second limit and translated message, and uses the existing unbounded contention policy. There were no catches or tests naming that error on these heads.

Paired with OpenHCSDev/toad#1166 at 5a7548f5e51eb2397ffa8dbddb6a27f4279a7a7f. Current Toad main already had #1159's lifetime cleanup transfers removed; the paired change uses direct opening contexts and checks RouteSelection before each ACP prompt.

Step 0 after:

Holder after the change Scope
Toad comms_root.py:374-380 Open and validate one service; the context exits before observation attaches.
Toad acp/agent_process.py:73-93 Select/attach/start one connection; no cleanup-stack transfer. Prompt rechecks the route at :97.
Core cli_commands.py:939-940 One ordinary CLI operation.
Core cli_commands.py:1411-1413 Open the watch's history source, before either streaming task starts.
Core cli_commands.py:1449-1450 Watch setup only; stream.write runs after exit.
Core comms.py:100-101 Capture one recipient identity.
Core comms.py:106-112 One inbox page read, joining its worker before releasing the context.
Core comms.py:115-116 One acknowledgment, outside the generator yield.
Core route_selection.py:70-71 One synchronous selected write.
Core comms.py:92-93, active_route.py:62-63 Context-manager plumbing for the operations above, rather than application/process lifetime.
Core active_route.py:187-188 Historical-root write guard; callers hold it for individual message/channel/order writes.

client_wire is a context factory, not an entered lifetime holder. Historical-root write callers were traced in input_origin, messaging, channel_management, publisher, coordination_tables/refusals and todos; each encloses its one write operation. Route publication waits in active_route.py:267 through the existing UNBOUNDED_CONTENTION, with no deadline or refusal translation.

Search RouteReadersHold|default-route readers hold across both repositories' src and tests: empty. Changed Python source parses and the paired Core/Toad modules import from the two checkouts. No tests, application launch or install ran, as directed; the review fork owns execution.

Assumed: the existing client and write operations finish; historical-root writes retain their current guarded scope; the pair ships in the same runtime update.

@trissim
trissim marked this pull request as ready for review October 23, 2026 21:16
Copilot AI balanced review requested due to automatic review settings October 23, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 830c235 into main Oct 23, 2026
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants