Repository navigation
fix(compaction): compact with the model a session inherits from its parent - #204755
Conversation
…arent OpenClaw-Publication: 85662330-c12e-44aa-8f1f-ceea1f9b7a9d
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesManual compaction uses the existing inherited-model selector for both preflight and execution. Example: agent:main:dashboard:child inherits openai/gpt-5.4 and retains the openai:personal auth pin.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: current main still ignores parent model inheritance during manual compaction, and this PR provides a focused repair with no introduced correctness defect found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe Gateway sessions.compact handler prepares the session, selects its model and runtime, and passes the selected model and existing auth pin to the compaction engine. flowchart TD
A[Manual compaction request] --> B[Gateway session lifecycle]
B --> C[Prepared parent lineage]
C --> D[Existing model selector]
D --> E[Runtime preflight and execution]
E --> F[Compaction engine]
Technical reviewBest possible solution: Retain this focused reuse of the existing inheritance and model-selection owners while preserving auth compatibility checks and runtime ownership. Do we have a high-confidence way to reproduce the issue? The source establishes the mismatch: current-main compaction ignores the parent selection but forwards the child's auth pin; the author also reports a regression that fails on base and passes on the PR, which this read-only review did not execute. Is this the best way to solve the issue? The patch is the smallest complete repair identified: reuse the existing parent reader and selected-model resolver through one helper called by both compaction phases, without introducing parallel policy or persistent state. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1f4079a13ed5. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +21, Tests +63. Total +84 across 2 files. Added test files: 1. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 24, 2026, 11:35 AM ET / 16:35 UTC. |
…arent (#204755) * fix(compaction): compact with the model a session inherits from its parent * fix(compaction): share inherited model selection across preflight and run * fix(compaction): compact with the model a session inherits from its parent OpenClaw-Publication: 85662330-c12e-44aa-8f1f-ceea1f9b7a9d (cherry picked from commit cee9028) Co-authored-by: RomneyDa <[email protected]>
…arent (openclaw#204755) * fix(compaction): compact with the model a session inherits from its parent * fix(compaction): share inherited model selection across preflight and run * fix(compaction): compact with the model a session inherits from its parent OpenClaw-Publication: 85662330-c12e-44aa-8f1f-ceea1f9b7a9d
…arent (#204755) * fix(compaction): compact with the model a session inherits from its parent * fix(compaction): share inherited model selection across preflight and run * fix(compaction): compact with the model a session inherits from its parent OpenClaw-Publication: 85662330-c12e-44aa-8f1f-ceea1f9b7a9d (cherry picked from commit cee9028) Companion audit: ec31b90 changes prepared transcript size policy; e52c1a9 and c2d208f are later Claude runtime-key reuse fixes; 966d287 changes Talk consultation runtime admission. Those are distinct from inherited model selection. Release adaptation: Use the existing inherited selector and lineage reader in both preflight and execution; keep stable persisted runtime and child auth selection. Co-authored-by: RomneyDa <[email protected]>
What
Manual compaction (
sessions.compact) now chooses its model the same way ordinary turns and the Control UI do, including a model inherited from a parent session. Preflight and execution share that one selection.Why
A dashboard child session inherited
anthropic/claude-opus-5-5from its parent and carried the matching personalanthropic:manualauth pin. Chat turns used the inherited model. Manual compaction usedresolveSessionModelRef, which ignores parent inheritance, so it fell back to the configured default (clawrouter/anthropic/claude-opus-5-5). It then combined that model with the session's Anthropic pin, and every/compactfailed with:The auth check was correct. The bug was that compaction built a model/credential pair the session never uses.
Changes
resolveSessionSelectedModelRefAsyncprepareGatewaySessionEntryReader, which honors configured storesusesLegacyRuntime) and execution share one selectionReview findings addressed:
Related issue, not fixed here: subagent-announce turns on the same session still resolve the configured default (ClawRouter), while human turns use the inherited Anthropic model. Each switch rewrites the whole prompt cache.
Testing
pnpm test src/gateway/server.sessions.compaction-model.test.ts: fails on base (compaction got the config defaultanthropic), passes with the fixcompaction,-model,-preemption,-accounting,-read-errors,chat-send-compaction-handoff): 38/38 passedpnpm check:changedpassed. The dead-export scan was skipped; it fails on main because of unrelatedbeamexports.🦞 Made with OpenClaw