CommandCodeAI / CommandCodeAI/command-code

Cache is invalidated increasing costs

Open
#626 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
4k
Forks
350
PR merge metrics
No merged PRs in 30d

Description

Summary

Luna 5.6 xhigh.
I've sent one prompt and agent was implementing it for 9 minutes, sending about 60 requests, quite evenly so input cache could not expire (OpenAI has 30 minutes retention). Context was steadily growing from 25K to 135K. There was no context compaction. Despite pure agentic work cache was invalidated 3 times during these 9 minutes, causing substantial costs increase. Here are traces id that causes new full cache write for input.
Traces ID:
688515c1ff04db92149a370635b6dfbc
f591b3c3861e52523c99049e28542125
80f39ae574ac6b340530bfe244d01a6a

Seems there is some tool call that is modifying prior context and causing full cache invalidation

Expected Behavior

As long as there is no context compaction or cache time has not expired there should not be cache invalidation with full context cache write.

Actual Behavior

Cache is invalidated when it should not.

Steps to reproduce the issue

Hard to tell what is causing it. Providing traces id:

  1. before invalidating cache: a9ca8bb342da0e7d4fcca5498a25bf0e
    next request invalidating cache: 688515c1ff04db92149a370635b6dfbc
  2. before invalidating cache: ca3e9dfbf07552b61e0b5c486d0ffd06
    next request invalidating cache: f591b3c3861e52523c99049e28542125
  3. before invalidating cache: 99eb39484857d759ba5d9ad7e999f837
    next request invalidating cache: 80f39ae574ac6b340530bfe244d01a6a
Command Code Version

1.11.0

Operating System

Linux

Terminal/IDE

JetBrains-JediTerm

Shell

zsh

Session file (optional)

No response

Fix prompt (optional)

No response

Additional context

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the listed trace pairs around each cache invalidation, using Command Code 1.11.0 on Linux with the reported OpenAI caching behavior. Identify which request or tool call changes the prior context despite no compaction or expiry; done means repeated agentic requests retain the input cache under those conditions and avoid full cache writes.

Written by the indexing model from the issue text.

Assessment

Domain
ai, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.