Skip to content

refactor(eviction): move the host-neutral eviction core out of the DeepSeek Harness adapter - #95

Merged
Xubqpanda merged 2 commits into
zjunlp:mainfrom
boxabirds:claude/upstream-5-eviction-refactor
Oct 2, 2026
Merged

Xubqpanda merged 2 commits into
zjunlp:mainfrom
boxabirds:claude/upstream-5-eviction-refactor

Conversation

@boxabirds

Copy link
Copy Markdown

Summary

Groundwork for #93 (OpenCode support), with no behaviour change.

The DeepSeek Harness adapter contains eviction logic that has nothing DeepSeek-specific in it. This PR moves that logic into @lightrsi/eviction (src/canonical-surface/), so other adapters can reuse it instead of copying it. The DeepSeek Harness adapter now calls the shared code through thin wrappers, and its public API is unchanged.

What moved

Shared module What it does
tool-closure.ts Pairs tool calls with their results, and decides which pairs are safe to evict
safety-policy.ts The independent safety checks applied before anything is evicted
eviction-cycle.ts The estimate → registry → safety → apply cycle
estimator-config.ts Checks the task-state estimator configuration and builds it

Item ids are generic, so a host can use its own ids instead of DeepSeek event sequence numbers. DeepSeek-specific parts stay in the adapter: event parsing, native replacement envelopes and the surfaceOp transaction.

Tests

This is a change protected by regression tests.

  • No behaviour change: the DeepSeek Harness adapter's existing 110 tests pass unchanged.
  • New tests for the shared code: one case-matrix file per module (canonical-surface-*.test.ts), with one test per input case. The eviction suite goes from 53 to 119 tests.
  • Wrappers pinned to the shared code: deepseek-harness/tests/shared-eviction-delegation.test.ts checks that the DeepSeek wrappers give the same results as the shared code. It covers tool pairs, safety decisions, pair classification, estimator setup and the pre-refactor exports.
  • Other checks: pnpm build, pnpm typecheck and check:boundaries pass, as do the claude-code, codex, cli, history and preset suites.

Prepared with help from Claude Code; the commits are marked Co-Authored-By: Claude.

claude added 2 commits October 1, 2026 01:04
…SH adapter

Move the host-neutral pieces of DeepSeek Harness eviction into
@lightrsi/eviction (canonical-surface/): tool call/result closure, the
independent safety policy, registry task-state classification, the
estimate -> registry -> safety -> transaction cycle, and estimator
construction helpers. Item ids are generic so transcript-based hosts
(pi, OpenCode) can use entry ids instead of DSH event seqs.

The DSH adapter keeps its public API and now delegates to the shared
module; only DSH event parsing, native replacement envelopes and the
surfaceOp transaction stay in the adapter. No behaviour change:
DSH tests 110/110, eviction tests 62/62 (9 new).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6it2Si8k8XNGMF8RdyMQz
…l-surface core

Replace the initial smoke tests with one test file per module (tool
closure, safety policy, eviction cycle, estimator config). Each file lists
the input cases it covers at the top and has exactly one test per case, so
a failure names the behaviour that changed.

Pin the DeepSeek Harness wrappers to the shared core with a delegation
test file: tool pairs, safety decisions (per oracle fixture and min-size
boundary), pair classification, estimator construction, and the
pre-refactor export surface.

eviction: 119/119, deepseek-harness: 138/138.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01S6it2Si8k8XNGMF8RdyMQz
@boxabirds
boxabirds force-pushed the claude/upstream-5-eviction-refactor branch from b1aa908 to 93b9067 Compare October 1, 2026 01:35
@Xubqpanda
Xubqpanda merged commit c79e4f0 into zjunlp:main Oct 2, 2026
2 checks passed
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.

3 participants