Repository navigation
Description
Summary
An identical delegation made from a later turn within 24 h is answered with the first run's receipt, and the delegated work reports back into the first turn's conversation, not the one now asking.
chat_with_agent derives its Idempotency-Key from caller, target, route, model, mode and message (deriveMcpIdempotencyKey in src/mcp-server/src/tools/chat.ts); the caller's turn is deliberately not part of it (Invariant #18: the key must not change when only report-back changes). The backend replays a matching key before it creates the child row (begin_task_idempotency in src/backend/services/dispatch_admission_service.py, reached from the /task admission path before create_task_execution_and_activities), so the second turn's request never runs and never inherits the second turn's conversation. With #3232's default report-back on async delegations, the replayed receipt also carries report_back: "requested", although the run it names was asked to report to the earlier turn (and may already have).
Example: an agent serving a Slack thread delegates "summarise yesterday's incidents" with parallel=true, async=true; two hours later, serving a different thread, it sends the same text. The second thread gets a receipt that says report-back was requested, and never gets a note: the only run is the first one, which reports into the first thread.
Acceptance Criteria
- The same delegation text sent from two different turns within the replay window runs (or reports) for each turn, while an exact retry from the SAME turn still replays the original (no double execution on a retry)
- The replayed receipt says it is a replay of an earlier run, so the caller is not told a fresh report-back was requested (see bug: an async /task keeps replaying its accepted receipt for 24 h after the run fails, so an exact retry returns the failed run #3245 for the replay flag on receipts)
- Tests cover: same text, same turn → replay; same text, different turn → new run or an honest result
Technical Notes
- Candidate fix: scope the key's intent to the platform turn (
X-Trinity-Execution-Id, which the backend already receives on/chatand/task), with the typed parent as a fallback, like the skill-gate requester's precedence inchat_execution_service.py. - Pre-existing; bug: chat_with_agent never forwards its execution_id argument, so a delegated task cannot report back to the caller's channel #3232 only makes it visible on more calls by turning report-back on by default for async delegations.
- Related: bug: chat_with_agent never forwards its execution_id argument, so a delegated task cannot report back to the caller's channel #3232, bug: an async /task keeps replaying its accepted receipt for 24 h after the run fails, so an exact retry returns the failed run #3245, abilityai/trinity-enterprise#566.
Activity
dolho commentedon Oct 23, 2026
/claim
github-actions commentedon Oct 23, 2026
Claimed by @dolho. Label
status-in-progressadded.Next steps:
feature/3296-<short-slug>Fixes #3296fix(mcp): a scheduler retry replays its delegations instead of runnin…
fix(mcp): an identical delegation from a later turn is a new delegati…
fix(mcp): an identical fan_out from a later turn is a new fan-out (#3944