Skip to content

Isolated sessions (cron jobs) reject all models except primary #11436

@jzOcb

Description

@jzOcb

Summary

Cron jobs with sessionTarget: "isolated" reject all model overrides except the primary model configured in agents.defaults.model. This prevents cost-effective scheduling using cheaper models like Haiku or Sonnet.

Environment

  • OpenClaw version: 2026.2.6-3 (commit f072249)
  • OS: Ubuntu 22.04 (Linux 6.8.0-94-generic)
  • Node: v22.22.0

Steps to Reproduce

  1. Configure multiple models in agents.defaults.models:
agents:
  defaults:
    model: anthropic/claude-opus-4-5
    models:
      - anthropic/claude-opus-4-5
      - anthropic/claude-sonnet-4
      - anthropic/claude-haiku-4
    modelAliases:
      opus: anthropic/claude-opus-4-5
      sonnet: anthropic/claude-sonnet-4
      haiku: anthropic/claude-haiku-4
  1. Create an isolated cron job with a non-primary model:
{
  "name": "test-sonnet",
  "schedule": {"kind": "at", "at": "2026-02-07T19:12:00Z"},
  "payload": {"kind": "agentTurn", "message": "Say hello", "model": "sonnet"},
  "sessionTarget": "isolated"
}
  1. Wait for job to execute

Expected Behavior

Job runs with the specified model (Sonnet), since it's in the allowedModels list.

Actual Behavior

Job fails immediately with:

error: "model not allowed: anthropic/claude-sonnet-4"

The alias is correctly resolved (sonnetanthropic/claude-sonnet-4), but the model check still rejects it.

Tested Variants

Model Specification Result
anthropic/claude-opus-4-5 (primary) ✅ Works
anthropic/claude-sonnet-4 ❌ Rejected
anthropic:jason/claude-sonnet-4 (with profile) ❌ Rejected
sonnet (alias) ❌ Rejected (resolves correctly, then rejected)
haiku (alias) ❌ Rejected

Impact

  • Forces all cron jobs to use the most expensive model (Opus)
  • Makes model override in cron payload effectively useless for isolated sessions
  • Workaround: Use system crontab + external scripts instead of OpenClaw cron

Possible Cause

Isolated sessions may be checking against a different allowlist than main sessions, or the model allowlist isn't being passed to the isolated session context.

Related

This may be related to PR #11198 (@Profile suffix fix), but that fix addressed a different issue (suffix parsing). This bug occurs even without the @ prefix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions