Skip to content

fix: keep learning from chat history when a conversation disappears - #208098

Merged
daniel-lxs merged 8 commits into
mainfrom
openclaw/work-for-roboclaw-944423
Nov 30, 2026
Merged

daniel-lxs merged 8 commits into
mainfrom
openclaw/work-for-roboclaw-944423

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #207960.

What this fixes

Learn from chat history can lose a conversation between listing it and reading it. Scribe skips a listed source that returns No session found and continues with the readable sources in the same agent-scoped list.

Each readable window publishes its lessons and checkpoint together. The checkpoint records the last message read, the activity time observed during listing, and the publication request ID. Existing Markdown checkpoint entries retain their last-learned time. For a changed source, history supplies only messages newer than that time and stops paging when it reaches the saved cursor. An unchanged listing is covered on the next run. If listing activity changes without a new message, a verified reread refreshes that activity marker.

A duplicate delivery returns the original published receipt with alreadyPublished and adds zero claims. Pending mutations retain their original payload checks. This preserves the reason changed mutation retries are rejected and keeps checkpoints scoped to sources listed by the current run. Changed retries · Conversation scope

Verification

On a fresh AWS CrabBox, the calibrated Qwen2.5-32B-Instruct provider ran the real cron list/delete/read race against main and this PR.

Run Observed result
Main 16b04e24a41e Stopped at the missing history. Zero claims and no checkpoint.
PR e4a974558b2a Skipped the missing conversation, read Harbor Clock, and published its cobalt-glass lesson and checkpoint in one receipt.
Fresh Scribe replay, same vault The planner returned Harbor Clock as covered with the original request ID. No Harbor Clock history read, no new claims or pages.
Duplicate delivery, empty lesson list The finish tool returned the original published receipt, including both item IDs, hashes and revisions, with alreadyPublished: true.

The source activity time was 47 ms later than the saved message time. The replay's final text counted one conversation as learned and reported zero writes. The tool trace records the source as already covered, and the vault contained exactly one claim throughout replay.

A stable-to-head upgrade wrote a checkpoint and claim using v2026.11.12 and reopened the same vault on this head. The original claim, note and mutation receipt survived. Bullet, tab, whitespace and date-first entries retained their cursors. Updating the selected entry preserved the others. The incremental-history regression returned only the newer message on a page containing a clipped, previously learned message and stopped at the saved cursor. Stable release

The runtime build, 136 focused tests, type-aware lint, formatting, and core and Knowledge type checks passed. The PR allocates 191 test lines above the standard allowance for the opt-in real Gateway race and the storage, pagination and terminal-settlement regressions.

Contributor: @daniel-lxs

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

🦞 Made with OpenClaw

roboclaw-bot and others added 2 commits November 29, 2026 07:02
Treat a missing history as one skipped source without moving its checkpoint. Keep other Scribe failures visible.

Co-authored-by: daniel-lxs <[email protected]>
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 5d705984-2146-451f-b8fc-607c74d6a351
@clawsweeper

clawsweeper Bot commented Nov 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation plugin: knowledge size: M labels Nov 29, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels Nov 29, 2026
@roboclaw-bot

roboclaw-bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Collaborator Author

Learn from chat history: a listed conversation disappears

I deleted a synthetic cron job after Scribe listed it and before its history read. Main stopped with nothing learned. The fix skipped the missing key, learned from the remaining conversation, and finished. I verified the checkpoint separately.

Clean comparison

Main · failed Fix · done
Before: Scribe stopped After: Scribe finished

Annotated comparison

Main · no conversations learned Fix · one conversation learned
Before: the import stopped After: the import completed

Real Control UI, isolated AWS Gateway, synthetic conversations. Baseline: 758614e723f1. Fix: c691b3ee3410 (same tree as the verified implementation).

roboclaw-bot and others added 2 commits November 29, 2026 07:10
Worked on by:
- @daniel-lxs

Co-authored-by: daniel-lxs <[email protected]>
OpenClaw-Publication: 4b63c554-03bc-4338-aa43-29d9ab153bd3
@roboclaw-bot
roboclaw-bot marked this pull request as ready for review November 29, 2026 07:18
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 29, 2026
@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: passed.

What this changes

This PR skips vanished conversation sources and publishes each readable window’s lessons and checkpoint together, with incremental reads and published-window recovery.

Example: A Scribe lists a temporary cron conversation and agent:main:harbor-clock, then the cron conversation disappears.

  • Before: The missing history stops the run before Harbor Clock’s decision is learned.
  • After: The Scribe skips the missing conversation, learns the cobalt-glass decision from Harbor Clock, and publishes its checkpoint.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Useful recovery behavior with inspected product evidence and focused compatibility regressions; the broader current-head verification is reported rather than independently replayed.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected Control UI screenshots demonstrate missing-source recovery on the earlier implementation; the current body additionally records exact-head AWS race/replay verification and a v2026.11.12 storage upgrade preserving records and receipts, supported by the revised source and focused regressions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: One unavailable conversation can stop chat-history learning before other readable conversations are processed.
Reason: The isolated failure demonstrates user value, and maintainer authorship establishes direction for the scoped recovery change.

Merge readiness

✅ Ready for maintainer review

This PR addresses a demonstrated Scribe failure, and the current source resolves both prior findings. No definite remaining correctness or security defect was found; exact-head CI is still running.

Reviewed head: e4a974558b2a735b479196c24cd643f582bd92e4

Before merge

None.

Findings

