[BUG] Interactive sessions write the 5-minute prompt cache from session start, while `claude -p` on the same account writes 1-hour (2.1.296, Team seat, survives `/login`)

Status Open
Reported on v2.1.296
Maintainer reply None cached
Activity 6 comments · opened Oct 13, 2026

What's wrong

Since 2026-10-12 at about 18:18 UTC, every newly started interactive session writes its main-conversation prompt cache under the 5-minute TTL. Headless claude -p runs on the same account, machine, version and model still write under 1 hour. The account is a subscription within its included usage, so per the prompt-caching docs both should get 1 hour. Interactive turns, -p runs and SDK turns are documented as the same "main conversation" bucket.

Evidence (from local transcripts, message.usage.cache_creation on non-sidechain assistant rows)

| Case | Entrypoint | Result |
|---|---|---|
| Interactive sessions started before 2026-10-12 18:18 UTC | cli | 1h; they kept writing 1h until they went idle (last at 19:56 UTC) |
| Every interactive session started after 18:18 UTC (5 sessions) | cli | 5m from the first turn, 1h always 0 |
| claude -p runs after 18:18 UTC (4 runs, latest 2026-10-13 04:54 UTC) | sdk-cli | 1h |
| Interactive session in a plain terminal, outside tmux and any launcher (2026-10-13 05:05 UTC) | cli | 5m |
| Interactive session after /login re-authentication (2026-10-13 05:08 UTC) | cli | 5m |

  • No session ever changed bucket partway through, across 14 sessions, so the TTL looks fixed at session start.
  • usage metadata is identical on 1h and 5m rows: service_tier: "standard", speed: "standard", fallback_credit: null.
  • In the transcripts from the four days up to the onset (2026-10-09 to 2026-10-12 18:18 UTC), every main-thread cache write was 1h.

Environment

  • Claude Code 2.1.296 (native install) on Linux (WSL2); model claude-opus-5-5. The same version was in use on both sides of the onset
  • Auth: claude.ai subscription via /login (OAuth). Team seat team_tier_1; user rate-limit tier default_claude_max_5x
  • ~/.claude.json: oauthAccount.hasExtraUsageEnabled: true, cachedExtraUsageDisabledReason: "out_of_credits" (still present after /login)
  • Not near the 5-hour or weekly limits
  • None set: ANTHROPIC_API_KEY, CLAUDE_CODE_USE_*, CLAUDE_CODE_OAUTH_TOKEN, CLAUDE_CODE_PROMPT_CACHE_TTL, FORCE_PROMPT_CACHING_5M, ENABLE_PROMPT_CACHING_1H, DISABLE_TELEMETRY, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC. No promptCacheTtl in user or managed settings
  • Cached tengu_prompt_cache_1h_config.allowlist still includes repl_main_thread* and sdk

Steps to reproduce (on an affected account)

  1. Run claude interactively, send one turn and exit.
  2. Run claude -p "Reply with OK" in the same directory.
  3. Compare the buckets:

``sh
jq -c 'select(.type=="assistant" and .isSidechain!=true and .message.usage.cache_creation)
| [.timestamp, .entrypoint, .message.usage.cache_creation.ephemeral_1h_input_tokens,
.message.usage.cache_creation.ephemeral_5m_input_tokens]' ~/.claude/projects/<dir>/<session>.jsonl
`
Interactive shows
[...,"cli",0,N] and -p shows [...,"sdk-cli",N,0]`.

Expected

Interactive sessions on a subscription within included usage write the main conversation under the 1-hour TTL, as -p does.

Possibly related

  • #46829: Anthropic support described an overage-latch bug, fixed in 2.1.90, in which a session started while the seat was in overage kept 5m on the main loop. The latch-at-start shape matches this report, but this seat is not in overage.
  • #79337, #80749, #93840: the interactive client misjudged usage-credit entitlement while -p worked on the same account. One investigator traced it to per-session flag evaluation, and one report involved out_of_credits.

Question

Does the interactive startup path consult usage-credit state (here, an org-level out_of_credits) when choosing the main-conversation TTL, and treat it as "drawing on usage credits"? Or has the overage latch regressed?

View original on GitHub ↗

3 Comments

bhasmang-tri · 2 days ago

Reproduced by a second user in the same Team org, 2026-10-13.

  • Claude Code 2.1.296, macOS (Darwin 25.3.0), model claude-opus-5-5, entrypoint cli (interactive).
  • New interactive session: every assistant row in the transcript shows ephemeral_5m_input_tokens > 0 and ephemeral_1h_input_tokens: 0, from the first turn.

One extra data point: the harness system prompt in that same session tells the model the session "uses a 1-hour Anthropic prompt-cache TTL". So the client appears to believe it is requesting 1h, while the usage shows 5m writes. That points to the request being sent or handled differently, not to the account being in usage overage.

Checked with:

grep -o '"cache_creation":{[^}]*}' ~/.claude/projects/<project>/<session>.jsonl | tail
chrs-myrs · 2 days ago

Follow-up from the reporter's side:

  • Same org: @bhasmang-tri's repro is a second seat in the same Team org, on macOS, so this isn't WSL-specific.
  • The API honours an explicit 1h: setting "promptCacheTtl": "1h" switches a running interactive session to ephemeral_1h writes within seconds. The interactive client's default TTL choice is what lands on 5m, even though the system prompt says "1-hour TTL".
  • Org usage credits aren't the trigger: after we turned usage credits off at org level (cachedExtraUsageDisabledReason went from out_of_credits to org_level_disabled), a fresh interactive session with user settings excluded (--setting-sources project,local) still wrote 5m.
jaredrhall · 1 day ago

Same symptom here, with a data point on behavior rather than just the label. Claude Code 2.1.296, Linux, Team seat, interactive cli sessions. Our 1h writes ended around 2026-10-12 15:15 CT, and 5m writes have continued since (a few sessions between about 14:00 and 15:10 CT that day were still 1h, so onset wasn't clean for us). Headless sdk-cli runs on the morning of 10-13 were still 1h. No TTL setting or env var is set, and /usage showed 39% of the session and 7% of the week used.

To test whether the 5m label matches behavior, I ran a controlled probe: a background session in an empty directory with three one-shot cron wakes, each a tiny no-tool turn. All writes were labeled ephemeral_5m:

| Idle before wake | cache_read | cache_write |
|---|---|---|
| 13.4 min | 56,368 | 30 |
| 30.0 min | 56,398 | 28 |
| 70.0 min | 27,378 (shared prefix only) | 29,076 |

So 5m-labeled writes survived 30 minutes and expired by 70, which looks like a 1h-like lifetime under a 5m label. The 27,378 read at 70 minutes is the same shared system-prompt prefix the probe's first call read, so the conversation itself was rebuilt. Interactive sessions on 10-12 and 10-13 show the same: idle gaps of 5–20 minutes and one of about 30 with full cache reads despite 5m labels.

Showing cached comments. Read the full discussion on GitHub ↗