Skip to content

Preserve OpenCode model variants for hcom messages#61

Merged
aannoo merged 1 commit into
aannoo:mainfrom
azkore:fix/opencode-preserve-variant
Jun 4, 2026
Merged

Preserve OpenCode model variants for hcom messages#61
aannoo merged 1 commit into
aannoo:mainfrom
azkore:fix/opencode-preserve-variant

Conversation

@azkore
Copy link
Copy Markdown
Contributor

@azkore azkore commented Jun 3, 2026

OpenCode carries reasoning effort as the prompt model variant (high, xhigh, etc.). hcom's OpenCode plugin was tracking only providerID and modelID, so hcom-delivered promptAsync turns 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.variant from chat.message, and passes that variant back as the top-level promptAsync variant when hcom delivers queued messages. The model payload sent to OpenCode stays limited to providerID and modelID, and --variant is 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 example variant=high, in the OpenCode DB and the session effort no longer resets. I ran cargo test opencode; 55 matching tests passed.

Fixes #60.

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.
@aannoo
Copy link
Copy Markdown
Owner

aannoo commented Jun 4, 2026

thanks

@aannoo aannoo merged commit f2aa147 into aannoo:main Jun 4, 2026
10 checks passed
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.
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.

OpenCode hcom messages drop model variants and reset effort

2 participants