fix(sessions): retire stale direct DM rows after dmScope changes#77880
fix(sessions): retire stale direct DM rows after dmScope changes#77880
Conversation
|
Codex review: needs changes before merge. Summary Reproducibility: yes. as a source-level reproduction for the PR regression: current main can route a binding-owned DM to Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Keep the explicit dry-runnable cleanup flow, but make stale direct-row detection binding-aware so it only retires rows that current routing configuration cannot still own. Do we have a high-confidence way to reproduce the issue? Yes, as a source-level reproduction for the PR regression: current main can route a binding-owned DM to Is this the best way to solve the issue? No, not yet. The explicit cleanup/archive approach is a good direction, but the proposed stale-key test must honor route-binding Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 58c706451e1d. |
8f22e8c to
9583e28
Compare
Fixes #76957. Restores the Control UI /new hook lifecycle through an explicit sessions.create emitCommandHooks opt-in, preserving hook-free defaults for programmatic parent-session creates. Validation: - pnpm protocol:check - pnpm test src/gateway/server.sessions.reset-hooks.test.ts ui/src/ui/app-render.helpers.node.test.ts - pnpm exec oxlint on touched TS files - pnpm exec oxfmt --check --threads=1 on touched files - git diff --check - OPENCLAW_LOCAL_CHECK=1 OPENCLAW_LOCAL_CHECK_MODE=throttled env NODE_OPTIONS=--max-old-space-size=4096 pnpm check:changed - GitHub PR checks green on 3a446ec - ClawSweeper re-review completed with no blocking findings and security cleared Duplicate triage: - #77376, #77004, and #76967 were superseded closed attempts for #76957 - #77562 is a closed duplicate issue - #77880 mentions #76957 but is not a duplicate of this hook fix
Fixes #76957. Restores the Control UI /new hook lifecycle through an explicit sessions.create emitCommandHooks opt-in, preserving hook-free defaults for programmatic parent-session creates. Validation: - pnpm protocol:check - pnpm test src/gateway/server.sessions.reset-hooks.test.ts ui/src/ui/app-render.helpers.node.test.ts - pnpm exec oxlint on touched TS files - pnpm exec oxfmt --check --threads=1 on touched files - git diff --check - OPENCLAW_LOCAL_CHECK=1 OPENCLAW_LOCAL_CHECK_MODE=throttled env NODE_OPTIONS=--max-old-space-size=4096 pnpm check:changed - GitHub PR checks green on 3a446ec - ClawSweeper re-review completed with no blocking findings and security cleared Duplicate triage: - #77376, #77004, and #76967 were superseded closed attempts for #76957 - #77562 is a closed duplicate issue - #77880 mentions #76957 but is not a duplicate of this hook fix (cherry picked from commit 49c4a13)
9583e28 to
dc26825
Compare
Fixes openclaw#76957. Restores the Control UI /new hook lifecycle through an explicit sessions.create emitCommandHooks opt-in, preserving hook-free defaults for programmatic parent-session creates. Validation: - pnpm protocol:check - pnpm test src/gateway/server.sessions.reset-hooks.test.ts ui/src/ui/app-render.helpers.node.test.ts - pnpm exec oxlint on touched TS files - pnpm exec oxfmt --check --threads=1 on touched files - git diff --check - OPENCLAW_LOCAL_CHECK=1 OPENCLAW_LOCAL_CHECK_MODE=throttled env NODE_OPTIONS=--max-old-space-size=4096 pnpm check:changed - GitHub PR checks green on 3a446ec - ClawSweeper re-review completed with no blocking findings and security cleared Duplicate triage: - openclaw#77376, openclaw#77004, and openclaw#76967 were superseded closed attempts for openclaw#76957 - openclaw#77562 is a closed duplicate issue - openclaw#77880 mentions openclaw#76957 but is not a duplicate of this hook fix
Summary
openclaw sessions cleanup --fix-dm-scopeto detect stale direct-DM session rows aftersession.dmScopeis returned tomain.retire-dm-scope, removes them only when the operator applies cleanup, and archives their transcript files as.deleted.*instead of silently dropping history.sessions.cleanupRPC, protocol schema, generated Swift mirrors, docs, and changelog.Fixes #47561.
Fixes #45554.
Behavior
When
session.dmScopeismain, the cleanup repair targets old direct-message session key shapes such as:agent:<agent>:direct:<peer>agent:<agent>:<channel>:direct:<peer>agent:<agent>:<channel>:<account>:direct:<peer>It skips the active key and does nothing unless
--fix-dm-scopeis explicitly set. Dry-run mode reports the planned rows without mutating the store.Triage Notes
/new.request failed (502)response, so this PR records the duplicate relationship in the body and closes both issues through the fix.Verification
pnpm test src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cli/program/register.status-health-sessions.test.ts src/gateway/server.sessions.store-rpc.test.tspnpm exec oxlint src/config/sessions/cleanup-service.ts src/commands/sessions-cleanup.ts src/cli/program/register.status-health-sessions.ts src/gateway/protocol/schema/sessions.ts src/gateway/server-methods/sessions.ts src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cli/program/register.status-health-sessions.test.tspnpm exec oxfmt --check --threads=1 CHANGELOG.md docs/cli/sessions.md docs/concepts/session.md src/config/sessions/cleanup-service.ts src/commands/sessions-cleanup.ts src/cli/program/register.status-health-sessions.ts src/gateway/protocol/schema/sessions.ts src/gateway/server-methods/sessions.ts src/config/sessions/store.pruning.integration.test.ts src/commands/sessions-cleanup.test.ts src/cli/program/register.status-health-sessions.test.tsgit diff --checkpnpm protocol:checkpnpm changed:lanes --jsonSecurity
No new network access, credential handling, process execution, dependency, or permission surface. The repair is explicit operator-invoked cleanup of local session-store rows and preserves transcript history by archiving removed row transcripts.