File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -597,6 +597,20 @@ describe("selectAgentHarness", () => {
597597 ) . toBe ( "codex" ) ;
598598 } ) ;
599599
600+ it ( "skips harness compaction preflight for claude-cli runtime sessions" , async ( ) => {
601+ await expect (
602+ maybeCompactAgentHarnessSession ( {
603+ sessionId : "session-1" ,
604+ sessionKey : "agent:main:main" ,
605+ sessionFile : "/tmp/session.jsonl" ,
606+ workspaceDir : "/tmp/workspace" ,
607+ provider : "anthropic" ,
608+ model : "claude-opus-4-7" ,
609+ config : agentModelRuntimeConfig ( "anthropic/claude-opus-4-7" , "claude-cli" ) ,
610+ } ) ,
611+ ) . resolves . toBeUndefined ( ) ;
612+ } ) ;
613+
600614 it ( "does not compact a plugin-pinned session through PI when the plugin has no compactor" , async ( ) => {
601615 registerFailingCodexHarness ( ) ;
602616
Original file line number Diff line number Diff line change 11import type { OpenClawConfig } from "../../config/types.openclaw.js" ;
22import { formatErrorMessage } from "../../infra/errors.js" ;
33import { createSubsystemLogger } from "../../logging/subsystem.js" ;
4+ import { isCliRuntimeAlias } from "../model-runtime-aliases.js" ;
45import type { CompactEmbeddedPiSessionParams } from "../pi-embedded-runner/compact.types.js" ;
56import type {
67 EmbeddedRunAttemptParams ,
@@ -442,6 +443,15 @@ function logAgentHarnessSelection(
442443export async function maybeCompactAgentHarnessSession (
443444 params : CompactEmbeddedPiSessionParams ,
444445) : Promise < EmbeddedPiCompactResult | undefined > {
446+ const runtime = resolveConfiguredAgentHarnessPolicy ( {
447+ provider : params . provider ,
448+ modelId : params . model ,
449+ config : params . config ,
450+ sessionKey : params . sessionKey ,
451+ } ) . runtime ;
452+ if ( isCliRuntimeAlias ( runtime ) ) {
453+ return undefined ;
454+ }
445455 const harness = selectAgentHarness ( {
446456 provider : params . provider ?? "" ,
447457 modelId : params . model ,
You can’t perform that action at this time.
0 commit comments