mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:40:44 +00:00
fix(agents): make post-compaction guard config valid + observation trim-resilient
Two correctness fixes from code review. 1. Zod schema (src/config/zod-schema.agent-runtime.ts) was strict and rejected tools.loopDetection.postCompactionGuard.* keys at validation time, making the guard's documented configurability inaccessible at gateway startup. Adds ToolLoopPostCompactionGuardSchema with both optional fields and wires it into ToolLoopDetectionSchema. 2. The runner observation cursor in pi-embedded-runner/run.ts used absolute indices into state.toolCallHistory, but that array is trimmed at historySize (default 30). Once the buffer was full, new records shifted out from under the cursor and the guard silently missed every loop in long-running sessions. Replaces the index cursor with a monotonic toolOutcomeSeq on SessionState that recordToolCallOutcome bumps on each observable push (unmatched branch only, mirroring the prior cursor's effective semantics). The runner now reads the most recent (currentSeq - lastSeq) entries from the tail of toolCallHistory, which is trim-resilient. Adds zod parse tests for the new config keys (valid, empty, unknown key, non-positive, non-integer) and a runner regression test that seeds toolCallHistory at the trim cap before triggering a post-compaction loop, asserting the abort still fires. Refs #77474
This commit is contained in:
committed by
Peter Steinberger
parent
2a702f927f
commit
4c4825679b
@@ -1,4 +1,4 @@
|
||||
7526a2ec39c5bbe905f8347f900d812f28dd65caaf3f0172d1e9692fb186dcd3 config-baseline.json
|
||||
baa4a12a48a03755cab302629a1f6b65b2e826c091a987d68de5989d39e8ed35 config-baseline.core.json
|
||||
a963f7242f75fbc137a7891b8056c199b42eeb8f4887aeaaa079bff6394feb89 config-baseline.json
|
||||
51f525cfffa40659d6273e56705e91f3cb1255b217dadab59c32f77e0f770b37 config-baseline.core.json
|
||||
cd7c0c7fb1435bc7e59099e9ac334462d5ad444016e9ab4512aae63a238f78dc config-baseline.channel.json
|
||||
9832b30a696930a3da7efccf38073137571e1b66cae84e54d747b733fdafcc54 config-baseline.plugin.json
|
||||
|
||||
Reference in New Issue
Block a user