refactor(agents): trim native compaction ownership follow-up

This commit is contained in:
Ayaan Zaidi
2026-06-02 14:11:49 +05:30
parent 5e52a9b513
commit db576c4a2d
5 changed files with 18 additions and 50 deletions

View File

@@ -217,10 +217,9 @@ backend hook can express the behavior.
If your backend runs an agent that compacts its **own** transcript, set
`ownsNativeCompaction: true` so OpenClaw's safeguard summarizer never runs against its
sessions - the CLI compaction lifecycle returns a no-op and the turn proceeds. This is
the **same opt-out Codex uses** (its app-server owns automatic compaction); `claude-cli`
declares it because Claude Code compacts internally with no harness endpoint. It also
removes any need to inflate `contextTokens` just to keep the safeguard from firing.
sessions - the CLI compaction lifecycle returns a no-op and the turn proceeds. `claude-cli`
declares it because Claude Code compacts internally with no harness endpoint. Native-harness
sessions such as Codex keep routing to their harness compaction endpoint instead.
**Only declare it when all of the following hold**, or a deferred over-budget session can
stay over budget / go stale (OpenClaw no longer rescues it):
@@ -228,9 +227,8 @@ stay over budget / go stale (OpenClaw no longer rescues it):
- the backend reliably compacts or bounds its own transcript as it nears its window;
- it persists a resumable session so the compacted state survives turns
(e.g. `--resume` / `--session-id`);
- it is **not** a native-harness compaction session - a session whose `agentHarnessId`
matches the provider routes to the harness endpoint instead; this no-op applies only
when there is no harness endpoint.
- it is not a native-harness compaction session - matching `agentHarnessId` sessions
route to the harness endpoint instead.
## MCP tool bridge