fix #75452: Heartbeat per-turn model override persists after turn completes#75567
fix #75452: Heartbeat per-turn model override persists after turn completes#75567zhangguiping-xydt wants to merge 2 commits intoopenclaw:mainfrom
Conversation
|
Codex review: needs changes before merge. What this changes: The PR adds a Required change before merge: The remaining work is narrow and file-local on the PR branch: repair the preserve branch for model-only session entries and update the changelog line to satisfy the gate. Security review: Security review cleared: Cleared: the diff changes session metadata persistence, focused tests, and changelog text only, with no dependency, CI, secret, install, publish, or code-download surface. Review findings:
Review detailsBest possible solution: Land a corrected narrow patch that keeps heartbeat model overrides scoped to heartbeat runs, preserves only valid pre-existing runtime model identity, covers legacy model-only session entries, leaves non-heartbeat persistence unchanged, and satisfies the active changelog gate. Do we have a high-confidence way to reproduce the issue? Yes. The linked issue gives a concrete config and before/after Is this the best way to solve the issue? No, not as currently written. The Full review comments:
Overall correctness: patch is incorrect Acceptance criteria:
What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e0cc374b07c1. |
Fixes #75452. Heartbeat runs can use a per-turn model override via agents.defaults.heartbeat.model. Before this change, the run metadata was written back to the shared session store, so the next normal turn could inherit the heartbeat provider/model and a smaller context window. This lands the contributor fix plus maintainer polish: - preserve existing session runtime model/provider/context metadata when persisting heartbeat turns - avoid creating invalid provider/model pairs for legacy model-only session entries - leave empty prior runtime state unset for heartbeat-only turns - keep normal non-heartbeat runtime persistence unchanged - add focused regression coverage for the session-store edge cases - refresh heartbeat docs and changelog attribution Validation: - pnpm test src/agents/command/session-store.test.ts src/agents/openclaw-tools.session-status.test.ts - pnpm exec oxfmt --check --threads=1 src/agents/agent-command.ts src/agents/command/session-store.ts src/agents/command/session-store.test.ts CHANGELOG.md docs/gateway/heartbeat.md - git diff --check - GitHub checks on 42a00dc: clean; no active checks and no relevant failures Duplicate PR #75567 was already closed; #75557 is the canonical fix.
Fixes openclaw#75452. Heartbeat runs can use a per-turn model override via agents.defaults.heartbeat.model. Before this change, the run metadata was written back to the shared session store, so the next normal turn could inherit the heartbeat provider/model and a smaller context window. This lands the contributor fix plus maintainer polish: - preserve existing session runtime model/provider/context metadata when persisting heartbeat turns - avoid creating invalid provider/model pairs for legacy model-only session entries - leave empty prior runtime state unset for heartbeat-only turns - keep normal non-heartbeat runtime persistence unchanged - add focused regression coverage for the session-store edge cases - refresh heartbeat docs and changelog attribution Validation: - pnpm test src/agents/command/session-store.test.ts src/agents/openclaw-tools.session-status.test.ts - pnpm exec oxfmt --check --threads=1 src/agents/agent-command.ts src/agents/command/session-store.ts src/agents/command/session-store.test.ts CHANGELOG.md docs/gateway/heartbeat.md - git diff --check - GitHub checks on 42a00dc: clean; no active checks and no relevant failures Duplicate PR openclaw#75567 was already closed; openclaw#75557 is the canonical fix.
Fixes openclaw#75452. Heartbeat runs can use a per-turn model override via agents.defaults.heartbeat.model. Before this change, the run metadata was written back to the shared session store, so the next normal turn could inherit the heartbeat provider/model and a smaller context window. This lands the contributor fix plus maintainer polish: - preserve existing session runtime model/provider/context metadata when persisting heartbeat turns - avoid creating invalid provider/model pairs for legacy model-only session entries - leave empty prior runtime state unset for heartbeat-only turns - keep normal non-heartbeat runtime persistence unchanged - add focused regression coverage for the session-store edge cases - refresh heartbeat docs and changelog attribution Validation: - pnpm test src/agents/command/session-store.test.ts src/agents/openclaw-tools.session-status.test.ts - pnpm exec oxfmt --check --threads=1 src/agents/agent-command.ts src/agents/command/session-store.ts src/agents/command/session-store.test.ts CHANGELOG.md docs/gateway/heartbeat.md - git diff --check - GitHub checks on 42a00dc: clean; no active checks and no relevant failures Duplicate PR openclaw#75567 was already closed; openclaw#75557 is the canonical fix.
Summary
Fixes #75452
Heartbeat turns that use a per-turn model override (e.g., a lightweight
ollamamodel) were persisting that override into the shared session state after the turn completed. Subsequent normal turns would then incorrectly see the heartbeat model instead of the originally configured model.Changes
preserveRuntimeModelflag toupdateSessionStoreAfterAgentRunthat preserves pre-existingmodel,modelProvider, andcontextTokenswhen setbootstrapContextRunKind === "heartbeat") inagent-command.tsTest plan
session-store.test.ts