Skip to content

fix(core_pool): load legacy cli/root checkpoints after owner resolve - #18

Draft
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-management-177f
Draft

fix(core_pool): load legacy cli/root checkpoints after owner resolve#18
cursor[bot] wants to merge 1 commit into
masterfrom
cursor/critical-bug-management-177f

Conversation

@cursor

@cursor cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Bug and impact

Commit dae8be7 added _resolve_core_owner so Feishu/sub/cron sessions no longer log or store memory under cli:root when acquired via CLI session switch. However, _load() only read checkpoint.json from the resolved owner path.

Concrete trigger: User switches CLI to a feishu:user:… session while checkpoints were still saved under data/memory/cli/root/. On daemon restart, restore_from_checkpoints finds the legacy file but _load() looks under feishu/{open_id}/, misses it, and cold-starts — conversation state is lost.

Root cause

Owner correction changed the lookup namespace without probing the legacy on-disk location used before the fix (or by restore_from_checkpoints which still passes ckpt.source / ckpt.owner_id).

Fix

  • Add _checkpoint_owner_candidates / _read_session_checkpoint to probe resolved owner first, then the caller-supplied owner.
  • Use this in _load() for both CoreProfile recovery and full checkpoint restore.
  • After restoring from a legacy path, migrate the checkpoint to the resolved owner and mark the legacy file expired.

Validation

  • Added test_read_session_checkpoint_falls_back_to_legacy_cli_root
  • uv run pytest tests/test_core_owner_resolve.py -v — all 7 tests pass
Open in Web View Automation 

_resolve_core_owner (dae8be7) corrected feishu session memory paths but
_load only read checkpoint.json under the resolved owner. Sessions switched
via CLI that still had checkpoints under cli/root cold-started on daemon
restart, losing conversation state.

Probe resolved owner first, then fall back to the caller-supplied owner,
and migrate restored legacy checkpoints to the resolved path.

Co-authored-by: Yuxuan Liu <Osc-7@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant