fix: heartbeat model override ignored — 4 root causes (#56788)#1
Open
daniel-rudaev wants to merge 1 commit intomainfrom
Open
fix: heartbeat model override ignored — 4 root causes (#56788)#1daniel-rudaev wants to merge 1 commit intomainfrom
daniel-rudaev wants to merge 1 commit intomainfrom
Conversation
Applies source-level fixes from upstream PRs #57094 and #57076 (both unmerged) via a build-time patch script. Root causes and fixes: 1. runtime-system.ts: plugin runtime API stripped heartbeat.model when forwarding to runHeartbeatOnceInternal — now passes it through 2. live-model-switch.ts: resolveLiveSessionModelSelection ignored caller- provided defaults when agentId was present, always using config default — now prefers caller defaults (the resolved heartbeat model) 3. model-fallback.ts: LiveSessionModelSwitchError was swallowed as a candidate failure, inverting the fallback order — now rethrown when rethrowLiveSwitch is set 4. get-reply.ts: post-directive resolution unconditionally overwrote the heartbeat model — now guarded by hasResolvedHeartbeatModelOverride Also in agent-runner-execution.ts: uses structural isLiveSessionModelSwitchError check (cross-module safe) and passes rethrowLiveSwitch: true. Upstream refs: openclaw/openclaw#56788, PR #57094, PR #57076
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes
agents.defaults.heartbeat.modelconfig being ignored at runtime — heartbeat always falling back to the default model (e.g. Opus) regardless of what is configured.Based on upstream openclaw/openclaw PRs #57094 and #57076, both currently open and unmerged.
Root causes (4 loss points in the model resolution chain)
runtime-system.ts— heartbeatmodelfield stripped when forwarding torunHeartbeatOnceInternallive-model-switch.ts—resolveLiveSessionModelSelection()ignores caller-provided defaults, uses config default insteadmodel-fallback.ts—LiveSessionModelSwitchErrorswallowed as a candidate failure, inverts fallback orderget-reply.ts— unconditionally overwrites heartbeat model after directive resolutionChanges
Applied via build-time patch script (
patches/apply-heartbeat-model-fix.sh) inDockerfile.base:src/plugins/runtime/runtime-system.ts— passmodelfield through torunHeartbeatOnceInternalsrc/plugins/runtime/types-core.ts— addmodel?: stringto heartbeat typesrc/agents/live-model-switch.ts— prefer caller-provideddefaultProvider/defaultModelover config lookupsrc/agents/model-fallback.ts— addisLiveSessionModelSwitchError()structural check +rethrowLiveSwitchparamsrc/auto-reply/reply/agent-runner-execution.ts— use structural check, passrethrowLiveSwitch: truesrc/auto-reply/reply/get-reply.ts— guard post-directive model overwrite withhasResolvedHeartbeatModelOverrideTesting
Patches verified against current
openclaw/openclawmain (commit at clone time). Patch script exits non-zero if any substitution fails.Upstream PRs pending — will remove patch and point directly to source once merged upstream.
References