fix(session-memory): skip transcript-only assistant rows#95820
fix(session-memory): skip transcript-only assistant rows#95820moeedahmed wants to merge 2 commits into
Conversation
0e3fc4f to
e9850db
Compare
|
Codex review: needs maintainer review before merge. Reviewed July 12, 2026, 4:02 AM ET / 08:02 UTC. Summary PR surface: Source 0, Tests +112. Total +112 across 2 files. Reproducibility: yes. Current main only deduplicates delivery-mirror rows, so a provider assistant row followed by an identical gateway-injected row remains a concrete source-level duplicate path. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep this PR open until a linked canonical PR proves it covers this PR's unique work, or a maintainer confirms closure. Do we have a high-confidence way to reproduce the issue? Yes. Current main only deduplicates delivery-mirror rows, so a provider assistant row followed by an identical gateway-injected row remains a concrete source-level duplicate path. Is this the best way to solve the issue? Yes. Reusing the shared transcript-only classification while dropping only immediate sanitized duplicates is narrower than general assistant-text deduplication and preserves unique injected replies. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 55679d88c6be. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source 0, Tests +112. Total +112 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
e9850db to
d5ad3e6
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
@clawsweeper re-review |
29d2f6c to
d5ad3e6
Compare
What Problem This Solves
Session-memory summaries can duplicate assistant replies when a transcript contains both the real provider assistant message and an OpenClaw-authored bookkeeping assistant row with identical visible text, such as
delivery-mirrororgateway-injected.Dropping every OpenClaw-authored assistant row is unsafe, because standalone message-tool delivery mirrors and non-duplicate gateway-injected replies can be the only visible assistant text. This PR now drops only duplicate bookkeeping rows and preserves unique visible assistant replies.
Summary
delivery-mirrorandgateway-injectedassistant rows only when their sanitized text repeats the previous visible assistant replydelivery-mirrorreplies and non-duplicategateway-injectedassistant textEvidence
node scripts/run-vitest.mjs run src/hooks/bundled/session-memory/handler.test.ts src/hooks/bundled/session-memory/transcript.test.tspassed: 2 files, 35 testscorepack pnpm exec oxfmt --check --threads=1 src/hooks/bundled/session-memory/transcript.ts src/hooks/bundled/session-memory/handler.test.tspassedgit diff --check origin/main...HEADpassedReal behavior proofcheck passed on the refreshed headReal transcript-reader proof using
getRecentSessionContentagainst a temporary JSONL transcript containing:delivery-mirrorrowgateway-injectedrowgateway-injectedrowOutput:
The duplicate OpenClaw-authored bookkeeping rows are omitted, while the unique gateway-injected assistant reply is retained.
Context
Raw transcripts can include both a real assistant response and OpenClaw-authored assistant bookkeeping rows. Session-memory should not duplicate the same assistant text, but it must still preserve OpenClaw-authored assistant rows when they are the only visible reply.