Repository navigation
fix(agents): recover from invalid compaction summaries - #119137
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 4, 2026, 7:35 AM ET / 11:35 UTC. ClawSweeper reviewWhat this changesThe PR rejects empty, whitespace-only, and reasoning-only compaction summaries, retries one invalid automatic summary, and adds regression plus built-runtime QA coverage. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessThe prior P1 blocker is resolved at the updated head: invalid summaries are rejected before persistence, and caller-owned default recovery now reaches the bounded automatic retry. No new blocking defect was found; this maintainer-authored, protected PR should remain open for normal exact-head review. Priority: P1 Review scores
Verification
How this fits togetherAgent sessions compact older context after overflow or budget pressure, persist the resulting summary, and then resume the agent run. The embedded runner selects the compaction entrypoint, while the session owner controls persistence and retry policy. flowchart LR
A[Context overflow or budget trigger] --> B[Embedded session runner]
B --> C[Automatic compaction owner]
C --> D[Model summary response]
D --> E{Usable visible text?}
E -->|No, first attempt| F[One bounded retry]
F --> D
E -->|Yes| G[Persist compacted context]
G --> H[Resume agent run]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +201, Tests +813, Other +310. Total +1324 across 22 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge the exact-head owner-boundary repair after normal maintainer review, retaining shared producer validation, the one automatic retry, and both built-runtime QA scenarios. Do we have a high-confidence way to reproduce the issue? Yes—source provides a high-confidence built-runtime path: force an overflow, return one invalid summary, and assert the second summary plus persisted final response; it was not executed in this read-only review. Is this the best way to solve the issue? Yes. Validating at the shared producer and applying one retry only at the automatic session owner avoids persisting bad state while preserving manual and provider-error behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2a3a840aaf80. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
5e9e3a9 to
8972341
Compare
8972341 to
d85722b
Compare
d85722b to
688b35e
Compare
|
Maintainer disposition for exact signed head
All listed before-merge work is satisfied. Proceeding through the repo-native |
|
Merged via squash.
|
…checkpoint * origin/main: (46 commits) fix(agents): recover from invalid compaction summaries (#119137) fix(gateway): expose OAuth-backed tools to CLI agents (#119166) fix(plugins): preserve metadata reloads during models status (#119183) fix(test): bound direct gateway server runs (#119184) test(tui): prove command surfaces through PTY (#119165) fix(testbox): restore claims across path aliases (#119170) fix(message): preserve sends with incidental Telegram locations fix(perf): give each concurrency sample a full deadline (#119164) fix(testbox): remove changed-gate sync residue (#119163) fix(telegram): preserve later chunks after rejected sends fix(tui): block terminal controls in system messages (#118998) fix(auto-reply): suppress false no-reply fallback during continuations (#119154) fix(scripts): prevent gateway benchmarks from stalling on probes (#119063) test(channels): verify built sanitizer semantics (#119151) fix: prevent live updater from leaving Gateway offline indefinitely (#119116) test(qa): restore memory tools primary ownership (#119142) fix(agents): settle yielded fanout at harness boundary (#118703) fix(codex): cap compaction override warning cache via createDedupeCache (#101745) fix(daemon): skip unlabeled launchd plists (#119091) test(qa): repair QA catalog integrity (#119140) ...
…tial-gate * origin/main: fix(agents): recover from invalid compaction summaries (#119137)
* origin/main: (208 commits) fix(telegram): route reactions to their originating forum topics test(gateway): isolate scheduled service timers (#119218) test(qa): cover Canvas agent and node controls (#119047) fix(cli): avoid repeated migration scans during local agent turns (#119051) fix(gateway): keep agents list on prepared model facts (#119208) fix(telegram): retry update offset persistence fix(ci): accept profiled partial Kova gates (#119121) fix(qqbot): keep channel API calls on the active account [AI] (#118575) fix(agents): recover from invalid compaction summaries (#119137) fix(gateway): expose OAuth-backed tools to CLI agents (#119166) fix(plugins): preserve metadata reloads during models status (#119183) fix(test): bound direct gateway server runs (#119184) test(tui): prove command surfaces through PTY (#119165) fix(testbox): restore claims across path aliases (#119170) fix(message): preserve sends with incidental Telegram locations fix(perf): give each concurrency sample a full deadline (#119164) fix(testbox): remove changed-gate sync residue (#119163) fix(telegram): preserve later chunks after rejected sends fix(tui): block terminal controls in system messages (#118998) fix(auto-reply): suppress false no-reply fallback during continuations (#119154) ...
* origin/main: (23 commits) chore(tui): add Gateway boundary PTY coverage (#119191) fix(telegram): route reactions to their originating forum topics test(gateway): isolate scheduled service timers (#119218) test(qa): cover Canvas agent and node controls (#119047) fix(cli): avoid repeated migration scans during local agent turns (#119051) fix(gateway): keep agents list on prepared model facts (#119208) fix(telegram): retry update offset persistence fix(ci): accept profiled partial Kova gates (#119121) fix(qqbot): keep channel API calls on the active account [AI] (#118575) fix(agents): recover from invalid compaction summaries (#119137) fix(gateway): expose OAuth-backed tools to CLI agents (#119166) fix(plugins): preserve metadata reloads during models status (#119183) fix(test): bound direct gateway server runs (#119184) test(tui): prove command surfaces through PTY (#119165) fix(testbox): restore claims across path aliases (#119170) fix(message): preserve sends with incidental Telegram locations fix(perf): give each concurrency sample a full deadline (#119164) fix(testbox): remove changed-gate sync residue (#119163) fix(telegram): preserve later chunks after rejected sends fix(tui): block terminal controls in system messages (#118998) ...
…time * origin/main: (177 commits) fix(telegram): route reactions to their originating forum topics test(gateway): isolate scheduled service timers (#119218) test(qa): cover Canvas agent and node controls (#119047) fix(cli): avoid repeated migration scans during local agent turns (#119051) fix(gateway): keep agents list on prepared model facts (#119208) fix(telegram): retry update offset persistence fix(ci): accept profiled partial Kova gates (#119121) fix(qqbot): keep channel API calls on the active account [AI] (#118575) fix(agents): recover from invalid compaction summaries (#119137) fix(gateway): expose OAuth-backed tools to CLI agents (#119166) fix(plugins): preserve metadata reloads during models status (#119183) fix(test): bound direct gateway server runs (#119184) test(tui): prove command surfaces through PTY (#119165) fix(testbox): restore claims across path aliases (#119170) fix(message): preserve sends with incidental Telegram locations fix(perf): give each concurrency sample a full deadline (#119164) fix(testbox): remove changed-gate sync residue (#119163) fix(telegram): preserve later chunks after rejected sends fix(tui): block terminal controls in system messages (#118998) fix(auto-reply): suppress false no-reply fallback during continuations (#119154) ...
* origin/main: (23 commits) chore(tui): add Gateway boundary PTY coverage (openclaw#119191) fix(telegram): route reactions to their originating forum topics test(gateway): isolate scheduled service timers (openclaw#119218) test(qa): cover Canvas agent and node controls (openclaw#119047) fix(cli): avoid repeated migration scans during local agent turns (openclaw#119051) fix(gateway): keep agents list on prepared model facts (openclaw#119208) fix(telegram): retry update offset persistence fix(ci): accept profiled partial Kova gates (openclaw#119121) fix(qqbot): keep channel API calls on the active account [AI] (openclaw#118575) fix(agents): recover from invalid compaction summaries (openclaw#119137) fix(gateway): expose OAuth-backed tools to CLI agents (openclaw#119166) fix(plugins): preserve metadata reloads during models status (openclaw#119183) fix(test): bound direct gateway server runs (openclaw#119184) test(tui): prove command surfaces through PTY (openclaw#119165) fix(testbox): restore claims across path aliases (openclaw#119170) fix(message): preserve sends with incidental Telegram locations fix(perf): give each concurrency sample a full deadline (openclaw#119164) fix(testbox): remove changed-gate sync residue (openclaw#119163) fix(telegram): preserve later chunks after rejected sends fix(tui): block terminal controls in system messages (openclaw#118998) ...
Parent coverage work: #119033
What Problem This Solves
Fixes an issue where automatic context recovery could accept an empty,
whitespace-only, or reasoning-only compaction summary. In the embedded default
runtime, the caller-owned recovery path also invoked public manual compaction,
so it did not use the bounded invalid-summary retry already expected by
automatic recovery.
Branch summarization had the same invalid-output acceptance bug and could begin
navigation mutation without a usable summary.
Why This Change Was Made
The shared compaction producer now returns a typed
InvalidSummaryOutputErrorwhen the model returns no usable summary text.Branch summarization validates the same invariant before mutating navigation
state.
Automatic session compaction owns exactly one retry for that typed error. A
private internal session entrypoint carries the same policy into caller-owned
default overflow, budget, and timeout recovery without rerunning hooks, locks,
preflight, lifecycle, or persistence. Public/manual compaction remains
one-shot. Provider errors, extension-owned compaction, and safeguard policy are
unchanged.
The two QA scenarios exercise the real built embedded runtime and retain sole
primary ownership of:
session-memory.compaction-empty-response-recoverysession-memory.compaction-reasoning-only-recoveryUser Impact
Default automatic recovery now retries one unusable summary and continues with
durable compacted context. If the second summary is still invalid, recovery
fails visibly without persisting a compaction. Manual compaction and unrelated
provider failures keep their existing behavior.
Release-note context: automatic compaction now recovers from one empty or
reasoning-only summary. No
CHANGELOG.mdchange is included.Evidence
Exact signed head:
688b35ebd02587b05cd4ca1ea3fa5271d8338256v26.4.0, including typecheck,lint, API-surface, dead-export, and import-cycle checks.
git diff --checkpassed.OPENCLAW_BUILD_PRIVATE_QA=1 pnpm buildpassed.dist/index.jsQA passed 2/2:compaction-empty-response-recoverycompaction-reasoning-only-recoverycompaction, and one persisted final answer.
each accepted coverage ID.
the owner-boundary fix ready to publish.
Retained artifacts:
.artifacts/qa-b3-compaction-output-recovery-688b35ebd02-20260804/Scope And Drift
+96/-29.+1297/-40.+30/-5, test/harness+133/-89.surface was added.
mainat publication isc3f148f6b772bc96d24c5619bf9f78f80733a67c.mainremovedobsolete plugin-metadata mocks and this branch adds compaction-route mocks.
The changes are independent, and
git merge-tree --write-tree origin/main HEADcompleted without conflict.The prior
d85722b30cb2e4325a3f2f65aae34ef6447c00e9proof is superseded by theexact-head evidence above.