[Bug]: In-process teammates never receive messages from the leader (mailbox key mismatch)

Author: glitch-uxCreated Jul 23, 2026Updated Jul 23, 2026

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 sideInProcessBackend.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's worker_id/leader_id="leader", and the "leader" idle-notification target at in_process.py:284. The existing test test_send_message_writes_to_mailbox also asserts this bare-name key.

  • Read sidestart_in_process_teammate polls the inbox keyed by the fully-qualified name@team id: 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

  1. Spawn a teammate on the in-process backend (e.g. team myteam, agent rcvr).
  2. From the leader, call send_message("rcvr@myteam", ...). The message file lands in ~/.openharness/teams/myteam/agents/rcvr/inbox/, unread.
  3. The running teammate loop (start_in_process_teammate_drain_mailbox) polls ~/.openharness/teams/myteam/agents/rcvr@myteam/inbox/, which is empty.
  4. 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 (c3479b5 at 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.