Repository navigation
Conversation
- Expose bounded active-branch replay groups through the context-engine SDK. - Carry admission and snapshot ownership through worker and memory readers. - Render persisted inter-session provenance at the final model boundary. - Cover canonical replay, branch admission, byte budgets, and stable provider prefixes.
|
🦞👀 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: ready, awaiting a maintainer decision. What this changesAdds bounded canonical transcript replay for context engines and restores inter-session provenance at the final model boundary. Example: A completion followed by a 2,190,526-byte image moves two historical users outside the hydration window.
Review scores
ProductKind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Partial Merge readiness⏳ Ready, awaiting maintainer decision Keep open: this PR addresses a concrete history-reconstruction gap still present on main, and no definite introduced correctness defect was found. Priority: P2 Decision needed
Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherContext engines select retained conversation history; the host transcript owner supplies canonical messages and carriers, which the final model boundary projects into provider requests. flowchart LR
A[Canonical transcript] --> B[Existing history owner]
B --> C[Bounded replay reader]
C --> D[Context engine assembly]
D --> E[Final model projection]
E --> F[Provider request]
Technical reviewBest possible solution: Keep canonical replay under the existing transcript owner and reuse the established provenance renderer after context-engine assembly. Do we have a high-confidence way to reproduce the issue? Current main exposes no canonical replay-group reader and annotates provenance before reconstruction; supplied red/green and Gateway observations support the reported path, while this read-only review ran no code. Is this the best way to solve the issue? The implementation uses the existing storage and projection owners, with necessary durable and memory adapters and one shared provenance renderer; it does not resolve the broader hydration-policy requests. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d4d6fe725bff. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +384, Tests +473, Docs +36, Other +2. Total +895 across 27 files. Added test files: 1. View PR surface stats
Preflight sourceSource 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
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 November 6, 2026, 7:29 PM ET / November 7, 2026, 00:29 UTC (Revision 2). |
- Skip model and thinking metadata between retained users and their context carriers. - Stop at background-result placements and all existing model-history boundaries. - Cover durable and memory readers with oversized metadata and placement regressions.
|
@clawsweeper re-review Updated to The combined test exposed an additional defect: thinking/model bookkeeping interrupted the canonical user/carrier group. Both storage readers now skip non-model bookkeeping while retaining background-result placement and other model-history boundaries. The focused reader tests pass (14 cases), and the isolated built Gateway restores both historical users and both carriers from outside hydration. The six preceding provider content blocks remain stable across completion -> image -> foreground chat. The image's own externalization, text-shorthand equivalence, synthetic-provider scope, and current validation gaps are explicitly separated from the older live cache-hit evidence. Please reassess the proof blocker and the bookkeeping/placement boundaries. Public SDK acceptance remains a maintainer decision. No live Gateway or configuration was changed. |
|
🦞👀 Re-review progress:
|
- Complete the repository transcript-reader mock and wrapper file inventory. - Document provenance cast invariants and verified worker-only replay ownership. - Tighten the moved assertion baseline and account for the three mock lines.
|
Review/repair update for Independent Astra review of the original change found a P2: both replay readers could restore a A fresh independent Astra review examined all eight repair files and their unchanged projection, admission, custody, and worker callers. No verified P0–P2 findings remained. The reviewed working diff SHA-256 was Validation on the repaired source:
Public SDK disposition: the narrow, read-only replay-groups capability fits the existing transcript-runtime surface, uses existing projection/admission ownership, selects caller-retained identities under bounded hydration, and has the concrete lossless-claw companion consumer. I recommend retaining it on those merits under Josh's requested review/landing scope; this does not manufacture a separate named owner's approval or waive enforced review/security checks. The companion review found no P0–P2 issues, passes 2,161 JS tests plus types/build/TUI/package and native SDK probes, and remains unchanged pending host-first landing. The earlier ClawSweeper no-findings comment covers its recorded older head, not this repair. Final landing remains subject to current-head feedback and applicable GitHub gates. Parent follow-up on the same published head: core types were independently rerun to terminal exit 0. The final committed ratchet is 6,556,380 LF versus ceiling 6,556,375 (five over). Direct immutable-Git-blob measurement at introduction base CI attribution follow-up for unchanged
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…aw#194362) * fix: Preserve canonical context through history reconstruction - Expose bounded active-branch replay groups through the context-engine SDK. - Carry admission and snapshot ownership through worker and memory readers. - Render persisted inter-session provenance at the final model boundary. - Cover canonical replay, branch admission, byte budgets, and stable provider prefixes. * fix: preserve replay carriers across transcript bookkeeping - Skip model and thinking metadata between retained users and their context carriers. - Stop at background-result placements and all existing model-history boundaries. - Cover durable and memory readers with oversized metadata and placement regressions. * fix: complete canonical replay CI integration - Complete the repository transcript-reader mock and wrapper file inventory. - Document provenance cast invariants and verified worker-only replay ownership. - Tighten the moved assertion baseline and account for the three mock lines. * fix: exclude retired prompt overrides from canonical replay --------- Co-authored-by: jalehman <[email protected]>
Refresh the complete v2026.11.3..09aa644 history: 99 in-range PRs, 35 issues, and direct-commit editorial coverage. Preserve all 62 prior contribution records and original main PR credits. Include typed Telegram callbacks, worker-heartbeat lease renewal, and the narrow large-store startup adaptations without claiming post-ready recovery. Source product: 09aa644 Source tree: f10a88c Main metadata: 3577724 Notes tooling: 514a224 Release provenance: 3768440 -> openclaw#194840, openclaw#179219, openclaw#196984, openclaw#196337 Release provenance: 00275d2 -> openclaw#194362 Release provenance: 66f0339 -> openclaw#186998 Release provenance: 915956a -> openclaw#186998 Co-authored-by: vincentkoc <[email protected]> Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
A context engine can retain a raw user message after that message leaves the host's bounded hydration window. Reconstructing it from the moving window loses its canonical runtime-context carriers. Inter-session provenance is also rendered before context-engine assembly, so reconstructing a completion can remove its envelope. The next foreground turn then rewrites an already-cached conversation prefix even when the system prompt and tools are unchanged.
Related: #164515 and #159799. This addresses the context-engine reconstruction case, not every hydration-window or cache-expiry issue reported there.
User Impact
Retained raw history can keep its original metadata, attached runtime context, and inter-session presentation across completion-to-chat transitions. The companion LCM change consumes the new public reader; the reader alone does not change LCM reconstruction. No configuration, model, compaction threshold, schema, or stored transcript is changed.
Why This Change Was Made
The host owns canonical transcript identity, active branches, and admission. Expose a bounded
readSessionTranscriptReplayGroupsthrough the existingcontext-engine-transcript-runtimeSDK instead of making context engines scan private files or infer missing carriers from text. Reuse the existing provenance renderer after model-prompt projection at the final LLM boundary.src/plugin-sdk/{context-engine-transcript-runtime,session-transcript-runtime}.tssrc/config/sessions/session-transcript-*,session-history-read-operation*,src/state/openclaw-agent-execution-*src/config/sessions/session-actor-memory-*src/agents/replay-provenance.ts,embedded-agent-runner/replay-history.ts,run/attempt-llm-boundary.tsThe reader returns requested IDs in order, deduplicated. Absent, inactive, non-user, and admission-fenced IDs are omitted. A cumulative uncompressed source-byte overflow rejects the whole read; storage failures are not silently treated as empty history. Default budget: 8 MiB; cap: 64 MiB and 10,000 IDs. No new cache, polling, retry loop, storage owner, or direct transcript-file reader is introduced.
Thinking/model changes, ordinary custom bookkeeping, labels, and session information may separate a user from its carriers without adding a model message. The reader skips those records without hydrating their payloads. It still stops at messages, other custom messages, background-result placements, compaction, reset, and branch-summary boundaries. Background-result placements are not bookkeeping: they can insert assistant messages at that position.
Evidence
Captured before/after on an existing long-running session
On November 6, 2026, a real subagent-completion -> image-tool -> foreground-chat transition was captured before and after the paired host/LCM repair. These were private operator turns in the existing main session, with channel delivery disabled. The table contains only numerical evidence; private conversation payloads and identifiers are not published.
The repaired chat reused 99.88% of input from cache; cache writes fell 99.82%. The repaired prompt is larger because canonical context that previously disappeared is retained. Model selections and compaction settings were unchanged. After a cleanup restart, another successful reply reported 551,513 cache-read, 469 cache-write, and 4 uncached input tokens.
Evidence boundary: the live capture used a patched 2026.10.8 deployment with both repairs. This PR ports the host repair onto current upstream; its current-head tests are listed separately below. No live deployment was changed while preparing these PRs. Ordinary new input, compaction, expiry, and logged assembly-error fallback can still create cache writes; this is not a claim that all subscription-limit causes disappear.
Gateway and companion-consumer proof at f49e92e
Tested host
f49e92e4d8151ff1d6a7a8078081934351c60691with the unchanged companion LCM head7fd2091a1dfccca8efce7c21432719541135fb6b. The host build, runtime-postbuild, and build-info stamps all match that committed head. The LCM bundle SHA-256 is9cc5dabedecad265eec2aae80615ed1fbac7fe2c369da68d44ef7e3c00ff31ad.An isolated built Gateway used a fresh workspace/state, disabled cron and external delivery, and a local Anthropic-protocol HTTP/SSE capture server. The sequence was real
chat.sendwarmup ->agentwith a synthetic internal completion event -> nativereadof a synthetic image -> foregroundchat.send. This exercises the Gateway completion endpoint, not a real child-task settlement. Model responses and usage counters were synthetic; no provider credentials, paid model requests, or live Gateway changes were involved.The actual companion engine ran through the public SDK. An observation-only wrapper logged its
assembleinputs/outputs without modifying them. The image moved both historical users and their carriers outside the host hydration window. The first run onf13368e3b2bexposed a real missing case: thinking-level/model-snapshot bookkeeping between the warmup user and its carrier stopped the reader. The follow-up fixes that case in both storage readers, with a separate stop boundary for background-result placements.Sanitized terminal observations:
Comparison boundary: the seventh block is the image tool result, which LCM intentionally replaces with a stored-file reference. The six preceding blocks include both canonical users, both runtime carriers, the earlier assistant reply, and the image tool call. The repository's
snapshotProviderPrefix/assertStableProviderPrefixchecks preserve their ordered content while accounting for Anthropic's equivalent text-string/block forms and moving cache-control markers. This is not full raw HTTP-byte equality or live Anthropic cache-hit proof; the older deployment's real cache counters remain separately labeled above. No compaction or assembly fallback occurred in this current-head run.Regression red/green
9f9471128ace: both failed with the missing inter-session envelope (29.18s). On the initial PR head, both passed (31.78s). The same test source was used; unrelated fixture setup failures were excluded from these results.f13368e3b2b: the durable reader and memory reader both returned empty carrier lists, failing their expected canonical groups. The repaired readers pass both cases, including oversized metadata that must not consume the replay payload budget.Functional checks at f49e92e and its predecessor
On Node 24, with one Vitest worker:
scripts/run-vitest.mjsentrypoint.git diff --checkpassed.build:ci-artifactspassed in 1m57.8s. Its non-fatal UI performance report flagged gzip budgets by 0.3 KiB (largest JS), 0.4 KiB (chat boot), and 0.7 KiB (new boot); no UI source or budget was changed by this PR. This is recorded, not claimed as a clean UI-performance gate.pnpm ui:check-performance:base 9f9471128ace7cff27cecfbad387a3129ef7daaccheck failed. Attribution found that the only module with changed raw size was the generated packaged-plugin inventory (ui/src/plugins/control-ui-distribution.ts: 4,162 versus 1,432 bytes); the candidate had the full built plugin distribution and the source archive did not. That run measured 560,795/560,533 bytes for largest-JS actual/limit and 797,633/797,380 for new-boot actual/limit. No budgets were raised or UI changes added. The source comparison's artifact asymmetry remains a validation limitation, not a passing gate or a claimed inherited failure.Public SDK declaration comparison on the initial PR head completed successfully against
9f9471128ace(pnpm plugin-sdk:api:diff --base 9f9471128ac --head f13368e3b2b). It reports three added exports on the existing context-engine transcript subpath, no removed entrypoints or exports, and 171 existing exports with changed reachable declarations from the added read operation/types (digestf06acae8). The follow-up does not change the public signature; its built SDK is exercised by the companion consumer above. Maintainer approval of this additive public contract remains a merge decision, not something this proof grants.November 9 CI repair
Marked ready for review to run normal hosted CI. Run
42711889355identified an incomplete repository-file transcript mock, two missing wrapper inventory entries, undocumented provenance cast invariants, and missing worker-only classification for the replay kernel. Commit49bab6c47a1c74ad6760b7022244b8c34bbb7909repairs those integration omissions without changing production execution or public SDK behavior. Both replay-kernel callers are existing worker modules:session-history-read-operation.worker.tsandopenclaw-agent-execution-transcript.worker.ts.Focused local verification:
git diff --check: passed. Main-thread SQLite count remains 167 -> 167.Hosted CI run 42713758431 completed successfully on
49bab6c47a1c74ad6760b7022244b8c34bbb7909, including all three previously failing jobs, build artifacts, and all three PostgreSQL conformance shards. The separate PR-tooling Darwin workflow also passed. The Gateway/companion-consumer evidence above remains explicitly pinned tof49e92e4d815; it was not rerun for these non-behavioral integration changes. No full test suite or auto-review was run locally, per operator instruction. Maintainer acceptance of the public SDK contract remains outstanding.Companion LCM PR: Martian-Engineering/lossless-claw#1288. The host capability must be available for that plugin's canonical replay path; older hosts retain the existing bounded-live-window behavior.