Repository navigation
Description
Bug type
Behavior bug (incorrect output/state without crash)
Beta release blocker
No
Summary
Heartbeat does not honor the configured agents.defaults.heartbeat.model on its own, because when the heartbeat session’s persisted providerOverride and modelOverride are removed, the next
heartbeat run resolves to the primary agent model instead.
Steps to reproduce
- Set:
- primary model = openai-codex/gpt-5.4
- heartbeat model = ollama/gemma4:e4b
- heartbeat session = agent:main:main:heartbeat
- Remove providerOverride and modelOverride from the heartbeat session entry.
- Trigger the next heartbeat run.
- Inspect the heartbeat session model.
Expected behavior
With agents.defaults.heartbeat.model configured to ollama/gemma4:e4b for agent:main:main:heartbeat, the expected behavior is that heartbeat runs on ollama/gemma4:e4b from config alone,
without requiring persisted session-level providerOverride or modelOverride fields.
Actual behavior
After removing the heartbeat session’s persisted providerOverride and modelOverride, the next observed heartbeat run resolved back to openai-codex/gpt-5.4 instead of the configured Ollama
heartbeat model, and restoring those session override fields returned heartbeat to the intended local model.
OpenClaw version
2026.4.2 (d74a122)
Operating system
macOS 15.7.4 (24G517)
Install method
Global Node installation under /opt/homebrew/lib/node_modules/openclaw (CLI launched as openclaw from that install).
Model
Configured heartbeat model under test: ollama/gemma4:e4b Observed fallback model when session overrides were removed: openai-codex/gpt-5.4
Provider / routing chain
OpenClaw CLI -> local OpenClaw gateway (loopback, token auth) -> configured provider "ollama" for heartbeat -> local Ollama model "gemma4:e4b" Observed fallback path after removing session overrides: OpenClaw heartbeat -> primary agent model "openai-codex/gpt-5.4"
Additional provider/model setup details
- Primary agent model in config: openai-codex/gpt-5.4
- Heartbeat config in ~/.openclaw/openclaw.json:
- agents.defaults.heartbeat.model = "ollama/gemma4:e4b"
- agents.defaults.heartbeat.session = "agent:main:main:heartbeat"
- Repro condition:
- remove providerOverride and modelOverride from the heartbeat session entry
- trigger the next heartbeat run
- Workaround:
- persist providerOverride: "ollama" and modelOverride: "gemma4:e4b" on the heartbeat session
- Same behavior was also reproduced with ollama/qwen3.5:4b, so it did not appear specific to Gemma
- Heartbeat config in ~/.openclaw/openclaw.json:
Logs, screenshots, and evidence
- Config validated on the tested install: openclaw config validate --json returned {"valid":true,"path":"/Users/neo/.openclaw/openclaw.json"}
- Tested config shows:
- .openclaw/openclaw.json:169 primary model openai-codex/gpt-5.4
- .openclaw/openclaw.json:223 heartbeat model ollama/gemma4:e4b
- .openclaw/openclaw.json:224 heartbeat session agent:main:main:heartbeat
- Observed runtime behavior:
- after removing the heartbeat session’s persisted overrides, the next heartbeat resolved to gpt-5.4
- after restoring the override fields, heartbeat returned to the intended local Ollama model
- Session state evidence is in:
- .openclaw/agents/main/sessions/sessions.jsonImpact and severity
Affected users/systems/channels: observed on this local OpenClaw install for the heartbeat session agent:main:main:heartbeat
Severity: breaks intended heartbeat model selection unless sticky session state is preserved
Frequency: reproducible in the tested scenario when providerOverride and modelOverride are removed
Consequence: heartbeat runs on the primary agent model instead of the configured heartbeat model, so config alone is not a reliable source of truth
Additional information
- OpenClaw version tested: 2026.4.2 (d74a122)
- OS: macOS 15.7.4 (24G517)
- Install method: global Node installation under /opt/homebrew/lib/node_modules/openclaw
- This does not appear model-specific; it was observed with both ollama/gemma4:e4b and ollama/qwen3.5:4b
- The issue appears to be config/session precedence rather than an Ollama runtime failure, because restoring the persisted session override returns heartbeat to the intended model
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
dinakars777 commentedon Apr 3, 2026
Investigation
I investigated this issue and found that the code already has the fix in place.
Code Analysis
heartbeat.modelfrom config and passes it asheartbeatModelOverridehasResolvedHeartbeatModelOverride = truePotential Root Causes
This might be a regression that was fixed in v2026.4.2, or there could be:
Can you confirm which version you're testing?
mintotsai commentedon Apr 3, 2026
Tested on OpenClaw 2026.4.2 (d74a122) on macOS 15.7.4 (24G517).
I also saw related heartbeat model-switch behavior earlier on
2026.3.28, but the specific repro in this issue was on2026.4.2.On this machine:
agent:main:main:heartbeatopenai-codex/gpt-5.4ollama/qwen3.5:4bandollama/gemma4:e4bWhat I observed on
2026.4.2:providerOverride/modelOverridegpt-5.4instead of the configured heartbeat modelIf I restore the persisted override fields, heartbeat returns to the intended local model.
So from this setup, config alone still did not appear to be sufficient on
2026.4.2.Let me know if there's any other details I can pull.
steipete commentedon Apr 25, 2026
Closing this as implemented after Codex review.
Current
mainalready implements the reported fix: heartbeat runs resolveagents.defaults.heartbeat.modelup front, mark that a heartbeat override was resolved, and then skip persisted session model overrides. The same logic and regression coverage are present in the shippedv2026.4.23release commit.What I checked:
modelas the per-heartbeat model override for heartbeat runs. Public docs:docs/gateway/heartbeat.md. (docs/gateway/heartbeat.md:224, a9797214338b)runHeartbeatOncereadsheartbeat?.model, normalizes it, and passes it downstream asheartbeatModelOverridein reply options. (src/infra/heartbeat-runner.ts:1064, a9797214338b)get-replyresolves the heartbeat model override before other selection paths and setshasResolvedHeartbeatModelOverride = truewhen successful. (src/auto-reply/reply/get-reply.ts:199, a9797214338b)hasResolvedHeartbeatModelOverrideis true, which is the exact fallback the issue reported. (src/auto-reply/reply/model-selection.ts:413, a9797214338b)src/auto-reply/reply/model-selection.test.ts:394, a9797214338b)heartbeat.sessionresolving to an explicit session key, matching the report’s use ofagent:main:main:heartbeat. (src/infra/heartbeat-runner.returns-default-unset.test.ts:866, a9797214338b)So I’m closing this as already implemented rather than keeping a duplicate issue open.
Review notes: reviewed against a155b84cdade; fix evidence: release v2026.4.23, commit a9797214338b.