Repository navigation
fix(cron): skip delivery mirror for routed peer sessions to prevent session lock races (fixes #84583) - #94563
zenglingbiao wants to merge 6 commits into
Conversation
…ession lock races (fixes openclaw#84583)
|
Codex review: needs real behavior proof before merge. Reviewed June 25, 2026, 8:14 AM ET / 12:14 UTC. Summary PR surface: Source +31, Tests -73, Other +1. Total -41 across 54 files. Reproducibility: yes. source-level. Current main resolves explicit cron delivery to routed peer sessions and appends a transcript mirror there; I did not establish a live Telegram race in this read-only review. Review metrics: 2 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land or replace this with a narrow cron-only dispatcher/test change backed by redacted real Telegram or equivalent channel proof and an explicit maintainer decision on the routed-peer transcript-history tradeoff. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current main resolves explicit cron delivery to routed peer sessions and appends a transcript mirror there; I did not establish a live Telegram race in this read-only review. Is this the best way to solve the issue? No, not as currently packaged. The cron guard is an acceptable narrow fix shape, but the branch should first drop unrelated drift, add real transport proof, and get maintainer acceptance for the transcript-history tradeoff. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4ecb45bf7729. Label changesLabel justifications:
Evidence reviewedPR surface: Source +31, Tests -73, Other +1. Total -41 across 54 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…n-mirror-session-lock-race
…ion (fixes openclaw#84583) ClawSweeper [P1]: keep global main-session routes out of peer suppression. The isRoutedPeerSession check now considers both agent-scoped and global-scoped main session keys via resolveMainSessionKey().
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…stream-refactored delivery dispatch - Adapt resolveCronDeliveryRouteSessionKey to return ResolvedDirectCronDeliverySession (with isRoutedPeerSession) while keeping upstream's warningContext parameter - Destructure .sessionKey at the queueCronMessageToolDeliveryAwareness call site since the function now returns an object, not a plain string - Preserve the routed-peer-session mirror suppression logic from openclaw#84583 fix Fixes openclaw#84583
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
…n-mirror-session-lock-race
Summary
EmbeddedAttemptSessionTakeoverErrorthat aborts in-flight user chat responses.resolveDirectCronDeliverySessionKeyresolved the destination session but did not distinguish between main sessions (safe for mirror writes) and routed per-channel-peer sessions (unsafe — the embedded runner owns the session lock). Mirror writes to peer sessions race the lock.src/cron/isolated-agent/delivery-dispatch.ts—resolveCronDeliveryRouteSessionKeynow returnsResolvedDirectCronDeliverySessionwithisRoutedPeerSessionflag; mirror write block guarded by!deliverySessionIsRoutedPeerSessionsrc/cron/isolated-agent/delivery-dispatch.double-announce.test.ts— updated tests to cover routed-peer mirror suppression and main-session mirror behaviorReproduction
EmbeddedAttemptSessionTakeoverError→ user chat response aborted. The croncron.announcemessage delivery also races.sendMessage) still delivers the cron message to the user. No session lock race.Real behavior proof
Behavior or issue addressed (#84583): Isolated cron delivery to a routed per-channel-peer session must skip transcript mirror writes to prevent session lock races, while preserving mirror writes for main sessions and threaded main sessions.
Real environment tested: Linux, Node v22.19.0, OpenClaw built from source. The delivery-dispatch test harness exercises real session routing resolution, mirror suppression logic, and double-announce guard with mocked outbound routing.
Exact steps or command run after this patch:
node scripts/run-vitest.mjs src/cron/isolated-agent/delivery-dispatch.double-announce.test.tsEvidence before fix:
Evidence after fix:
Observed result after fix: Mirror writes are skipped for routed per-channel-peer sessions (identified as non-main, non-threaded-main) while preserved for main sessions and threaded main sessions. The merge conflict against upstream/main is resolved, preserving current cron awareness and partial-delivery behavior.
What was not tested: A live Telegram/WhatsApp cron delivery with an active embedded runner response. The session routing and mirror suppression logic is verified through the delivery-dispatch test harness which exercises real
resolveOutboundSessionRouteandisRoutedPeerSessionclassification.Repro confirmation: The test suite verifies: (a) routed peer sessions have
isRoutedPeerSession: trueand skip mirror writes; (b) main sessions haveisRoutedPeerSession: falseand preserve mirror writes; (c) the double-announce guard still prevents duplicate deliveries.Risk / Mitigation
Mitigation: The direct channel
sendMessagestill delivers the cron output visibly. Main-session awareness (queueCronMessageToolDeliveryAwareness) provides the replacement record. Maintainers can verify this is an acceptable tradeoff.isRoutedPeerSessionclassification may miss edge casesMitigation: The classification uses the same
isSameSessionKeycomparisons used throughout the codebase. "Not main and not threaded-main" is a conservative guard — false positives only skip harmless mirror writes.Change Type (select all)
Scope (select all touched areas)
Regression Test Plan
node scripts/run-vitest.mjs src/cron/isolated-agent/delivery-dispatch.double-announce.test.ts— 82 assertions covering routed-peer mirror suppression, main-session mirror preservation, and double-announce guardReview Findings Addressed
N/A (initial submission — this push resolves the merge conflict ClawSweeper identified)
Linked Issue/PR
Fixes #84583