Skip to content

feat: add disable_compaction kwarg to rlm_harness#1211

Open
hallerite wants to merge 3 commits intomainfrom
feat/rlm-harness-disable-compaction
Open

feat: add disable_compaction kwarg to rlm_harness#1211
hallerite wants to merge 3 commits intomainfrom
feat/rlm-harness-disable-compaction

Conversation

@hallerite
Copy link
Copy Markdown
Member

@hallerite hallerite commented Apr 20, 2026

Summary

Adds a disable_compaction: bool = False kwarg to rlm_harness(). When set, removes the summarize tool from the harness's tool registry — the model can no longer self-compact conversation history.

Motivation

In RL ablations (e.g. length-shaping studies), the summarize tool lets the model arbitrarily collapse turns, which confounds measurements of context-length effects. We want a simple way to turn it off per-run without editing DEFAULT_RLM_TOOL_NAMES globally.

Scope

RLM has two compaction mechanisms:

  1. Auto-compaction via RLM_MAX_TURNS_IN_CONTEXT — already off by default (env passes -1)
  2. Model-callable summarize tool — hardcoded into DEFAULT_RLM_TOOL_NAMES before this PR, not user-overridable

This PR addresses (2). (1) is already controllable via existing env arg.

Change

  • disable_compaction=False → unchanged behavior (tool_names = ["ipython", "summarize"])
  • disable_compaction=Truetool_names = ["ipython"]

Default preserves back-compat.

🤖 Generated with Claude Code


Note

Low Risk
Low risk: small, opt-in change that only filters the harness tool_names list and preserves default behavior when the new flag is unset.

Overview
Adds a disable_compaction: bool = False kwarg to rlm_harness() to optionally remove the summarize tool from the harness tool registry.

Default behavior is unchanged; when enabled, the harness passes a filtered tool_names list (excluding summarize) into Harness(...).

Reviewed by Cursor Bugbot for commit 4120679. Bugbot is set up for automated code reviews on this repo. Configure here.

Drops the `summarize` tool from the RLM tool registry when set, removing
the agent's ability to self-compact conversation history. Useful for
ablations where compaction would confound the treatment.

Auto-compaction via RLM_MAX_TURNS_IN_CONTEXT is already off by default
(env arg defaults to -1); this flag addresses the other compaction
mechanism (the `summarize` tool).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hallerite hallerite force-pushed the feat/rlm-harness-disable-compaction branch from 06a5eb3 to 1f9a9c9 Compare April 20, 2026 22:02
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4120679. Configure here.

append_to_system_prompt: str | None = None,
local_checkout: str | Path | None = None,
gh_token: str | None = None,
disable_compaction: bool = False,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing docs update for new user-facing kwarg

Low Severity

The new disable_compaction kwarg on rlm_harness() modifies user-facing functionality for RLMEnv, which is described in docs/environments.md. The project rule requires corresponding documentation updates when core user-facing functionality described in docs is added or modified. The PR description itself contains valuable context about the two compaction mechanisms (auto-compaction via RLM_MAX_TURNS_IN_CONTEXT and model-callable summarize tool) that would be useful reference material — the rule notes such information belongs in docs/faqs.md if it doesn't fit elsewhere.

Fix in Cursor Fix in Web

Triggered by project rule: BugBot Instructions

Reviewed by Cursor Bugbot for commit 4120679. Configure here.

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.

1 participant