From 13e917e2923c92e89247d0d0d0483e83376ec08a Mon Sep 17 00:00:00 2001 From: Val Alexander <68980965+BunsDev@users.noreply.github.com> Date: Thu, 30 Apr 2026 02:33:43 -0500 Subject: [PATCH] fix: derive dynamic context-window guard thresholds Derive context-window guard thresholds from the effective model window, keeping 10% hard-min and 20% warning ratios with 4k/8k floors. Stop the embedded runner from forcing old fixed guard overrides so runtime admission uses the dynamic resolver. Validation: - CI run 25151866833 passed, including build-artifacts and checks-node-channels. - Parity gate 25151866868 passed. - Testbox pnpm test:channels passed: 54 files / 433 tests. Fixes #42999. Prepared head SHA: 9c80383639321871fe93e276c56459de096a2d70 --- CHANGELOG.md | 1 + docs/gateway/local-models.md | 2 +- src/agents/context-window-guard.test.ts | 104 +++++++++++++++--- src/agents/context-window-guard.ts | 63 ++++++++--- .../run.overflow-compaction.harness.ts | 4 + .../run.overflow-compaction.test.ts | 2 + src/agents/pi-embedded-runner/run/setup.ts | 10 +- src/commands/onboard-custom-config.test.ts | 2 +- 8 files changed, 147 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index afcbf1f78d3..5c359b507f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Docs: https://docs.openclaw.ai - Security/outbound: strip re-formed HTML tags during plain-text sanitization so nested tag fragments cannot leave a CodeQL-detected `