agent-orchestrator/packages/cli/__tests__/commands
Dhruv Sharma f0d4faf2a4
fix: fail ao send when killed session delivery is not confirmed (#1236)
* fix: fail send when killed session delivery is not confirmed

* fix(core): drop requireConfirmation throw that re-introduced duplicate-message bug

The PR's sendWithConfirmation added a throw when confirmation heuristics
did not flip within SEND_CONFIRMATION_ATTEMPTS on a restored session.
But runtimePlugin.sendMessage had already fired, so the throw bubbled up
to the lifecycle manager's catch-all, leaving lastCIFailureDispatchHash
(and its merge-conflict twin) unset. Next poll re-dispatched the same
message — exactly the duplicate-message bug that commit 77685a5 removed.

Real fix for #1074 is preserved: restoreForDelivery still throws when
waitForRestoredSession returns false, which happens before sendMessage
fires. Killed sessions that cannot be revived are still reported as
failures, with no duplicate-send risk.

- sendWithConfirmation no longer takes requireConfirmation; unconfirmed
  delivery always returns (soft success).
- prepareSession returns Session (the tuple only existed to drive the
  removed throw).
- send's retry predicate reverts to prepared.restoredAt === undefined
  && isRestorable(prepared).
- Adds regression test: restored session + sendMessage fires +
  confirmation never flips → send() resolves.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-20 13:56:31 +05:30
..
dashboard.test.ts chore: rename @composio scope to @aoagents across all packages 2026-04-09 15:59:33 +00:00
doctor.test.ts feat(cli): install-aware ao update, startup notifier, doctor version check (#1156) 2026-04-13 11:46:26 +05:30
init.test.ts Resolve remaining PR review comments 2026-03-17 15:51:02 +05:30
open.test.ts chore: rename @composio scope to @aoagents across all packages 2026-04-09 15:59:33 +00:00
plugin.test.ts chore: rename @composio scope to @aoagents across all packages 2026-04-09 15:59:33 +00:00
report.test.ts fix: address PR #1300 requested changes 2026-04-18 11:13:53 +05:30
review-check.test.ts feat(cli): filter terminated sessions from ao session ls / ao status by default (#1340) 2026-04-20 13:05:34 +05:30
send.test.ts fix: fail ao send when killed session delivery is not confirmed (#1236) 2026-04-20 13:56:31 +05:30
session.test.ts feat(cli): filter terminated sessions from ao session ls / ao status by default (#1340) 2026-04-20 13:05:34 +05:30
setup.test.ts chore: rename @composio scope to @aoagents across all packages 2026-04-09 15:59:33 +00:00
spawn.test.ts refactor(cli): remove lifecycle-worker subprocess, poll in-process (#1186) 2026-04-14 17:23:33 +05:30
start.test.ts fix(cli,core): reuse orchestrator sessions across ao start; fix dashboard id mismatch (#1075) 2026-04-19 13:12:28 +05:30
status.test.ts feat(cli): filter terminated sessions from ao session ls / ao status by default (#1340) 2026-04-20 13:05:34 +05:30
update.test.ts feat(cli): install-aware ao update, startup notifier, doctor version check (#1156) 2026-04-13 11:46:26 +05:30