Skip to content

fix(agent): Explore and claude-code-guide no longer hard-code model=haiku#154

Merged
tjb-tech merged 1 commit intoHKUDS:mainfrom
yl-jiang:fix/explore-agent-model-inherit
Apr 17, 2026
Merged

fix(agent): Explore and claude-code-guide no longer hard-code model=haiku#154
tjb-tech merged 1 commit intoHKUDS:mainfrom
yl-jiang:fix/explore-agent-model-inherit

Conversation

@yl-jiang
Copy link
Copy Markdown
Contributor

Problem

The built-in Explore and claude-code-guide agent definitions both hard-code model="haiku". When these agents are spawned as subprocesses (via the agent tool), the child process receives --model 'haiku' on its command line. This causes an immediate API error for any user whose session is backed by a non-Anthropic provider — OpenAI-compatible endpoints, AWS Bedrock, Google Vertex, or any custom base_url — because "haiku" is not a valid model name on those APIs.

A secondary bug: build_inherited_cli_flags did not special-case the sentinel value "inherit". Agents that already used model="inherit" (Plan, verification) would therefore pass the literal string --model 'inherit' to the subprocess instead of omitting the flag and letting the OPENHARNESS_MODEL env var (already forwarded by build_inherited_env_vars) do its job.

Fixes #153.

Changes

  • src/openharness/coordinator/agent_definitions.py — Changed model="haiku"model="inherit" for Explore and claude-code-guide, consistent with the existing Plan and verification built-in agents.

  • src/openharness/swarm/spawn_utils.pybuild_inherited_cli_flags now skips the --model flag when the value is "inherit" so the subprocess correctly inherits the parent model via OPENHARNESS_MODEL.

Testing

New tests added and all pass (uv run pytest -q):

tests/test_swarm/test_spawn_utils.py

  • test_build_inherited_cli_flags_explicit_model_included — a real model name produces --model <name> in the flag list.
  • test_build_inherited_cli_flags_inherit_model_excluded"inherit" produces no --model flag.
  • test_build_inherited_cli_flags_none_model_excludedNone produces no --model flag.
  • test_build_inherited_cli_flags_empty_string_model_excluded — empty string produces no --model flag.

tests/test_coordinator/test_agent_definitions.py

  • test_builtin_explore_does_not_hardcode_provider_modelExplore must not reference an Anthropic-only model alias.
  • test_builtin_claude_code_guide_does_not_hardcode_provider_model — same guard for claude-code-guide.
  • test_builtin_provider_agnostic_agents_use_inherit_or_none — asserts all four provider-agnostic built-in agents (Plan, verification, Explore, claude-code-guide) use None or "inherit".

Full suite result: 727 passed, 6 skipped (3 pre-existing BashTool macOS script -f failures unrelated to this change).

…aiku

Both built-in agents previously set model="haiku", which caused
subprocess spawning to fail for users running any non-Anthropic provider
(OpenAI, Bedrock, custom base URLs, etc.) because the literal string
"haiku" is not a valid model on those APIs.

Changes:
- Explore and claude-code-guide now use model="inherit", consistent
  with the existing Plan and verification built-in agents.
- build_inherited_cli_flags now skips the --model flag when the value
  is "inherit", so the subprocess inherits the parent model via the
  OPENHARNESS_MODEL env var that build_inherited_env_vars already
  forwards. Previously "inherit" was passed verbatim as a model name,
  which would have also broken Plan and verification agents.

Tests added:
- build_inherited_cli_flags: model="inherit" and model=None produce no
  --model flag; a real model name is included as expected.
- Builtin agent definitions: Explore and claude-code-guide must not
  reference Anthropic-only model aliases; Plan, verification, Explore,
  and claude-code-guide must all use None or "inherit".

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 16, 2026 13:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes subprocess-spawned built-in agents failing on non-Anthropic providers by removing hard-coded Anthropic model aliases and correctly implementing the "inherit" model sentinel so child agents inherit the parent model via OPENHARNESS_MODEL.

Changes:

  • Updated built-in Explore and claude-code-guide agent definitions to use model="inherit" instead of model="haiku".
  • Updated build_inherited_cli_flags to omit --model when the model is "inherit".
  • Added regression tests covering model flag inheritance/omission behavior and guarding against provider-specific model aliases in built-ins.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/openharness/coordinator/agent_definitions.py Switches built-in agents to provider-agnostic model inheritance ("inherit").
src/openharness/swarm/spawn_utils.py Skips emitting --model when the model is the "inherit" sentinel.
tests/test_swarm/test_spawn_utils.py Adds tests asserting correct --model flag inclusion/exclusion behavior.
tests/test_coordinator/test_agent_definitions.py Adds tests ensuring provider-agnostic built-ins don’t hard-code Anthropic-only aliases.
CHANGELOG.md Documents the bugfix and the inheritance behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +145 to 147
# "inherit" means use the parent's model via the OPENHARNESS_MODEL env var.
if model and model != "inherit":
flags.extend(["--model", shlex.quote(model)])
Comment thread CHANGELOG.md
@@ -26,6 +26,8 @@ The format is based on Keep a Changelog, and this project currently tracks chang

- `todo_write` tool now updates an existing unchecked item in-place when `checked=True` instead of appending a duplicate `[x]` line.

@tjb-tech tjb-tech merged commit c881c7d into HKUDS:main Apr 17, 2026
7 of 8 checks passed
@yl-jiang yl-jiang deleted the fix/explore-agent-model-inherit branch April 23, 2026 14:09
arik08 pushed a commit to arik08/MyHarness that referenced this pull request Apr 26, 2026
…aiku (HKUDS#154)

Both built-in agents previously set model="haiku", which caused
subprocess spawning to fail for users running any non-Anthropic provider
(OpenAI, Bedrock, custom base URLs, etc.) because the literal string
"haiku" is not a valid model on those APIs.

Changes:
- Explore and claude-code-guide now use model="inherit", consistent
  with the existing Plan and verification built-in agents.
- build_inherited_cli_flags now skips the --model flag when the value
  is "inherit", so the subprocess inherits the parent model via the
  OPENHARNESS_MODEL env var that build_inherited_env_vars already
  forwards. Previously "inherit" was passed verbatim as a model name,
  which would have also broken Plan and verification agents.

Tests added:
- build_inherited_cli_flags: model="inherit" and model=None produce no
  --model flag; a real model name is included as expected.
- Builtin agent definitions: Explore and claude-code-guide must not
  reference Anthropic-only model aliases; Plan, verification, Explore,
  and claude-code-guide must all use None or "inherit".

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

[Bug] Explore and claude-code-guide agents fail on non-Anthropic providers due to hard-coded model="haiku"

3 participants