Repository navigation
fix(gateway): stop persisting passive chat greetings into the durable logbook - #129506
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Note: this PR also carries a one-commit repair for currently-red |
|
Codex review: found issues before merge. Reviewed August 25, 2026, 3:58 PM ET / 19:58 UTC. ClawSweeper reviewWhat this changesThe branch makes welcome-only system-agent greetings ephemeral except for external-edit alerts, and updates one Merge readinessKeep this PR open: it prevents new passive welcome rows, but affected upgraded profiles retain their existing rows and still render the duplicate. Likely related people: steipete (high confidence). Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherGateway chat sessions seed an engine from the durable system-agent transcript, generate a welcome, and expose the transcript separately to the Custodian UI. The UI renders that loaded transcript as earlier conversation before appending the live welcome. flowchart LR
A[Durable transcript] --> B[Gateway chat session]
B --> C[Engine seeds prior history]
C --> D[Welcome generated]
D --> E{User input or external edit?}
E -->|Yes| F[Persist transcript]
E -->|No| G[Ephemeral welcome]
A --> H[Custodian earlier history]
G --> H
Decision needed
Why: The durable records contain only role, text, and time, so choosing a migration or deletion rule can discard real conversation and materially changes persisted-state semantics. Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +6, Tests +37. Total +43 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Mantis proof suggestionA redacted Custodian chat transcript before and after reconnect would directly demonstrate the claimed web UI chat effect. A maintainer can ask Mantis to capture proof by posting this exact PR comment: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the producer-side guard and add a maintainer-approved, retention-safe recovery for legacy rows; if their origin cannot be established safely, scope the change to future sessions and offer explicit operator recovery rather than deleting rows by greeting text. Do we have a high-confidence way to reproduce the issue? Yes—current main persists a passive welcome, the transcript reader returns it unchanged, and Custodian loads that history before rendering the next live welcome. The review did not execute the UI flow because this is read-only inspection. Is this the best way to solve the issue? No—the new producer guard is the right prevention point for future rows, but it does not solve the retained-state half of the reported behavior for upgraded profiles. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 66bfdeffb9b4. LabelsLabel 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 (1 earlier review cycle)
|
… logbook Every fresh system-agent chat session persisted its generated welcome into the durable logbook, and the next session seeded that tail back as history. On a zero-history profile the embedded Control UI custodian (which loads openclaw.chat.history separately) rendered the identical 'Inference is ready' greeting twice — live plus under an EARLIER divider — and greetings accumulated on every reconnect. Persist a newly generated welcome only when the request carries genuine user input, or when a caretaker welcome delivers a one-shot external-edit alert (facts.recentExternalEdit) whose audit cursor advances on delivery and therefore must stay recoverable. Ordinary caretaker, onboarding, and new-agent welcome-only connections keep the greeting in live engine context without creating durable transcript rows. Reset boundaries and real conversation persistence are unchanged. Regression tests fail pre-fix for all three greeting variants: two consecutive welcome-only connects must not replay the prior greeting.
8e302fe to
5258ed2
Compare
|
Merged via squash.
|
… logbook (openclaw#129506) Every fresh system-agent chat session persisted its generated welcome into the durable logbook, and the next session seeded that tail back as history. On a zero-history profile the embedded Control UI custodian (which loads openclaw.chat.history separately) rendered the identical 'Inference is ready' greeting twice — live plus under an EARLIER divider — and greetings accumulated on every reconnect. Persist a newly generated welcome only when the request carries genuine user input, or when a caretaker welcome delivers a one-shot external-edit alert (facts.recentExternalEdit) whose audit cursor advances on delivery and therefore must stay recoverable. Ordinary caretaker, onboarding, and new-agent welcome-only connections keep the greeting in live engine context without creating durable transcript rows. Reset boundaries and real conversation persistence are unchanged. Regression tests fail pre-fix for all three greeting variants: two consecutive welcome-only connects must not replay the prior greeting.
What Problem This Solves
On a zero-history fresh profile, the first thing an operator sees after onboarding is the system-agent greeting duplicated: the live "Inference is ready" welcome plus an identical copy under an "EARLIER" divider, and another copy accumulates on every chat reconnect. Captured live during a macOS onboarding round (obt826, main 203024e):
Mechanism: the
openclaw.chatsession owner (system-agent.ts) seeds each new engine from the durable logbook tail, generates the welcome, then unconditionally persisted that welcome into the logbook (persistEngineHistory, unconditional since 8c7f09a). The embedded Control UI custodian loadsopenclaw.chat.historyindependently and labels the seeded tail "EARLIER", so the previous session's identical greeting renders below the fresh one.Why This Change Was Made
Record facts where they happen: a passive greeting that produced no user interaction is not conversation history. The welcome is now persisted only when the initial request carries genuine user input, or when a caretaker welcome delivers the one-shot external-edit alert (
facts.recentExternalEdit) — that alert's audit cursor advances on delivery, so it must remain recoverable in the logbook (contract from 629de99, preserved). Ordinary caretaker, onboarding, and new-agent welcome-only connections keep their greeting in live engine/model context without durable rows. Reset boundaries (reset: truekeeps the logbook, clean model context) and real conversational persistence are untouched.Alternatives rejected: filtering at
seedHistoryloses because the Control UI loads the unfiltered durable history itself; tagging greeting rows adds persisted/protocol surface for ephemeral state; dropping every greeting unconditionally would break the external-edit durability contract.User Impact
Fresh installs and every subsequent app launch show one greeting, once. The durable logbook stops accumulating identical passive greetings; externally-edited-config alerts still survive delivery.
Evidence
Regression tests fail pre-fix for all three greeting variants (caretaker, onboarding, new-agent): two consecutive welcome-only connections must not replay the prior greeting (3 failed pre-fix, all pass post-fix). Focused gateway suites green: 43 tests across system-agent-greeting-welcome, system-agent, reset-boundary, and session-lifecycle. Full
check-changedgreen. Autoreview clean ("patch is correct (0.99)"). Production delta +6 lines, justified by the external-edit durability boundary.