Repository navigation
fix #183856: stop writing retired top-level channel to session entry - #184079
wangjx-xydt wants to merge 3 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: stale review; fresh review needed. Summary Next step Review history (2 earlier review cycles)
|
The fast reply session initializer spread a top-level `channel` field (retired SessionEntry slot key) into the session entry when a provider was present. Doctor flags durable rows that carry it as legacy delivery fields, so a native /status right after /new produced a recurring maintenance warning. The canonical delivery block already owns channel identity, so the field is simply no longer emitted.
…trap The regression now seeds a post-`/new` session owning canonical external delivery state, bootstraps `/status` over it, and asserts the retired top-level `channel` key stays absent, the reused delivery block survives, and the entry is a no-op for Doctor's legacy-delivery normalizer.
7f73559 to
22068e5
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Move the normalizeLegacySessionEntryDelivery import below isPathInside to match oxfmt's ordering; the previous placement failed the check-lint job.
|
Thanks @wangjx-xydt for finding and fixing this! Merged the credited replacement in #190213, with a regression that checks the persisted session and canonical delivery readers. Closing this superseded PR; your co-author credit is preserved in the landed commit. |
Summary
/statusis the first message after a chat/new, the fast reply session initializer wrote a retired top-levelchannelfield into the session entry.openclaw doctorthen reportedFound 1 durable session row(s) with legacy delivery fieldsand kept reporting it after everydoctor --fix.channelfield from the fast session initializer. Channel identity is already owned by the canonicaldeliveryblock, so dropping the stray field loses no routing information.src/auto-reply/reply/get-reply-fast-path.ts: removed thechannelvariable and its...(channel ? { channel } : {})spread ininitFastReplySessionState.src/auto-reply/reply/get-reply.fast-path.test.ts: added a regression that seeds a post-/newsession owning canonical externaldelivery, bootstraps a native/statusover it, and asserts the resultingsessionEntryhas nochannelproperty, keeps the reuseddeliveryblock untouched, and is a no-op for Doctor's legacy-delivery normalizer.deliveryblock,chatType,subject,groupChanneland all other canonical session fields are untouched. Doctor's legacy-delivery normalizer and its repair behavior are unchanged. No persisted schema or cache format changes.Fixes #183856
Real behavior proof
/statusright after/newwrote the retiredchannelkey next to the canonicaldeliveryblock, making doctor repeatedly ask for repair on healthy sessions. After the fix the fast initializer no longer emits the field, the reused canonical delivery survives, and the resulting entry is a no-op for Doctor's legacy-delivery normalizer (so a persisted row is not flagged).issue-183856worktree on top of latestmain(e850f7c5), running the realinitFastReplySessionStatefast bootstrap flow (native/status,Provider=telegram) through the existing fast-reply test harness, and the real Doctor delivery-state repair suite against SQLitesession_nodes.entry_jsonrows.sessionEntrycarriedchannel: "telegram"(assertion failed withReceived: "telegram"). After the fix the same bootstrap produces asessionEntrywithout achannelproperty, with the seeded canonical externaldeliveryblock intact, andnormalizeLegacySessionEntryDeliveryreturns the entry unchanged (a persisted row is not reported by doctor). The Doctor suite proves the end-to-end data model: a durable row carryingchannel/route/deliveryContext/lastAccountIdis found byrepairCanonicalSessionDeliveryStates, repaired to a canonicaldeliveryblock, has everyLEGACY_SESSION_DELIVERY_KEYSkey stripped, and is no longer reported on the next scan.openclaw doctorrun against the persistedsession_nodes.entry_jsonwas not executed in this environment; the fix is verified at the exact producer (fast session initializer) with the native/statuspath, and the doctor normalizer that flags the field is covered by its own suite against real SQLite rows. The unrelatedget-reply-native-slash-fast-path.test.tsfile could not be run locally due to a pre-existing startup hang in this environment (it does not import the changed module); it runs in CI.Regression Test Plan
src/auto-reply/reply/get-reply.fast-path.test.ts/statusfast bootstrap (Providertelegram) over a post-/newsession that owns canonical externaldeliverymust (1) not produce a top-levelchannelproperty, (2) keep the reuseddeliveryblock, and (3) be a no-op fornormalizeLegacySessionEntryDelivery— the exact normalizer Doctor applies when deciding whether a durable row needs repair.initFastReplySessionState) on the exact reported trigger (native/statusafter/newwith a provider present), asserting the retired key is absent and that the persisted row would not be flagged by Doctor; the doctor-delivery suite independently asserts the normalizer's repair of already-affected rows.Root Cause
initFastReplySessionStateinsrc/auto-reply/reply/get-reply-fast-path.tscomputedconst channel = normalizeOptionalString(ctx.Provider)and spread...(channel ? { channel } : {})into theSessionEntry.channelis a retiredSessionEntryslot key (RETIRED_SESSION_SLOT_KEYSinsrc/plugins/session-entry-slot-keys.ts); the coreSessionEntrytype no longer carries it. The canonicaldeliveryblock already owns channel identity, so the field was pure legacy metadata that doctor flags.