Skip to content

Fix opencode control agent model/variant propagation#420

Merged
proboscis merged 1 commit intomainfrom
issue/orch-441/run-20260211-150446
Feb 11, 2026
Merged

Fix opencode control agent model/variant propagation#420
proboscis merged 1 commit intomainfrom
issue/orch-441/run-20260211-150446

Conversation

@proboscis
Copy link
Owner

Summary

  • propagate resolved control model/variant into opencode control-session creation flow
  • persist opencode control-session metadata (port, model, model_variant) in .orch/control-session.json
  • enforce model/variant-aware reuse for control sessions; if stored metadata mismatches, create a fresh control session
  • add daemon tests proving resolved control model/variant reach SendMessagePrompt and metadata is persisted/reused correctly

Acceptance Criteria Evidence

1) Control agent uses opencode.default_model and default_variant from config

Verified by new test:

  • go test ./internal/daemon -run 'TestResolvedControlModelAndVariantReachOpenCodeInitialPrompt' -count=1
  • Result: ok github.com/s22625/orch/internal/daemon

This test writes project config with:

opencode:
  default_model: openai/gpt-5.3-codex
  default_variant: xhigh

Then verifies the resolved values are sent in initial /message payload.

2) Initial prompt to new control session includes configured model/variant

Verified by new/updated tests:

  • go test ./internal/daemon -run 'TestGetOrCreateOpenCodeControlSessionCreatesWhenRecoveryFindsNoSession' -count=1
  • Result: ok github.com/s22625/orch/internal/daemon

The test captures /session/{id}/message request and asserts model=openai/gpt-5.3-codex, variant=xhigh.

3) Reused control sessions also respect configured model/variant

Verified by tests:

  • TestGetOrCreateOpenCodeControlSessionReusesExisting
  • TestGetOrCreateOpenCodeControlSessionCreatesNewWhenStoredModelMismatches

Command:

  • go test ./internal/daemon -run 'TestGetOrCreateOpenCodeControlSessionReusesExisting|TestGetOrCreateOpenCodeControlSessionCreatesNewWhenStoredModelMismatches' -count=1
  • Result: ok github.com/s22625/orch/internal/daemon

Behavior now:

  • stored control-session metadata includes model + model_variant
  • reuse only occurs when stored model metadata matches current resolved config
  • mismatch triggers fresh control-session creation with the configured model/variant

4) orch run continues to correctly pass model/variant (no regression)

Regression checks run:

  • go test ./internal/daemon -run 'TestProtoStartRunFieldMapping|TestProtoContinueRunFieldMapping' -count=1
  • go test ./internal/agent -run 'TestSendMessagePromptWithDirectoryAndModel' -count=1
  • go test ./internal/daemon -count=1
  • go build ./...

All passed.

5) Added test verifying ResolveControlModelAndVariant values reach SendMessagePrompt

Added:

  • TestResolvedControlModelAndVariantReachOpenCodeInitialPrompt

It explicitly resolves values via ResolveControlModelAndVariant("opencode") and verifies those values are sent in the initial SendMessagePrompt payload.

Additional validation

  • make lint passed (semgrep architecture lint)

Issue

  • fixes orch-441

@proboscis proboscis merged commit 3fd8ef2 into main Feb 11, 2026
1 of 2 checks passed
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