openclaw - ✅(Solved) Fix Transcript rewrite suffix replay still makes plugin-side transcript GC unsafe [2 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#64457Fetched 2026-04-11 06:14:53
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
cross-referenced ×2commented ×1

Latest openclaw/openclaw main still exposes a transcript-rewrite behavior that re-branches from the first replaced entry and re-appends the remaining suffix. That makes plugin-side transcript GC unsafe when a caller performs repeated rewrites against the same session transcript.

A related config-array delivery/logging discrepancy showed up in the original 2026.4.9 production incident, but I could not reproduce that second part in an isolated 2026.4.9 profile after adding stronger plugin-side diagnostics. I’m including it here as unresolved context, not as a confirmed latest-main repro.

Root Cause

lossless-claw had been using transcript rewrites as part of transcript GC. Even with plugin-side fixes, the host rewrite primitive is still risky because repeated rewrites can duplicate the untouched suffix after the first replaced entry. That creates transcript amplification and follow-on lock/contention behavior when plugins try to clean up large sessions.

Fix Action

Fixed

PR fix notes

PR #376: [codex] Add session pattern config diagnostics

Description (problem / solution / changelog)

Closes #373

Summary

  • add source diagnostics for ignoreSessionPatterns and statelessSessionPatterns
  • warn explicitly when env-backed pattern arrays replace plugin-config arrays
  • carry config diagnostics into the engine so startup banners can attribute pattern sources
  • extend config and plugin-registration tests for diagnostics, precedence, and logging

Why

The workspace-support incident was harder to debug because runtime logs did not say where the resolved ignore/stateless patterns came from, and env overrides could silently replace plugin-config arrays.

Validation

  • npm test
  • stacked validation branch: npm test
  • isolated OpenClaw 2026.4.9 profile startup logged the full ignore/stateless pattern set from plugin config and showed the profile-local LCM DB path

Companion OpenClaw issue: openclaw/openclaw#64457

Changed files

  • .changeset/pr373-config-diagnostics.md (added, +5/-0)
  • src/db/config.ts (modified, +210/-134)
  • src/engine.ts (modified, +11/-3)
  • src/plugin/index.ts (modified, +21/-3)
  • src/startup-banner-log.ts (modified, +2/-0)
  • src/types.ts (modified, +4/-0)
  • test/config.test.ts (modified, +30/-1)
  • test/plugin-config-registration.test.ts (modified, +37/-4)

PR #377: [codex] Gate transcript GC behind an opt-in flag

Description (problem / solution / changelog)

Closes #374

Summary

  • add an opt-in transcriptGcEnabled config flag and default it to false
  • make maintain() skip transcript-GC rewrite work unless the flag is enabled
  • expose the new flag in the manifest and docs
  • add regression coverage that keeps transcript-GC disabled by default while preserving the rest of LCM behavior

Why

The incident transcript showed rewrite-based transcript GC can amplify large sessions. Making transcript GC explicit keeps the rest of LCM usable while we chase the host-owned rewrite behavior separately.

Validation

  • npm test
  • stacked validation branch: npm test
  • isolated OpenClaw 2026.4.9 profile startup logged Transcript GC disabled (default false) while the context engine still initialized and persisted a normal allowed-session turn on agent:lcm-smoke:main

Companion OpenClaw issue: openclaw/openclaw#64457

Changed files

  • .changeset/transcript-gc-disabled-by-default.md (added, +5/-0)
  • README.md (modified, +5/-0)
  • docs/configuration.md (modified, +2/-0)
  • openclaw.plugin.json (modified, +7/-0)
  • skills/lossless-claw/references/config.md (modified, +9/-0)
  • src/db/config.ts (modified, +6/-0)
  • src/engine.ts (modified, +8/-1)
  • src/plugin/index.ts (modified, +6/-0)
  • src/startup-banner-log.ts (modified, +1/-0)
  • test/bootstrap-flood-regression.test.ts (modified, +1/-0)
  • test/circuit-breaker.test.ts (modified, +1/-0)
  • test/config.test.ts (modified, +12/-0)
  • test/engine.test.ts (modified, +40/-1)
  • test/expansion.test.ts (modified, +1/-0)
  • test/lcm-expand-query-tool.test.ts (modified, +1/-0)
  • test/lcm-expand-tool.test.ts (modified, +1/-0)
  • test/lcm-tools.test.ts (modified, +1/-0)
  • test/plugin-config-registration.test.ts (modified, +6/-7)
  • test/session-operation-queues.test.ts (modified, +1/-0)
  • test/summarize.test.ts (modified, +1/-0)
RAW_BUFFERClick to expand / collapse

Summary

Latest openclaw/openclaw main still exposes a transcript-rewrite behavior that re-branches from the first replaced entry and re-appends the remaining suffix. That makes plugin-side transcript GC unsafe when a caller performs repeated rewrites against the same session transcript.

A related config-array delivery/logging discrepancy showed up in the original 2026.4.9 production incident, but I could not reproduce that second part in an isolated 2026.4.9 profile after adding stronger plugin-side diagnostics. I’m including it here as unresolved context, not as a confirmed latest-main repro.

Confirmed On Latest Main

  • Local upstream checkout fetched to upstream/main at daeb74920d.
  • src/agents/pi-embedded-runner/transcript-rewrite.ts still finds the first rewritten entry and rebuilds the transcript from there, re-appending the remaining suffix after the rewritten segment.
  • In the original incident, repeated rewrite-style maintenance produced a ~35 MB workspace-support transcript with ~94.6% duplicate message bytes. The repeated prompt/tool blobs matched suffix replay rather than a clean session join.

Why This Matters

lossless-claw had been using transcript rewrites as part of transcript GC. Even with plugin-side fixes, the host rewrite primitive is still risky because repeated rewrites can duplicate the untouched suffix after the first replaced entry. That creates transcript amplification and follow-on lock/contention behavior when plugins try to clean up large sessions.

Minimal Repro Shape

  1. Start from a session transcript with a large trailing suffix.
  2. Rewrite one or more entries somewhere before the end of the transcript.
  3. Trigger another rewrite/maintenance pass against the same session.
  4. Observe the remaining suffix get re-appended from the first rewritten entry forward, producing duplicate prompt/tool blocks.

Additional Context From Validation

  • I validated three companion lossless-claw draft PRs against an isolated OpenClaw 2026.4.9 profile:
    • Martian-Engineering/lossless-claw#375
    • Martian-Engineering/lossless-claw#376
    • Martian-Engineering/lossless-claw#377
  • In that isolated profile, plugin startup did correctly log the full ignoreSessionPatterns / statelessSessionPatterns arrays from plugin config, and workspace-support stayed at 0 LCM conversations / 0 LCM messages during a real agent:workspace-support:main turn.
  • Because of that, I could not reproduce the older config-array drop symptom on the latest isolated run. The production 2026.4.9 logs had previously omitted those arrays even though openclaw.json contained them, so there may still be a separate intermittent config delivery or startup logging gap.

Requested Follow-up

  • Make transcript rewrite idempotent for repeated rewrites against the same session suffix, or expose a safer append/update primitive for plugins.
  • Add an integration test that performs multiple rewrites against the same transcript and asserts that message count and suffix content stay stable.
  • If the config-array discrepancy is still believed possible, add startup tracing for the raw plugin config object handed to plugin registration so it is easier to distinguish config delivery bugs from plugin-side logging bugs.

extent analysis

TL;DR

Make the transcript rewrite idempotent to prevent duplicate message bytes and transcript amplification.

Guidance

  • Review the transcript-rewrite.ts file to understand how the rewrite process is currently handled and identify potential areas for improvement.
  • Consider adding a check to prevent re-appending the remaining suffix after the first rewritten entry, ensuring that repeated rewrites do not produce duplicate prompt/tool blocks.
  • Implement an integration test to verify that multiple rewrites against the same transcript do not affect message count and suffix content stability.
  • Investigate the config-array delivery/logging discrepancy and add startup tracing for the raw plugin config object to help distinguish between config delivery bugs and plugin-side logging bugs.

Example

No code snippet is provided as the issue does not contain sufficient information to generate a specific example.

Notes

The provided information suggests that the issue is related to the transcript rewrite behavior in the openclaw/openclaw repository. However, the exact cause of the config-array discrepancy is still unclear and may require further investigation.

Recommendation

Apply a workaround to make the transcript rewrite idempotent, as this will help prevent duplicate message bytes and transcript amplification. This can be achieved by modifying the transcript-rewrite.ts file to handle repeated rewrites correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING