Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 72ebaeb

Browse files
Tarquinengithub-actions[bot]
authored andcommitted
fix: rejoin system prompt if experimental plugin hook triggers to preserve caching (anomalyco#5550)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 0dc62d5 commit 72ebaeb

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

  • packages/opencode/src/session

packages/opencode/src/session/llm.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,18 @@ export namespace LLM {
6060
.join("\n"),
6161
)
6262

63+
const header = system[0]
6364
const original = clone(system)
6465
await Plugin.trigger("experimental.chat.system.transform", {}, { system })
6566
if (system.length === 0) {
6667
system.push(...original)
6768
}
69+
// rejoin to maintain 2-part structure for caching if header unchanged
70+
if (system.length > 2 && system[0] === header) {
71+
const rest = system.slice(1)
72+
system.length = 0
73+
system.push(header, rest.join("\n"))
74+
}
6875

6976
const params = await Plugin.trigger(
7077
"chat.params",

0 commit comments

Comments
 (0)