Repository navigation
fix(sessions): preserve target rows during legacy migration - #117272
vincentkoc merged 4 commits into
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 5:01 AM ET / 09:01 UTC. ClawSweeper reviewWhat this changesRepairs automatic legacy-session migration so it supplies each store key to session normalization, preserves protected target rows on a rejected normalization, and avoids a second stale transcript-path replacement. Merge readinessKeep this PR open for normal landing review. The latest head fixes the current-main destructive normalization path, resolves the prior P0 post-move rewrite finding by removing that obsolete second replacement, and adds focused coverage for the matching legacy-transcript case; remaining work is exact-head CI completion and a merge refresh. Priority: P0 Review scores
Verification
How this fits togetherStartup state migration reads legacy JSONL/session-store artifacts, merges them into the canonical per-agent session store, and moves legacy transcript artifacts. The resulting session records feed later routing, provider selection, delivery state, and group activation behavior. flowchart LR
A[Legacy JSONL and session store] --> B[Startup state migration]
C[Canonical target session store] --> B
B --> D[Normalize rows with store keys]
D --> E{Protected target row valid?}
E -->|yes| F[Atomically save canonical store]
E -->|no| G[Defer migration with warning]
F --> H[Move legacy transcript artifacts]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -12, Tests +276. Total +264 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the guarded canonical normalization path after exact-head CI is green, preserving the one-save migration flow and retaining the focused regression coverage for key-shaped pending rows. Do we have a high-confidence way to reproduce the issue? Yes—current main's merged-store loop omits the session key before strict replacement, and the PR body provides a matching built-runtime migration transcript; this review did not execute the reproduction locally. Is this the best way to solve the issue? Yes—the latest patch fixes the owner boundary by passing the canonical key into normalization, fails safely for rejected existing target rows, and removes the stale second rewrite instead of adding another compensating path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ac2c9847c860. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
375eb49 to
5c63519
Compare
5c63519 to
ed4d2fc
Compare
209ce49 to
cbefb83
Compare
Legacy migration must pass each stored map key into the canonical session-entry normalizer so key-shaped pending rows survive both replacement writes and ACP metadata detection.\n\nFixes openclaw#117263
cbefb83 to
7f5b559
Compare
7f5b559 to
f4aa51d
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
* origin/main: fix(update): keep rolled-back Git installs runnable (openclaw#117294) refactor(ui): centralize chat outbox projections (openclaw#117284) fix(sessions): preserve target rows during legacy migration (openclaw#117272) fix(security): detect multiline skill prompt injection (openclaw#117254) fix(qa): lease credentials for Telegram startup proof (openclaw#116842) refactor(memory): unify session ingestion (openclaw#117293) fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621) fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292) fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
…#117272) * fix(sessions): pass session key to legacy normalizer Legacy migration must pass each stored map key into the canonical session-entry normalizer so key-shaped pending rows survive both replacement writes and ACP metadata detection.\n\nFixes openclaw#117263 * fix(sessions): defer rejected target-row migrations * test(sessions): cover pending legacy migration paths * fix(sessions): remove obsolete transcript rewrite --------- Co-authored-by: Vincent Koc <[email protected]>
* origin/main: fix(update): keep rolled-back Git installs runnable (openclaw#117294) refactor(ui): centralize chat outbox projections (openclaw#117284) fix(sessions): preserve target rows during legacy migration (openclaw#117272) fix(security): detect multiline skill prompt injection (openclaw#117254) fix(qa): lease credentials for Telegram startup proof (openclaw#116842) refactor(memory): unify session ingestion (openclaw#117293) fix(channels): strip internal tool text in Reef and Zalo Personal (openclaw#112621) fix(ui): keep newer Appearance choices after delayed theme imports [AI-assisted] (openclaw#117292) fix(inference): simplify lifecycle and preserve Codex tool identity (openclaw#117298)
Fixes #117263
What Problem This Solves
Automatic startup migration could silently delete readable target-session rows whose
sessionIdequals their canonical agent session key. The normalizer needs the store key to recognize that legacy shape asinitializationPending; without it, the row is rejected and omitted from the replacement store.The original repair exposed a second destructive path: after moving legacy transcripts, migration re-normalized mutable raw rows and replaced the store again. A matching
<pendingKey>.jsonladded retiredsessionFilemetadata to the pending row, made normalization reject it, and deleted it in the second write.Root Cause
sessionFile, a file-era field retired by refactor(sessions): remove file-era transcript runtime #113233 and removed from the canonical session-entry shape. That obsolete second replacement write violated the same target-row preservation invariant.Canonical Repair
sessionFilerewrite entirely. Transcript files still move to the canonical agent directory; the canonical store is written once.<pendingKey>.jsonl, metadata preservation, and rerun idempotence.Best-fix judgment: deleting the obsolete second write is better than carrying first-pass entries into it or adding another guard. Canonical entries no longer persist file paths, so preserving the rewrite would keep dead policy and another state-replacement boundary without a supported contract.
User Impact
Startup migration now preserves live pending-session metadata, including display name, category, provider/model overrides, delivery state, and group activation. A matching legacy transcript is moved without mutating or deleting the canonical row. A second startup is byte-stable.
Evidence
Validated head:
f4aa51d96b2b5df7c8a6198fb1c0f63741419ac3Sanitized direct AWS Crabbox: public networking, no Tailscale, no instance role, no hydration, only
CIforwarded, trusted bootstrap, exact SHA verification.pnpm format:checksrc/infra/state-migrations.test.ts: 79/79src/config/sessions/sessions.test.ts: 21/21src/acp/runtime/session-meta.test.ts: 12/12openclaw status --jsonstartup migration twice against isolated state<pendingKey>.jsonlACP_PROOF_OK,LEGACY_PROOF_OK,RUNTIME_PROOF_OKopenclaw/ci-gate: passed on the exact head.Diff Shape
AI Assistance