Summary
The headline openclaw#639 ship-gate fix (threading session provider/model/authProfileId through volitional compaction, honoring the real compaction result instead of lying {ok:true}) has no behavioral test. The classifier test (src/agents/pi-embedded-runner/compact-reasons.test.ts:41-47) pins the string match for unknown_model but doesn't assert the call-site threading or counter-truth that the ship-gate was actually about.
Shipping the fix without a regression-pinning test means the next provider/model rename or fallback-dispatcher refactor can silently reintroduce the original bug.
What needs pinning
-
Provider/model reach the compaction call: both request_compaction call sites (agent-runner-execution.ts:1008-1036 and followup-runner.ts:271-312) pass the session's provider, model, authProfileId to compactEmbeddedPiSession — NOT the hardcoded defaults.
-
authProfileId fallback-drop: when the compaction runs on the fallback provider (different from persisted primary), authProfileId is dropped (set to undefined).
-
Counter truthfulness: getVolitionalCompactionCount increments on {ok:true, compacted:true}, does NOT increment on {ok:true, compacted:false, reason:"below_threshold"} (legit skip), does NOT increment on {ok:false, reason:"unknown_model"} (real failure).
-
Log level per outcome: legit-skip → log.info [system:request_compaction:resolved-skip]; real failure → log.warn [system:request_compaction:resolved-failure].
Approach
Add a new test file src/agents/tools/request-compaction-tool.volitional-threading.test.ts (or extend the existing request-compaction-tool.test.ts) with:
- Stub
compactEmbeddedPiSession via the triggerCompaction closure injected by the callers.
- Feed three outcomes:
{ok:true,compacted:true}, {ok:true,compacted:false,reason:"nothing to compact"}, {ok:false,reason:"unknown model foo"}.
- Assert counter delta + log call args for each.
Separately, add a call-site test (in followup-runner.test.ts and/or a new agent-runner-execution.*.test.ts) that verifies triggerCompaction receives a closure that calls compactEmbeddedPiSession with the expected provider/model/authProfileId shape.
Acceptance Criteria
Context
pr-test-analyzer C1. Direct protection for the openclaw#639 fix arc.
Summary
The headline openclaw#639 ship-gate fix (threading session
provider/model/authProfileIdthrough volitional compaction, honoring the real compaction result instead of lying{ok:true}) has no behavioral test. The classifier test (src/agents/pi-embedded-runner/compact-reasons.test.ts:41-47) pins the string match forunknown_modelbut doesn't assert the call-site threading or counter-truth that the ship-gate was actually about.Shipping the fix without a regression-pinning test means the next provider/model rename or fallback-dispatcher refactor can silently reintroduce the original bug.
What needs pinning
Provider/model reach the compaction call: both
request_compactioncall sites (agent-runner-execution.ts:1008-1036andfollowup-runner.ts:271-312) pass the session'sprovider,model,authProfileIdtocompactEmbeddedPiSession— NOT the hardcoded defaults.authProfileId fallback-drop: when the compaction runs on the fallback provider (different from persisted primary),
authProfileIdis dropped (set toundefined).Counter truthfulness:
getVolitionalCompactionCountincrements on{ok:true, compacted:true}, does NOT increment on{ok:true, compacted:false, reason:"below_threshold"}(legit skip), does NOT increment on{ok:false, reason:"unknown_model"}(real failure).Log level per outcome: legit-skip →
log.info[system:request_compaction:resolved-skip]; real failure →log.warn[system:request_compaction:resolved-failure].Approach
Add a new test file
src/agents/tools/request-compaction-tool.volitional-threading.test.ts(or extend the existingrequest-compaction-tool.test.ts) with:compactEmbeddedPiSessionvia thetriggerCompactionclosure injected by the callers.{ok:true,compacted:true},{ok:true,compacted:false,reason:"nothing to compact"},{ok:false,reason:"unknown model foo"}.Separately, add a call-site test (in
followup-runner.test.tsand/or a newagent-runner-execution.*.test.ts) that verifiestriggerCompactionreceives a closure that callscompactEmbeddedPiSessionwith the expectedprovider/model/authProfileIdshape.Acceptance Criteria
isLegitSkipReasonexactly)unknown_model/provider_error_*/ freeform failure reasons{ok:true,compacted:true}infofor legit-skip andwarnfor real failureagent-runner-execution.tsandfollowup-runner.tstriggerCompaction constructionauthProfileIdfallback-drop (inner-provider ≠ persisted-primary →authProfileId: undefined)Context
pr-test-analyzer C1. Direct protection for the openclaw#639 fix arc.