Repository navigation
Conversation
|
🦞👀 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 real behavior proof before merge. What this changesThis PR lets memory-flush model overrides specify a primary model and named fallbacks, with matching validation, discovery, Doctor repair, and documentation. Example: The operator selects ollama/qwen3:8b for memory flushing and permits anthropic/claude-haiku-4-5 as its fallback.
Review scores
ProductKind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete Merge readiness⛔ Blocked before merge - 5 items remain Keep this PR open under the same-author pairing guard; current main now offers plugin routing that overlaps the proposed core selector, so the implementation direction needs reconsideration. Priority: P2 Decision needed
Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe memory plugin builds a maintenance plan from configuration; the reply runner forwards its model selection into shared fallback dispatch and records the flush outcome. flowchart LR
A[Operator configuration] --> B[Schema validation]
B --> C[Memory plugin flush plan]
C --> D[Memory maintenance runner]
D --> E[Shared model fallback dispatch]
E --> F[Durable memory and flush status]
Technical reviewBest possible solution: Implement memory-only fallback policy through the existing routing hook unless maintainers establish a concrete need for additional core configuration. Do we have a high-confidence way to reproduce the issue? Source confirms that an explicit flush model disables inherited fallbacks; this is intentional behavior, and no target code was executed during this review. Is this the best way to solve the issue? The selector preserves the existing cost guard, but current main's memory-trigger routing hook can express the requested primary and fallback policy without these additional core contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fbc99b8c03f5. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +81, Tests +212, Docs +8, Generated +2. Total +303 across 23 files. Added test files: 0. View PR surface stats
Review metrics
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 HistoryReview history (17 earlier review cycles; latest 8 shown)
Reviewed October 21, 2026, 1:02 AM ET / 05:02 UTC (Revision 18). |
|
Moving this to draft: the config-surface ratchet needs a generated artifact I cannot produce here. That is the correct gate for this change — adding a config key is exactly what it is meant to make deliberate — and the budget bump is intentional here, so the answer is to run
Everything else in the diff stands as written, and the shape is unchanged from the proposal in #137613: |
|
Unblocked: The core config surface goes 2420 → 2422. The budget bump is deliberate: the key exists so an operator can name the models they accept paying for on the flush path, which the exact-override default cannot express, and there is no existing key to trade away for it. Verified locally: |
|
Exact-head proof: a configured flush model that is unavailable now selects a named fallback and the flush completes. Built this branch from source and ran a real turn against it — "memoryFlush": {
"enabled": true,
"model": "ollama/glm-5.3-flash:cloud",
"fallbacks": ["openrouter/auto"],
"forceFlushTranscriptBytes": 10
}The primary flush model is genuinely unavailable — that Ollama account is past its weekly limit and returns A probe on the flush's model selection shows the declared list reaching it: {"flushModel": "ollama/glm-5.3-flash:cloud",
"declaredFallbacks": ["openrouter/auto"],
"runModel": "openrouter/auto", "runProvider": "openrouter"}The runtime then selected it: And the flush completed rather than failing: On current main the same configuration cannot express this. With Path note. This ran on the embedded path ( Local against this head: The probe was added to the local build only and is not in the diff. The run used a throwaway state directory, not a live workspace. |
841e5e9 to
2ae459d
Compare
CI note:
|
7230233 to
879e1aa
Compare
879e1aa to
f31f9e6
Compare
Rebuilt on current upstream/main: memoryFlush.model now uses the canonical
AgentModelConfig selector ({ primary, fallbacks }) so operators can name the
fallback models they accept paying for on the pre-compaction flush path. A
bare string keeps the exact-override default: an unreachable maintenance
model never silently bills the paid conversation model.
Flush-selector fallbacks flow through configured-model-refs collection and
the doctor's codex-route repair/scan, and the flush plan carries them to
the runner's fallback options.
The rebuild accidentally dropped docs/.generated/config-baseline.counts.json and config-baseline.sha256, breaking check-docs and the baseline ratchets (count budget file missing + hash mismatch). Restore both files and regenerate: the PR intentionally grows the config surface by 3 core entries (memory-flush fallback naming), so the counts ratchet core 2463 -> 2466 and the sha256 is updated accordingly.
60edeee to
a29a88e
Compare
A `{ fallbacks: [...] }` selector with no primary passed config
validation, but dispatch ignored the operator's fallbacks and silently
inherited the active conversation model's fallback chain. memoryFlush.model
now uses MemoryFlushModelSchema, which requires a primary whenever
fallbacks are supplied. Bare-string configs keep the exact-override
default unchanged.
Adds validation tests (accept string/primary-led selector, reject
fallback-only, stored-string upgrade round-trip) and a
configuration -> plan -> dispatch test proving a validated nested
selector recovers through the named fallback and records the memory
write.
|
Repair pushed to What changed
Tests / evidence (all real runs, no live model calls)
Honest limits: the fallback-recovery run uses the standard mocked model runner (no live provider calls), so it proves configuration → plan → dispatch agreement, not a live provider round-trip. No real credentials, endpoints, or user paths appear in any artifact. Still needs maintainers: the core-config-surface product decision — whether pre-compaction memory flush should gain this operator-facing selector at all. The repair only makes the selector safe if accepted. |
|
This pull request has been automatically marked as stale due to inactivity. |
|
This pull request has been automatically marked as stale after 7 days without qualifying human activity. |
* fix: use session model policy for memory flushes Remove the separate memory-flush model override from configuration and plugin plans. Reuse the active session model and normal fallback policy, and migrate existing settings through Doctor with a recorded notice. Supersedes #138144. Related: #137613. Co-authored-by: zijunl <[email protected]> * test: verify memory flush fallback handoff * docs: retire memory flush override from capability taxonomy * test(memory): remove obsolete flush model fixtures --------- Co-authored-by: zijunl <[email protected]>
…#182208) * fix: use session model policy for memory flushes Remove the separate memory-flush model override from configuration and plugin plans. Reuse the active session model and normal fallback policy, and migrate existing settings through Doctor with a recorded notice. Supersedes openclaw#138144. Related: openclaw#137613. Co-authored-by: zijunl <[email protected]> * test: verify memory flush fallback handoff * docs: retire memory flush override from capability taxonomy * test(memory): remove obsolete flush model fixtures --------- Co-authored-by: zijunl <[email protected]>
Implements the shape proposed in #137613 (comment 5538478657).
What Problem This Solves
An explicit
agents.defaults.compaction.memoryFlush.modelresolves exactly and drops the fallback chain:That guard is right and this does not remove it. A flush pointed at a local or free-tier model should not quietly start billing the operator's paid conversation model every time that model is unreachable.
The gap is that it is the only available behaviour.
memoryFlushexposesenabled,model,softThresholdTokens, andforceFlushTranscriptBytes— nothing that says "prefer the cheap model, and here is what I accept falling back to". Today the choice is:model— cheap and fast, but one unavailable primary fails the flush outright, ormemoryFlush.fallbacksmakes the third option expressible. The operator names, in configuration, exactly which models they accept paying for on this path — so the fall-through is deliberate and visible rather than silent, which is what the original guard was protecting.Behaviour
modelfallbacks[]or all-blank["a", "b"]Nothing changes for any existing configuration: the new key is optional and its absence reproduces current behaviour exactly.
Evidence
Motivation from a live deployment (OpenClaw 2026.8.1): primary
ollama/glm-5.3:cloud, fallbackanthropic/claude-sonnet-5,memoryFlush.model: ollama/glm-5.3-flash:cloud.With the flush model set and its quota exhausted, every flush failed outright:
Confirmed the primary was genuinely unavailable at that moment, not merely slow — a direct turn on the same model returned
⚠️ API rate limit reached. With a reachable flush model the same setup completed and appended to the memory file, so the failure was model availability rather than the flush path.That is the case this field is for: the operator wanted the cheap model first and Sonnet as the named replacement, and could not express it. Unsetting
modelrestored resilience but moved summarisation onto the large conversation model even when the cheap one was healthy.Tests
extensions/memory-core/src/flush-plan.test.tscovers the plan resolver: declared refs reach the plan with blanks dropped and order preserved, and omitted / empty / all-blank lists all resolve toundefinedso the exact-override default holds.Notes
fallbacksis ignored whenmodelis unset, since the flush already follows the active model's chain there. The help text says so; a schema-level dependency would be stricter but the config surface has no precedent for one that I could find.ollama/glm-5.3:cloud, fallbackanthropic/claude-sonnet-5. Withmodel: ollama/glm-5.3-flash:cloudset, every flush failed with⚠️ API rate limit reachedonce the Ollama weekly quota ran out; unsettingmodelrestored resilience but moved summarisation onto Sonnet even when the cheap model was available.🤖 Generated with Claude Code
https://claude.ai/code/session_01BjsHL4YEa67pAiPpSY3svm