Skip to content

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

Merged
jalehman merged 2 commits into
Martian-Engineering:mainfrom
electricsheephq:codex/374-transcript-gc
Apr 10, 2026
Merged

[codex] Gate transcript GC behind an opt-in flag#377
jalehman merged 2 commits into
Martian-Engineering:mainfrom
electricsheephq:codex/374-transcript-gc

Conversation

@100yenadmin

@100yenadmin 100yenadmin commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator

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

@100yenadmin 100yenadmin marked this pull request as ready for review April 10, 2026 18:35
Copilot AI review requested due to automatic review settings April 10, 2026 18:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in transcriptGcEnabled configuration flag (default false) to gate rewrite-based transcript GC during maintain(), reducing the risk of transcript amplification while keeping core LCM behavior usable.

Changes:

  • Introduces transcriptGcEnabled in config resolution (env + plugin config), manifest schema, and documentation.
  • Makes LcmContextEngine.maintain() return early (no rewrites) unless transcriptGcEnabled is enabled.
  • Updates/extends tests to assert the default-off behavior and explicit enablement.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/session-operation-queues.test.ts Adds transcriptGcEnabled to test config fixture.
test/plugin-config-registration.test.ts Ensures plugin config passes the new flag and expects startup logging for it.
test/expansion.test.ts Adds transcriptGcEnabled to base config.
test/engine.test.ts Enables GC explicitly for rewrite test; adds regression test for default-off maintain().
test/config.test.ts Asserts default + env + plugin config behavior; asserts manifest schema includes the flag.
test/circuit-breaker.test.ts Adds transcriptGcEnabled to test config fixture.
test/bootstrap-flood-regression.test.ts Adds transcriptGcEnabled to test config fixture.
src/plugin/index.ts Emits a startup banner describing Transcript GC enablement state.
src/engine.ts Gates maintain() transcript rewrite GC behind transcriptGcEnabled.
src/db/config.ts Adds transcriptGcEnabled to LcmConfig and to resolveLcmConfig() resolution precedence.
skills/lossless-claw/references/config.md Documents the new config flag and default.
README.md Documents env var + plugin config flag and default-off behavior.
openclaw.plugin.json Exposes flag in UI hints and config schema.
docs/configuration.md Adds flag to example config and key table.
.changeset/transcript-gc-disabled-by-default.md Changeset describing default-off and opt-in behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/plugin/index.ts
Comment thread src/db/config.ts
Comment thread src/engine.ts
@100yenadmin

Copy link
Copy Markdown
Collaborator Author

Issue: #374
Companion host issue: openclaw/openclaw#64457

Since the first review, this PR picked up follow-up commit 95c5cf2, which makes it standalone-correct against main: "transcript-gc-enabled" is now part of StartupBannerKey, the remaining test mocks set transcriptGcEnabled: false explicitly, and the generic ignore/stateless startup banner behavior is restored here instead of depending on #376.

Validation:

  • branch: npm test passed
  • refreshed stacked branch (#375 + #376 + #377): 39 files / 671 tests passed
  • latest OpenClaw main host build daeb749 in an isolated profile with the stacked plugin used a fresh DB at /Users/lume/.openclaw-lcm-stack-mainvalidate/lcm.db; ignored workspace-support still produced 0 conversations / 0 messages, and allowed agent:lcm-smoke:main produced 1 conversation / 2 messages while maintain() stayed on the non-rewrite path for that turn

Maintainer note: after the follow-up fixes this PR is standalone-safe, and it was also revalidated as the third PR in the full stack.

@jalehman jalehman self-assigned this Apr 10, 2026
@jalehman jalehman merged commit 3b2d34c into Martian-Engineering:main Apr 10, 2026
1 check passed
@github-actions github-actions Bot mentioned this pull request Apr 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transcript GC can still amplify transcripts via rewrite-based suffix replay

3 participants