You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
swarm: await_members has no blocking mode and swarm dependency IDs are not accepted by bg wait #2152
Type: enhancement (the non-blocking wake behavior is by design and works; this is adding an opt-in blocking/unified wait) Labels:enhancement, swarm
Problem swarm await_members is non-blocking: it registers a dependency and returns immediately with "Watching ... in the background. You'll be woken." The wake mechanism works, but there is no synchronous join, and the dependency ID returned is not accepted by bg wait (which only knows background tasks). A coordinator with nothing else to do ends up in a poll loop (swarm list / repeated await_members), and the two "waitable" subsystems (swarm deps vs. bg tasks) do not share a common handle.
Code
crates/jcode-app-core/src/server/background_tasks.rs:259-343 — dispatch_swarm_await_completion delivers a soft-interrupt + wake when the condition is met; it is inherently non-blocking.
This is a deliberate design decision, not a bug. The code comment in communicate.rs:1784-1786 states:
Public member waits are always asynchronous. The blocking CommAwaitMembers protocol remains available internally, but agents must not park an entire turn waiting on a worker or a long-lived socket.
The background flag is hardcoded to true (line 1786) regardless of what the agent requests. If an agent requests background: false, the response includes a compatibility note: "Blocking member waits are no longer supported; this wait was started asynchronously."
The rationale: a blocking wait would park the agent's entire turn (and the coordinator's turn) on a long-lived socket, blocking all other work. The recommended pattern is:
Start the wait with background: true (default).
Record the returned wait ID in todo.waiting_on.
Continue working on independent tasks.
The wait completes in the background and notifies/wakes the session.
The internal CommAwaitMembers protocol does support blocking (the background: false path exists in the server), but it is intentionally not exposed to the public swarm tool to prevent agent turns from stalling.
This is not something to fix — it is the intended behavior. Closing as not-a-bug.
Thanks for following up with the code comment. Triage: as you noted, non-blocking member waits are intentional. I am leaving this open for the maintainer to confirm whether to close it or keep the unified wait handle idea as a feature request.
— Jcode agent (automated triage), on behalf of @1jehuang
Activity
osmanaksu commentedon Nov 12, 2026
This is a deliberate design decision, not a bug. The code comment in
communicate.rs:1784-1786states:The
backgroundflag is hardcoded totrue(line 1786) regardless of what the agent requests. If an agent requestsbackground: false, the response includes a compatibility note: "Blocking member waits are no longer supported; this wait was started asynchronously."The rationale: a blocking wait would park the agent's entire turn (and the coordinator's turn) on a long-lived socket, blocking all other work. The recommended pattern is:
background: true(default).todo.waiting_on.The internal
CommAwaitMembersprotocol does support blocking (thebackground: falsepath exists in the server), but it is intentionally not exposed to the public swarm tool to prevent agent turns from stalling.This is not something to fix — it is the intended behavior. Closing as not-a-bug.
1jehuang commentedon Nov 13, 2026
Thanks for following up with the code comment. Triage: as you noted, non-blocking member waits are intentional. I am leaving this open for the maintainer to confirm whether to close it or keep the unified wait handle idea as a feature request.
— Jcode agent (automated triage), on behalf of @1jehuang