#92776: fix(agents): prevent indefinite session model pinning from polluted fallback origin#93275
#92776: fix(agents): prevent indefinite session model pinning from polluted fallback origin#93275wings1029 wants to merge 1 commit into
Conversation
…allback origin resolveAutoFallbackPrimaryProbe required the persisted modelOverrideFallbackOrigin to match the current configured primary before firing the snap-back probe. When the origin fields were polluted with the failing model instead of the configured primary (openclaw#92776), the guard returned undefined and the probe never fired — leaving the session permanently stuck on a degraded fallback model. Fix: use the current configured primary as the probe origin instead of requiring a matching persisted origin. This ensures the snap-back probe always fires, attempting to clear the auto-fallback override once the primary becomes available. Also relax entryMatchesAutoFallbackPrimaryProbe to match on the fallback override alone (provider/model) without requiring the persisted origin to match — polluted session entries must still be updatable after the probe fires. Test: updated 'skips primary probes for strict or stale fallback selections' — when origin differs from primary, the probe now returns a valid probe targeting the current primary instead of undefined. Fixes openclaw#92776. Co-Authored-By: Claude <[email protected]>
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close as superseded: #92819 is already the open canonical fix for the same linked session-pinning bug, has maintainer-modifiable branch state and proof marked sufficient, and covers the broader prepared-selection/session cleanup boundary that this narrower PR does not. Canonical path: Use #92819 as the canonical fix path for the linked issue, because it carries the fuller stale-origin cleanup and prior review/proof context. So I’m closing this here and keeping the remaining discussion on #92819. Review detailsBest possible solution: Use #92819 as the canonical fix path for the linked issue, because it carries the fuller stale-origin cleanup and prior review/proof context. Do we have a high-confidence way to reproduce the issue? Yes. Current main returns no primary probe when an auto fallback entry's persisted origin differs from the configured primary, matching the linked polluted-session report. Is this the best way to solve the issue? No. This is a plausible narrow fix, but #92819 is the better current landing path because it owns the same bug with broader guarded cleanup across reply and direct agent-command selection. Security review: Security review cleared: The diff only changes TypeScript agent fallback/session logic and tests; no dependency, workflow, permission, secret, or artifact-download surface is touched. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 8682d0701b27. |
|
Thanks @zhiqiang26 for the focused fix and proof on this. I am closing #93275 as superseded by the open canonical path in #92819 for #92776. Both PRs target the same stale auto-fallback origin/session-pinning failure. #92819 is the broader prepared-selection fix path: it carries the shared stale-origin classifier, reply-side deferred cleanup, direct agent-command handling, maintainer-modifiable branch state, and the current review/proof context. I am keeping the canonical thread open there so validation and follow-up stay in one place. Credit for this narrower source PR stays visible here, and Clownfish will preserve attribution if details from this work are carried forward. If this PR covers a different reproduction path or #92819 misses something after it lands, please reply and we can reopen or split it back out. |
Summary
modelOverrideFallbackOriginfields. When the origin recorded thefailing model instead of the configured primary, the snap-back probe
(
resolveAutoFallbackPrimaryProbe) returned undefined on every turn,leaving the session permanently stuck on a degraded fallback model.
requiring a matching persisted origin. Also relax
entryMatchesAutoFallbackPrimaryProbeto match on the fallbackoverride alone, so polluted session entries can be updated.
Fixes #92776
Linked context
resolveAutoFallbackPrimaryProbestarved it of valid input whenorigin fields were polluted.
the latest release still preserve auto-created fallback model pins
across later turns." This PR fixes the upstream mechanism.
Real behavior proof
Behavior addressed: Session model pinning no longer persists
indefinitely when
modelOverrideFallbackOriginis polluted. Thesnap-back probe now uses the configured primary as origin, ensuring it
fires on every turn until the primary becomes available.
Real setup tested: Linux 4.19.112, Node.js v22.21.1, OpenClaw main,
vitest.
Exact steps or command run after fix:
After-fix evidence:
All 309 tests pass.
Observed result after the fix: When origin doesn't match the current
primary (polluted or stale), the probe returns a valid probe targeting
the current primary instead of undefined. The probe fires, the primary
is tried, and if available, the override is cleared (snap-back).
What was not tested: End-to-end session with polluted origin on a
live OpenClaw instance with real provider chain.
Proof limitations or environment constraints: Unit test environment.
The behavioral change is verified through existing and updated test
coverage for
resolveAutoFallbackPrimaryProbe.Tests and validation
Updated test: "skips primary probes for strict or stale fallback
selections" — when origin differs from primary, the probe now returns
a valid probe (
{provider: primary, model: primary, fallbackProvider: override, fallbackModel: override}) instead of undefined.Risk checklist
Did user-visible behavior change? (
Yes)will snap back to the configured primary when it becomes available.
Did config, environment, or migration behavior change? (
No)Did security, auth, secrets, network, or tool execution behavior change? (
No)What is the highest-risk area?
probed more aggressively. The existing minIntervalMs throttle (default
5 min) prevents excessive probing.
How is that risk mitigated?
Current review state
What is the next action?
What is still waiting on author, maintainer, CI, or external proof?
and multi-turn scenario). Unit tests cover the behavioral change.
Which bot or reviewer comments were addressed?
rather than requiring persisted origin to match exactly.
polluted sessions will snap back on their next turn without migration.