fix(swarm): deliver leader messages to in-process teammates - #337
Open
glitch-ux wants to merge 1 commit into
Open
fix(swarm): deliver leader messages to in-process teammates#337glitch-ux wants to merge 1 commit into
glitch-ux wants to merge 1 commit into
Conversation
InProcessBackend.send_message writes to the teammate's inbox keyed by the bare agent name (agents/<name>/inbox), but start_in_process_teammate polled the inbox keyed by the fully-qualified 'name@team' id. The two paths never matched, so every leader -> teammate message (user_message and mailbox-based shutdown) was silently dropped for in-process teammates. Poll the inbox keyed by config.name so it matches where send_message and the rest of the swarm (write_to_mailbox, the 'leader' idle-notification target) deliver. Add a regression test that drives a real teammate query turn and asserts the leader's message is consumed from the inbox.
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.
Issue: #336
Problem
For teammates on the in-process backend, messages the leader sends never reach
the teammate — the write and read sides key the mailbox directory differently.
Mailboxes live at
~/.openharness/teams/<team>/agents/<agent_id>/inbox/.InProcessBackend.send_message(agent_id="name@team", ...)writes to the inboxkeyed by the bare agent name —
agents/<name>/inbox/(
src/openharness/swarm/in_process.py:525). This is the convention usedeverywhere else in the swarm (
write_to_mailbox(recipient_name, ...),permission_sync'sworker_id/leader_id="leader", and the"leader"idle-notification target at
in_process.py:284), and it is pinned by theexisting
test_send_message_writes_to_mailbox.start_in_process_teammatepolls the inbox keyed by the fully-qualifiedname@teamid —agents/<name@team>/inbox/(
src/openharness/swarm/in_process.py:245).agents/<name>/inbox/≠agents/<name@team>/inbox/, so the teammate polls adirectory the leader never writes to. Both
user_messageand mailbox-basedshutdowndeliveries are silently dropped.Change
config.name(the bare agent name) so the read sidematches the write side and the rest of the swarm.
test_teammate_receives_message_sent_by_leader, which drives one realteammate query turn (stubbing
run_queryto yield a single event) andasserts the leader's message is drained and marked read from the inbox. It
fails on
main(message staysread=False) and passes with this change.One-line runtime change; no public API change.
Verification
The new test fails without the fix and passes with it.