Repository navigation
Description
Summary
Since 2026.6.9 (still present in 2026.6.10, current latest), isolated cron runs embed a per-run UUID inside the session= field of the system prompt's Runtime: line. Because that UUID changes every run, byte-exact prefix caching is broken for everything after it — notably the ~8k-token tool catalog. Every cron LLM call then pays full uncached input. 2026.6.8 is unaffected. This re-introduces the class fixed in #43148 (related: #19989, #26750).
Affected versions
- Introduced: 2026.6.9 · Confirmed still broken: 2026.6.10 (npm
latest) · Last good: 2026.6.8
Mechanism
The Runtime: line changed from (6.8):
Runtime: agent=<agent> | session=agent:<agent>:cron:<jobid> | host=… | os=…
to (6.9 / 6.10):
Runtime: agent=<agent> | session=agent:<agent>:cron:<jobid>:run:<RUN_UUID> | host=… | os=…
<RUN_UUID> is unique per run → the cached prefix is no longer byte-stable → tool catalog etc. miss cache and are re-billed every call. Provider-agnostic.
Likely origin: #91685 ("refuse keyless implicit isolated cron delivery inherited from shared agent-main bucket", in 2026.6.9) gives each isolated cron run a distinct per-run session key, which is rendered verbatim into the cached system prompt.
Evidence
Same job, only the version changed:
| version | Runtime: has :run:<UUID> |
input_tokens / call |
|---|---|---|
| 2026.6.8 | no | ~200 (cached) |
| 2026.6.9 / 2026.6.10 | yes | ~11,500 (uncached) |
Reproduced on two independent metered providers (both jumped identically → not provider-specific). For multi-iteration cron agents (10–25 calls/run, each re-sending growing context) this compounds to ~1.5–2M tokens/run — a ~10x cost increase on metered providers.
Suggested fix
Keep the volatile per-run id out of the cached system prefix:
- Don't render the cron delivery run-id into the system prompt at all (keep it internal to delivery routing); or
- Move the
Runtime:line (or just its volatile fields) below the cache breakpoint / into a separate non-cached system message — the approach already discussed in [Bug]: Changing system prompt causes cache invalidations #43148; or - Split static (agent/host/os/model + tool catalog, above the breakpoint) from volatile fields (session/run id, timestamps, below it).
Repro
- Create an isolated cron job (
sessionTarget: isolated) on a metered provider that reportsinput_tokens. - Run on 2026.6.8 → note
input_tokens/call and that the session field is…:cron:<jobid>(no:run:). - Upgrade to 2026.6.9/2026.6.10, run again → session field is now
…:cron:<jobid>:run:<UUID>andinput_tokensjumps ~50x.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 25, 2026
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 25, 2026, 2:00 AM ET / 06:00 UTC.
Summary
Keep open: current main and v2026.6.10 still pass a per-run isolated cron session key into embedded execution and render that key in the prompt Runtime line, so the reported cache-busting mechanism remains source-reproducible.
Reproducibility: yes. at source level: current main constructs a
:run:isolated-cron session key, passes it into embedded execution, and renders it in the Runtime prompt line. I did not independently reproduce the live provider token jump.Root-cause cluster
Relationship:
canonicalCanonical: #96677
Summary: This issue is the current canonical tracker for the specific isolated-cron Runtime-line
:run:prompt-cache regression; older prompt-cache issues cover related but distinct mechanisms.Members:
partial_overlap: [Bug]: Changing system prompt causes cache invalidations #43148 - It covered broader changing system prompt cache invalidations and was closed after cache-boundary fixes, but it did not cover this later isolated-cron run-id regression.partial_overlap: Recurring isolated cron jobs have unstable first-turn OpenAI prompt-cache hits across runs #62809 - It tracked unstable OpenAI prompt-cache affinity for recurring isolated crons and was closed by a stable promptCacheKey fix, but this issue shows the raw Runtime prompt text remains volatile.partial_overlap: Allow cron payloads to specify a stable prompt_cache_key independent of per-run sessionId #76218 - It requested an explicit stable cron prompt_cache_key and was closed into the earlier canonical cache-affinity issue, which only partially addresses this Runtime-line mechanism.adjacent_distinct: fix(cron): refuse keyless implicit isolated cron delivery inherited from shared agent-main bucket #91685 - The merged PR changed adjacent keyless isolated-cron delivery behavior and is cited by the reporter as likely origin context, but it is not a remaining fix candidate for prompt rendering.partial_overlap: Optimize prompt caching by moving volatile current-time injection out of cache-sensitive prompt prefixes #71973 - It remains open for volatile current-time cache placement across automation paths, which overlaps prompt-cache stability but is a separate volatile-field contract.Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.
Next step
A focused repair is plausible from the current source path, but the worker should keep the scope to prompt/cache-facing identity and treat live provider proof as validation rather than redesign.
Review details
Best possible solution:
Keep the per-run cron identity internal for routing and cleanup, but render or route a stable cron prompt identity so repeated isolated runs keep a byte-identical cacheable prompt prefix.
Do we have a high-confidence way to reproduce the issue?
Yes at source level: current main constructs a
:run:isolated-cron session key, passes it into embedded execution, and renders it in the Runtime prompt line. I did not independently reproduce the live provider token jump.Is this the best way to solve the issue?
Yes, the requested repair direction is the right narrow fix: keep run identity internal and make prompt/cache-facing identity stable. Reusing one session across runs would weaken isolation, and adding a new config knob is not required for the core bug.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
Codex review notes: model internal, reasoning high; reviewed against 56d95b18f4bc.
Label changes
Label changes:
issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.clawsweeper:source-repro: Current issue advisory state selects this label.clawsweeper:needs-live-repro: Current issue advisory state no longer selects this label.issue-rating: 🐚 platinum hermit: Current issue advisory state no longer selects this label.Label justifications:
P2: This is a source-backed prompt-cache cost regression with a bounded cron/provider surface and no outage, data loss, or security bypass.impact:session-state: The issue is caused by per-run isolated cron session identity leaking into model-facing runtime prompt state.impact:other: The concrete maintainer-visible impact is wasted model input tokens and degraded provider prompt-cache reuse.Evidence reviewed
Acceptance criteria:
What I checked:
${agentSessionKey}:run:${runSessionId}when the base key is a cron key. (src/cron/isolated-agent/run.ts:634, 56d95b18f4bc)sessionKey: params.runSessionKeyand separately passes a stablepromptCacheKey, so stable provider affinity does not remove the volatile session key from prompt-facing runtime metadata. (src/cron/isolated-agent/run-executor.ts:377, 56d95b18f4bc)buildRuntimeLineincludessession=${sanitizeForPromptLiteral(runtimeInfo.sessionKey)}, so the cron run key remains model-visible. (src/agents/system-prompt.ts:1400, 56d95b18f4bc)src/agents/system-prompt.ts:1277, 56d95b18f4bc)src/cron/isolated-agent/run.session-key-isolation.test.ts:122, 56d95b18f4bc):run:runSessionKey, embeddedsessionKey: params.runSessionKey, and Runtimesession=rendering. (src/agents/system-prompt.ts:1400, aa69b12d0086)Likely related people:
src/cron/isolated-agent/run.ts)src/agents/system-prompt.ts,src/agents/system-prompt-cache-boundary.ts,src/agents/openai-transport-stream.ts)src/cron/isolated-agent/run.ts,src/cron/isolated-agent/delivery-target.ts)How this review workflow works
@clawsweeper re-reviewcomments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.@clawsweeper re-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only.@clawsweeper reviewto request a fresh review only.@clawsweeper autofix,@clawsweeper automerge,@clawsweeper fix ci, or@clawsweeper address review.@clawsweeper explainto ask for more context, or@clawsweeper stopto stop active automation.fix(agents): isolated cron busts prompt prefix cache via per-run sess…
fix(agents): isolated cron busts prompt prefix cache via per-run sess…
fix(agents): isolated cron busts prompt prefix cache via per-run sess…
fix(agents): isolated cron busts prompt prefix cache via per-run sess…