{"version":"2.1.280","anchor":"new-hostscheduledrun-session-flag","canonical_anchor":"new-claude-code-host-scheduled-run-env-var-gates-a-local-hos","heading":"New host-scheduled-run flag for scheduled tasks","tier":"use","area":"Sessions","url":"https:\/\/changelogs.core-directive.com\/v\/2.1.280\/e\/new-hostscheduledrun-session-flag","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.280","markdown":"### New host-scheduled-run flag for scheduled tasks\n\nClaude Code now tracks whether a process was started by a host for a scheduled run, and uses that to gate scheduled-trigger notifications\n\n**Unclear.** What sets hostScheduledRun to true or how it's used isn't specified.\n\n**What**\n\n- Session state gained a new `hostScheduledRun` boolean field (alongside existing `childSession`, `claudecode`, `coworkFrameArtifacts` flags), defaulting to false.\n\n- A new `CLAUDE_CODE_HOST_SCHEDULED_RUN` environment variable sets this flag; it's read into app state and passed through several env-passthrough allowlists so it survives subprocess spawns. When set to `1`, it allows a locally-declared `fireReason` (limited to 1-32 lowercase letters\/underscores) on a scheduled-trigger task delivery to be honored.\n\n- Session-start telemetry now records this flag.\n\n- Scheduled-trigger task notifications, including a sanitized `fireReason` field, are now only sent when the process is a genuine host-scheduled run \u2014 not a child session and not an interactive `claude` session.\n\n**Why** This prevents a regular interactive or child session from claiming to be a \"scheduled run\" and firing scheduled-trigger notifications it shouldn't be able to send; only a process the host explicitly started for a scheduled run can claim that status.\n\n- Area: Sessions\n- Names: `hostScheduledRun`\n- Tier: Use it now\n- Useful: 3\/5\n- Signal: 4\/5"}