Repository navigation
fix: keep scheduled global work in its existing conversation - #188173
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesPreserve the literal global conversation key when scheduled work targets session:global under global session scope. Example: Agent main schedules an agentTurn targeting session:global with session.scope set to global.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it narrowly fixes a current conversation-routing bug, and no actionable defect was found in the introduced diff. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway cron resolver converts scheduled agent and session selectors into destinations consumed by ordinary session admission, execution, and settlement. flowchart TD
A[Scheduled agent turn] --> B[Gateway cron target resolver]
B --> C[Selected agent and physical session key]
C --> D[Session event admission]
D --> E[Existing conversation and model turn]
E --> F[Cron settlement]
Technical reviewBest possible solution: Keep the correction in the existing cron resolver, preserving physical global identity without changing storage integrity checks or delivery accounting. Do we have a high-confidence way to reproduce the issue? The current-main resolver deterministically qualifies the literal global key incorrectly, and the linked report supplies a native reproduction corroborated by the inspected failure screenshot; this review ran no target code. Is this the best way to solve the issue? This is the smallest complete prevention fix: preserve the sentinel at the existing producer and extend its routing table, without introducing another owner or weakening duplicate-row rejection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 292faaa04587. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +4, Tests +7, Docs +2, Other +2. Total +15 across 4 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 30, 2026, 4:16 AM ET / 08:16 UTC (Revision 2). |
|
The PR now includes fixed-head native execution evidence for Execution status was @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Fixed: explicit global scheduled work stays in the selected agent's existing conversation. |
…w#188173) Keep explicit global scheduled targets in the selected agent's existing conversation under global scope. Refs openclaw#188165.
…w#188173) (cherry picked from commit e1535e4) Release adaptation: bounded product, matching tests and relevant documentation only. Excluded: config/test-lines-allocations/global-cron-session-target.txt. Preserve literal global target under global scope; explicit agent-qualified targets unchanged. Related 11.6 canonicalization exists and 188257 follows. Validation queued. Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit f84823ee6a6e28e78179be45714160513ab2dbdf)
Refs #188165.
What Problem This Solves
A scheduled
agentTurnaddressed tosession:globalundersession.scope: "global"can leave the existing conversation, createagent:main:globalwith a different session ID, and fail settlement with a duplicate canonical-key warning. In the native reproduction, the run performed useful file work before failing, so retrying on the assumption that nothing happened would be misleading.User Impact
Explicit global targets keep the selected agent's existing global conversation and context. Ordinary per-sender targets, explicitly qualified named keys, foreign-agent rejection, and duplicate-row integrity checks retain their current behavior. No configuration change or schema migration is introduced.
This correction prevents the demonstrated producer error. It does not merge or delete rows created by earlier failed runs, and it does not claim that updating or running Doctor repairs an already-affected two-row state. That recovery remains separate from this change.
Why This Change Was Made
The Gateway resolver applied ordinary agent qualification to the literal global selector before alias resolution. Under global scope, storage uses the literal key while the event queue can expose an agent-qualified identity. Passing the latter as a fresh physical target created the second conversation.
The resolver now preserves the literal selector under global scope before continuing its existing owner checks and dispatch. The change is confined to that producer and the existing routing regression table; it does not alter session storage or delivery accounting.
Evidence
A fresh isolated native Gateway was configured for global scope before any conversation existed. Native session creation and an ordinary model turn kept one
globalrow and saved the requested initial note. A single scheduled review then created a second qualified row with a different ID, saved a review without the earlier conversation context, and ended in the duplicate-key error. The original row and selected input bytes were preserved.The extended target-boundary regression fails on the unchanged production base for both selected-agent cases; eight controls pass, including the global main alias, per-sender global name, explicit qualified address, and foreign-agent refusal. The preexisting physical-identity suite also passes, including actual duplicate rejection.
Changed-file formatting/lint and all selected production/test type families passed on the exact candidate tree. All 103 cases in the four affected files passed. The requested single-worker target file then passed all 10 cases in 29.49 seconds (mostly cold transformation; 31.47 seconds through the native runner). Seven net test lines extend the existing table through the repository allocation mechanism.
On head
619a3fcb6dbb67cb0af22deca453268630a009fe, a second fresh native fixture used global scope before session creation. The direct-global scheduled review and a main-alias continuation both retained the original session ID and the single physicalglobalrow. They saved a correct 39-parcel loading plan and a 9-space capacity check while preserving the input files. No duplicate-key warning occurred. The actual harness wasopenclaw.Both runs recorded execution status
ok. Their missing-channel completion failure remains visible in the captures and belongs to delivery accounting, which this patch leaves unchanged. The original affected fixture remains intact; this proof establishes prevention, not recovery of the already-created duplicate.Independent engineering review is clean for that prevention scope, and automatic review found no actionable issue through P2. Exact-head CI passed. The completed ClawSweeper review rates the exact head Diamond (5/6) with no findings.
Visual evidence
Open the exact-head native run history and inspect the saved result; this does not replay the scheduled job
result-redacted.webm
Visual verification
619a3fcb6dbb67cb0af22deca453268630a009fe