Repository navigation
fix: recover overlapping global chats through Doctor - #188577
shakkernerd wants to merge 10 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. Automatic review is on hold, including after source changes. Request a fresh re-review after resolving the failure; maintainers can also release the hold through an intentional scanner-policy update. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
0441bd0 to
dc16bfd
Compare
dc16bfd to
199d296
Compare
|
@clawsweeper review |
|
🦞👀 Re-review progress:
|
|
Codex review: blocked before merge. What this changesThis PR recovers overlapping global conversations through offline Doctor repair and prevents retired literal URLs from opening another chat. Example: An agent has separate saved conversations at global and agent:main:global.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep this PR open: recovery remains necessary, and the previous participant-count finding is fixed, but the repair can orphan managed attachments and cause their files to be deleted. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherDoctor repairs persisted session bindings under exclusive offline custody, using the session lifecycle writer and cron history owner; the Control UI then resolves the recovered and retired addresses. flowchart TD
A[Overlapping session bindings] --> B[Offline Doctor maintenance]
B --> C[Session lifecycle writer]
B --> D[Cron history owner]
C --> E[Recovered conversation]
E --> F[Control UI routing]
C --> G[Managed media ownership]
Technical reviewBest possible solution: Keep the existing repair owners, but refuse conversations with managed attachment records before removing their old binding until attachment preservation is supported. Do we have a high-confidence way to reproduce the issue? The linked report establishes the original native failure, and source inspection shows both the remaining recovery gap on main and the introduced attachment-cleanup failure; no target code was run during this review. Is this the best way to solve the issue? Offline repair through the existing lifecycle and history owners is appropriate, and repair plus retired-URL handling forms one coherent change, but its preflight must protect managed attachments before the old node is removed. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1b777ab47da0. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +487, Tests +532, Docs +46, Other +2. Total +1067 across 19 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label 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 31, 2026, 8:11 AM ET / 12:11 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
|
Closing due to inactivity. |
Related: #188165
What Problem This Solves
Older stored state can contain both
globalandagent:<agentId>:globalfor one agent, with different session IDs and saved conversations. The normal qualified session reader cannot choose between those overlapping bindings, so continuing either conversation can fail even though its history and files still exist. Doctor previously left this pair in place.This change repairs the stored binding once through Doctor. The original ongoing chat keeps
global; the accidentally created second chat receives a distinct ordinary address derived from its existing session ID.User Impact
With the Gateway stopped, run
openclaw doctor --fix, restart, and reopen the recovered conversation from Sessions. Both conversations retain their original session IDs, stored titles, history windows, ownership, membership and workspace locations. Files stay where they were. After the repair, both addresses use normal session handling.The old literal review URL requires explicit reopening. A retained view or a fresh visit resolves to the existing missing-session view, which offers navigation choices without silently moving work into the ongoing chat. Ordinary global aliases retain their meaning.
Attributable completed cron history follows the recovered conversation. Its stored run identity, timing and outcome remain unchanged, and scheduled-job definitions and enabled states are untouched. Doctor refuses an occupied destination, pending input, linked work or uncertain historical identity rather than overwriting or guessing. The moved review chat must have no repository workspace or persisted worker placement; those bindings remain untouched and their recovery is outside this operation. A binding owned only by the unchanged ongoing chat does not prevent repair.
Why This Change Was Made
The defect is an overlapping persisted binding. Doctor first completes ordinary key normalization. Its existing maintenance lock and session lifecycle writer own offline repair, history-window movement and preservation of session artifacts. They can give the second conversation an ordinary address while retaining its original identity and saved work.
The agent database move and the shared historical-reference update use their existing transaction owners. If execution stops between them, the retained run's session ID identifies the existing destination on the next Doctor run. Recovery checks for outstanding references before inspecting a destination, so a completed repair leaves subsequently active conversations alone. It selects the owner of the recorded history windows rather than scanning older recovered chats.
The UI change is limited to verifying the old explicit literal address, revalidating it after reconnect and keeping a retired view in place until the user chooses where to go. The canonical session and update documentation explains the repair and reopening step.
Evidence
The original Doctor regression failed on the base because the literal overlapping row remained after repair. The focused tests exercise the real Doctor entry, existing session writers and historical-run producer, including preserved history and ownership, refusal conditions, repeat execution and interruption between the two database commits. Two additional retry failures were reproduced before correcting selection: a completed repair rejected a conversation with restart work, and an interrupted repair inspected an older recovered conversation instead of the recorded session's destination.
The candidate in 3cc0cff passed formatting, focused lint and i18n checks, file-size/assertion/test-line guards, the SQLite worker and membership-writer guard, and seven selected type-check groups. Its Doctor-consumer run passed 357 cases in 32 files. Passing evidence for 743 cases in 30 other related files remains applicable on unchanged inputs, including the reconnect tests. These 62 related files cover initial preservation, retry and interruption, refusal conditions, healthy aliases, legacy normalization and explicit old-view handling.
A participant preservation case reproduced a doubled contribution count before correction. The lifecycle owner now transfers artifacts once, preserving counts and timestamps through repair and repeat execution. Repository-bound review inputs refuse before rehome while their Files access, identities, history, permissions and binding remain unchanged. Persisted worker placements receive the same protection. Separate controls verify that bindings owned only by the ongoing chat do not prevent recovery.
The original affected pair was repaired through the normal offline update/Doctor owner on this head. Independent native readback preserved both original session IDs, all 77 retained messages, ownership, membership, permissions, workspace roots and all three saved files. The disabled schedule stayed unchanged; the historical failed run retained its other facts while following the recovered conversation. Repeating Doctor made no further change.
Both original chats then completed one new natural UI turn at their own addresses. The ongoing chat used its saved work to recommend three pickups at capacity 18; the review retained its separate saved plan and kept seven parcels held pending inspection. Native send/acknowledgement/final receipts and rendered answers agree on each original identity. Independent post-turn readback preserved the existing history prefixes, files, authority and workspace roots. The retained and freshly opened old review URLs both stayed at the old address and required explicit reopening, with no sends.
A fresh healthy global conversation created by published OpenClaw 2026.10.9 was upgraded through OCM to the release-shaped package built from this head. Full-integrity Doctor completed, and the original address, session ID, six-message history prefix, owner fields, workspace and saved note were preserved. Existing Doctor behavior supplied a previously missing display title from the first message. One new ordinary agent turn then used the saved plan, retaining twelve eligible samples and three held for inspection. Independent readback preserved the original history prefix and note; no background service was introduced.
A confirmed blocker remains for an overlapping review conversation with managed attachments: after rehome, normal media cleanup can remove its old-key attachment record and original payload file. The unchanged ongoing-chat attachment control passes. This PR is not ready to land while that recovery contract is unresolved.
The current hosted ratchets pass. The published head's remaining Visitor Access and native plugin-spawn CI failures also reproduce on the relevant baseline; their attribution is recorded separately. Focused integration with the selected target, including its landed Visitor fixture repair, and final readiness checks remain pending. This PR remains open and unmerged.
Visual evidence
Original repair and continuation; reconnect wait labeled 8x
recovery-and-continuation.mp4
Visual verification
3cc0cff304505ccdc524ea1487314740480d95cb