[Bug]: In-process teammates never receive messages from the leader (mailbox key mismatch)
What happened?
For teammates spawned on the in-process backend, messages the leader sends
never reach the teammate. The leader's send_message and the teammate's own
mailbox poll disagree on how the inbox directory is keyed, so every
leader → teammate message is silently dropped.
Mailboxes live at ~/.openharness/teams/<team>/agents/<agent_id>/inbox/.
Write side —
InProcessBackend.send_message(agent_id="name@team", ...)splits the id and writes to the inbox keyed by the bare agent name:agents/<name>/inbox/(src/openharness/swarm/in_process.py:510,:525). This matches the rest of the swarm:write_to_mailbox(recipient_name, ...),permission_sync'sworker_id/leader_id="leader", and the"leader"idle-notification target atin_process.py:284. The existing testtest_send_message_writes_to_mailboxalso asserts this bare-name key.Read side —
start_in_process_teammatepolls the inbox keyed by the fully-qualifiedname@teamid:agents/<name@team>/inbox/(src/openharness/swarm/in_process.py:245).
Because agents/<name>/inbox/ ≠ agents/<name@team>/inbox/, the teammate polls
a different directory than the one the leader writes to. Both mailbox-delivered
message types are affected: user_message (leader hand-off / follow-up turns)
and mailbox-based shutdown.
Steps to reproduce
- Spawn a teammate on the in-process backend (e.g. team
myteam, agentrcvr). - From the leader, call
send_message("rcvr@myteam", ...). The message file lands in~/.openharness/teams/myteam/agents/rcvr/inbox/, unread. - The running teammate loop (
start_in_process_teammate→_drain_mailbox) polls~/.openharness/teams/myteam/agents/rcvr@myteam/inbox/, which is empty. - The message is never drained, never marked read, and never injected as a turn.
A focused regression test that drives one real query turn and asserts the
leader's message is consumed from the inbox is included in the linked PR; it
fails on main (message stays read=False) and passes with the fix.
Environment
- OpenHarness
main(c3479b5at time of writing) - Backend: in-process teammate backend (
InProcessBackend) - Python 3.10 / 3.11
Relevant logs or screenshots
Key lines in src/openharness/swarm/in_process.py:
# start_in_process_teammate — read side (buggy): keyed by name@team
mailbox = TeammateMailbox(team_name=config.team, agent_id=agent_id) # agent_id == "name@team"
# InProcessBackend.send_message — write side: keyed by bare name
agent_name, team_name = agent_id.split("@", 1)
mailbox = TeammateMailbox(team_name=team_name, agent_id=agent_name) # "name"
Suggested fix: poll the inbox keyed by the bare agent name (config.name) so
the read side matches the write side and the rest of the swarm's mailbox
convention.
Source: HKUDS/OpenHarness