Repository navigation
fix(cron): keep stored user session models strict - #177494
Conversation
Isolated cron runs that used a session's stored model selection still resolved the configured fallback chain, because the run's fallback policy only knew about payload, subagent, and agent/default selections. A model pinned with /model, the picker, or sessions.patch (and legacy pins without a source) could fail and then be answered by a configured fallback or the configured primary. Carry the stored session provenance from run preparation into the shared cron fallback policy, which preflight and execution both use, and let the shared session policy keep user selections exact. Explicit payload fallbacks, payload models, and automatic session selections keep their existing chains.
Keep the stored user pin in the integration controls so they differ from the strict cases only by the job's own fallbacks or model, assert the provider error on the strict runs, exercise the payload-model guard at the policy level, and note that a user pin keeps local-provider preflight strict.
The explicit-fallbacks control used the configured fallback model, so a regression that let configured fallbacks replace the job's own list would still pass. Use a distinct job fallback and assert each control's trace.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesScheduled agent turns preserve stored user model pins while retaining explicit job model and fallback precedence. Example: An automation session pins pinned/model-x, which returns HTTP 404 model_not_found, with fallback/model-b configured.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a documented model-selection bug still present on current main. The prior fixture finding is resolved, and no new actionable defects were found; exact-head CI remains pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCron resolves scheduled work into isolated execution or ordinary session admission; session selection facts and job overrides determine the provider candidate chain and final run result. flowchart TD
A[Scheduled job] --> B[Session model selection]
B --> C[Isolated preparation]
B --> D[Session admission and queue]
C --> E[Shared fallback policy]
D --> E
E --> F[Provider execution]
F --> G[Automation result]
Technical reviewBest possible solution: Land this provenance handoff through the existing fallback and admission owners once required CI passes. Do we have a high-confidence way to reproduce the issue? Current-main source confirms the missing provenance handoff, consistent with the supplied baseline Gateway traces; this read-only review executed no target code or tests. Is this the best way to solve the issue? The patch restores the documented exact-selection contract using existing owners, preserves explicit job overrides, and captures queued derived policy at the existing admission fence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 28f539f636ba. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +42, Tests +790, Docs +2. Total +834 across 14 files. Added test files: 2. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (7 earlier review cycles)
Reviewed October 23, 2026, 12:32 AM ET / 04:32 UTC (Revision 8). |
Realistic model ids made the deliberately failing stub read like a real provider credential failure. Name the stubs by role (pinned, primary, fallback, jobfallback) and record requests by provider route.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
fix(cron): keep an automation on the user's pinned session model When a user explicitly pinned a session's model and that model failed, an automation running in that session silently answered with the configured fallback model instead, unlike a normal chat turn. Automations now honor the explicit pin the same way chat does: they use only the pinned model and report its failure. Jobs that set their own fallback list still use it. Evidence: built Gateway and CLI with local provider fixtures. On main both isolated and named-session automations answered from the fallback after the pinned model failed (twice each); with this change they contact only the pinned model and fail visibly (twice each). A job with an explicit fallback list still succeeds through it. Captures: openclaw#177494 (comment). Thanks @nxmxbbd. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A scheduled automation can answer using a configured fallback after the user explicitly pins its session model and that model fails. Normal session selections are exact, but automation fallback preparation loses the stored selection provenance.
User Impact
Automations targeting either isolated or ordinary named sessions honor an explicit user model pin. A failed pinned model produces a failed run instead of silently answering with a different model. Explicit job fallback lists and job model overrides retain their existing precedence; automatic selections retain configured fallback behavior.
Why This Change Was Made
Carry the existing session-selection provenance through scheduled run preparation into the existing fallback resolver. Refresh that derived policy when queued work is retargeted without replacing its admitted authority. No persisted schema, config option, plugin SDK surface, or new fallback policy is introduced.
Evidence
Captured provider request order, shipped CLI output, and red/green regression.
Built Gateway/CLI artifacts on Node 24.22.1 in isolated Linux Docker with owned local provider fixtures. All state was created through shipped config CLI, automations add/run/edit, and sessions.create/patch RPCs.
Simplification: reuse the existing fallback resolver and selection facts; remove the duplicated prompt-executor parameter projection. Remaining production growth carries provenance across the two execution paths and refreshes queued derived policy without changing authority. The larger integration fixtures exercise actual runner/provider outcomes and distinct queued-admission behavior rather than adding production test seams.
Merge Danger
Two-way door: a revert restores the old fallback behavior; no stored format is changed. Blast radius is scheduled agent model fallback, including queued turns. Explicit job overrides and normal automatic fallback remain supported.