agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

worker-to-orchestrator messaging: ao send --steer fails with SESSION_MODE_MISMATCH; guessed worker-N-10 address resolves to reviewer sub-session that replies as the orchestrator

Open axisrow opened this issue 2 months ago • 2 comments

Summary

Worker sessions have no working bottom-up channel to deliver a message to the orchestrator: direct attempts either fail outright or (worse) land on the wrong addressee. As a result the orchestrator sees a "silent" worker and only learns about a finished report by manually reading the worker's transcript.

Observed on macOS, ao with the claude-code harness, a project with one orchestrator + several workers (sessions running in Terminal UI).

Bug 1: ao send --session <orchestrator> --steer fails with SESSION_MODE_MISMATCH

Repro:

  1. Project created via ao; orchestrator launched by ao (session id, e.g. hhru-80, harness claude-code, Terminal UI).
  2. From a worker session shell (e.g. hhru-581) run:
    ao send --session hhru-80 --steer --message "Worker report: ..."
    
  3. Result: Exit code 1: this session was created in Terminal UI mode and has no chat conversation (SESSION_MODE_MISMATCH).

Expected: the orchestrator is a regular participant of the project's session graph; a worker must be able to deliver a message to it (queued into its console). Currently worker→orchestrator via the CLI does not work at all. worker→worker and orchestrator→worker do work.

Workaround used today: the orchestrator reads the worker's transcript directly (sqlite sessions.agent_session_id → jsonl under ~/.claude/projects/...). That is archaeology, not a channel.

Bug 2: a guessed address lands in a foreign sub-session, which then replies as the orchestrator

Repro:

  1. Worker hhru-580 has a cycle-review reviewer sub-session with the internal address hhru-580-10 (uds socket /tmp/cc-socks/<pid>.sock, from-name="hhru-580-10").
  2. The worker, not knowing the orchestrator's address, guesses a plausible one and sends SendMessage to hhru-580-10.
  3. The message is delivered to the reviewer sub-session; it (an LLM with full project context) replies in an orchestrator tone: "Report received, decisions recorded" — and the worker accepts that as the orchestrator's confirmation.

Consequences: decisions get "recorded" by a sub-agent that is not the orchestrator; the <session>-10 naming scheme makes such collisions likely. Expected: either the orchestrator's address is discoverable by workers (e.g. ao session orchestrator --project X plus explicit "reply only there"), or sub-session addresses are not resolvable for foreign SendMessage without an explicit reference.

Environment

  • macOS (Darwin 25.6.0), ao daemon, claude-code harness (v2.1.278), 2026-09-20.
  • Affected sessions: orchestrator hhru-80 (Terminal UI), workers hhru-580, hhru-581.
  • Exact error: this session was created in Terminal UI mode and has no chat conversation (SESSION_MODE_MISMATCH).

axisrow avatar Sep 20 '26 14:09 axisrow

Proposed fix plan

Root cause: ao send --steer can only deliver into a "chat conversation"; the orchestrator session was created in Terminal UI where no conversation object exists → SESSION_MODE_MISMATCH. Meanwhile ao already has a mechanism for injecting a message into a live claude-code session: workers correctly receive incoming [from <session>] turns on the orchestrator→worker path. The fix is in the delivery transport, not in demanding a chat.

  1. Minimal bug fix: in the ao send handler, when the target session is in Terminal UI, do not fail with SESSION_MODE_MISMATCH; deliver via the existing incoming-turn mechanism (pty console injection while the REPL is live) or a queued prompt picked up on the next idle. "No chat conversation" is a reason to pick a different transport, not to refuse delivery.
  2. Discoverable orchestrator address: ao session orchestrator --project <id> (or a field in ao session ls) so workers stop guessing addresses (observed guesses: hhru-80, hhru-580-10).
  3. Sub-session address hygiene: reviewer sub-sessions (<worker>-10, uds /tmp/cc-socks/<pid>.sock) should not resolve for foreign SendMessage calls without an explicit reference — otherwise the "reviewer sub-session replied as the orchestrator" collision will recur (observed: hhru-580-10 answered worker hhru-580's report in an orchestrator tone, and the worker accepted it as owner confirmation).

The minimal change that removes the pain is №1.

axisrow avatar Sep 20 '26 15:09 axisrow

The current ao send --steer path is Chat-only; that explains the TUI SESSION_MODE_MISMATCH. PR #5064 is active work on durable worker-to-orchestrator report delivery through ao report, including supported TUI targets. It does not change --steer or native guessed subagent addresses, so I am keeping this issue open while that PR is reviewed and the remaining behavior is assessed.

codebanditssss avatar Sep 23 '26 13:09 codebanditssss