feat(opencode-v2): port compaction ownership, destructive policy, step usage from #1194 - #2
Closed
Scratchydisk wants to merge 2 commits into
Closed
Scratchydisk wants to merge 2 commits into
Scratchydisk wants to merge 2 commits into
Conversation
…p usage from mksglu#1194 Ports the separable pieces of mksglu#1194 onto our monolithic V2 setup (no core.ts restructure, no target-axis): - Compaction ownership: resolveCompactionMode() reads options.compaction ('own' default, 'passthrough'/'host' alias). Own mode sets event.result={summary} so the host skips model summarization (zero LLM calls); passthrough leaves result unset while still persisting the snapshot for cross-session resume. Empty snapshot: unset either way. - Destructive-tool policy: ctx_purge/ctx_upgrade refuse inside execute unless CONTEXT_MODE_ALLOW_DESTRUCTIVE=1 (V2 host does no per-call permission prompt for plugin tools). - v2-native usage capture: correlate session.step.started model by assistantMessageID with session.step.ended tokens/cost via new parseOpencodeV2StepUsage() (reasoning folded into output, native USD verbatim); message.updated kept as fallback. - Docs: OpenCode 2 section in platform-support.md + opencode-v2.json template. Tests: 12 new (parser mapping/edge cases, mode resolution, policy unit+refusal, own/passthrough/empty compaction, step correlation end-to-end into session DB). Targeted suites 140 passed, typecheck clean. Full suite shows 33 pre-existing failures in hooks/session bundles, reproduced on clean tree.
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.
Ports the separable pieces of mksglu#1194 onto our monolithic V2 setup (no core.ts restructure, no target-axis):
Verification: 12 new tests (targeted suites 140 passed, typecheck clean) + live sessions on real opencode 2.0.12 (ctx_stats end-to-end, ctx_purge refusal, StepEnded rows, zero load errors). Full suite has 33 pre-existing failures in hooks/session bundles, reproduced on clean tree.