[Bug]: Dynamic runtime context blocks in system prompt invalidate tools KV cache across sessions and workspaces

Ouverte
#638 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
typescript
Domaine
ai-infra-agents

Piste de recherche

Start by tracing where the system prompt, tool definitions, and runtime context blocks are assembled; the issue does not name specific files or tests. Check how session and workspace context enters the request, then verify that the system and tools prefix stays invariant across sessions while the context remains available in messages. Done means this ordering is covered by an appropriate test.

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

Description

Summary

Because prefix caching evaluates requests in system → tools → messages order, embedding workspace- and session-specific runtime context blocks directly in system invalidates the KV cache for both system and the entire tools definition block on every new session or workspace switch.

Current Behavior

Dynamic/workspace-dependent sections (environment/OS/cwd/date, session info, memory, skills, project instructions / AGENTS.md, etc.) are placed directly into the system prompt.

As a result:

  • Changing workspace, project instructions, memory, or session metadata changes the system prefix.
  • Because tools sit after system in the prefix cache (system → tools → messages), the entire tools schema block misses the cache at session startup, even though tool definitions are identical across sessions and projects.
Expected Behavior / Suggestion

Remove the dynamic/workspace-dependent runtime context blocks from system (keeping system strictly static and invariant across sessions/workspaces) and place those runtime context blocks after tools (in messages).

This keeps the system + tools prefix stable and reusable across new sessions and workspaces, giving immediate token/cost and latency savings from cache hits right from the start of each session.

Langage dominant
TypeScript
Étoiles
2.3k
Forks
315
Merge moyen
3 h 54 min
PR mergées (30 j)
9

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de MiniMax-AI/minimax-code

Toutes les issues de MiniMax-AI/minimax-code

Issues similaires

Plus d'issues TypeScript

Recevez les nouvelles issues par e-mail

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