anthropics / anthropics/claude-code

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

Ouverte
#93,024 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
area:routines bug
Langage dominant
Python
Étoiles
145k
Forks
23.1k
Métriques de merge des PR
Métriques de PR en attente

Description

## 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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Domaine
backend, tooling
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.