Skip to content

fix: clear stale model-selection overrides in cron session resolution - #61291

Closed
kiranvk-2011 wants to merge 3 commits into
openclaw:mainfrom
kiranvk-2011:fix/cron-session-stale-override
Closed

kiranvk-2011 wants to merge 3 commits into
openclaw:mainfrom
kiranvk-2011:fix/cron-session-stale-override

Conversation

@kiranvk-2011

@kiranvk-2011 kiranvk-2011 commented Apr 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Cron jobs that share a sessionTarget with an interactive chat session inherit stale providerOverride / modelOverride / fallbackNotice* values from that session. This causes cron jobs to retry against rate-limited providers (4× retries, ~30-50s delay) instead of using their configured payload.model, even when a healthy fallback provider is available.

This PR adds conditional override clearing in resolveCronSession(): when the cron job specifies a payloadModel and it is an isolated session (forceNew), the 5 model-selection override fields are stripped from the inherited session entry before the session is used.

The Problem

resolveCronSession() in src/cron/isolated-agent/session.ts uses { ...entry } to construct the cron session from the stored session entry. This copies all fields, including:

  • providerOverride — forces a specific provider before payload.model is evaluated
  • modelOverride — forces a specific model
  • fallbackNoticeActiveModel / fallbackNoticeSelectedModel / fallbackNoticeReason — stale rate-limit notices

When an interactive Telegram/WhatsApp session shares the same sessionTarget as a cron job, any provider override set by that session (e.g., from a /new sonnet46 command, or from the gateway re-writing providerOverride after each successful run) contaminates the cron session.

The gateway's provider resolution evaluates providerOverride before payload.model, so the cron job's configured model is bypassed entirely. The job retries 4 times against the overridden (often rate-limited) provider before falling back — adding 30-50 seconds of unnecessary latency per cron run.

The Fix

resolveCronSession() now accepts optional payloadModel and forceNew parameters. When both conditions are met:

  1. params.forceNew is true (isolated cron session — always creates a fresh entry)
  2. params.payloadModel is truthy (cron job specifies a model in its payload)

...the function clears 5 override fields from the session entry:

providerOverride: undefined,
modelOverride: undefined,
fallbackNoticeActiveModel: undefined,
fallbackNoticeSelectedModel: undefined,
fallbackNoticeReason: undefined,

Why forceNew instead of isNewSession

The guard is scoped to forceNew (isolated sessions) rather than isNewSession so that shared session targets — which persist back to the interactive session store via persistSessionEntry — never lose user-set overrides. forceNew is only true when sessionTarget === "isolated" (set at run.ts:288), making this safe for all session target types.

Why authProfileOverride is NOT cleared

authProfileOverride and its companions (authProfileOverrideSource, authProfileOverrideCompactionCount) are intentionally preserved. resolveSessionAuthProfileOverride() uses the previous authProfileOverride value as input for pickNextAvailable(current) to rotate across auth profiles. Clearing it would force pickFirstAvailable() on every new cron session, defeating round-robin failover.

Files Changed

File Change
src/cron/isolated-agent/session.ts Added payloadModel?: string and forceNew?: boolean params; conditional override clearing block
src/cron/isolated-agent/run.ts Pass payloadModel from job payload to resolveCronSession()
src/cron/isolated-agent/session.test.ts 6 new test cases covering override clearing logic

Test Coverage

6 new test cases in session.test.ts:

  1. Clears overrides when forceNew and payloadModel are both set — verifies all 5 model-selection fields are cleared
  2. Preserves overrides on shared sessions even with payloadModel — forceNew absent, overrides survive
  3. Preserves overrides when payloadModel is not set — backward compat
  4. Preserves overrides with empty payloadModel string — falsy edge case
  5. Preserves non-override fields — sendPolicy, compaction state untouched
  6. Clears overrides and delivery routing when forceNew and payloadModel set — combined with delivery field clearing

All 16 tests pass (10 existing + 6 new). Lint (pnpm lint) and typecheck (pnpm tsgo) clean.

Reproduction (Real-World)

Observed on a production OpenClaw instance running v2026.3.28:

  • Cron job: knowledge-sync (hourly, payload.model: "bailian/qwen3.5-plus")
  • Shared session: agent:opus46:telegram:direct:7295404152 with providerOverride: "github-copilot"
  • Result: Every cron run attempted 4× retries against rate-limited github-copilot before falling back to bailian/qwen3.5-plus, adding ~40s latency per run
  • After clearing providerOverride manually: Cron runs completed in ~27s using the payload model directly

