Skip to content

refactor: add memory session sync identity API#89348

Closed
jalehman wants to merge 1 commit into
clawdbot-d02.1.9.1.24/31b-public-sdk-transcript-target-writer-apifrom
clawdbot-d02.1.9.1.25/31b-memory-session-sync-identity-api
Closed

refactor: add memory session sync identity API#89348
jalehman wants to merge 1 commit into
clawdbot-d02.1.9.1.24/31b-public-sdk-transcript-target-writer-apifrom
clawdbot-d02.1.9.1.25/31b-memory-session-sync-identity-api

Conversation

@jalehman

@jalehman jalehman commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

What

Adds identity-based memory session sync targets so memory-core can sync runtime transcripts by storage-neutral session identity while keeping deprecated sessionFiles compatibility for canonical OpenClaw transcript paths.

Why

Path 3 needs memory sync to stop treating transcript filenames as canonical identity before the SQLite storage flip. The scoped transcript read/write APIs can address known transcript targets, but memory sync also needs an identity-shaped targeted-sync request that can work under either file-backed or SQLite-backed stores.

Refs #88838. Builds on #89262.

Changes

  • Add sync({ sessions })
  • Deprecate sessionFiles
  • Resolve identities to files
  • Queue identity targets
  • Reject unsafe paths
  • Update SDK baseline
File Change
packages/memory-host-sdk/src/host/types.ts Adds identity sync target params
packages/memory-host-sdk/src/host/session-files.ts Resolves canonical session identities
extensions/memory-core/src/memory/manager-sync-ops.ts Syncs identity-scoped targets
extensions/memory-core/src/memory/manager-sync-control.ts Queues identity sync requests
extensions/memory-core/src/memory/manager.ts Passes identity targets through
extensions/memory-core/src/memory/qmd-manager.ts Uses normalized target metadata
src/plugin-sdk/memory-core-host-engine-storage.ts Mirrors SDK storage API
docs/.generated/plugin-sdk-api-baseline.sha256 Updates SDK API baseline

Testing

  • node scripts/run-vitest.mjs packages/memory-host-sdk/src/host/session-files.test.ts extensions/memory-core/src/memory/manager-targeted-sync.test.ts extensions/memory-core/src/memory/manager-session-sync-state.test.ts extensions/memory-core/src/memory/manager.readonly-recovery.test.ts extensions/memory-core/src/memory/manager-sync-yield.test.ts extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts
  • pnpm exec oxfmt --check <touched files>
  • node scripts/run-oxlint.mjs <touched files>
  • pnpm exec tsx scripts/sync-plugin-sdk-exports.ts --check
  • pnpm exec tsx scripts/check-plugin-sdk-subpath-exports.ts
  • pnpm exec tsx scripts/generate-plugin-sdk-api-baseline.ts --check
  • Autoreview completed with no actionable findings

Broad tsgo proof is still blocked by existing unrelated Copilot/UI type errors outside this branch.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core size: L maintainer Maintainer-authored PR labels Jun 2, 2026
@clawsweeper

clawsweeper Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 21, 2026, 8:07 PM ET / 00:07 UTC.

Summary
The PR adds identity-shaped memory sync targets, narrows deprecated sessionFiles handling to canonical transcript paths, wires targeted sync through memory-core, and refreshes the plugin SDK API baseline.

PR surface: Source +243, Tests +187, Generated 0. Total +430 across 18 files.

Reproducibility: not applicable. this is a refactor/API PR rather than a bug report. Source inspection shows current main only supports path-shaped sessionFiles, while this branch adds a new identity-targeted sync contract.

Review metrics: 1 noteworthy metric.

  • Public sync API surface: 2 types added, 1 sync parameter shape changed, 1 field deprecated. The memory sync contract is plugin-facing, so maintainers should consciously accept the API and compatibility impact before merging this branch directly.

Stored data model
Persistent data-model change detected: migration/backfill/repair: extensions/memory-core/src/memory/manager-session-sync-state.test.ts, serialized state: packages/memory-host-sdk/src/host/session-files.test.ts, serialized state: packages/memory-host-sdk/src/host/session-files.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-sync-control.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-sync-ops.startup-catchup.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-sync-ops.ts, and 16 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: superseded
Canonical: #95087
Summary: The author comments, live PR bodies, and file diffs show this draft is superseded by the combined memory/QMD identity replacement, while the broader tracker remains open for the overall migration.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Use the combined successor for maintainer review, or add branch-local real behavior proof and SDK documentation if this memory-only slice is revived.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body lists tests only; before merging this branch directly, it needs redacted terminal output, logs, linked artifacts, or similar proof showing sync({ sessions }) and canonical sessionFiles behavior after the patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] Merging this branch directly still changes a plugin-facing memory sync API and deprecated sessionFiles behavior without branch-local real behavior proof.
  • [P1] Identity-targeted sync decides which transcript is refreshed and reindexed, so resolver mistakes can stale or mis-associate session memory.
  • [P1] The replacement PR has sufficient proof but remains open, protected, and mergeability-unknown, so it is not a terminal close target without maintainer action.

Maintainer options:

  1. Use The Combined Successor (recommended)
    Let maintainers review refactor: add memory and QMD session identity mapping #95087 as the combined memory/QMD identity slice, then close this protected draft after that path is accepted or merged.
  2. Revive This Memory-Only Slice
    If maintainers prefer the smaller branch, require identity sync docs or migration notes plus redacted real behavior proof before merge.
  3. Accept Direct API Risk
    Maintainers may intentionally merge this branch, but should explicitly accept the plugin SDK compatibility and session-state risk first.

