Repository navigation
fix(memory): automations linked to older dashboard chats get no memory access - #182345
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesDoctor records missing direct-chat metadata on eligible older dashboard sessions so linked automations can access memory. Example: An automation links to agent:main:dashboard:7d3c1f00-0000-4000-8000-000000000001 created before chat-type stamping.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current upgrade gap through the existing Doctor repair owner; no actionable correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherDoctor normalizes persisted session rows before runtime use; the existing memory resolver consumes their chat type, current occurrence authority, and session-generation facts to grant or refuse provider access. flowchart LR
A[Legacy dashboard session] --> B[Doctor eligibility check]
B --> C[Canonical row repair]
C --> D[Scheduled occurrence admission]
D --> E[Memory audience resolver]
E --> F[Provider authority guard]
F --> G[Memory partition]
Technical reviewBest possible solution: Land the bounded Doctor backfill while preserving the existing memory audience and revocation owners. Do we have a high-confidence way to reproduce the issue? Current source denies roots without a durable chat type, and the supplied stable-release upgrade reproduction demonstrates that failure for legacy dashboard-linked jobs; no target code was executed during this review. Is this the best way to solve the issue? The repair restores an existing session invariant through Doctor's canonical transaction owner, with conservative eligibility and no competing runtime fallback. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c078b8d49af8. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +80, Tests +154, Docs +4. Total +238 across 4 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
Reviewed October 24, 2026, 3:51 AM ET / 07:51 UTC (Revision 2). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…y access (openclaw#182345) * fix(doctor): record pre-existing dashboard roots as direct chats * docs(memory): note the Doctor chat-type backfill for older dashboard chats * fix(doctor): describe the chat-type backfill without implying owner access * test(doctor): keep real note exports in the chat-type backfill test
…y access (#182345) * fix(doctor): record pre-existing dashboard roots as direct chats * docs(memory): note the Doctor chat-type backfill for older dashboard chats * fix(doctor): describe the chat-type backfill without implying owner access * test(doctor): keep real note exports in the chat-type backfill test Backport adaptation: retain beta.5 branch-native fixture APIs and existing regression coverage; no donor behavior omitted. Source-commit: 8e5741e Canonical-group: final-p0-r0b-8e5741ef75bc Co-authored-by: RomneyDa <[email protected]>
Release adaptation of 50b532d (#183153). The backport of #182345 (51f63cb) exported isUnstampedDashboardRoot only for its unit test. Main made it private and drove the eligibility cases through repairLegacyDashboardChatTypes using a canonical-repair fixture this branch does not carry. Keep every accepted and rejected row case, now asserted through the repair boundary with the branch's session accessor.
…eadcode after backports (#187570) * refactor: keep Teams allowlist sentinel private (#185484) The Microsoft Teams fail-closed allowlist sentinel now remains module-private while preserving its exact restrictive projection and lifecycle coverage. (cherry picked from commit 59b1ddd) * test: teach the live-wrapper fake Bun to answer --revision Partial cherry-pick of the test/scripts/test-live.test.ts hunk only. #173807 (backported as e72f868) made the CI Bun --revision probe mandatory; the fake Bun fixture must answer it from the checkout pin. (cherry picked from commit 08dd80a) * test(ci): expect watchdog exit 124 from wedged run-tsgo #184639 (backported as d9a91b5) intentionally changed the run-tsgo watchdog exit from 1 to 124 so CI collectors stop admitting work. Main realigned this case in run-tsgo-worktree.test.ts (9b14a38); on the release branch the same watchdog case lives in run-tsgo.test.ts and was not realigned by the backport. * test(vitest): keep gateway database-worker routes in canonical order The beta.5 adaptation of #178415 (23a2bcd) prepended three integration proofs to gatewayDatabaseWorkerTestFiles. Canonical project ownership compares that list against sorted discovery, so the out-of-order entries failed vitest-cli-ownership. Move them to their sorted positions; routing membership is unchanged. * refactor: keep Slack reconnect policy private (#181690) Keeps Slack reconnect policy details module-private while preserving the exact invalid-auth cutoff, reset, and blocked-status behavior. (cherry picked from commit cd65901) * fix: keep retired Telegram throttler release private Telegram hunk of 09f9ec8 (#183086) only. The release-only test called the private helper directly; its surviving-alias case is already asserted through releaseRemovedTelegramAccountThrottler, so drop the duplicate direct call. (cherry picked from commit 09f9ec8, partial) * refactor: keep Claude partial-message measurement private src/agents/cli-output-stream-limits.ts hunk of 28e2774 (#184686) only; the backport of #184352 left this export without a consumer. (cherry picked from commit 28e2774, partial) * refactor: keep managed plugin cache selector private src/plugins/management-catalog.ts hunk of 2c0c30b (#185269) only; the backport of #184921 left this export without a consumer. (cherry picked from commit 2c0c30b, partial) * refactor(agents): keep requester settle batch callbacks type private The backport of #181260 (2f7589a) moved RequesterSettleWakeParams into the state module, leaving RequesterSettleWakeBatchCallbacks exported only for a test fixture. Main keeps it module-private; type the fixture through RequesterSettleWakeParams instead. * refactor(infra): drop unconsumed streaming UTF-8 decoder The minimal backport of #180861 (8d3183d) added decodeUtf8Chunks as a prerequisite, but its main consumers (streaming state-migration importers) were intentionally not backported, so production Knip flags it. Remove the export and its unit case; decodeUtf8Input is unchanged. * refactor(scripts): keep pinned Bun CI detection private The minimal #172625 backport (e6c3639) deferred the dev-tool, test-runtime and run-format callers that consume isCiEnvironment on main, so the export has no consumer on the release branch. * test(update): drop orphaned recovery version-mismatch fixture The #185692 backport in 39f9bde removed the last consumer of recoveryVersionMismatch from update-cli.plugin-convergence.test.ts. Main removed the same fixture in eae9bc4 (#181717). * test(gateway): type config removal mocks through inline module imports The release adaptation of #152052 (41aa7a6, de41770) typed its partial mocks through type-only namespace imports. Knip treats the secrets runtime namespace as the only consumer of its exports, so the full-tree scan reported prepareSecretsRuntimeSnapshotRestore and SecretResolverWarning as unused. Use main's inline typeof import() form. * refactor(shared): drop unconsumed async-store helper The backport of #179213 (6d9852d, plus f3fb0e9 registering it as a wrapper component) took the runWithAsyncStore helper and its test without the plugin-instance-invocation consumer, leaving src/shared/async-store.ts unused in production. Remove the helper, its test and its wrapper-components entry rather than complete a perf change during beta stabilization. * chore(knip): model backported perf scripts and Telegram worker fixture Mirror main's Knip entries for files added by beta.5 backports: - scripts/perf/{node-event-session-source-measure.mjs, stream-dispatch-scope-measure.ts,system-prompt-report-retention.ts} as path-invoked script roots (#183931, #183552, #183010); - the Telegram ingress context Worker fixture loaded by URL (#178909) in production ignoreFiles. Also register scripts/test-security-mail-parser.mjs, the standalone nodemailer sender-parsing regression added by #187301 (release-only). * refactor(doctor): keep dashboard migration guard at the repair boundary Release adaptation of 50b532d (#183153). The backport of #182345 (51f63cb) exported isUnstampedDashboardRoot only for its unit test. Main made it private and drove the eligibility cases through repairLegacyDashboardChatTypes using a canonical-repair fixture this branch does not carry. Keep every accepted and rejected row case, now asserted through the repair boundary with the branch's session accessor. * test(agents): hold requester preparation for the settle capacity case after #181260 backport Backport 2f7589a (#181260) filters delivered child findings from settle wakes (needsRequesterSettleFindings), so this delivered-row case no longer reads the child transcript where it injected worker capacity and failed with 'expected findTranscriptEvent to be called'. Main realigned the same case in 411b2e6 (#178104): inject capacity at captureRequesterSessionEntryCurrent and assert the delivered result is not repeated in the resumed wake. Apply that realignment; the 'Already delivered child results' wording that main also asserts belongs to #178104's message change, which this branch does not carry. (adapted from commit 411b2e6) --------- Co-authored-by: Shakker <[email protected]>
What Problem This Solves
Fixes: automations linked to a dashboard chat created on v2026.10.6 or earlier still get no memory access after upgrading. Those chats have no stored chat type, so the memory audience check refuses them (
root session ... has no durable chat type).User Impact
After
openclaw doctor --fix, automations linked to an older dashboard chat get the same memory access as automations linked to a chat created today. Owner-saved jobs get the owner-private vault. Older jobs with no recorded owner get that chat's conversation memory instead of being refused. Group and channel sessions stay unchanged.Why This Change Was Made
#181359 records
chatType: "direct"only when sessions.create/chat.send creates a new dashboard root. It has no backfill, so older dashboard roots keep a null chat type until a webchat turn runs in them. Chats that were only driven bysessions_send, cron, or theagentmethod never get one. This PR adds a Doctor row repair that records the same stamp on rows that provably are such roots. Doctor owns legacy-state normalization, so runtime code stays unchanged.Eligibility rule (
isUnstampedDashboardRoot). This is the creation-timenewDashboardRootcondition rebuilt from durable facts. A row qualifies only when all of these hold:chatTypeis unset andcreatedVia === "operator"agent:<id>:dashboard:<…>and is not an incognito key, and the row is notincognitoparentSessionKeyis that agent's main session key under the currentsession.mainKey. That is the dashboard-root grouping link.spawnedBy,forkSource, orpluginOwnerId, and noexternaldelivery routeChannel and group sessions are created via
channel, neveroperator. An operator can create a row with a channel-shaped key, and v2026.10.6 also parents that row to main, so the dashboard-key check is what excludes it. The upgrade proof below covers exactly that row. A dashboard root from before roots were grouped under main (July 2026) has no parent link and stays unstamped. That is an accepted gap: those rows can't be told apart from operator-created explicit children.There is no runtime "stamp on next chat.send" change. Gateway client turns already record
ChatType: "direct"(gateway-client-identity.ts). On Josh's live install, every operator dashboard root that has run a webchat turn already hasdirect. The null rows are the ones driven only bysessions_send, cron, oragent, and only Doctor can reach those.Scope: one new Doctor module plus one call in
doctor-session-transcripts.ts. The call sits next to the existing exec-policy row repair and uses the sharedrepairCanonicalSessionEntriesscan/rewrite. No changes to the cron Doctor check from the sibling card.Evidence
src/commands/doctor-session-dashboard-chat-type.test.ts(18 tests). They cover the predicate's accept case, the configuredmainKey, and every reject branch: existing chat type, channel/spawn/unstamped creation, spawned child, fork, plugin owner, incognito row and key, external delivery, explicit or missing parent, channel-shaped key, the main session, and a cross-agent parent. A Doctor integration test checks three things: preview changes nothing,--fixstamps only the eligible root, and the rerun is a no-op. The only change to the repaired row ischatType; its session ID and lifecycle revision stay the same, so linked jobs keep their captured parent incarnation.src/commands/doctor-session-exec-policy.test.ts(shared repair path) also passes.pnpm tsgo:coreandpnpm tsgo:core:testpass; oxlint/oxfmt are clean on changed files.createdVia: operator, a dashboard key, and a null chat type, and all 36 are eligible. Zero group/channel rows match. The 36 rows are main 5, fm-base 8, fm-skills 8, fm-both 7, fm-know 7, douglas 1. Two cron jobs link to an eligible row, both disabled. No row loses access.cbx_ea109a58f557(c7a.8xlarge), runrun_f46c44aa8d12fffa38458232311a8c5a, exit 0, lease released. Tested source: this PR's production files byte-identical to head3a05c30b748(the commit after the proof only changes the test's mock), on basee96f6921f32, plus local-only proof tooling (a QA memory provider and a fake CLI that calls it through the loopback MCP bridge). An earlier eu-west-1 run on542600bf42b(run_a62f9a8a3074538b6516953b9fd0296f) gave the same result.[email protected], isolated state):sessions.createmakes a dashboard chat, an operator-created row with a channel-shaped key (agent:main:discord:group:proof-123), and an incognito root, and each gets a linked cron job. Both stored rows havechatType: nullandparentSessionKey: agent:main:main.openclaw doctor --fixon this branch printsRecorded 1 dashboard chat(s) as direct chats … agent:main:dashboard:a8c7c677-…. The dashboard row becomeschatType: "direct"with the same lifecycle revision. The channel-shaped row staysnull. Linked jobs are unchanged across the upgrade.audience {"kind":"owner-private","agentId":"main"}→OWNER-PRIVATE-NOTE. The pre-upgrade job (no recorded owner) gets that chat'sconversationaudience →CONVERSATION-NOTE. Before this change, both were denied withroot session … has no durable chat type(2b upgrade proof).memory audience unavailable: root session agent:main:discord:group:proof-123 has no durable chat type. The incognito-linked job stays paused because its conversation is unavailable after the restart. That is existing behavior, unrelated to this repair.