fix(agents): stabilize prompt cache fingerprints#60731
Conversation
Greptile SummaryThis PR adds conservative normalization of structured prompt sections to stabilize prompt-cache fingerprints for OpenAI-family and other prompt-byte-sensitive transports. It introduces a new Key observations:
Confidence Score: 5/5This PR is safe to merge; all changes are additive normalizations with no behavioral impact on the prompt's logical content and are well-covered by new tests. No P0 or P1 issues found. The change is narrowly scoped to structured prompt assembly, leaves user-injected file content untouched as documented, and is backed by byte-stability regression tests. Previously flagged issues in earlier review threads are pre-existing style observations, not blocking bugs. No files require special attention. Reviews (2): Last reviewed commit: "refactor(agents): simplify prompt capabi..." | Re-trigger Greptile |
|
@greptileai review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5f61ff6390
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const seen = new Set<string>(); | ||
| const normalized: string[] = []; | ||
| for (const capability of capabilities) { | ||
| const value = normalizeStructuredPromptSection(String(capability ?? "")).toLowerCase(); |
There was a problem hiding this comment.
Preserve capability ID casing in prompt normalization
Lowercasing each capability in normalizePromptCapabilityIds rewrites canonical IDs before they are rendered in the runtime line, so values like inlineButtons become inlinebuttons. This creates inconsistent prompt guidance (the same system prompt still references capabilities.inlineButtons) and can cause the agent to surface invalid or non-canonical capability names for camelCase/plugin-defined capabilities. Please dedupe/sort case-insensitively but keep the original canonical token when emitting capability IDs.
Useful? React with 👍 / 👎.
* fix(agents): stabilize prompt cache fingerprints * chore(changelog): note prompt cache fingerprint stability * refactor(agents): simplify capability normalization * refactor(agents): simplify prompt capability normalization helper
* fix(agents): stabilize prompt cache fingerprints * chore(changelog): note prompt cache fingerprint stability * refactor(agents): simplify capability normalization * refactor(agents): simplify prompt capability normalization helper
* fix(agents): stabilize prompt cache fingerprints * chore(changelog): note prompt cache fingerprint stability * refactor(agents): simplify capability normalization * refactor(agents): simplify prompt capability normalization helper
* fix(agents): stabilize prompt cache fingerprints * chore(changelog): note prompt cache fingerprint stability * refactor(agents): simplify capability normalization * refactor(agents): simplify prompt capability normalization helper
* fix(agents): stabilize prompt cache fingerprints * chore(changelog): note prompt cache fingerprint stability * refactor(agents): simplify capability normalization * refactor(agents): simplify prompt capability normalization helper
* fix(agents): stabilize prompt cache fingerprints * chore(changelog): note prompt cache fingerprint stability * refactor(agents): simplify capability normalization * refactor(agents): simplify prompt capability normalization helper
Summary
Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
Regression Test Plan (if applicable)
src/agents/system-prompt.test.tssrc/agents/system-prompt-cache-boundary.test.tssrc/agents/pi-embedded-runner/run/attempt.test.tsUser-visible / Behavior Changes
Diagram (if applicable)
Security Impact (required)
Yes, explain risk + mitigation:Repro + Verification
Environment
Steps
Expected
Actual
Evidence
Attach at least one:
Human Verification (required)
git diff --checkpnpm buildis currently blocked on unrelated existing latest-maintype failures insrc/agents/tools/sessions-spawn-tool.tsandsrc/plugin-sdk/core.tsReview Conversations
Compatibility / Migration
Risks and Mitigations