Fixes #57947
Fixes #47592


AI Disclosure: This PR was developed with AI assistance (Claude, via OpenCode). The contributor reviewed, tested, and validated all changes. The fix approach was designed based on manual source code analysis and production debugging of the issue on a live OpenClaw deployment.

@greptile-apps

greptile-apps Bot commented Apr 5, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Conditionally clears six stale model-selection override fields in resolveCronSession() when a cron job starts a new session and specifies its own payloadModel. The gate isNewSession && params.payloadModel is correct: fresh session reuse (the continuation case) is deliberately left untouched, and cron jobs without a configured model preserve backward-compatible inheritance behavior.

The tests in session.test.ts are thorough, covering the clearing path, the no-payloadModel preservation path, the empty-string falsy edge case, the fresh-session invariant, and the combined forceNew + payloadModel case. One P2 inconsistency: authProfileOverrideSource and authProfileOverrideCompactionCount — companion fields always written and cleared together with authProfileOverride by clearSessionAuthProfileOverride — are omitted from the new spread. The omission is safe today because downstream resolver logic short-circuits when authProfileOverride is undefined, but including them would keep the session entry consistent with the rest of the codebase's invariant for these fields.

Confidence Score: 5/5

Safe to merge; the fix is correct and well-tested, with only a minor P2 companion-field omission

All findings are P2 or lower. The core logic is correct, the new payloadModel guard matches the stated intent exactly, and the five new test cases cover the critical branches including backward-compatibility preservation. The single P2 note is a stylistic consistency issue that does not affect runtime correctness.

No files require special attention; the P2 omission in session.ts is flagged inline but does not affect correctness.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/cron/isolated-agent/session.ts
Line: 93-101

Comment:
**Companion fields `authProfileOverrideSource` / `authProfileOverrideCompactionCount` not cleared alongside `authProfileOverride`**

These two metadata fields are always written and cleared together with `authProfileOverride` (see `clearSessionAuthProfileOverride` in `src/agents/auth-profiles/session-override.ts`, lines 36–38). Leaving them behind from a prior session creates an inconsistent entry: `authProfileOverride` is `undefined` but the source/count metadata still describes a profile that no longer applies. In practice this is safe today because `resolveSessionAuthProfileOverride` checks `authProfileOverride` first and short-circuits all consumer paths when `current` is falsy — but it breaks the invariant maintained by `clearSessionAuthProfileOverride` and leaves stale data readable before that resolver runs.

