Skip to content

fix(session): honor compaction agent variant - #200

Draft
kvnloo wants to merge 2 commits into
devfrom
fix/41578-compaction-variant
Draft

kvnloo wants to merge 2 commits into
devfrom
fix/41578-compaction-variant

Conversation

@kvnloo

@kvnloo kvnloo commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Tracks anomalyco#41578.

processCompaction already resolves the compaction agent to honor its model override, but the assistant message still inherited userMessage.model.variant. Prefer agent.variant and fall back to the triggering message variant.

Intentionally one behavioral line, with no unrelated compaction changes.

Credit: @semidark for the original report and @robertjmcintyre for the field confirmation/workaround analysis.

@kvnloo

kvnloo commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

Independent verification (Claude lane): this PR does not fix the issue

Head 6d6d5b9bf2fe66b4d11004b4a020881602b83320, one commit, +1/-1 in packages/opencode/src/session/compaction.ts. It is 1 ahead and 11 behind upstream dev and merges cleanly.

Finding. The change only alters the variant label stored on the summary message. The request still goes out with the user's variant, because request preparation reads input.user.model.variant and compaction still passes the unmodified user message.

Evidence (local, uncommitted probe tests; user variant high, compaction agent variant no-thinking)

  • At head: the stored label is no-thinking, but the prepared request resolves to high.
  • At base: both are high.
  • Existing compaction tests at head: 55 pass, 1 skip. packages/opencode typecheck passes. The PR adds no test.

So the stored label now disagrees with what was sent. Before the PR it was at least accurate.

Also

  • An agent variant the model does not define is recorded verbatim; other call sites guard against that.
  • The V2 compaction path in packages/core has no variant handling (by reading; not run).
  • Upstream issue 41578 is still open and upstream is unfixed. An earlier upstream PR with the same one-line change and the same gap was closed by stale cleanup.
  • All six CI jobs on this PR ended at about 24 hours, which looks like a runner timeout, not a test result. Job logs were not opened.

Suggested fix. Pass compaction a user message whose model variant is the resolved one, or add an explicit variant to the stream input that preparation prefers. The first also changes what plugins see, so it needs a deliberate choice. Add a test that asserts the prepared request, not the label.

Not run: the full test suite, the repo-wide typecheck, e2e, Windows. Nothing pushed. Cost: about 27 tool calls by one agent.

@kvnloo

kvnloo commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

Claiming the bounded PR #200 repair identified by independent review: make the resolved compaction-agent variant reach request preparation, and add an owning regression assertion that distinguishes the sent variant from the stored label. Scope is the existing compaction implementation and its focused tests only. No origin action and no ownership of unrelated opencode work.

@kvnloo

kvnloo commented Oct 10, 2026

Copy link
Copy Markdown
Owner Author

Result — CHECK / addressed-needs-rerun

Pushed abda862f4de32fa81a9a9f92d7f386c797fc32f4 to the existing fork draft.

  • Frozen incumbent/head: 6d6d5b9bf2fe66b4d11004b4a020881602b83320.
  • RED: with user variant high and compaction-agent variant no-thinking, the captured summary request received high (Expected: no-thinking; Received: high). The prior one-line change only corrected the stored label.
  • Fix: resolve the variant once, use it for the stored assistant metadata, and pass a copy of the user message carrying that variant across the processor/request boundary.
  • GREEN: focused regression 1 pass/0 fail; full compaction.test.ts 56 pass/1 pre-existing skip/0 fail; package tsgo --noEmit passed; git diff --check passed.
  • Push preflight ran the repository-wide Turbo typecheck, and the remote branch now resolves to the exact candidate SHA above. Hosted CI still needs to rerun; the previous six failures were timeout-era runs on the old head.

Requirement evidence remains open origin issue anomalyco#41578 and its documented compaction-agent variant configuration. No origin write or promotion performed.

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