Repository navigation
fix(agents): clear legacy auto fallback pins - #87484
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 29, 2026, 1:11 AM ET / 05:11 UTC. Summary PR surface: Source +66, Tests +127. Total +193 across 9 files. Reproducibility: unclear. The review failed before ClawSweeper could establish a reproduction path. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Risk before merge
Maintainer options:
Next step before merge
Review detailsBest possible solution: Retry the Codex review after fixing the execution failure. Do we have a high-confidence way to reproduce the issue? Unclear. The review failed before ClawSweeper could establish a reproduction path. Is this the best way to solve the issue? Unclear. Retry the review first so ClawSweeper can evaluate the actual issue and fix direction. AGENTS.md: unclear because the file could not be read completely. Codex review notes: model gpt-5.5, reasoning high; reviewed against 98611e62728e. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +66, Tests +127. Total +193 across 9 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
This comment was marked as spam.
This comment was marked as spam.
|
Reviewing against PR head [Medium] Per-consumer gating is fragile. [Medium] Adjacent consumers not updated. [Medium] Symmetry gap in [Medium] The Smaller items:
|
|
Thanks for the reviews. Addressed in ClawSweeper P1 — failing
@amknight review feedback
Verified, deferred as follow-ups (not expanded here to keep this fix narrow given the cross-PR conflict surface flagged above):
Verification (normal source checkout):
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
… feedback Add hasLegacyAutoFallbackWithoutOrigin to the live-model-switch agent-scope mock so the agents-core lane runs, simplify the redundant hasSessionModelOverride guard, use a single source of truth for the legacy-pin staleness check with a comment on the load-bearing modelKey guard, and add preservation/edge-case/guard regression coverage. Rename the misleading primary-probe agent test.
6ccc23e to
f3b2477
Compare
|
Maintainer update: rebased this onto current Proof:
|
* fix(agents): clear legacy auto fallback pins * fix(agents): repair legacy auto-fallback test mock and tighten review feedback Add hasLegacyAutoFallbackWithoutOrigin to the live-model-switch agent-scope mock so the agents-core lane runs, simplify the redundant hasSessionModelOverride guard, use a single source of truth for the legacy-pin staleness check with a comment on the load-bearing modelKey guard, and add preservation/edge-case/guard regression coverage. Rename the misleading primary-probe agent test. * style(agents): format rebased fallback fix --------- Co-authored-by: Peter Steinberger <[email protected]>
* fix(agents): clear legacy auto fallback pins * fix(agents): repair legacy auto-fallback test mock and tighten review feedback Add hasLegacyAutoFallbackWithoutOrigin to the live-model-switch agent-scope mock so the agents-core lane runs, simplify the redundant hasSessionModelOverride guard, use a single source of truth for the legacy-pin staleness check with a comment on the load-bearing modelKey guard, and add preservation/edge-case/guard regression coverage. Rename the misleading primary-probe agent test. * style(agents): format rebased fallback fix --------- Co-authored-by: Peter Steinberger <[email protected]>
Summary
This PR fixes sessions that were left pinned to an auto-selected fallback model when the persisted session entry does not contain fallback-origin metadata.
modelOverrideSource: "auto"session entries withoutmodelOverrideFallbackOriginProvider/modelOverrideFallbackOriginModelcould still be treated as effective session overrides, so later normal turns reused the stale fallback instead of returning to the configured primary.openclaw agentrun metadata from treating it as an effective user/session override.Linked context
Closes #87467
Related #87467
Was this requested by a maintainer or owner? No direct owner request; this is a focused bug fix for the linked issue.
Real behavior proof (required for external PRs)
modelOverrideSource: "auto"fallback but no fallback-origin metadata no longer stays pinned to the stale fallback model on later normal turns. The next turn clears the stale auto pin and starts from the configured primary model.agent:main:dashboard:fallback-proof:providerOverride: "google"modelOverride: "gemini-2.0-flash"modelOverrideSource: "auto"modelOverrideFallbackOriginProvidermodelOverrideFallbackOriginModelgoogle/gemini-2.5-flashpnpm buildpnpm openclaw gateway restartpnpm openclaw gateway status --deeppnpm openclaw agent --session-key agent:main:dashboard:fallback-proof --message "Live proof after patch. Reply with exactly: proof-after" --json --timeout 120{ "time": "2026-05-27T22:33:18.649-04:00", "message": "model fallback decision", "event": "model_fallback_decision", "runId": "95d987b0-f6f0-4205-9fba-08d10cfc7687", "decision": "candidate_failed", "requestedProvider": "google", "requestedModel": "gemini-2.5-flash", "candidateProvider": "google", "candidateModel": "gemini-2.5-flash", "attempt": 1, "total": 1, "reason": "model_not_found", "errorPreview": "Unknown model: google/gemini-2.5-flash", "fallbackStepType": "fallback_step", "fallbackStepFromModel": "google/gemini-2.5-flash", "fallbackStepFromFailureReason": "model_not_found", "fallbackStepFinalOutcome": "chain_exhausted", "isPrimary": true, "requestedModelMatched": true, "fallbackConfigured": false }Before evidence from the same affected state before the final fix:
{ "time": "2026-05-27T22:24:50.280-04:00", "message": "model fallback decision", "event": "model_fallback_decision", "runId": "88613a50-285f-4236-a4ab-6b16da4ab1f4", "decision": "candidate_failed", "requestedProvider": "google", "requestedModel": "gemini-2.0-flash", "candidateProvider": "google", "candidateModel": "gemini-2.0-flash", "attempt": 1, "total": 1, "reason": "model_not_found", "errorPreview": "Unknown model: google/gemini-2.0-flash", "fallbackStepType": "fallback_step", "fallbackStepFromModel": "google/gemini-2.0-flash", "fallbackStepFromFailureReason": "model_not_found", "fallbackStepFinalOutcome": "chain_exhausted", "isPrimary": true, "requestedModelMatched": true, "fallbackConfigured": false }google/gemini-2.0-flash; it requested the configured primarygoogle/gemini-2.5-flash.Tests and validation
Which commands did you run?
pnpm exec oxfmt --write --threads=1 src/agents/agent-command.ts src/agents/agent-scope.ts src/agents/agent-scope.test.ts src/commands/agent.test.ts src/auto-reply/reply/get-reply.ts src/auto-reply/reply/get-reply-run.ts src/auto-reply/reply/model-selection.ts src/auto-reply/reply/model-selection.test.tsgit diff --checkpnpm test src/commands/agent.test.ts -t "uses default fallback list for auto session model overrides|clears legacy auto session model overrides without origin metadata"pnpm test src/auto-reply/reply/model-selection.test.ts -t "clears legacy auto-failover overrides without origin metadata on normal turns|can suppress a stored auto-failover override for a primary recovery probe|keeps pre-loaded fallback provider/model for an auto-failover override|keeps explicit user openai-codex route overrides"pnpm test src/agents/agent-scope.test.ts -t "identifies legacy auto fallback overrides without origin metadata|resolves throttled primary probes for auto fallback selections|skips primary probes for strict or stale fallback selections|recognizes recovered auto fallback provenance without a source marker"pnpm check:changedpnpm buildWhat regression coverage was added or updated?
openclaw agentcommand coverage for missing-origin auto fallback overrides, including the selected primary model and cleared persisted override fields.What failed before this fix, if known?
google/gemini-2.0-flash) instead of the configured primary (google/gemini-2.5-flash).If no test was added, why not?
Risk checklist
Did user-visible behavior change? (
Yes/No)Yes. Legacy auto fallback pins without origin metadata now reset to the configured primary on the next normal turn.
Did config, environment, or migration behavior change? (
Yes/No)No config/default/environment surface changed. This is runtime session-state cleanup during existing model selection paths.
Did security, auth, secrets, network, or tool execution behavior change? (
Yes/No)No. Security/runtime controls are unchanged: provider auth, secret handling, network access, tool execution policy, and prompt/tool permissions are not modified. The fix relies on runtime-enforced session metadata checks, not prompt text.
What is the highest-risk area?
Model selection for sessions that currently have persisted auto fallback overrides.
How is that risk mitigated?
The reset only applies to
modelOverrideSource: "auto"entries missing fallback-origin metadata. Entries with valid auto fallback provenance keep primary-probe behavior, andmodelOverrideSource: "user"overrides remain effective.Current review state
What is the next action?
Waiting on CI and maintainer review.
What is still waiting on author, maintainer, CI, or external proof?
CI has not run yet. No additional author action is known.
Which bot or reviewer comments were addressed?
No bot or reviewer comments yet.
AI-assisted: yes.
Made with Cursor