Description
Every inbox message is delivered exactly twice to the receiving terminal. This corrupts
agent input streams in multi-agent workflows using assign + send_message.
Root Cause
In inbox_service.py, check_and_send_pending_messages() calls send_input() before
update_message_status(DELIVERED). The send_input() types into tmux, which updates the
terminal log file, which triggers the watchdog's on_modified handler. The second watchdog
invocation calls get_pending_messages() and finds the message still PENDING (because
update_message_status hasn't committed yet), so it delivers the message again.
Reproducer
- Create a session with a supervisor agent
- Use
assign to create a worker agent
- Worker calls
send_message back to supervisor
- Observe the message appears twice in the supervisor's tmux window
Fix
Move update_message_status(message.id, MessageStatus.DELIVERED) before
terminal_service.send_input(). PR: #
Environment
- CAO version: 2.0.0 (commit d2e9b56)
- OS: macOS
- Provider: kiro_cli
File the issue first, then reference it in the PR. Want me to help with anything else on this?
Description
Every inbox message is delivered exactly twice to the receiving terminal. This corrupts
agent input streams in multi-agent workflows using assign + send_message.
Root Cause
In
inbox_service.py,check_and_send_pending_messages()callssend_input()beforeupdate_message_status(DELIVERED). Thesend_input()types into tmux, which updates theterminal log file, which triggers the watchdog's
on_modifiedhandler. The second watchdoginvocation calls
get_pending_messages()and finds the message still PENDING (becauseupdate_message_statushasn't committed yet), so it delivers the message again.Reproducer
assignto create a worker agentsend_messageback to supervisorFix
Move
update_message_status(message.id, MessageStatus.DELIVERED)beforeterminal_service.send_input(). PR: #Environment
File the issue first, then reference it in the PR. Want me to help with anything else on this?