Skip to content

fix: revert opencode_env config regression and move RLM logic out of cli_agent_env#1042

Merged
mikasenghaas merged 2 commits intomainfrom
fix/revert-opencode-and-cli-agent-rlm
Mar 19, 2026
Merged

fix: revert opencode_env config regression and move RLM logic out of cli_agent_env#1042
mikasenghaas merged 2 commits intomainfrom
fix/revert-opencode-and-cli-agent-rlm

Conversation

@mikasenghaas
Copy link
Member

@mikasenghaas mikasenghaas commented Mar 19, 2026

Summary

  • Reverts opencode_env.py config builder to use shell variable expansion (${OPENAI_MODEL%%/*} etc.) instead of hardcoded "intercepted/model" to include the correct model name in the native oc system prompt — regression from opencode_rlm_env #1023
  • Moves is_sub_llm_call-aware first-turn prompt check from CliAgentEnv.add_model_response into OpenCodeRLMEnv, restoring the simple len(trajectory) == 0 check in the base class
  • OpenCodeRLMEnv.add_model_response uses super(CliAgentEnv, self) to skip the base class check and call MultiTurnEnv directly

🤖 Generated with Claude Code


Note

Medium Risk
Changes how OpenCode model/provider config is generated and how first-turn prompts are recorded when sub-LLM calls occur, which can affect model selection and trajectory/prompt correctness during rollouts.

Overview
Fixes an OpenCode config regression by switching build_opencode_config back to shell-expanded OPENAI_MODEL parsing so the generated config uses the real provider/model ($OPENAI_MODEL, ${OPENAI_MODEL%%/*}, ${OPENAI_MODEL##*/}) instead of a hardcoded intercepted/model.

Moves the sub-LLM aware “first main turn” prompt update logic out of CliAgentEnv.add_model_response into OpenCodeRLMEnv.add_model_response, ensuring state["prompt"] is set based on the first non-sub call while keeping the base CLI env’s first-turn check simple.

Updates tests to validate the rendered config after shell expansion (provider key, model name, and baseURL) using an explicit OPENAI_MODEL=myprovider/mymodel.

Written by Cursor Bugbot for commit b38775c. This will update automatically on new commits. Configure here.

mikasenghaas and others added 2 commits March 19, 2026 21:59
…cli_agent_env

Revert opencode_env.py config builder to use shell variable expansion
instead of hardcoded "intercepted/model" (regression from #1023).

Move is_sub_llm_call-aware first-turn prompt check from CliAgentEnv
into OpenCodeRLMEnv where it belongs, restoring the simple
len(trajectory)==0 check in the base class.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…de config

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@mikasenghaas mikasenghaas merged commit 628d1fd into main Mar 19, 2026
6 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.

2 participants