Next step before merge

  • [P1] Manual review is required because the item is protected and the remaining action is stack direction or closure, not a narrow automated code repair.

Security
Cleared: No concrete security or supply-chain regression was found; the diff is TypeScript SDK/runtime memory sync code, tests, and generated API hashes.

Review findings

  • [P2] Document the identity sync contract — packages/memory-host-sdk/src/host/types.ts:44-53
Review details

Best possible solution:

Use #95087 as the reviewed landing path and close this draft only after maintainer acceptance or merge; revive this branch only if maintainers want the narrower API slice.

Do we have a high-confidence way to reproduce the issue?

Not applicable; this is a refactor/API PR rather than a bug report. Source inspection shows current main only supports path-shaped sessionFiles, while this branch adds a new identity-targeted sync contract.

Is this the best way to solve the issue?

No as a standalone merge path right now. The combined successor is the better review unit because it includes the dependent QMD identity mapping and proof, but protected status means maintainers must own the final stack decision.

Full review comments:

  • [P2] Document the identity sync contract — packages/memory-host-sdk/src/host/types.ts:44-53
    This adds public MemorySyncParams.sessions and deprecates sessionFiles, but the branch only updates generated API hashes. If this branch is revived instead of the combined successor, add SDK docs or migration notes for the identity fields, sessionKey, and canonical path compatibility before merge.
    Confidence: 0.86

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 1f6ae32cabb9.

Label changes

Label justifications:

  • P2: This is a normal-priority memory-core/plugin-SDK migration slice with bounded scope but real compatibility and session-state review needs.
  • merge-risk: 🚨 compatibility: The PR changes a public plugin SDK sync shape and narrows deprecated path-based sessionFiles compatibility.
  • merge-risk: 🚨 session-state: The new identity targets determine which session transcript memory sync refreshes and reindexes.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body lists tests only; before merging this branch directly, it needs redacted terminal output, logs, linked artifacts, or similar proof showing sync({ sessions }) and canonical sessionFiles behavior after the patch. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +243, Tests +187, Generated 0. Total +430 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 11 333 90 +243
Tests 6 206 19 +187
Docs 0 0 0 0
Config 0 0 0 0
Generated 1 2 2 0
Other 0 0 0 0
Total 18 541 111 +430

What I checked:

  • Repository policy read and applied: Root policy treats protected-label gates, plugin APIs, and session state as compatibility-sensitive review surfaces; scoped SDK and extensions guides confirm these are plugin-facing public-contract paths. (AGENTS.md:27, 1f6ae32cabb9)
  • Current PR is protected and still a draft: Live GitHub state reports this PR open, draft, mergeable, labeled maintainer, status: 📣 needs proof, merge-risk: 🚨 compatibility, and merge-risk: 🚨 session-state at head b2ce1bca6c311ec9af0c3308a342180c9f58d6fd. (b2ce1bca6c31)
  • Current main lacks the identity sync API: On current main, MemorySearchManager.sync accepts reason, force, sessionFiles, and progress; there is no sessions, MemorySessionSyncTarget, or MemorySyncParams shape. (packages/memory-host-sdk/src/host/types.ts:110, 1f6ae32cabb9)
  • Current main queues only path-shaped targeted sync: The current memory manager only enqueues targeted session sync from non-empty params.sessionFiles, so the central identity-targeted behavior is not already on main. (extensions/memory-core/src/memory/manager.ts:1002, 1f6ae32cabb9)
  • Replacement PR is the live superseding path: Live GitHub state for refactor: add memory and QMD session identity mapping #95087 shows it is open, not draft, labeled proof: sufficient and status: 👀 ready for maintainer look, but also protected with maintainer; mergeability is currently unknown. (0c90ccb6c280)
  • Replacement contains the memory sync identity API: The replacement head adds MemorySessionSyncTarget and MemorySyncParams.sessions, while keeping deprecated canonical sessionFiles compatibility. (packages/memory-host-sdk/src/host/types.ts:35, 0c90ccb6c280)

Likely related people:

  • jalehman: They authored the merged adjacent SDK transcript identity target API and the open replacement PR that combines this memory sync slice with the QMD identity mapping. (role: recent Path 3 API contributor and stack context holder; confidence: high; commits: 7a0d36f3d0e1, b2ce1bca6c31, 0c90ccb6c280; files: packages/memory-host-sdk/src/host/types.ts, extensions/memory-core/src/memory/manager-sync-ops.ts, extensions/memory-core/src/qmd-session-artifacts.ts)
  • Shakker: The available local shallow blame for the current memory SDK and memory-core sync surfaces points to the shallow boundary commit authored by Shakker, so this is a weak routing signal only. (role: current-main shallow boundary contributor; confidence: low; commits: c6386178973d; files: packages/memory-host-sdk/src/host/types.ts, extensions/memory-core/src/memory/manager.ts, extensions/memory-core/src/memory/manager-sync-control.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 2, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

Superseded by #95087.

The replacement draft bundles this memory session sync identity API slice with the dependent QMD artifact identity mapping from #89360, stacked on #95030. That keeps the memory-core targeted sync API and QMD session-search visibility mapping in one review unit with current proof and autoreview.

@jalehman

Copy link
Copy Markdown
Contributor Author

Superseded by #95087.

#95087 combines this memory session sync identity API slice with the QMD artifact-to-session identity mapping from #89360 so the memory-core targeted sync API and mapped session-search visibility can be reviewed and proved together on the post-#95030 main base.

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. labels Jun 20, 2026
@jalehman

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #95087, which merged the memory session sync identity API together with the QMD session artifact identity mapping in one reviewed Path 3 replacement PR. #89348 remains useful history, but it is no longer the active review/merge target.

@jalehman jalehman closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant