Summary
After upgrading to 2026.6.11, Discord messages arriving while the agent is mid-turn are silently dropped with "reply session initialization conflicted". The error is not retried for Discord, resulting in permanent message loss.
Root Cause
PR #96218 (guard reply session initialization) introduced optimistic locking to commitReplySessionInitialization. The function computes a revision hash from the current session store entry and compares against expectedRevision. When an agent turn is actively writing tool results to the session transcript, the revision advances between the snapshot and the commit, causing the guard to reject the incoming message.
The code has a single retry (staleSnapshotRetried):
if (!committed.ok) {
if (!staleSnapshotRetried) return await initSessionStateAttempt(params, true);
throw new Error(`reply session initialization conflicted for ${sessionKey}`);
}
This retry fires immediately with no backoff — the agent turn is still writing, so it fails again.
Why Discord is affected
When processDiscordQueuedMessage catches this error, it is NOT classified as DiscordRetryableInboundError. The replay guard commits it as processed (commitDiscordInboundReplay), permanently dropping the message. The only handling is:
runtime.error(`discord message run failed: ${String(error)}`);
By contrast, Telegram has explicit retry handling for this error: resolveSpooledUpdateRetryDelayMs with exponential backoff via REPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.
Reproduction
- Send a Discord message that triggers a tool-using agent turn
- While the agent is mid-turn (fetching data, writing tool results), send a second message
- The second message is silently dropped
Impact
Any Discord message that arrives while the agent turn is actively writing to the session store has effectively zero delivery chance. The single retry has no backoff and the conflict is not classified as retryable.
Suggested fixes
- Classify
reply session initialization conflicted as DiscordRetryableInboundError so the replay guard does not permanently commit it
- Add backoff between retries (even 500ms would likely resolve most conflicts by giving the agent turn time to settle)
- Or increase the retry count from 1 to 3-5 with exponential backoff
Version
Regression first seen in 2026.6.11 (PR #96218, authored by @jalehman). Did not occur in 2026.6.9.
Summary
After upgrading to 2026.6.11, Discord messages arriving while the agent is mid-turn are silently dropped with
"reply session initialization conflicted". The error is not retried for Discord, resulting in permanent message loss.Root Cause
PR #96218 (
guard reply session initialization) introduced optimistic locking tocommitReplySessionInitialization. The function computes a revision hash from the current session store entry and compares againstexpectedRevision. When an agent turn is actively writing tool results to the session transcript, the revision advances between the snapshot and the commit, causing the guard to reject the incoming message.The code has a single retry (
staleSnapshotRetried):This retry fires immediately with no backoff — the agent turn is still writing, so it fails again.
Why Discord is affected
When
processDiscordQueuedMessagecatches this error, it is NOT classified asDiscordRetryableInboundError. The replay guard commits it as processed (commitDiscordInboundReplay), permanently dropping the message. The only handling is:By contrast, Telegram has explicit retry handling for this error:
resolveSpooledUpdateRetryDelayMswith exponential backoff viaREPLY_SESSION_INIT_CONFLICT_MESSAGE_RE.Reproduction
Impact
Any Discord message that arrives while the agent turn is actively writing to the session store has effectively zero delivery chance. The single retry has no backoff and the conflict is not classified as retryable.
Suggested fixes
reply session initialization conflictedasDiscordRetryableInboundErrorso the replay guard does not permanently commit itVersion
Regression first seen in 2026.6.11 (PR #96218, authored by @jalehman). Did not occur in 2026.6.9.