Preserve OpenCode model variants for hcom messages#61
Merged
Conversation
OpenCode stores reasoning effort as the prompt model variant. The hcom OpenCode plugin kept only the provider and model when tracking the current model, so hcom-delivered promptAsync turns omitted the variant and could reset the session effort. Track the current OpenCode variant from chat messages, pass it back as the promptAsync variant for hcom deliveries, and keep the model payload limited to the provider/model fields OpenCode expects. Also read --variant from launch args as a fallback for resumed sessions.
Owner
|
thanks |
aannoo
added a commit
that referenced
this pull request
Jun 4, 2026
The hand-resolved integration onto origin/main (Kimi #59 + OpenCode #61) silently dropped copilot/pi entries in non-exhaustive contexts that still compiled and passed the existing suite: - shared/context.rs: is_copilot/is_pi detection + Tool dispatch + is_inside_ai_tool - shared/platform.rs: is_inside_ai_tool() + detect_current_tool_from_env() - instance_binding.rs: auto_subscribe_defaults tool allowlist (copilot) - bootstrap.rs: DELIVERY_AUTO condition (pi) + spawn-help capability lines - delivery.rs: wake-inject <hcom> marker match (copilot, pi) - main.rs: pty --help tool list (pi) - help.rs/hooks.rs/config.rs: fork/hooks/filter/label/dir help text - README/Cargo.toml/pyproject.toml: tool list + Pi table row + keywords cargo test (1816+17), fmt, clippy all green.
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.
OpenCode carries reasoning effort as the prompt model
variant(high,xhigh, etc.). hcom's OpenCode plugin was tracking onlyproviderIDandmodelID, so hcom-deliveredpromptAsyncturns were saved without a variant. In active sessions this can reset the effort back to the model default and silently lower reasoning quality.This keeps the current OpenCode variant with the tracked model, preserves
input.variantfromchat.message, and passes that variant back as the top-levelpromptAsyncvariant when hcom delivers queued messages. Themodelpayload sent to OpenCode stays limited toproviderIDandmodelID, and--variantis read from launch args as a fallback for sessions started with an explicit variant.I also verified the fix manually against a live OpenCode session: before the fix,
<hcom>-delivered turns were saved with a blank variant; after the fix, they persist the active variant, for examplevariant=high, in the OpenCode DB and the session effort no longer resets. I rancargo test opencode; 55 matching tests passed.Fixes #60.