Repository navigation
Conversation
- Move nudges to the request-only system prompt and avoid synthetic assistant text before tool-call adjacency, so DCP markers cannot leak into visible or persisted conversation content. - Harden V1 message handling (clone before mutation) and V2 restore IDs so reasoning/tool-call pairing survives compression. - Add a guarded V1 wire-transform fallback for hosts where the messages transform hook is not fired for the main request. - State/persistence/compaction: delete persisted state on session.deleted, refresh stale stats after compaction, preserve plan-mode transitions, deduplicate protected tool outputs across recompression, bound tokenizer lookups. - Register V1/V2 commands through a single path and guard RPC when the host does not expose it. - Default context limits to model-window percentages. - Add regressions for nudges, adjacency, permissions, persistence, commands, and a scoped non-live V1/V2 lab; record per-item upstream dispositions in docs/engineering/UPSTREAM_BACKLOG.md. Refs: Tarquinen#608 Refs: Tarquinen#632 Refs: Tarquinen#642 Refs: Tarquinen#666 Refs: Tarquinen#687 Refs: Tarquinen#688 Refs: Tarquinen#664
linsaftw
force-pushed
the
dcp/upstream-pr
branch
from
December 2, 2026 19:21
6676be9 to
f27bd19
Compare
Tests that exercise session persistence did not override the XDG dirs, so a local or CI test run wrote session state into the user's real ~/.local/share/opencode/storage/plugin/dcp directory. Load an env shim ahead of the test runner so module-level storage/config paths resolve into a temp sandbox.
linsaftw
force-pushed
the
dcp/upstream-pr
branch
from
December 2, 2026 19:36
ffccf4c to
e5456f9
Compare
The repo's PR check runs `npm audit --audit-level=high`, which failed on tar 7.5.x (installed transitively through @opencode/plugin tooling), ws 8.21.x, and cross-spawn 7.0.6 (GHSA-ghv9-86vm-4v8m). Pinning the patched releases keeps the audit gate green; remaining findings are moderate dev-transitive packages.
…dy V1 wire guard - resetOnCompaction zeroed totalPruneTokens, the lifetime savings total that global stats aggregate across session files. Only the pending counter is stale after compaction, so keep the lifetime total. - installV1WireTransform patched globalThis.fetch and never restored it; add uninstallV1WireTransform and call it from the plugin dispose hook. - Replace the per-session V1 wire suppression flag with a per-body marker check. Host versions fire the transform hook for aux agents (title/summary) while skipping the main request, so a session flag suppressed the real request; conversely the system prompt documents marker syntax and must be excluded from detection. - Drop in-memory session state on session.deleted so long-lived processes do not retain blocks and summaries for deleted sessions. Refs: Tarquinen#559 Refs: Tarquinen#564 Refs: Tarquinen#664
Author
|
Works very good |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause and fix
stripHallucinationsFromStringstrips compact DCP markers; V2 JSON/SSE responses get conservative marker sanitization. V2 RPC registration is guarded when the host exposes no RPC.opencode runrequest does not fireexperimental.chat.messages.transform. Added a guarded wire-level fallback that injects DCP IDs and applies active compression pruning to LLM-shaped POST bodies only, never to/api/endpoints. Duplicate injection is prevented by checking the outgoing conversation for existing DCP markers, not by a per-session flag: some host versions fire the hook for aux agents (title/summary) while skipping the real request, so a session-level flag suppressed the request that needed the fallback.system/developeritems are excluded from that check because the system prompt documents the marker syntax.session.deleted(feat: delete session state file when session is deleted #559) and the in-memory state map entry is dropped too, so long-lived processes do not retain compressed blocks for deleted sessions; the compaction refresh (fix: stale stats and incorrect token breakdown after Compaction #564) keeps the lifetime savings total and resets only the pending counter, sincetotalPruneTokensfeeds global stats; plan-mode transitions are preserved (fix(prune): preserve OpenCode Plan-mode transition messages #696); protected tool outputs are deduplicated across recompression ([Bug]: Protected task/subagent outputs re-appended verbatim on every recompression — duplicate notifications and net-negative context growth #672); tokenizer lookups are bounded and reused (Token counting can block OpenCode's event loop for minutes on long single-character runs #659/perf: reuse one tokenizer and bound the cost of counting huge inputs #663); logger/persistence writes are hardened.maxContextLimit/minContextLimit(fix(config): default context limits to a share of the model window #671).~/.local/share/opencodedirectory.Grouped changes
overridespintar@8.0.5,ws@8.23.1, andcross-spawn@7.1.2so the repo's ownnpm audit --audit-level=highgate passes.Issues/PRs addressed
Integrated or ported with per-item evidence: #559 #564 #569 #582 #597 #608 #616 #628 #632 #639 #642 #648 #658 #659 #663 #666 #669 #670 #671 #672 #687 #688 #694 #695 #696 #698.
Full disposition ledger for all 57 open issues and 33 open PRs, including deferred items with reasons (e.g. #647 cross-cutting tool-call ID reuse, #693 compaction-state semantics, #649 low-value hot-path refactor), is in
docs/engineering/UPSTREAM_BACKLOG.md.Evidence
npx tsc --noEmit— exit 0.npm test— exit 0; 154 main tests + 8 logger tests pass.npx prettier --check .— exit 0.npx tsup— exit 0.npm audit --audit-level=high— exit 0 after the dependency pins; the remaining 30 findings are moderate dev-transitive packages (@npmcli/*,@opentelemetry/*,@opencode/plugin,@opentui/solid,ip-address,gcp-metadata).rangeandmessagemodes, all reportcompression: true; RPC, manual compress, decompress, recompress, permissions, concurrent sessions, restart, and native compaction pass.Notes
/api/requests, and restores the original globalfetchfrom the plugindisposehook so a reload does not leave a stale wrapper.