Skip to content

feat: default compaction (256k) and max_depth=1 - #150

Merged
samsja merged 3 commits into
mainfrom
feat/default-compaction-and-depth
Aug 28, 2026
Merged

feat: default compaction (256k) and max_depth=1#150
samsja merged 3 commits into
mainfrom
feat/default-compaction-and-depth

Conversation

@samsja

@samsja samsja commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

Two default changes:

setting before after disable/override
summarize_at_tokens None (compaction off) 256,000 RLM_SUMMARIZE_AT_TOKENS="" or "0"
max_depth 0 (no sub-agents) 1 RLM_MAX_DEPTH=0

Why

  • Compaction on by default: without it, long trajectories die at the model context limit. 256k is a safety-net threshold — typical rollouts never touch it (SWE medians are ~10-30k), but the rare monster trajectory compacts and survives instead of failing. Compaction behavior (handoff quality, post-compaction recovery via the surviving kernel + conversation log) has been validated in the ablations backing feat: terse persona prompt, bash+ipython default tools, actionable compaction handoff #142; at-threshold rollouts solved at 0.75-0.88 with the improved handoff prompt.
  • max_depth=1 by default: one level of await rlm('sub-task') is available out of the box, matching how the harness is deployed in practice.

Notes

  • Empty/0 env values for RLM_SUMMARIZE_AT_TOKENS now mean "disabled" (previously "" meant unset->off; unset now means the 256k default).
  • With max_depth>=1 the engine owns a SessionTreeSupervisor; embedders using the sync close() inside an event loop must switch to await engine.aclose() (the idempotency test now pins max_depth=0 for that reason — it tests retries, not recursion).
  • Tests: 130 passed; the 6 test_acp.py failures are pre-existing on clean main in this environment.

Note

Medium Risk
Behavior changes for all deployments that relied on implicit defaults (compaction off, no sub-agents); long runs may compact unexpectedly and recursive rlm() is enabled unless env overrides are set.

Overview
Default execution policy now turns on context compaction at 256,000 tokens and allows one level of sub-agent recursion (max_depth=1), including matching env defaults for RLM_MAX_DEPTH.

RLM_SUMMARIZE_AT_TOKENS parsing changes semantics: omitting the variable applies the 256k threshold; "" or "0" explicitly disables compaction (replacing the old “unset/empty means off” behavior). _summarize_at_tokens encodes that logic and invalid positives still raise.

Tests assert the new defaults, cover disable-via-empty/zero, switch async engine teardown from close() to await aclose() (needed when recursion/supervisor is on), and pin max_depth=0 on the compaction/idempotency test so it stays focused on retries rather than sub-agents.

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

- summarize_at_tokens defaults to 256_000 (was None/off): long trajectories
  compact instead of dying at the context limit; disable with
  RLM_SUMMARIZE_AT_TOKENS="" or "0".
- max_depth defaults to 1 (was 0): one level of `await rlm(...)` sub-agents
  available out of the box; RLM_MAX_DEPTH=0 restores the old behavior.
- test_model_call_idempotency pins max_depth=0 explicitly (it tests retry
  idempotency, not recursion; sync close() inside a loop is unsupported for
  supervisor-owning engines).
hallerite
hallerite previously approved these changes Aug 26, 2026
@samsja
samsja marked this pull request as ready for review August 26, 2026 23:54

@cursor cursor Bot 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.

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 bc59190. Configure here.

Comment thread tests/test_acp.py
@hallerite
hallerite self-requested a review August 27, 2026 00:10
samsja added 2 commits August 28, 2026 04:53
With max_depth defaulting to 1, engines own a SessionTreeSupervisor, and the
sync close() correctly refuses inside a running event loop. The async ACP
tests now use `await engine.aclose()` (the API-correct call); the one sync
test keeps close(), which runs the async cleanup itself outside a loop.
@samsja
samsja merged commit 80ab23e into main Aug 28, 2026
9 checks passed
@samsja
samsja deleted the feat/default-compaction-and-depth branch August 28, 2026 05:20
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.

2 participants