```suggestion
    ...(isNewSession &&
      params.payloadModel && {
        providerOverride: undefined,
        modelOverride: undefined,
        authProfileOverride: undefined,
        authProfileOverrideSource: undefined,
        authProfileOverrideCompactionCount: undefined,
        fallbackNoticeActiveModel: undefined,
        fallbackNoticeSelectedModel: undefined,
        fallbackNoticeReason: undefined,
      }),
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: clear stale model-selection overrid..." | Re-trigger Greptile

Comment thread src/cron/isolated-agent/session.ts Outdated
Comment on lines +93 to +101
...(isNewSession &&
params.payloadModel && {
providerOverride: undefined,
modelOverride: undefined,
authProfileOverride: undefined,
fallbackNoticeActiveModel: undefined,
fallbackNoticeSelectedModel: undefined,
fallbackNoticeReason: undefined,
}),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Companion fields authProfileOverrideSource / authProfileOverrideCompactionCount not cleared alongside authProfileOverride

These two metadata fields are always written and cleared together with authProfileOverride (see clearSessionAuthProfileOverride in src/agents/auth-profiles/session-override.ts, lines 36–38). Leaving them behind from a prior session creates an inconsistent entry: authProfileOverride is undefined but the source/count metadata still describes a profile that no longer applies. In practice this is safe today because resolveSessionAuthProfileOverride checks authProfileOverride first and short-circuits all consumer paths when current is falsy — but it breaks the invariant maintained by clearSessionAuthProfileOverride and leaves stale data readable before that resolver runs.

Suggested change
...(isNewSession &&
params.payloadModel && {
providerOverride: undefined,
modelOverride: undefined,
authProfileOverride: undefined,
fallbackNoticeActiveModel: undefined,
fallbackNoticeSelectedModel: undefined,
fallbackNoticeReason: undefined,
}),
...(isNewSession &&
params.payloadModel && {
providerOverride: undefined,
modelOverride: undefined,
authProfileOverride: undefined,
authProfileOverrideSource: undefined,
authProfileOverrideCompactionCount: undefined,
fallbackNoticeActiveModel: undefined,
fallbackNoticeSelectedModel: undefined,
fallbackNoticeReason: undefined,
}),
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/cron/isolated-agent/session.ts
Line: 93-101

Comment:
**Companion fields `authProfileOverrideSource` / `authProfileOverrideCompactionCount` not cleared alongside `authProfileOverride`**

These two metadata fields are always written and cleared together with `authProfileOverride` (see `clearSessionAuthProfileOverride` in `src/agents/auth-profiles/session-override.ts`, lines 36–38). Leaving them behind from a prior session creates an inconsistent entry: `authProfileOverride` is `undefined` but the source/count metadata still describes a profile that no longer applies. In practice this is safe today because `resolveSessionAuthProfileOverride` checks `authProfileOverride` first and short-circuits all consumer paths when `current` is falsy — but it breaks the invariant maintained by `clearSessionAuthProfileOverride` and leaves stale data readable before that resolver runs.

```suggestion
    ...(isNewSession &&
      params.payloadModel && {
        providerOverride: undefined,
        modelOverride: undefined,
        authProfileOverride: undefined,
        authProfileOverrideSource: undefined,
        authProfileOverrideCompactionCount: undefined,
        fallbackNoticeActiveModel: undefined,
        fallbackNoticeSelectedModel: undefined,
        fallbackNoticeReason: undefined,
      }),
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — you're right that clearSessionAuthProfileOverride() in session-override.ts (lines 36–38) always clears all three fields together as an invariant. Leaving the companion metadata behind would create an inconsistent session entry even if it's currently safe at runtime.

Fixed in d3cdfdcd59 — the spread now clears all 8 fields including authProfileOverrideSource and authProfileOverrideCompactionCount. Tests updated to include these companion fields in both the "clears overrides" and "preserves overrides" assertions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow-up: after further analysis prompted by a Codex review comment, the authProfileOverride family has been removed from the cleared set in a174da0888.

The reason: resolveSessionAuthProfileOverride() uses authProfileOverride as the current input for pickNextAvailable(current) on new sessions. Clearing it forces every new cron session to pickFirstAvailable(), breaking round-robin rotation across multiple auth profiles. Since auth-profile rotation state is semantically distinct from model-selection contamination, it should be preserved.

The fix now clears only 5 fields (the model-selection + fallback-notice group). Tests explicitly assert that all 3 auth-profile fields are preserved.

@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch from 180cc8e to d3cdfdc Compare April 5, 2026 10:44
@kiranvk-2011

Copy link
Copy Markdown
Contributor Author

Thanks for the thorough review. The P2 companion field observation is correct — addressed in d3cdfdcd59.

The spread now clears all 8 fields: the original 6 plus authProfileOverrideSource and authProfileOverrideCompactionCount, maintaining the invariant established by clearSessionAuthProfileOverride(). Tests updated with full companion field coverage in both clearing and preservation assertions.

Branch has been rebased onto latest main and force-pushed to trigger fresh CI.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3cdfdcd59

ℹ️ 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".

Comment thread src/cron/isolated-agent/session.ts Outdated
Comment on lines +97 to +99
authProfileOverride: undefined,
authProfileOverrideSource: undefined,
authProfileOverrideCompactionCount: undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep auth-profile rotation state when payload model is set

Clearing authProfileOverride, authProfileOverrideSource, and authProfileOverrideCompactionCount here wipes the previous profile state before prepareCronRunContext calls resolveSessionAuthProfileOverride(...), so new sessions with payload.model always look like they have no prior profile and fall back to pickFirstAvailable() instead of rotating from the previous profile. In practice this regresses multi-profile failover/round-robin for isolated cron jobs (which are always new sessions), making repeated runs stick to the first profile and more likely to re-hit the same rate-limited credentials.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid catch — agreed. The authProfileOverride family serves a different purpose (profile rotation state for resolveSessionAuthProfileOverride()) than the model-selection fields (providerOverride/modelOverride). Clearing them would force pickFirstAvailable() on every new cron session instead of pickNextAvailable(current), effectively defeating round-robin rotation.

Fixed in a174da0888: removed all three auth-profile fields (authProfileOverride, authProfileOverrideSource, authProfileOverrideCompactionCount) from the cleared set. The fix now only clears 5 model-selection fields:

  • providerOverride
  • modelOverride
  • fallbackNoticeActiveModel
  • fallbackNoticeSelectedModel
  • fallbackNoticeReason

Tests updated to assert that auth-profile fields are explicitly preserved while stale model-selection overrides are cleared.

@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch from d3cdfdc to a174da0 Compare April 5, 2026 11:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a174da0888

ℹ️ 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".

Comment thread src/cron/isolated-agent/session.ts Outdated
Comment on lines +99 to +101
...(isNewSession &&
params.payloadModel && {
providerOverride: undefined,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict override clearing to isolated cron sessions

The new isNewSession && params.payloadModel gate clears providerOverride/modelOverride for all new cron sessions, not just isolated ones. Agent-turn cron jobs can also run with sessionTarget: "current" or session:<id> (src/cron/service/jobs.ts:135-148), and run.ts only forces new sessions for "isolated" (src/cron/isolated-agent/run.ts:288). That means a stale shared session now loses user-set model overrides when a payload model is present, which mutates interactive session state and regresses override persistence across inactivity rollovers. This clearing should be scoped to isolated/cron-owned sessions (or equivalent) rather than every isNewSession case.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in ba37ee1c47 — the condition has been narrowed from isNewSession && params.payloadModel to params.forceNew && params.payloadModel.

forceNew is only true when sessionTarget === "isolated" (set at run.ts:288), so shared session targets (session:<id>) are never modified. This preserves user-set overrides across inactivity rollovers while still clearing stale state for cron-owned sessions that create a fresh entry every run.

New test added: "preserves model-selection overrides on shared sessions even with payloadModel" — asserts all 5 fields survive when forceNew is absent.

Branch has been squashed to a single commit and rebased onto latest main.

@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch 4 times, most recently from d3d2b49 to 4be1dc8 Compare April 5, 2026 15:45

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4be1dc8e8c

ℹ️ 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".

Comment thread src/cron/isolated-agent/session.ts Outdated
Comment on lines +103 to +104
...(params.forceNew &&
params.payloadModel && {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope override clearing to cron-owned isolated sessions

Even with the new forceNew guard, this still clears model-selection state for non-cron shared sessions: the hook runner always sets sessionTarget: "isolated" but can reuse a caller/default sessionKey (src/gateway/server/hooks.ts:60-66,79-87), and run.ts persists back to that same key whenever it is not cron:* (src/cron/isolated-agent/run.ts:292-299). In that path, payload.model now causes providerOverride/modelOverride/fallback notice fields to be deleted from an interactive session entry, so a hook call can silently wipe user-set /model state. This is fresh evidence beyond the earlier isNewSession discussion because it uses the forceNew hook path that still targets shared keys.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Valid catch — thank you.

Hook-dispatched jobs (hooks.ts:60) always set sessionTarget: "isolated" (→ forceNew: true) but pass through the caller's sessionKey, which can be a shared interactive session key (not a cron:* key). In run.ts:286-288, runSessionKey only scopes to a per-run key when baseSessionKey.startsWith("cron:") — otherwise it persists back to the original agentSessionKey. So a hook call with payload.model set would clear providerOverride/modelOverride/fallback fields from the interactive session entry, silently wiping user-set /model state.

Fixed in 6c6929c076: Added isCronSession?: boolean parameter to resolveCronSession(), gated on baseSessionKey.startsWith("cron:") in run.ts. The clearing guard is now a triple condition:

if (params.forceNew && params.payloadModel && params.isCronSession) {

This ensures only actual cron sessions (with cron:* base keys) clear stale overrides. Hook-dispatched isolated sessions with non-cron keys skip the clearing entirely, preserving interactive session state.

New test added: "preserves model-selection overrides on hook-dispatched isolated sessions (non-cron key)" — verifies forceNew: true + payloadModel set + isCronSession: false leaves all override fields untouched.

amittell pushed a commit to amittell/openclaw that referenced this pull request Apr 5, 2026
Cherry-pick of openclaw#61291 (kiranvk-2011). Resolves conflict: our branch already
has direct imports where PR used lazy-loaded helpers; core fix in session.ts
applied cleanly. Added payloadModel pass-through at resolveCronSession call
site in run.ts to complete the wire-up.
@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch from 4be1dc8 to 6c6929c Compare April 5, 2026 21:24
@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch from 6c6929c to 2d48e41 Compare April 5, 2026 22:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2d48e41da8

ℹ️ 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".

Comment thread src/cron/isolated-agent/run.ts Outdated
@@ -281,6 +281,8 @@ async function prepareCronRunContext(params: {
agentId,
nowMs: now,
forceNew: input.job.sessionTarget === "isolated",
payloadModel: input.job.payload.kind === "agentTurn" ? input.job.payload.model : undefined,
isCronSession: baseSessionKey.startsWith("cron:"),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Classify cron-owned runs without relying on sessionKey prefix

Using baseSessionKey.startsWith("cron:") to set isCronSession can still misclassify shared hook runs as cron-owned: in src/gateway/server/hooks.ts the hook dispatcher always runs with sessionTarget: "isolated" (so forceNew is true) but uses a configurable sessionKey, and src/gateway/hooks.ts allows configured/requested keys that can start with cron:. When that happens and payload.model is set, resolveCronSession() will clear providerOverride/modelOverride on what is effectively a shared session, silently wiping persisted /model state. This should be keyed off an explicit ownership signal (for example deliveryContract) rather than a string-prefix heuristic.

Useful? React with 👍 / 👎.

@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch from 2d48e41 to 705d81f Compare April 5, 2026 22:18
@kiranvk-2011

Copy link
Copy Markdown
Contributor Author

Good catch — the session-key prefix is fragile for exactly the reason you describe. Replaced with deliveryContract: hook dispatchers pass "shared" (hooks.ts:86) while cron-scheduled jobs default to "cron-owned" (run.ts:366), so this is a reliable ownership signal that can't be fooled by configurable session keys.

Changes in 705d81fec1:

  • session.ts: renamed isCronSession → isCronOwnedSession, updated comment block
  • run.ts: isCronOwnedSession: (input.deliveryContract ?? "cron-owned") !== "shared"
  • session.test.ts: updated hook-dispatch test to reference deliveryContract semantics

All 17 tests pass.

@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch 2 times, most recently from 41c3c68 to e2114a1 Compare April 5, 2026 23:52
When a cron job shares a sessionTarget with an interactive chat session,
resolveCronSession() copies the full session entry via spread, inheriting
stale providerOverride / modelOverride / fallbackNotice* fields.  These
force the cron run to retry against a rate-limited provider before the
payload model's fallback chain activates, adding 30-50 s of wasted
retries per run.

Clear the five model-selection override fields when starting an isolated
cron session (forceNew) that specifies its own payloadModel.  The guard
is scoped to forceNew rather than isNewSession so that shared session
targets — which persist back to the interactive session store — never
lose user-set overrides.

authProfileOverride and its companions are intentionally preserved:
resolveSessionAuthProfileOverride() uses the previous value for
round-robin profile rotation via pickNextAvailable().

Fixes openclaw#57947
Fixes openclaw#47592

> Generated with AI assistance (Claude claude-opus-4.6 via OpenCode).
… ownership

Replace baseSessionKey.startsWith("cron:") heuristic with an explicit
ownership signal derived from deliveryContract.  Hook dispatchers pass
deliveryContract: "shared" while cron-scheduled jobs default to
"cron-owned", making this a reliable discriminator that cannot be
fooled by configurable session keys that happen to start with "cron:".
@kiranvk-2011
kiranvk-2011 force-pushed the fix/cron-session-stale-override branch from e2114a1 to 4bdbd0e Compare April 6, 2026 05:04
@steipete

Copy link
Copy Markdown
Contributor

Closing this as implemented after Codex review.

Current main already resolves cron payload.model ahead of stored session overrides and forwards that selected provider/model into execution, so the PR’s override-clearing fix is no longer needed for the reported behavior.

What I checked:

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review notes: reviewed against 7b5307acfc34; fix evidence: release v2026.4.23, commit a9797214338b.

@steipete steipete closed this Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants