Repository navigation
refactor(agents): consolidate compaction and context-engine ownership - #117482
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 1:30 PM ET / 17:30 UTC. ClawSweeper reviewWhat this changesThis PR consolidates transcript compaction, summary fallback, token-pressure accounting, lifecycle callbacks, and context-engine quarantine under their existing agent-runtime owners without intentionally changing user-facing behavior. Merge readinessKeep open for explicit maintainer review. The inspected PR source preserves the existing host-parameter compatibility window and context-engine fallback behavior, and the supplied Testbox proof directly exercises the key session-continuity paths; however, this broad refactor remains behind main and the partial checkout could not reconstruct the complete current merge result offline. No discrete P0–P2 patch defect was established in the directly inspected code. Priority: P2 Review scores
Verification
How this fits togetherAgent sessions compact long transcripts to remain within model context limits, then preserve summaries and tool-call structure for the next model request. Context engines can customize that process; if one fails, the registry quarantines it and routes subsequent compatible operations to the default engine. flowchart LR
Session[Agent session transcript] --> Pressure[Context pressure]
Pressure --> Planning[Compaction planning]
Planning --> Summary[Summary and history preservation]
Summary --> Engine[Context-engine lifecycle]
Engine --> Fallback[Quarantine and default fallback]
Fallback --> Continued[Continued agent session]
Decision needed
Why: The branch changes the owners of transcript summaries, fallback quarantine, and lifecycle callbacks; the protected maintainer label requires a human to accept that consolidation after reviewing the refreshed merge result. Before merge
Agent review detailsSecurityNone. PR surfaceSource -767, Tests 0. Total -767 across 22 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one canonical compaction and context-engine path, preserve the current compatibility projection and summary-fallback invariants, and approve only after the exact merge result has focused session-continuity proof. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR is an internal refactor, not a report of a standalone reproducible defect. Its claimed preserved behaviors are covered by supplied real Testbox output and directly inspected regression contracts. Is this the best way to solve the issue? Yes, conditionally: consolidating the compatibility projection and fallback behavior inside the resolved context-engine wrapper keeps the owner boundary canonical rather than retaining separate wrappers. The exact current merge result still needs focused proof before it is the confirmed best landing path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 586e1fe10e11. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via squash.
|
* origin/main: (26 commits) fix(update): return failure when dirty checkout blocks update (#117452) fix(auto-reply): apply mixed chat directives in one session transaction (#117542) refactor(ui): unify channel status and setup controls (#117499) fix(doctor): preserve surviving lint selections (#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (#112464) refactor(channels): consolidate lightweight plugin discovery (#117541) fix(imessage): prevent duplicate messages after delayed sends (#110853) refactor(memory): unify authoritative dreaming state and presentation (#117538) refactor(agents): consolidate main-session recovery ownership (#117383) fix(proxy-capture): make path-based session cleanup atomic (#98852) refactor(agents): consolidate compaction and context-engine ownership (#117482) fix(gateway): preserve Responses usage details (#117533) perf(gateway): skip empty session recovery stores (#117498) fix(ci): update canonical Kova performance pin (#117508) fix(system-agent): emit the wizard cancel hint once per message (#113731) refactor: dedupe secrets runtime snapshot fixtures (#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (#117493) ...
* origin/main: (35 commits) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (openclaw#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (openclaw#117493) ...
* origin/main: (491 commits) feat(gateway): advertise chat attachment limits on hello-ok (#116188) fix(ui): preserve full graphemes in session owner initials (#117350) refactor(tui): consolidate runtime ownership (#117368) fix(update): return failure when dirty checkout blocks update (#117452) fix(auto-reply): apply mixed chat directives in one session transaction (#117542) refactor(ui): unify channel status and setup controls (#117499) fix(doctor): preserve surviving lint selections (#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (#112464) refactor(channels): consolidate lightweight plugin discovery (#117541) fix(imessage): prevent duplicate messages after delayed sends (#110853) refactor(memory): unify authoritative dreaming state and presentation (#117538) refactor(agents): consolidate main-session recovery ownership (#117383) fix(proxy-capture): make path-based session cleanup atomic (#98852) refactor(agents): consolidate compaction and context-engine ownership (#117482) fix(gateway): preserve Responses usage details (#117533) perf(gateway): skip empty session recovery stores (#117498) fix(ci): update canonical Kova performance pin (#117508) fix(system-agent): emit the wizard cancel hint once per message (#113731) refactor: dedupe secrets runtime snapshot fixtures (#117502) test(google): cover ready callback close precedence ...
* origin/main: (325 commits) fix(skills): preserve profile in ClawHub command hints (#117555) fix(cli): explain filtered plugin policy without unsafe recovery (#117556) fix(irc): strip markdown from outbound text (#112961) refactor(plugins): consolidate registry snapshots (#117561) fix(plugins): fail blocked enable commands (#117536) test(secrets): dedupe runtime state fixtures (#117563) feat(gateway): advertise chat attachment limits on hello-ok (#116188) fix(ui): preserve full graphemes in session owner initials (#117350) refactor(tui): consolidate runtime ownership (#117368) fix(update): return failure when dirty checkout blocks update (#117452) fix(auto-reply): apply mixed chat directives in one session transaction (#117542) refactor(ui): unify channel status and setup controls (#117499) fix(doctor): preserve surviving lint selections (#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (#112464) refactor(channels): consolidate lightweight plugin discovery (#117541) fix(imessage): prevent duplicate messages after delayed sends (#110853) refactor(memory): unify authoritative dreaming state and presentation (#117538) refactor(agents): consolidate main-session recovery ownership (#117383) fix(proxy-capture): make path-based session cleanup atomic (#98852) refactor(agents): consolidate compaction and context-engine ownership (#117482) ... # Conflicts: # extensions/xai/realtime-voice-bridge.ts
…openclaw#117482) * refactor(agents): consolidate compaction and context-engine ownership * fix(agents): preserve prior summaries during compaction fallback * chore(ci): refresh merge proof after routing repair
* origin/main: (26 commits) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (openclaw#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (openclaw#117493) ...
* origin/main: (35 commits) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (openclaw#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (openclaw#117493) ...
* origin/main: (491 commits) feat(gateway): advertise chat attachment limits on hello-ok (openclaw#116188) fix(ui): preserve full graphemes in session owner initials (openclaw#117350) refactor(tui): consolidate runtime ownership (openclaw#117368) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence ...
* origin/main: (325 commits) fix(skills): preserve profile in ClawHub command hints (openclaw#117555) fix(cli): explain filtered plugin policy without unsafe recovery (openclaw#117556) fix(irc): strip markdown from outbound text (openclaw#112961) refactor(plugins): consolidate registry snapshots (openclaw#117561) fix(plugins): fail blocked enable commands (openclaw#117536) test(secrets): dedupe runtime state fixtures (openclaw#117563) feat(gateway): advertise chat attachment limits on hello-ok (openclaw#116188) fix(ui): preserve full graphemes in session owner initials (openclaw#117350) refactor(tui): consolidate runtime ownership (openclaw#117368) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) ... # Conflicts: # extensions/xai/realtime-voice-bridge.ts
What Problem This Solves
Long-running agent sessions depend on compaction, transcript pruning, summary generation, and plugin context-engine fallback to preserve conversation continuity under pressure. Those paths had accumulated duplicate policy, unreachable fallback outcomes, overlapping lifecycle wrappers, and fragmented token accounting, making overflow recovery and delegated-session continuity harder to maintain safely.
Why This Change Was Made
This maintainer-requested, AI-assisted cleanup consolidates compaction planning, token-pressure estimation, summary fallback, frozen tool-result projection, lifecycle hooks, and context-engine quarantine at their existing architectural owners. It removes 767 handwritten production lines while retaining public context-engine contracts, Unicode/CJK and image budgets, tool-call pairing, provider cancellation, generic-fallback preservation of prior summaries, and persisted session semantics.
User Impact
No intentional user-visible behavior changes. Agent sessions retain their existing compaction triggers, prior summaries during generic fallback, plugin hooks, retry/cancellation behavior, tool-result recovery, and conversation continuity; regression coverage explicitly protects model-outage summary preservation, whitespace-only delegated replies, and simultaneous context-engine fallback initialization.
Evidence
Net tracked change: 767 production lines removed, zero net test lines removed, and 767 total lines removed across 22 files; existing fallback regression coverage is retained while lifecycle regressions are strengthened.
Direct, redacted Blacksmith Testbox
tbx_01kyz2qyzwa1hctkk8exvgww3hterminal proof; all three owner-boundary behaviors passed on the corrected source:The HTTP case starts a real loopback provider, aborts after exactly one response, and asserts the source transcript is unchanged. The context-engine case runs simultaneous failing lifecycle calls and asserts the legacy fallback factory was invoked exactly once. The safeguard case injects a generic model fallback and asserts both the existing known context and fallback explanation survive.
Blacksmith Testbox
tbx_01kyyx10qke7rtbmsqfwz7cr81: the complete owner/sibling focused matrix passed across 27 files, 519 tests, and eight Vitest shards. Coverage includes real loopback HTTP provider cancellation with unchanged transcript, 39 overflow-loop scenarios, 18 timeout-triggered compaction scenarios, more than 110 safeguard cases, Unicode/CJK budgets, frozen tool-result recovery, plugin hooks, and context-engine quarantine.Corrected-source owner/sibling rerun: 11 directly affected suites passed, including all 119 compaction-safeguard cases, every summary fallback/partial-summary scenario, real HTTP cancellation, both tool-result projection suites, plugin compaction hooks, and the full 48-case context-engine suite.
Complete remote
pnpm check:changed: passed in 6m03s on the corrected source, including production/test typechecking, formatting, architecture boundaries, dead-export/dependency guards, all 22 changed files under 245 type-aware lint rules, schema guards, and runtime import-cycle checks.Complete remote
pnpm build: passed in 2m55s on the corrected source, including packaged runtime, all 148 public plugin SDK subpaths, browser assets, and Control UI performance checks.Unified type-aware lint: all 22 changed files checked against 245 rules with zero warnings or errors.
Independent xhigh P0–P2 full-diff/coverage cross-reviews directly inspected the installed Anthropic dependency contract and both native/normalized redacted-thinking formats: clean. A fresh structured
gpt-5.6-solxhigh-reasoning review of the complete 22-file corrected branch also reported zero P0–P2 findings; TruffleHog: clean.No protocol, public SDK, configuration, SQLite schema, guard, baseline, or suppression changes.