Skip to content

harbor: remove extra DeepSeek Harness compaction headroom - #1796

Merged
burtenshaw merged 2 commits into
mainfrom
harbor/dsh-compaction-headroom
Dec 3, 2026
Merged

burtenshaw merged 2 commits into
mainfrom
harbor/dsh-compaction-headroom

Conversation

@younesbelkada

@younesbelkada younesbelkada commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

What

profile_patch configures dsh's compaction-basic with headroomTokens: 0 and an explicit summary token limit. The limit is the smaller of the route's reply budget and dsh's default of 65,536. The pinned release requires a positive summary limit and would otherwise inherit zero from headroomTokens.

Why

dsh's compaction-basic compacts at min(0.8 × contextWindow, contextWindow − maxTokens − headroomTokens), and headroomTokens defaults to 65536, which is sized for DeepSeek's 1M window. With a 131072-token window and 32768-token replies, that threshold is 32768 tokens. A compaction keeps 0.16 × (131072 − 32768) ≈ 15.7k tokens. Once the system prompt, tools and summary are added, the context is back at the threshold right after each summary, so dsh compacts again on nearly every step.

On Terminal-Bench 2.1, Inkling-2-Mini, 131072 window, 32768-token replies:

  • dsh compacted 452 times over 19 trials. The median compaction took 86 s.
  • Compaction took about 72% of each attempt.
  • Compaction started at a median of 36k tokens of context, and the next request after it already had 35k.
  • 41 of 86 attempts hit the 60-minute agent timeout. Other harnesses on the same setup had 1 to 14.

With headroomTokens: 0, dsh compacts at the earlier of 80% of the context window or the point where it has just enough space for a full reply.

Window / reply budget Threshold before Threshold after
131072 / 32768 32768 98304
65536 / 32768 none: the default leaves a negative budget, so dsh skipped step compaction and compacted only after an overflow 32768

The entry id compaction-basic is the one declared in dsh's base layer (@deepseek-ai/dsh-base, cordis.patch.yml). That layer gives it no config, so this patch is its only config.

Test plan

  • Run tests/envs/test_harbor_deepseek_harness.py with Harbor 0.25.0. All 11 tests passed, including the bundle install test.
  • Load the generated config with the pinned npm release's resolver. A zero-only patch fails validation. The updated patch resolves to 32,768 and 98,304 tokens for the two configurations above, and to 104,857 for a 131,072-token context with 16,384-token replies.

🤖 Generated with Claude Code


Note

Low Risk
Targets DeepSeek Harness profile generation and tests only; no auth, infra, or shared runtime paths beyond dsh rollout config.

Overview
DeepSeek Harness profile patches now configure compaction so agents with smaller served context windows (e.g. 131k) do not trigger dsh’s step compaction on almost every turn. profile_patch adds a compaction-basic entry with headroomTokens: 0 and maxTokens capped at min(65_536, max_tokens), overriding dsh’s default 65k headroom sized for 1M contexts.

The module docstring is updated to mention this compaction policy. A parametrized test checks the new patch entry across several window/reply budgets.

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

… fits

dsh's compaction-basic compacts at min(0.8 x window, window - maxTokens -
headroomTokens), with headroomTokens 65536 by default. With a 131072-token
window and 32768-token replies that is 32768 tokens, while a compaction keeps
0.16 x 98304 tokens, so the context is back at the threshold after every
summary and dsh compacts again on nearly every step. Set headroomTokens to 0
in the profile patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@burtenshaw burtenshaw added bug Something isn't working size: small Small pull request labels Dec 3, 2026 — with Cursor
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

The docs for this pull request are available at https://openenv.github.io/OpenEnv/pr-preview/pr-1796/ (commit dbde1d7). The preview may take a minute to update and is removed when the pull request closes.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

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 using default effort 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 8be30cf. Configure here.

Comment thread src/openenv/harbor/deepseek_harness.py Resolved
@burtenshaw burtenshaw changed the title harbor: let DeepSeek Harness compact only when a full reply no longer fits harbor: remove extra DeepSeek Harness compaction headroom Dec 3, 2026
@burtenshaw
burtenshaw merged commit f7a6430 into main Dec 3, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size: small Small pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants