anthropics / anthropics/claude-code

Manually re-triggering a scheduled task replays a stale/cached result instead of a fresh run

オープン
#93,024 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
area:routines bug
主要言語
Python
スター
145k
フォーク
23.1k
PR マージ指標
PR 指標を取得中

説明

## Description

Manually re-triggering a scheduled task (`.claude/scheduled-tasks//SKILL.md`) from the Routines UI repeatedly produces near-identical output to the previous run — including a stale date label and specific numbers/phrasing — rather than a fresh agent execution. Editing the task's own instructions to explicitly guard against this had no effect on the next manual run.

## Setup

- A cron-scheduled task (`cronExpression: "0 9 * * 1-5"`, with `jitterSeconds: 558`) posts a small analytics report to a Google Chat webhook once per weekday morning.
- The task's SKILL.md instructs the agent to: call two specific data-fetching MCP tools before composing the report, derive "today" from the session's own live date context, and only then write a payload file and run one approved `curl` command.

## What happened

On 2026-09-09 (a Wednesday), the automatic 09:09 Madrid trigger produced a report labeled with the *wrong day* — "Tuesday (yesterday vs Sunday)", a full day behind the actual current date — and posted it to the destination webhook.

To investigate, I manually re-triggered the same task from the Routines UI a couple of times to see if a fresh run would pick up the correct (Wednesday) date. Each manual re-trigger:

- Skipped straight from reading the task prompt to calling `Bash` (the final `curl` POST) in essentially one step — no visible calls to the two required data-fetching tools beforehand, contrary to the instructions.
- Posted a report with the same wrong day label and with numbers/phrasing nearly identical to the original run (e.g. the same "~11% → ~6%" and "-5.1pp WoW" language recurring verbatim across separately-triggered sessions).

After noticing this, we added an explicit guard to the top of the SKILL.md requiring the agent to (a) re-derive today's date from the live session context every run, never from a missed/prior trigger, and (b) verify it had actually called the required data-fetching tools *this run* before posting, and to skip posting if a duplicate had already gone out. I then manually re-triggered the task again.

That run **still** exhibited the same pattern: the injected prompt confirmed the new guard text was present, but the transcript again showed only `(called Bash)` with no data-fetching tool calls, and the posted summary text was virtually identical (same specific percentages and phrasing) to the earlier posts.

This suggests something below the prompt/instruction layer for this task — each manual re-trigger appears to replay/return a cached result rather than executing a genuinely fresh agent turn, since a fresh completion should not reproduce identical wording nor ignore newly-added top-of-prompt instructions.

## Impact

- Repeated manual re-triggers of a scheduled task do not produce independent fresh runs, making it impossible to recover from a bad automatic run by simply re-running it.
- Reports are silently wrong (mislabeled date, stale/reused figures) with no indication that fresh data wasn't actually fetched.
- Editing the task's own instructions had no effect, since the bug appears to be in the triggering/execution layer, not something addressable from the skill content.

## What we'd expect

- Manually re-triggering a scheduled task from the Routines UI should start an independent, fresh agent execution that actually executes the tool calls described in its own instructions, not replay a prior run's result.

Happy to provide more detail (session transcripts, exact task config) if useful — let me know what's most helpful to attach.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reproducing with a cron-scheduled task under .claude/scheduled-tasks//SKILL.md and manual re-triggering it from the Routines UI. Trace the scheduled-task trigger/execution path and any caching or replay behavior around prior runs. Done means a manual re-trigger starts a fresh agent execution, calls the required tools for that run, and no longer reuses the stale date or report text.

索引モデルが issue の本文から書いたものです。

評価

領域
backend, tooling
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。