Skip to content

perf(llm): enable OpenCode prompt cache keys - #2344

Merged
shunkakinoki merged 1 commit into
mainfrom
codex/opencode-prompt-cache-key
Aug 10, 2026
Merged

perf(llm): enable OpenCode prompt cache keys#2344
shunkakinoki merged 1 commit into
mainfrom
codex/opencode-prompt-cache-key

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • enable OpenCode setCacheKey for both remote and local CLIProxy providers
  • regenerate the checked-in OpenCode config
  • add regression coverage for both provider blocks

Validation

  • shellspec spec/llm_update_spec.sh — 80 examples, 0 failures
  • git diff --check
  • make build reached Nix evaluation but was stopped after sustained shared /nix/var/nix/db/db.sqlite contention; no configuration error was reported

Summary by cubic

Enable stable prompt cache keys in OpenCode for both remote and local CLIProxyAPI providers to improve cache hits and reduce latency. Regenerated the checked-in config and added a regression spec to ensure setCacheKey stays enabled.

Written for commit 4b84c2a. Summary will update on new commits.

Review in cubic

@indent-zero

indent-zero Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Indent Zero is shutting down on August 7th. Please migrate over to Indent 2.0 to continue getting PR reviews.

PR Summary

Enables OpenCode's session-scoped promptCacheKey on both @ai-sdk/openai-compatible CLIProxy providers so that repeated turns within an OpenCode session can hit upstream prompt caches (primarily the GPT-5/Codex route through CLIProxy). Also lands a matching shellspec assertion so scripts/llm-update.sh regeneration keeps the flag in place.

  • config/opencode/opencode.jsonc: adds "setCacheKey": true to the shunkakinoki (remote CLIProxy) and cliproxyapi (local CLIProxy) options blocks.
  • config/opencode/opencode.tpl.jsonc: mirrors the same additions in the template so regeneration stays in sync.
  • spec/llm_update_spec.sh: adds an It 'enables stable prompt cache keys for both CLIProxy providers' case that greps for the flag inside each provider range of the generated file.

Issues

No issues found.

CI Checks

Waiting for CI checks...

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6f5cb144-3c25-45ef-95ec-0f73e3ea58b1

📥 Commits

Reviewing files that changed from the base of the PR and between d2f3ed0 and 4b84c2a.

📒 Files selected for processing (3)
  • config/opencode/opencode.jsonc
  • config/opencode/opencode.tpl.jsonc
  • spec/llm_update_spec.sh

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Enabled stable prompt cache keys for local and remote CLIProxy providers, improving cache consistency and response efficiency.
  • Tests

    • Added coverage to verify cache key settings for both configured providers.

Walkthrough

The OpenCode remote and local CLIProxy providers now enable setCacheKey: true. A runtime specification verifies this setting for both providers.

Changes

OpenCode cache-key configuration

Layer / File(s) Summary
Enable provider cache keys
config/opencode/opencode.jsonc, config/opencode/opencode.tpl.jsonc
Both CLIProxy provider definitions set setCacheKey to true while retaining their API key settings.
Validate cache-key settings
spec/llm_update_spec.sh
The runtime fallback test checks setCacheKey: true for both providers.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Poem

A rabbit hops through config bright,
Two cache keys bloom in lines of light.
Remote and local now agree,
Tests check the setting faithfully.
setCacheKey twinkles true—
Hop, hop, the cache comes through!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes enabling OpenCode prompt cache keys, which is the main change.
Description check ✅ Passed The description accurately covers the configuration changes, regenerated config, regression coverage, and validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/opencode-prompt-cache-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@shunkakinoki
shunkakinoki merged commit e119e23 into main Aug 10, 2026
26 of 29 checks passed
@shunkakinoki
shunkakinoki deleted the codex/opencode-prompt-cache-key branch August 10, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant