Repository navigation
fix(compaction): #721 feedback truncation, #722 final-audit fallback, #723 scalable summary budget - #5
fix(compaction): #721 feedback truncation, #722 final-audit fallback, #723 scalable summary budget#5amittell wants to merge 5 commits into
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
…efect list to the corrective pass On quality-audit failure the safeguard re-emits audit reasons through wrapUntrustedInstructionBlock, whose hard 4000-char cap truncates the missing_identifiers list mid-string whenever the session carries more than a few identifier-dense items (up to 12 extracted identifiers: hex hashes, URLs, paths, host:port, 6+ digit numbers). The model then receives an incomplete defect list, cannot restore the missing identifiers, the retry fails the same audit, and the run cancels with no valid summary. Two changes: - auditSummaryQuality now emits the FULL missing-identifier list (bounded only by the 12-item extraction cap) instead of the first 3, so the corrective pass sees every defect. - New wrapUntrustedQualityFeedbackBlock routes the audit defect list through its own untrusted wrapper with an 8000-char budget sized for the audit output (max 5 missing_section lines + 1 missing_identifiers line). Operator-supplied context still uses the legacy 4000-char wrapper. The identifier values are session-derived (already in the summarization prompt input), so no widened trust surface. Regression tests: a >4000-char missing-identifiers payload asserts every identifier survives in the audit reasons, and an end-to-end quality-guard scenario asserts the complete defect list appears in the corrective instruction sent to the model.
…ary on final quality-audit failure
When the quality audit fails on the FINAL retry attempt (or nothing is
regenerable) the safeguard returned { cancel: true } with no fallback
summary. A context-heavy session (~300k+ tokens / ~1.1M+ chars) then can
never compact: it sits at 100% context and the next turn hits the
context-length-exceeded provider 400 path, permanently uncompactionable.
On the final failed attempt, finalize a structured fallback summary
(re-distilled from the previous summary via buildStructuredFallbackSummary,
plus the preserved recent turns) and let compaction PROCEED with a
degraded artifact. The path is logged with
reasonCode=quality_guard_degraded_fallback and the reason codes, and any
producer losses from the failed attempts are carried into the degraded
finalization so the truncation diagnostic stays attached to the artifact.
Genuinely unrecoverable paths (LLM throw, no model, no auth, corrective
generation failure) still cancel.
Tests: the two cases that pinned cancel now assert compaction proceeds
with a structured fallback summary and no cancel reason.
…uites Adds the regression tests for the three compaction-safeguard tickets: - openclaw#721: unit test asserting the missing_identifiers audit reason carries the full >4000-char identifier payload, and an end-to-end quality-guard scenario asserting every identifier survives in the corrective instruction sent to the model. - openclaw#722: the two final-audit cases now assert degraded fallback behavior (compaction proceeds, structured fallback summary, no cancel reason, quality_guard_degraded_fallback log line). - openclaw#723: unit tests for resolveCompactionSummaryBudgetChars (16k floor, no-maxTokens ceiling, scaled ceiling, session-size passthrough) and an end-to-end scenario asserting a ~1M-char serialized session finalizes with all required tail sections plus a 20k filler line intact and no truncation marker. Also updates the test API surface: exports wrapUntrustedQualityFeedbackBlock + resolveCompactionSummaryBudgetChars, renames MAX_COMPACTION_SUMMARY_CHARS to the MIN_COMPACTION_SUMMARY_CHARS floor, and threads per-section maxChars through the preserved/split-turn section builders.
wrapUntrustedQualityFeedbackBlock replaced the legacy operator-context wrapper for the quality-feedback path (openclaw#721); drop the now-unused import so tsgo core stays clean.
b4c6863 to
df808ef
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The new scaled-budget helper can produce NaN on non-finite model.maxTokens, and the quality-feedback wrapper budget/docs still allow defect-list truncation for long identifiers.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR improves the compaction safeguard in src/agents/agent-hooks/ so large/identifier-dense sessions remain compactable by (1) sending full quality-audit defect feedback back to the model, (2) degrading to a structured fallback summary on terminal audit failure instead of cancelling, and (3) scaling the compaction summary byte budget with the summarizer model’s output capacity.
Changes:
- Increase quality-audit feedback completeness/room by emitting the full missing-identifier list and routing it through a larger untrusted wrapper.
- On final quality-audit failure, proceed with a degraded structured fallback summary (including producer-loss observability) rather than returning
{ cancel: true }. - Replace the fixed 16k compaction summary cap with a per-compaction budget that scales with model output tokens, and scale preserved/split-turn suffix section budgets accordingly (plus add regression coverage).
File summaries
| File | Description |
|---|---|
| src/agents/agent-hooks/compaction-safeguard.ts | Implements scaled summary budget resolution, threads dynamic budgets through finalization and suffix sections, and adds terminal degraded-fallback behavior + logging. |
| src/agents/agent-hooks/compaction-safeguard-quality.ts | Expands quality-feedback wrapping and ensures missing-identifier audit feedback includes the full list for corrective retries. |
| src/agents/agent-hooks/compaction-safeguard.test.ts | Adds/updates regression tests covering the new quality feedback sizing, degraded fallback behavior, and scaled summary budgeting. |
| src/agents/agent-hooks/compaction-safeguard.test-support.ts | Extends the test API surface to expose newly added helpers/constants for unit and scenario tests. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| // The audit itself is the cap for the full corrective defect list: it carries at most | ||
| // five missing sections plus one missing-identifiers line. The 4000-char untrusted | ||
| // wrapper is for operator-supplied context only; never route the defect list through it. | ||
| const MAX_QUALITY_FEEDBACK_INSTRUCTION_CHARS = 8000; |
There was a problem hiding this comment.
This finding is valid. The current-upgrade replacement in #6 bounds feedback at the identifier producer, retains only complete identifiers, and records omissions. The final accounting also includes angle-bracket escaping at the prompt boundary: 7dc9799 . Two new escaped-overflow table cases failed before that fix; the final prompt/compaction/persistence run passes all 41 tests with type-aware lint green. The existing oversized-value cases are retained. This legacy PR remains open until the replacement passes its remaining build/CI/live gates and lands.
| const maxOutputTokens = Math.max( | ||
| 0, | ||
| Math.floor((params.model.maxTokens ?? 0) - SUMMARIZATION_OVERHEAD_TOKENS), | ||
| ); |
There was a problem hiding this comment.
This finding is valid. The current-upgrade replacement in #6 removes the scaled final-artifact budget and finalizes against the existing native 16,000-character persistence limit before retention and audit: db883ed . Tests cover NaN, both infinities, undefined, nonpositive/fractional values and very large model limits. An actual SQLite save/reopen/replay/next offline-provider regression verifies the audited summary survives persistence. The separate summarizer reserve-token guard remains. This legacy discussion will be resolved with replacement merge evidence once #6 completes its pending gates.
…afeguard set Records the 2026-09-02 22:22/22:35 deploys (stop, build, spare-port smoke, launchd), that the smoke run performed the api-root-changed rotation on mac-mini, and Alex's ruling that openclaw#721-openclaw#723 / #5 is the next carry, with the group-session measurements that motivate it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…t's real worst case Adversarial review defect: MAX_QUALITY_FEEDBACK_INSTRUCTION_CHARS was 8000, but the missing_identifiers reason line is bounded only by the 12-identifier COUNT, not length — each identifier is a URL and can be arbitrarily long. Reproduced with 12 ~668-char artifact URLs (8091 chars fed): the wrapper silently truncated the 12th identifier mid-list, so the corrective pass received an incomplete defect list — the exact unrecoverable-retry failure mode openclaw#721 exists to remove. A fixed small char budget cannot guarantee "the whole list fits" against a count-only cap. Fix: raise the quality-feedback wrapper budget to 20,000 chars (still far below any context window, so the corrective instruction stays re-injectable), document the count-vs-length bound, and add a regression test pinning that a >8000-char 12-identifier defect list survives the wrapper complete. Verified: compaction-safeguard.test.ts 138/138, compaction-instructions 27/27, core compaction suites 83/83, tsgo error set identical to base (zero new, zero in touched files).
|
Superseded by PR #6, now merged as be4d58b into upgrade-v2026.8.1. That branch is anchored to the verified installed stable 2026.8.1 source; this beta upgrade targets a different lineage. The replacement passed hosted tests/lint/CI gate, M4 source checks, independent review and the native Gateway build. Live activation and acceptance remain separate tracked work. Preserving this branch and its discussion for history. |
openclaw#166738) Builds on openclaw#166737 (merged: curated `scripts/lib/recommended-models.json` + shared `canonicalModelKey`/`canonicalModelFamily`/`compareModelRecency`); this PR only adds the helper script and its test. ## What Problem This Solves The recommended-models list is now curated by hand, so a maintainer needs a daily, reviewable signal for what to change: new releases, Arena reorderings, and entries that are retired or no longer served. ## User Impact No user-visible change. Maintainers (and later a daily draft-PR agent) can run ``` OPENROUTER_API_KEY=... node --import ./scripts/tsx.mjs scripts/suggest-recommended-models.mts [--list <path>] ``` and get a markdown report ending in a unified diff against `scripts/lib/recommended-models.json`. The list file is never written; a human edits it. ## Why This Change Was Made TypeScript port of the recv2 prototype's ranking: LMArena Agent Arena score first; equal scores, and models without one, order by OpenRouter 30-day usage. The newest served family member without its own Arena row takes the slot of its newest ranked older sibling, counting at least that sibling's usage, so it sorts directly ahead of it (release date decides recency, so grok-4.20 does not outrank grok-4.7). DeepSWE is dropped; `-fast` and other serving variants fold into the base model. - Inputs: every run fetches each source fresh, with no cache; a failed request or a response that fails schema validation fails that run. Sources: LMArena Agent Arena `agent/latest` through the HF datasets-server JSON rows endpoint (no parquet dependency), OpenRouter `/api/v1/models`, OpenRouter `rankings-daily` (only when `OPENROUTER_API_KEY` is set; otherwise curated entries without an Arena score keep their order), Vercel `/v1/models`, and the hosted catalog v2. - Identity: each source id resolves once through the shared `canonicalModelKey`, with its display name, so dated aliases join their versioned model. Examples: `mistral-small-2603` is Mistral Small 4, OpenRouter `mistral-large-4-0` matches Vercel `mistral-large-4`, and usage arrives through OpenRouter `canonical_slug`. Non-chat models are excluded by gateway modality or type labels; `-latest` aliases are excluded. - Report sections: - **New models:** first seen within 7 days and not listed. Each shows its likely same-family predecessor and both prices, and is flagged `possible new class` when either price differs by more than 2x or the family has no predecessor. - **Arena moves:** rank changes among entries both lists keep, largest first. - **Gone or deprecated:** first-party retired with its replacement, no longer served, or no signal. - **Suggested list:** the full ordered list plus the diff. No overlap with Pash/Sarah changes (the PR adds one new file). ## Evidence - Port fidelity: on the live inputs, the helper reproduced the prototype's 86-id suggested list exactly before the review-driven identity fixes. Two differences remain, and openclaw#166737's seed list already includes both: `mistral-medium-2604` is folded into `mistral-medium-3.5` because they are the same model, and `ling-3.0-flash-*` is now spelled `ling-3-flash-*` because zero minor versions fold. - Typecheck: `node scripts/run-tsgo.mjs -p tsconfig.scripts.json` and `tsgo:test:root` report no errors; scoped oxlint and oxfmt are clean. `canonical-model-key.test.ts` passed 32/32. - Ordering: `test/scripts/suggest-recommended-models.test.ts` feeds stubbed sources through the real entry point. Two models tied on Arena score order by usage (the higher-usage one first, against alphabetical order), and a successor that inherits its sibling's Arena slot still sorts ahead of that higher-usage sibling. With the previous alphabetical tiebreak the test fails. - Cost: `pnpm test test/scripts/suggest-recommended-models.test.ts --maxWorkers=1` takes 2.2 s wall end to end (Vitest 0.78 s; the test itself 9 ms). CI on this head: run 37692398322, green in 595 s wall and 5,717 job-seconds across 58 jobs for the whole PR; the new test adds about 9 ms of that. - Error and fallback paths: a list containing `claude-opus-4.8` reported "retired by its first-party provider; replaced by claude-opus-5", and `nonexistent-model-9` reported "no host serves it". A missing `--list` file exits 1 with a clear message. Without a key, the report states that usage was skipped and keeps unscored curated entries. With an invalid `OPENROUTER_API_KEY`, the run exits 1 with `https://openrouter.ai/api/v1/datasets/rankings-daily returned HTTP 401` and prints no report. - Live run: all inputs were fetched fresh (5 requests, 3.9 s wall). Both outputs below are copied verbatim. In the live data the only exact Arena ties are successor/sibling pairs (`gpt-5.6`/`gpt-5.4`, `mimo-v2.6-pro`/`mimo-v2.5-pro`), and each successor sorts first. Run against the curated list in openclaw#166737, using the default path: # Recommended models suggestion, 2026-10-07 ## Sources - LMArena Agent Arena, published 2026-10-02: 50 rows, 48 models. Source: LMArena Agent Arena (lmarena-ai/leaderboard-dataset), CC BY 4.0. - OpenRouter rankings-daily 2026-09-07..2026-10-06. Source: OpenRouter (openrouter.ai/rankings), as of 2026-10-07T21:06:52.590Z. Licensed under CC BY 4.0. - Catalog v2 generated 2026-09-29 (1039 rows), OpenRouter models (467), Vercel AI Gateway models (415): 490 served chat models. ## New models (first seen in the last 7 days, not listed) | model | first seen | suggested | price in/out per 1M | predecessor | predecessor price | note | | --- | --- | --- | --- | --- | --- | --- | | glyph-cluster | 2026-10-07 | no signal yet | ? | none | | possible new class: no predecessor | | mistral-large-4 | 2026-10-06 | no signal yet | $0.68 / $2.09 | mistral-large-3 | $0.5 / $1.5 | | | apodex-1.1-mini | 2026-10-01 | no signal yet | ? | none | | possible new class: no predecessor | | pareto-26.10-preview | 2026-10-01 | no signal yet | $0.8 / $3.2 | none | | possible new class: no predecessor | ## Arena moves None. ## Gone or deprecated None. ## Suggested list <details><summary>85 models</summary> | # | model | signal | | --- | --- | --- | | 1 | claude-fable-5.1 | Arena 0.143 (#1) | | 2 | claude-opus-5.5 | Arena 0.138 (#2) | | 3 | claude-sonnet-5.5 | Arena 0.125 (#3) | | 4 | gpt-6-astra | Arena 0.123 (#4) | | 5 | gpt-6.1-sol | Arena 0.112 (#5) | | 6 | gpt-6-sol | Arena 0.097 (#6) | | 7 | claude-opus-5 | Arena 0.087 (#7) | | 8 | claude-fable-5 | Arena 0.082 (#8) | | 9 | gpt-5.6-sol | Arena 0.065 (#12) | | 10 | claude-sonnet-5 | Arena 0.044 (#13) | | 11 | kimi-k3 | Arena 0.042 (openclaw#14) | | 12 | grok-4.7 | Arena 0.040 (openclaw#16) | | 13 | deepseek-v4.1-flash | Arena 0.040 (openclaw#17) | | 14 | muse-spark-1.3 | Arena 0.040 (openclaw#18) | | 15 | hy4-preview | Arena 0.040 (openclaw#19) | | 16 | glm-5.2 | Arena 0.035 (openclaw#20) | | 17 | gemini-3.8-flash | Arena 0.030 (openclaw#21) | | 18 | qwen3.8-max | Arena 0.025 (openclaw#22) | | 19 | glm-5.3 | Arena 0.024 (openclaw#23) | | 20 | gpt-6-luna | Arena 0.014 (openclaw#24) | | 21 | grok-4.6 | Arena 0.013 (openclaw#25) | | 22 | grok-4.5 | Arena 0.012 (openclaw#26) | | 23 | deepseek-v4-pro | Arena 0.012 (openclaw#27) | | 24 | gpt-5.6 | Arena 0.011 (openclaw#28) via gpt-5.4 | | 25 | gpt-5.4 | Arena 0.011 (openclaw#28) | | 26 | step-5-preview | Arena 0.005 (openclaw#30) | | 27 | gpt-5.6-terra | Arena 0.004 (openclaw#31) | | 28 | glm-5.3-flash | Arena -0.004 (openclaw#32) | | 29 | mimo-v2.6-flash | Arena -0.006 (openclaw#33) | | 30 | gpt-5.6-luna | Arena -0.012 (openclaw#35) | | 31 | gemini-3.7-flash | Arena -0.015 (openclaw#36) | | 32 | qwen3.8-27b | Arena -0.017 (openclaw#37) | | 33 | muse-spark-1.2 | Arena -0.033 (openclaw#38) | | 34 | muse-spark-1.1 | Arena -0.049 (openclaw#39) | | 35 | qwen3.7-max | Arena -0.051 (openclaw#40) | | 36 | hy3 | Arena -0.054 (openclaw#41) | | 37 | minimax-m3 | Arena -0.069 (openclaw#42) | | 38 | qwen3.7-plus | Arena -0.072 (openclaw#43) | | 39 | mimo-v2.6-pro | Arena -0.075 (openclaw#44) via mimo-v2.5-pro | | 40 | mimo-v2.5-pro | Arena -0.075 (openclaw#44) | | 41 | gemini-3.6-flash | Arena -0.077 (openclaw#45) | | 42 | gemini-3.1-pro-preview | Arena -0.077 (openclaw#46) | | 43 | inkling-small | Arena -0.103 (openclaw#47) | | 44 | inkling | Arena -0.109 (openclaw#48) | | 45 | mistral-medium-3.5 | Arena -0.124 (openclaw#49) | | 46 | solar-pro4 | Arena -0.159 (openclaw#50) | | 47 | space-bunny-alpha | OpenRouter 56.7T | | 48 | deepseek-v4-flash | OpenRouter 53.3T | | 49 | nemotron-3-ultra-550b-a55b | OpenRouter 21.1T | | 50 | mimo-v2.5 | OpenRouter 18.9T | | 51 | laguna-s-2.1 | OpenRouter 4.6T | | 52 | gemini-3-flash-preview | OpenRouter 3.4T | | 53 | ling-3-flash-fin | OpenRouter 3.4T | | 54 | gemini-2.5-flash-lite | OpenRouter 3.0T | | 55 | nemotron-3.5-lightning | OpenRouter 2.7T | | 56 | gpt-oss-120b | OpenRouter 2.5T | | 57 | dots-3-note-preview | OpenRouter 2.4T | | 58 | gemini-3.1-flash-lite | OpenRouter 2.1T | | 59 | gemini-2.5-flash | OpenRouter 2.0T | | 60 | qwen3.8-flash | OpenRouter 1.8T | | 61 | gemma-4-31b | OpenRouter 1.7T | | 62 | claude-sonnet-4.6 | OpenRouter 1.4T | | 63 | deepseek-v3.2 | OpenRouter 1.4T | | 64 | qwen3.7-flash | OpenRouter 1.4T | | 65 | ling-3-flash-sante | OpenRouter 1.2T | | 66 | nemotron-3-super-120b-a12b | OpenRouter 1.2T | | 67 | nex-n2.5-pro | OpenRouter 1.1T | | 68 | ling-3-flash-vl | OpenRouter 1.0T | | 69 | gpt-6-luna-pro | OpenRouter 853B | | 70 | gemma-4-26b-a4b | OpenRouter 845B | | 71 | gpt-5.6-luna-pro | OpenRouter 566B | | 72 | solar-mini4 | OpenRouter 510B | | 73 | deepseek-v4-flash-vision-exp | OpenRouter 430B | | 74 | mistral-nemo | OpenRouter 384B | | 75 | ling-3.1-flash | OpenRouter 298B | | 76 | glm-5.3-flashx | OpenRouter 187B | | 77 | gpt-oss-20b | OpenRouter 127B | | 78 | gemini-3.5-flash-lite | OpenRouter 124B | | 79 | minimax-m2.7 | OpenRouter 113B | | 80 | gpt-4o-mini | OpenRouter 89B | | 81 | claude-haiku-5.5 | OpenRouter 82B via claude-haiku-4.5 | | 82 | claude-haiku-4.5 | OpenRouter 82B | | 83 | claude-opus-4.7 | OpenRouter 55B | | 84 | step-3.7-flash | OpenRouter 50B | | 85 | claude-sonnet-4.5 | OpenRouter 46B | </details> No changes to the curated list. <details><summary>Same inputs against the 2026-09-27 list (shows Arena moves, a drop, a 10x price flag and the diff)</summary> # Recommended models suggestion, 2026-10-07 ## Sources - LMArena Agent Arena, published 2026-10-02: 50 rows, 48 models. Source: LMArena Agent Arena (lmarena-ai/leaderboard-dataset), CC BY 4.0. - OpenRouter rankings-daily 2026-09-07..2026-10-06. Source: OpenRouter (openrouter.ai/rankings), as of 2026-10-07T21:07:02.742Z. Licensed under CC BY 4.0. - Catalog v2 generated 2026-09-29 (1039 rows), OpenRouter models (467), Vercel AI Gateway models (415): 490 served chat models. ## New models (first seen in the last 7 days, not listed) | model | first seen | suggested | price in/out per 1M | predecessor | predecessor price | note | | --- | --- | --- | --- | --- | --- | --- | | claude-haiku-5.5 | 2026-10-07 | openclaw#81 | $0.1 / $0.5 | claude-haiku-4.5 | $1 / $5 | possible new class: price 10.0x | | glyph-cluster | 2026-10-07 | no signal yet | ? | none | | possible new class: no predecessor | | mistral-large-4 | 2026-10-06 | no signal yet | $0.68 / $2.09 | mistral-large-3 | $0.5 / $1.5 | | | apodex-1.1-mini | 2026-10-01 | no signal yet | ? | none | | possible new class: no predecessor | | pareto-26.10-preview | 2026-10-01 | no signal yet | $0.8 / $3.2 | none | | possible new class: no predecessor | ## Arena moves | model | listed | suggested | signal | | --- | --- | --- | --- | | mimo-v2.6-flash | openclaw#47 | openclaw#29 | Arena -0.006 (openclaw#33) | | gpt-6-luna | openclaw#24 | openclaw#20 | Arena 0.014 (openclaw#24) | | grok-4.7 | openclaw#15 | #12 | Arena 0.040 (openclaw#16) | | deepseek-v4-pro | openclaw#16 | openclaw#23 | Arena 0.012 (openclaw#27) | | gemini-3.8-flash | #11 | openclaw#17 | Arena 0.030 (openclaw#21) | | hy4-preview | #10 | openclaw#15 | Arena 0.040 (openclaw#19) | | mimo-v2.6-pro | openclaw#32 | openclaw#39 | Arena -0.075 (openclaw#44) via mimo-v2.5-pro | | mimo-v2.5-pro | openclaw#33 | openclaw#40 | Arena -0.075 (openclaw#44) | | gemini-3.1-pro-preview | openclaw#35 | openclaw#42 | Arena -0.077 (openclaw#46) | | solar-pro4 | openclaw#45 | openclaw#46 | Arena -0.159 (openclaw#50) | | gpt-6-sol | #6 | #6 | Arena 0.097 (#6) | | muse-spark-1.3 | openclaw#14 | openclaw#14 | Arena 0.040 (openclaw#18) | | qwen3.8-max | openclaw#18 | openclaw#18 | Arena 0.025 (openclaw#22) | | gpt-5.6-terra | openclaw#21 | openclaw#27 | Arena 0.004 (openclaw#31) | | qwen3.7-plus | openclaw#36 | openclaw#38 | Arena -0.072 (openclaw#43) | | claude-opus-5.5 | #3 | #2 | Arena 0.138 (#2) | | gpt-6-astra | #2 | #4 | Arena 0.123 (#4) | | claude-opus-5 | #4 | #7 | Arena 0.087 (#7) | | claude-fable-5 | #5 | #8 | Arena 0.082 (#8) | | deepseek-v4.1-flash | #12 | #13 | Arena 0.040 (openclaw#17) | | glm-5.2 | #13 | openclaw#16 | Arena 0.035 (openclaw#20) | | grok-4.6 | openclaw#20 | openclaw#21 | Arena 0.013 (openclaw#25) | | grok-4.5 | openclaw#19 | openclaw#22 | Arena 0.012 (openclaw#26) | | glm-5.3-flash | openclaw#23 | openclaw#28 | Arena -0.004 (openclaw#32) | | gpt-5.6-luna | openclaw#25 | openclaw#30 | Arena -0.012 (openclaw#35) | | gemini-3.7-flash | openclaw#26 | openclaw#31 | Arena -0.015 (openclaw#36) | | qwen3.8-27b | openclaw#27 | openclaw#32 | Arena -0.017 (openclaw#37) | | muse-spark-1.2 | openclaw#28 | openclaw#33 | Arena -0.033 (openclaw#38) | | muse-spark-1.1 | openclaw#29 | openclaw#34 | Arena -0.049 (openclaw#39) | | qwen3.7-max | openclaw#30 | openclaw#35 | Arena -0.051 (openclaw#40) | | hy3 | openclaw#31 | openclaw#36 | Arena -0.054 (openclaw#41) | | minimax-m3 | openclaw#34 | openclaw#37 | Arena -0.069 (openclaw#42) | | inkling-small | openclaw#38 | openclaw#43 | Arena -0.103 (openclaw#47) | | inkling | openclaw#39 | openclaw#44 | Arena -0.109 (openclaw#48) | | mistral-medium-3.5 | openclaw#40 | openclaw#45 | Arena -0.124 (openclaw#49) | 29 usage-ranked entries also move; see the diff. ## Gone or deprecated - ling-3.0-flash-fin: no host serves it - ling-3.0-flash-vl: no host serves it - ling-3.0-flash-sante: no host serves it - kimi-k2.6: no Arena score and no OpenRouter usage in the window ## Suggested list <details><summary>85 models</summary> | # | model | signal | | --- | --- | --- | | 1 | claude-fable-5.1 | Arena 0.143 (#1) | | 2 | claude-opus-5.5 | Arena 0.138 (#2) | | 3 | claude-sonnet-5.5 | Arena 0.125 (#3) | | 4 | gpt-6-astra | Arena 0.123 (#4) | | 5 | gpt-6.1-sol | Arena 0.112 (#5) | | 6 | gpt-6-sol | Arena 0.097 (#6) | | 7 | claude-opus-5 | Arena 0.087 (#7) | | 8 | claude-fable-5 | Arena 0.082 (#8) | | 9 | gpt-5.6-sol | Arena 0.065 (#12) | | 10 | claude-sonnet-5 | Arena 0.044 (#13) | | 11 | kimi-k3 | Arena 0.042 (openclaw#14) | | 12 | grok-4.7 | Arena 0.040 (openclaw#16) | | 13 | deepseek-v4.1-flash | Arena 0.040 (openclaw#17) | | 14 | muse-spark-1.3 | Arena 0.040 (openclaw#18) | | 15 | hy4-preview | Arena 0.040 (openclaw#19) | | 16 | glm-5.2 | Arena 0.035 (openclaw#20) | | 17 | gemini-3.8-flash | Arena 0.030 (openclaw#21) | | 18 | qwen3.8-max | Arena 0.025 (openclaw#22) | | 19 | glm-5.3 | Arena 0.024 (openclaw#23) | | 20 | gpt-6-luna | Arena 0.014 (openclaw#24) | | 21 | grok-4.6 | Arena 0.013 (openclaw#25) | | 22 | grok-4.5 | Arena 0.012 (openclaw#26) | | 23 | deepseek-v4-pro | Arena 0.012 (openclaw#27) | | 24 | gpt-5.6 | Arena 0.011 (openclaw#28) via gpt-5.4 | | 25 | gpt-5.4 | Arena 0.011 (openclaw#28) | | 26 | step-5-preview | Arena 0.005 (openclaw#30) | | 27 | gpt-5.6-terra | Arena 0.004 (openclaw#31) | | 28 | glm-5.3-flash | Arena -0.004 (openclaw#32) | | 29 | mimo-v2.6-flash | Arena -0.006 (openclaw#33) | | 30 | gpt-5.6-luna | Arena -0.012 (openclaw#35) | | 31 | gemini-3.7-flash | Arena -0.015 (openclaw#36) | | 32 | qwen3.8-27b | Arena -0.017 (openclaw#37) | | 33 | muse-spark-1.2 | Arena -0.033 (openclaw#38) | | 34 | muse-spark-1.1 | Arena -0.049 (openclaw#39) | | 35 | qwen3.7-max | Arena -0.051 (openclaw#40) | | 36 | hy3 | Arena -0.054 (openclaw#41) | | 37 | minimax-m3 | Arena -0.069 (openclaw#42) | | 38 | qwen3.7-plus | Arena -0.072 (openclaw#43) | | 39 | mimo-v2.6-pro | Arena -0.075 (openclaw#44) via mimo-v2.5-pro | | 40 | mimo-v2.5-pro | Arena -0.075 (openclaw#44) | | 41 | gemini-3.6-flash | Arena -0.077 (openclaw#45) | | 42 | gemini-3.1-pro-preview | Arena -0.077 (openclaw#46) | | 43 | inkling-small | Arena -0.103 (openclaw#47) | | 44 | inkling | Arena -0.109 (openclaw#48) | | 45 | mistral-medium-3.5 | Arena -0.124 (openclaw#49) | | 46 | solar-pro4 | Arena -0.159 (openclaw#50) | | 47 | space-bunny-alpha | OpenRouter 56.7T | | 48 | deepseek-v4-flash | OpenRouter 53.3T | | 49 | nemotron-3-ultra-550b-a55b | OpenRouter 21.1T | | 50 | mimo-v2.5 | OpenRouter 18.9T | | 51 | laguna-s-2.1 | OpenRouter 4.6T | | 52 | gemini-3-flash-preview | OpenRouter 3.4T | | 53 | ling-3-flash-fin | OpenRouter 3.4T | | 54 | gemini-2.5-flash-lite | OpenRouter 3.0T | | 55 | nemotron-3.5-lightning | OpenRouter 2.7T | | 56 | gpt-oss-120b | OpenRouter 2.5T | | 57 | dots-3-note-preview | OpenRouter 2.4T | | 58 | gemini-3.1-flash-lite | OpenRouter 2.1T | | 59 | gemini-2.5-flash | OpenRouter 2.0T | | 60 | qwen3.8-flash | OpenRouter 1.8T | | 61 | gemma-4-31b | OpenRouter 1.7T | | 62 | claude-sonnet-4.6 | OpenRouter 1.4T | | 63 | deepseek-v3.2 | OpenRouter 1.4T | | 64 | qwen3.7-flash | OpenRouter 1.4T | | 65 | ling-3-flash-sante | OpenRouter 1.2T | | 66 | nemotron-3-super-120b-a12b | OpenRouter 1.2T | | 67 | nex-n2.5-pro | OpenRouter 1.1T | | 68 | ling-3-flash-vl | OpenRouter 1.0T | | 69 | gpt-6-luna-pro | OpenRouter 853B | | 70 | gemma-4-26b-a4b | OpenRouter 845B | | 71 | gpt-5.6-luna-pro | OpenRouter 566B | | 72 | solar-mini4 | OpenRouter 510B | | 73 | deepseek-v4-flash-vision-exp | OpenRouter 430B | | 74 | mistral-nemo | OpenRouter 384B | | 75 | ling-3.1-flash | OpenRouter 298B | | 76 | glm-5.3-flashx | OpenRouter 187B | | 77 | gpt-oss-20b | OpenRouter 127B | | 78 | gemini-3.5-flash-lite | OpenRouter 124B | | 79 | minimax-m2.7 | OpenRouter 113B | | 80 | gpt-4o-mini | OpenRouter 89B | | 81 | claude-haiku-5.5 | OpenRouter 82B via claude-haiku-4.5 | | 82 | claude-haiku-4.5 | OpenRouter 82B | | 83 | claude-opus-4.7 | OpenRouter 55B | | 84 | step-3.7-flash | OpenRouter 50B | | 85 | claude-sonnet-4.5 | OpenRouter 46B | </details> ```diff --- a/../../../../../../tmp/recprobe/list-20260927.json +++ b/../../../../../../tmp/recprobe/list-20260927.json @@ -1,80 +1,87 @@ [ "claude-fable-5.1", - "gpt-6-astra", "claude-opus-5.5", + "claude-sonnet-5.5", + "gpt-6-astra", + "gpt-6.1-sol", + "gpt-6-sol", "claude-opus-5", "claude-fable-5", - "gpt-6-sol", "gpt-5.6-sol", "claude-sonnet-5", "kimi-k3", - "hy4-preview", - "gemini-3.8-flash", + "grok-4.7", "deepseek-v4.1-flash", - "glm-5.2", "muse-spark-1.3", - "grok-4.7", - "deepseek-v4-pro", - "glm-5.3", + "hy4-preview", + "glm-5.2", + "gemini-3.8-flash", "qwen3.8-max", - "grok-4.5", + "glm-5.3", + "gpt-6-luna", "grok-4.6", - "gpt-5.6-terra", + "grok-4.5", + "deepseek-v4-pro", + "gpt-5.6", "gpt-5.4", + "step-5-preview", + "gpt-5.6-terra", "glm-5.3-flash", - "gpt-6-luna", + "mimo-v2.6-flash", "gpt-5.6-luna", "gemini-3.7-flash", "qwen3.8-27b", "muse-spark-1.2", "muse-spark-1.1", "qwen3.7-max", "hy3", - "mimo-v2.6-pro", - "mimo-v2.5-pro", "minimax-m3", - "gemini-3.1-pro-preview", "qwen3.7-plus", + "mimo-v2.6-pro", + "mimo-v2.5-pro", "gemini-3.6-flash", + "gemini-3.1-pro-preview", "inkling-small", "inkling", "mistral-medium-3.5", + "solar-pro4", + "space-bunny-alpha", "deepseek-v4-flash", - "mimo-v2.5", "nemotron-3-ultra-550b-a55b", - "space-bunny-alpha", - "solar-pro4", + "mimo-v2.5", "laguna-s-2.1", - "mimo-v2.6-flash", - "ling-3.0-flash-fin", "gemini-3-flash-preview", - "nemotron-3.5-lightning", + "ling-3-flash-fin", "gemini-2.5-flash-lite", - "claude-sonnet-4.6", + "nemotron-3.5-lightning", "gpt-oss-120b", - "gemini-2.5-flash", - "gemini-3.1-flash-lite", "dots-3-note-preview", - "deepseek-v3.2", - "gemma-4-31b", + "gemini-3.1-flash-lite", + "gemini-2.5-flash", "qwen3.8-flash", + "gemma-4-31b", + "claude-sonnet-4.6", + "deepseek-v3.2", + "qwen3.7-flash", + "ling-3-flash-sante", "nemotron-3-super-120b-a12b", + "nex-n2.5-pro", + "ling-3-flash-vl", + "gpt-6-luna-pro", "gemma-4-26b-a4b", "gpt-5.6-luna-pro", - "qwen3.7-flash", - "ling-3.0-flash-vl", - "minimax-m2.7", + "solar-mini4", "deepseek-v4-flash-vision-exp", - "gpt-oss-20b", - "ling-3.0-flash-sante", - "step-3.7-flash", - "claude-haiku-4.5", "mistral-nemo", - "gpt-4o-mini", + "ling-3.1-flash", "glm-5.3-flashx", + "gpt-oss-20b", "gemini-3.5-flash-lite", - "gpt-6-luna-pro", + "minimax-m2.7", + "gpt-4o-mini", + "claude-haiku-5.5", + "claude-haiku-4.5", "claude-opus-4.7", - "claude-sonnet-4.5", - "kimi-k2.6" + "step-3.7-flash", + "claude-sonnet-4.5" ] ``` </details> ## Merge danger This is a two-way door: it adds one new dev script and its test, writes no files, and is never wired into CI or publishing. A revert removes it completely. If it is wrong, the impact is limited to a misleading suggestion report that a human reviews before editing the list. Co-authored-by: Ayaan Zaidi <[email protected]>
fix(compaction): openclaw#721 feedback truncation, openclaw#722 final-audit fallback, openclaw#723 scalable summary budget
OpenClaw runtime fixes landing on the
upgrade-v2026.8.1-beta.2branch. Three relatedtickets in the compaction-safeguard module (
src/agents/agent-hooks/compaction-safeguard*.ts),all of which made large, identifier-dense sessions structurally uncompactionable.
openclaw#721 — corrective quality feedback truncated at 4000 chars
Root cause. On quality-audit failure, the safeguard feeds the audit reasons back to the
model via
wrapUntrustedInstructionBlock, which hard-caps text at 4000 chars(
MAX_UNTRUSTED_INSTRUCTION_CHARS, compaction-safeguard-quality.ts). The reasons stringcarries
missing_identifiers:<list>. That list only held the first 3 missing identifiers,and for identifier-dense sessions (up to 12 extracted identifiers: hex >= 8, URLs, paths,
host:port, 6+ digit numbers) the joined reasons exceed 4000 chars and are truncated
mid-string. The model receives an incomplete defect list, cannot restore the missing
identifiers, the retry fails the same audit, and the run returns
cancel: truewith novalid summary.
Change.
auditSummaryQualitynow emits the full missing-identifier list (bounded only bythe 12-item extraction cap) instead of the first 3.
wrapUntrustedQualityFeedbackBlockroutes the audit defect list through its ownuntrusted wrapper with an 8000-char budget, sized for the audit output (max 5
missing_sectionlines + 1missing_identifiersline). Operator-supplied context(
/compactinstructions, identifier policy text) still uses the legacy 4000-char wrapper.The identifiers are session-derived (already present in the summarization prompt input),
so the widened wrapper does not enlarge the trust surface.
Tests.
missing_identifierspayload > 4000 chars asserts every identifier survives inthe audit reason.
asserts the corrective instruction sent to the model contains the complete defect
list (every identifier present), then passes on retry.
openclaw#722 — no fallback on final quality-audit failure
Root cause. When the quality audit fails on the FINAL retry attempt (or when nothing
is regenerable), the code returned
{ cancel: true }with no fallback summary. Acontext-heavy session (~300k+ tokens / ~1.1M+ chars) then can never compact: it sits at
100% context and the next turn hits the context-length-exceeded provider 400 path. The
session is permanently uncompactionable.
Change. On the final failed attempt, finalize a structured fallback summary
(
buildStructuredFallbackSummaryre-distilled from the previous summary, plus thepreserved recent turns) and let compaction proceed with a degraded artifact. Any
producer losses from the failed attempts are carried into the degraded finalization so
the truncation diagnostic stays attached to the artifact. The path logs
reasonCode=quality_guard_degraded_fallbackwith the reason codes. Genuinelyunrecoverable paths (LLM throw, no model, no auth, corrective generation failure) still
cancel.
Tests. The two cases that pinned
cancel: truenow assert compaction proceeds with astructured fallback summary, no cancel reason, and the degraded-fallback log line.
openclaw#723 — summary budget (16k chars) does not scale with context window
Root cause.
MAX_COMPACTION_SUMMARY_CHARSwas a fixed 16,000-char ceiling, withthe split-turn context at 8,000 (
MAX_SPLIT_TURN_CONTEXT_CHARS). For a ~300k+ tokensession (~1.1M+ chars serialized), even a perfect summary was truncated to ~1.5% of the
source before finalization; the required tail sections were cut off and
auditSummaryQualityfailed on the truncated artifact (missing_section). Retries cannever repair truncation, so compaction was structurally guaranteed to fail at this size
and degrade to a stall.
Design decision — budget formula. The compaction summary budget now scales with
the session size, bounded by what the summarization model can actually emit.
MIN_COMPACTION_SUMMARY_CHARS(16,000) is the floor (legacy behavior), not a ceiling:where
serializedCharsis the total text length of the summarizable messages + split-turnprefix, and
SUMMARIZER_OUTPUT_BUDGET_RATIO = 2,SUMMARIZER_CHARS_PER_TOKEN = 2(lower-bound UTF-16 chars per token for Latin text). Rationale:
can never satisfy; capping at a multiple of the output budget keeps the request
satisfiable while still representing large sessions far better than 1.5%.
summary re-injectable into the next conversation turn: it never exceeds a small
multiple of the model's output budget, so the boundary entry does not itself trip
context-length-exceeded on the following preflight.
fixed cap.
(legacy behavior) — the scaling only applies to the built-in LLM path.
budgetCompactionSummaryis unchanged (it already takes amaxCharsparam); thescaled budget is resolved per compaction and threaded through finalization, and the
preserved/split-turn bounded sections now scale with half of the resolved budget
instead of the fixed 8k.
Example: a 200k-context / 32k-maxTokens model on a 1.1M-char session:
maxOutputTokens = 32000 - 4096 = 27904,ceiling = 16000 + 27904*2*2 = 127776,budget = min(max(1100000, 16000), 127776) = 127776— an 8× improvement over the fixed16k, with the required tail sections no longer cut off.
Tests.
maxTokensceiling, scaled ceiling, and session-sizepassthrough for
resolveCompactionSummaryBudgetChars.22k+ structured body (20k filler + all required sections + the audited identifier)
asserts the finalized artifact keeps every required tail section and the 20k filler
line intact, with no truncation marker and a first-attempt quality pass.
Test results
src/agents/agent-hooks/compaction-safeguard.test.ts— 137/137 pass (133 baselinefrom cancel-pinned to degraded-fallback-pinned). Re-verified after the 2026-09-01 rebase
(below).
(
d109b11c018) fails 16 tests, including the docs(showcase): add Visual Morning Briefing Scene openclaw/openclaw#721 end-to-end case (the correctiveinstruction visibly truncates mid-identifier at the 4000-char cap) and both fix: externalize playwright-core in Bun build for browser automation openclaw/openclaw#723 budget
tests — i.e. the regression tests reproduce the reported failure mode before the fix
and pass after.
src/agents/agent-hooks/compaction-instructions.test.ts— 27/27 pass.compaction.test.ts,compaction.failure-proof.test.ts,compaction.summarize-fallback.test.ts,compaction-partial-summary.test.ts,compaction-planning-worker.test.ts,compaction-real-conversation.test.ts,compaction.abort-http.test.ts,compaction.identifier-preservation.test.ts,compaction.token-sanitize.test.ts,compaction.tool-result-details.test.ts) —83/83 pass.
agent-command.compaction-rotation.test.ts— pre-existing environment failure(markdown-it v15
lib/common/html_re.mjsexport mismatch in the host's hoistednode_modules); fails identically on the unmodified base and is unrelated to thisdiff.
tsgo -p tsconfig.core.json— zero errors in any touched file (agent-hooks/ compaction-safeguard*.ts); remaining errors are pre-existing on the branch(markdown-it token types, tui, auth-profiles, terminal-resolution, channels
lifecycle).
Rebase note (2026-09-01)
The branch was rebased from
f309526a194onto the current base tipd109b11c018(
--onto, 4 commits replayed). The base picked upe545867b558("degrade instead ofcancel on final quality-audit failure") in the meantime — a minimal openclaw#722 fix in the
same file and hunk as this PR's openclaw#722 commit. The openclaw#722/openclaw#723 changes overlap, so
resolution kept this PR's superset: the degraded fallback additionally carries
producerLossesinto finalization and logsproducerLosses=on thedegraded-fallback warning (strictly more observability, same control flow). No
behavioral change vs
e545867b558; this PR remains the single source of truth for thefull openclaw#722 fix and makes openclaw#721/openclaw#723 land on the same branch.
Notes
upgrade-v2026.8.1-beta.2branch(module
src/agents/agent-hooks/), not marketing-site changes.missing_identifiersreason format is unchanged (onemissing_identifiers:line);only its length and wrapper budget changed, so existing consumers that split on
missing_identifiers:are unaffected.e545867b558("degrade instead of cancel on finalquality-audit failure", merged into the base after this PR was first opened) — this PR's
feat(bash): add host-only /bash slash command openclaw/openclaw#722 commit is its superset (adds producer-loss carry-through + log field) and the
rebase note above documents the hunk overlap.
Verification 2026-09-04
Fresh per-ticket verification against the current base tip
d109b11c018(
upgrade-v2026.8.1-beta.2), headdf808efca37:auditSummaryQualityemits the full missing-identifier list(bounded only by the 12-item extraction cap,
src/agents/agent-hooks/compaction-safeguard-quality.ts:243) and the correctivefeedback is routed through the dedicated
wrapUntrustedQualityFeedbackBlock(
compaction-safeguard-quality.ts:47, 8000-char budget at line 15 — sized for theaudit's worst case: 5
missing_sectionlines + one 12-identifier line; the legacy4000-char operator wrapper is no longer on this path,
src/agents/agent-hooks/compaction-safeguard.ts:1579). Regression tests: afinalizes a structured degraded summary via
buildStructuredFallbackSummary(effectivePreviousSummary)and returnscompactionResult(degraded.summary)instead of{ cancel: true }(
src/agents/agent-hooks/compaction-safeguard.ts:1555-1560); producer losses fromfailed attempts are carried into
finalizeSummaryTextand the degraded-fallbackwarning logs
producerLosses=(compaction-safeguard.ts:1562-1570). Genuinelyunrecoverable paths (LLM throw, no model, no auth, corrective generation failure)
still cancel above the quality loop. Superset of the base's
e545867b558minimaldegrade fix (see rebase note); the two tests pin the degraded-fallback behavior.
resolveCompactionSummaryBudgetChars(
src/agents/agent-hooks/compaction-safeguard.ts:758) resolves the finalizationbudget per compaction as
`clamp(serializedChars, MIN_COMPACTION_SUMMARY_CHARS=16_000 (line 88), 16_000 +
(maxTokens - SUMMARIZATION_OVERHEAD_TOKENS) * SUMMARIZER_OUTPUT_BUDGET_RATIO=2
— the 16k cap is now a floor, the ceiling scales with what the summarization model can actually emit, and the preserved/split-turn bounded sections scale with half the resolved budget (lines 1436-1453, threaded throughfinalizeSummaryText` at line 1221). Design reasoning (why cap at amultiple of the output budget rather than full session size: audit-satisfiable
budget + summary re-injectable on the next turn; provider path keeps the 16k
floor) is documented in the "## fix: externalize playwright-core in Bun build for browser automation openclaw/openclaw#723" section above — this satisfies the ticket's
design-spike requirement. Regression tests: floor / no-maxTokens / scaled ceiling
(unit) and a ~1M-char session keeping all required tail sections + 20k filler
intact with a first-attempt quality pass (e2e).
Rebase status. The branch head
df808efca37is already based on the currentbase tip
d109b11c018(merge base == base tip; PR is MERGEABLE with zero commitsto replay). Rebase verified as a no-op on 2026-09-04; no force-push required and
none performed.
Fresh test runs (2026-09-04, head
df808efca37):src/agents/agent-hooks/compaction-instructions.test.ts— 27/27 pass.src/agents/agent-hooks/compaction-safeguard.test.ts— 137/137 pass.compaction.test.ts26,compaction.failure-proof.test.ts1,
compaction.summarize-fallback.test.ts6,compaction-partial-summary.test.ts9,
compaction-planning-worker.test.ts12,compaction-real-conversation.test.ts5,
compaction.abort-http.test.ts1,compaction.identifier-preservation.test.ts19,
compaction.token-sanitize.test.ts7,compaction.tool-result-details.test.ts3) — 83/83 pass (6/6 in the real-conversation + abort-http shard, 77/77 in
the agents-core shard).
src/agents/agent-command.compaction-rotation.test.ts— still fails with theknown pre-existing environment error (markdown-it v15
lib/common/html_re.mjsexport mismatch); re-verified on 2026-09-04 that it fails identically on the
unmodified base
d109b11c018(clean base worktree, 0 local changes) — notcaused by this diff.