anthropics / anthropics/claude-code

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

未关闭
#93,024 0 条评论 0 个 reaction 已指派 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 摘要。