None.

Agent review details

How this fits together

Knowledge Scribes consume agent-scoped session inventories and history, extract cited lessons, and publish claims and progress through Knowledge’s existing storage and mutation owners.

flowchart TD
  A[Scribe run] --> B[Agent scoped session tools]
  B --> C[Conversation progress tracking]
  C --> D[Knowledge conversation operations]
  D --> E[Existing batch publication]
  E --> F[Claims checkpoint and receipt]
Loading

Technical review

Best possible solution:

Keep missing-source continuation and atomic window publication while preserving existing cursors, agent scope, and ordinary mutation retry validation.

Do we have a high-confidence way to reproduce the issue?

Current-main instructions treat step failures as terminal without an unavailable-history exception, and the supplied isolated Gateway comparison demonstrates that a listed cron conversation can disappear before its history read.

Is this the best way to solve the issue?

The implementation preserves the existing session-access and batch-publication owners while making skipped sources and completed windows explicit; the focused tests cover legacy progress, pagination, replay, and premature settlement.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 6889eb07bb41.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned change and current-main boundary: Reviewed the introduced merge-base-to-head changes; fetched main still has separate model-directed claim and checkpoint writes without the missing-history exception. (extensions/knowledge/skills/knowledge-ingest/references/learning.md:42, e4a974558b2a)
  • Inspected real-product evidence: The four downloaded screenshots show an isolated Control UI run stopping with zero learned conversations before the fix and completing with one learned conversation afterward; their comment identifies earlier implementation revisions.
  • Legacy checkpoint finding addressed: The parser now accepts Markdown-delimited source keys and timestamps rather than requiring tabs, and the storage regression retains a bullet-style legacy cursor. (extensions/knowledge/src/storage-conversations.ts:40, e4a974558b2a)
  • Incremental-pagination finding addressed: Already-learned messages are removed before clipping and budgeting; reaching the saved cursor ends pagination when the returned new window is complete, with a regression covering clipped old text. (src/agents/tools/sessions-history-tool.ts:611, e4a974558b2a)
  • Publication and retry contract: Published-window recovery verifies the retained agent and window identity and returns the historical receipt; unresolved mutations still use checkReplay, and claims plus checkpoint use the existing batch publisher. (extensions/knowledge/src/storage-conversations.ts:215, e4a974558b2a)
  • Recorded upgrade verification: The current PR body reports a v2026.11.12-to-head storage check preserving the original claim, checkpoint IDs, mutation receipt, and legacy Markdown cursors; the persisted Plan addition is optional. (extensions/knowledge/src/storage-types.ts:36, e4a974558b2a)

Likely related people:

  • Josh Lehman: Raw commit 239b496 adds extensions/knowledge/skills/knowledge-ingest/references/learning.md:26 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 239b4969e72a; files: extensions/knowledge/skills/knowledge-ingest/references/learning.md)
  • Daniel: Raw commit 8687643 adds extensions/knowledge/skills/knowledge-ingest/references/learning.md:78 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 86876433baf7; files: extensions/knowledge/skills/knowledge-ingest/references/learning.md)

PR surface

Source +919, Tests +591, Docs +35, Other +2. Total +1547 across 32 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 23 965 46 +919
Tests 6 594 3 +591
Docs 2 49 14 +35
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 32 1610 63 +1547

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Knowledge tool surface 2 new operations Planning and finishing conversation windows add model-facing contracts without introducing a configuration option.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • merge-risk: 🚨 compatibility: The PR adds Knowledge operations and machine-consumed checkpoint activity/receipt fields; legacy parsing, the storage regression, and the recorded stable-upgrade check address existing-state compatibility.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall readiness starts with the lower of the proof and patch scores. It is capped at 3/6 if the fix is partial, the change offers little benefit, a product decision is still open, or the PR reverses an earlier decision without saying why. ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-11-29T07:23:27.032Z sha da21994 :: needs changes before merge. :: [P2] Cite the incident beside the missing-history instruction
  • reviewed 2026-11-29T07:41:17.602Z sha 50a9c67 :: passed. :: none
  • reviewed 2026-11-29T08:17:42.929Z sha 4c8e6d5 :: passed. :: none
  • reviewed 2026-11-29T22:58:26.631Z sha ce4ccc1 :: blocked before merge. :: [P2] [P2] Preserve existing checkpoint notes before requiring tab-separated rows | [P2] [P2] Complete incremental reads when they reach the saved cursor

Reviewed November 29, 2026, 6:40 PM ET / 23:40 UTC (Revision 5).

@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 29, 2026
@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph guard cleared

This PR no longer has dependency changes awaiting review. A future dependency graph change requires an admin or SecOps member’s /allow-dependencies-change comment after the guard notice identifies that revision.

  • Current SHA: e4a974558b2a735b479196c24cd643f582bd92e4

@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Security-sensitive guard cleared

Current revision: e4a974558b2a735b479196c24cd643f582bd92e4

This PR no longer changes files in the maintainer security-review tier.

Separate CODEOWNERS requirements still apply to security policy and enforcement files.

@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

Keep the observed session-list activity alongside the last message read.
An unchanged listed source is already covered even when the session and
message timestamps differ. Report the original request ID and resolve
an already-published window through the source receipt without issuing
a new mutation or counting its claims again.

Publish each readable window with its lessons, skip only vanished
sources, and keep the payload checks on unresolved and ordinary writes.
@daniel-lxs

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀

Re-review progress:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: knowledge proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants