Fix stale runtime model reuse on session reset#41173
Conversation
Greptile SummaryThis PR fixes a bug where
Confidence Score: 5/5
Last reviewed commit: f07e5a0 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f07e5a00c4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
8f35b25 to
083726d
Compare
083726d to
d8a04a4
Compare
|
Merged via squash. Thanks @PonyX-lab! |
* main: (42 commits) test: share runtime group policy fallback cases refactor: share windows command shim resolution refactor: share approval gateway client setup refactor: share telegram payload send flow refactor: share passive account lifecycle helpers refactor: share channel config schema fragments refactor: share channel config security scaffolding refactor: share onboarding secret prompt flows refactor: share scoped account config patching feat(discord): add autoArchiveDuration config option (openclaw#35065) fix(gateway): harden token fallback/reconnect behavior and docs (openclaw#42507) fix(acp): strip provider auth env for child ACP processes (openclaw#42250) fix(browser): surface 429 rate limit errors with actionable hints (openclaw#40491) fix(acp): scope cancellation and event routing by runId (openclaw#41331) docs: require codex review in contributing guide (openclaw#42503) Fix stale runtime model reuse on session reset (openclaw#41173) docs: document r: spam auto-close label fix(ci): auto-close and lock r: spam items fix(acp): implicit streamToParent for mode=run without thread (openclaw#42404) test: extract sendpayload outbound contract suite ...
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Fixes openclaw#43930 When switching between models (e.g., Gemini → Grok → Gemini), the context may contain function_response entries that were valid for the previous model but cause errors for Gemini API with 'Name cannot be empty'. This fix skips tool calls without valid name during message conversion, preventing the INVALID_ARGUMENT error from Gemini API. Related to PR openclaw#41173 which added stripRuntimeModelState() for session reset, but model switching is a different scenario that needs separate handling.
Fixes openclaw#43930 When switching between models (e.g., Gemini → Grok → Gemini), the context may contain function_response entries that were valid for the previous model but cause errors for Gemini API with 'Name cannot be empty'. This fix skips tool calls without valid name during message conversion, preventing the INVALID_ARGUMENT error from Gemini API. Related to PR openclaw#41173 which added stripRuntimeModelState() for session reset, but model switching is a different scenario that needs separate handling.
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman (cherry picked from commit 5337439)
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman (cherry picked from commit 5337439)
Merged via squash. Prepared head SHA: d8a04a4 Co-authored-by: PonyX-lab <[email protected]> Co-authored-by: jalehman <[email protected]> Reviewed-by: @jalehman (cherry picked from commit 5337439)
Describe the problem and fix in 2–5 bullets:
sessions.resetreused stale runtimemodel/modelProviderfields from the previous session entry instead of recomputing from current defaults and explicitoverrides.
resolveSessionModelRef(...), and runtimeresetSession()also clears stale runtimemodel metadata defensively.
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
sessions.resetnow recomputes the next session model from current defaults and session overrides instead of preserving stale runtime model metadata from the previoussession.
Security Impact (required)
No)No)No)No)No)Yes, explain risk + mitigation:Repro + Verification
Environment
pnpmqwencode/qwen3.5-plus-2026-02-15stale runtime state andopenai/gpt-test-aconfigured default in testsSteps
modelProvider/model.sessions.resetfor that session.Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
sessions.resetand runtimeresetSession()retry behavior.pnpm build && pnpm check && pnpm testrepo-wide suite.Review Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes)No)No)Failure Recovery (if this breaks)
f07e5a0.src/gateway/server-methods/sessions.ts,src/auto-reply/reply/agent-runner.ts.precedence and targeted tests).
Risks and Mitigations
model/modelProvider/systemPromptReportare cleared; explicitmodelOverride/providerOverrideremain intact, and targeted testscover reset recomputation behavior.
AI-assisted: yes.
Testing: targeted tests only.