[codex] Gate transcript GC behind an opt-in flag#377
Conversation
There was a problem hiding this comment.
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
transcriptGcEnabledin config resolution (env + plugin config), manifest schema, and documentation. - Makes
LcmContextEngine.maintain()return early (no rewrites) unlesstranscriptGcEnabledis 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.
|
Issue: #374 Since the first review, this PR picked up follow-up commit Validation:
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. |
Closes #374
Summary
transcriptGcEnabledconfig flag and default it tofalsemaintain()skip transcript-GC rewrite work unless the flag is enabledWhy
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 testnpm testTranscript GC disabled (default false)while the context engine still initialized and persisted a normal allowed-session turn onagent:lcm-smoke:mainCompanion OpenClaw issue: openclaw/openclaw#64457