Repository navigation
fix(sessions): preserve assigned owners through Doctor and startup repairs - #127706
Merged
Merged
Conversation
Contributor
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Contributor
Author
|
Merged via squash.
|
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Aug 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Problem This Solves
Fixes an issue where operators who assign responsibility for a session lose that assignment, see the wrong person listed as owner, or encounter a stuck migration after running
openclaw doctor --fix, renaming the main agent, or moving a session between agent stores.Why This Change Was Made
Assigned responsibility lives in five dedicated SQLite columns, while legacy-main migration, quarantine, cross-store import, malformed-row recovery, and canonical Doctor repair previously copied only the session payload. Reuse one transactional ownership writer at each authoritative SQLite migration boundary, preserve the selected winner's exact actor/assigner/timestamp, clear stale destination assignments, and use schema-version-aware lazy-column detection so rolled-back first-use assignments cannot poison later writes. Ordinary legacy JSON imports still cannot declare their own owner.
The shared ownership implementation shrinks by four lines; the complete production delta is +61/-48, net +13 lines, justified by preserving durable human assignment across every real Doctor/startup migration path. No schema version, protocol, configuration, public API, sharing authorization, or dependency changes.
User Impact
The owner shown in session lists, owner filters, and responsibility facets remains accurate after Doctor repairs, startup migration, cross-agent store moves, conflict quarantine, and malformed-session recovery. Unowned sessions stay unowned; first-use legacy databases remain readable and only gain the existing nullable owner columns when an actual assignment is preserved.
Evidence
Before the fix, real Doctor repair failed all three initial ownership cases: an owned alias kept the wrong previous destination owner, an unowned winner inherited a stale owner, and a cross-store move lost its assignment. A separate real nested transaction reproduced the poisoned schema cache as
no such column: owner_actor_type; the existing conflict-quarantine flow also lost its assignment.After the owner-boundary repair, 162 tests pass across real session assignment/rollback, legacy in-place and cross-store migration, owned/unowned quarantine, Doctor canonical/malformed/retention repair, startup, migration ledgers/races, the full SQLite accessor suite, and a forged-owner JSON import regression:
Core typecheck, type-aware lint, formatting, import-cycle validation, SQLite schema-version guard, max-lines ratchet, assertion-safety ratchet, and independent in-session code review also pass. The tests execute the real Doctor migration, real SQLite transactions, and public owner-assignment API; no external provider or authenticated channel is involved.