Skip to content

fix: keep OpenCode enrich out of system prompt#1015

Merged
wbugitlab1 merged 3 commits into
mainfrom
issue/287-prompt-cache-system-mutation
Jun 19, 2026
Merged

fix: keep OpenCode enrich out of system prompt#1015
wbugitlab1 merged 3 commits into
mainfrom
issue/287-prompt-cache-system-mutation

Conversation

@wbugitlab1

Copy link
Copy Markdown
Owner

Summary

  • Move OpenCode per-file /agentmemory/enrich injection from experimental.chat.system.transform to chat.message message parts.
  • Keep first-turn AGENTMEMORY_INSTRUCTIONS and /context system injection unchanged.
  • Add a regression test proving /enrich no longer mutates output.system, is appended to output.parts, and is excluded from prompt observation.
  • Update the OpenCode README to document stable system context plus volatile message-stream file enrichment.

Fixes #287.

Verification

  • corepack pnpm exec vitest run --exclude test/integration.test.ts test/opencode-prompt-cache.test.ts failed before the fix for the expected reasons.
  • corepack pnpm exec vitest run --exclude test/integration.test.ts test/opencode-prompt-cache.test.ts
  • corepack pnpm exec vitest run --exclude test/integration.test.ts test/opencode-prompt-cache.test.ts test/opencode-auto-context.test.ts test/integration-plaintext-http.test.ts test/context-injection.test.ts test/hook-source-smoke.test.ts
  • corepack pnpm run lint
  • corepack pnpm run build
  • corepack pnpm test
  • semgrep scan --config p/default --error --metrics=off .
  • gitleaks protect --staged --redact

Final review lanes: security/privacy, test coverage, and maintainability/integration all returned ACCEPT.

@wbugitlab1 wbugitlab1 merged commit 6e088db into main Jun 19, 2026
2 checks passed
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.

Token input cache rate dropped ~10pp due to per-turn system prompt mutation

1 participant