Skip to content

feat: support custom Claude model#527

Open
metowolf wants to merge 11 commits intotiann:mainfrom
metowolf:cursor/claude-custom-model-c218
Open

feat: support custom Claude model#527
metowolf wants to merge 11 commits intotiann:mainfrom
metowolf:cursor/claude-custom-model-c218

Conversation

@metowolf
Copy link
Copy Markdown
Contributor

@metowolf metowolf commented Apr 26, 2026

Summary

  • Add support for specifying custom Claude models when spawning sessions
  • Infer custom Claude model from the model value automatically
  • Update web UI to allow custom model input with proper i18n labels
  • Fix related model options test

Changes

  • Spawn: Support custom model type for Claude agent, allowing users to input any model name (e.g., custom model versions or preview builds)
  • Model inference: Automatically detect and handle custom Claude model strings that don't match presets
  • Web UI: Add custom model input field with translated placeholder and validation messages
  • Tests: Update model options test to include the new custom option

Test plan

  • Model options test passes with custom option included
  • Manual testing of custom model input in web UI
  • Verify custom model is correctly passed to Claude agent on spawn

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • No issues found.

Summary

  • Review mode: initial
  • Reviewed the full diff for runner-spawned Claude model propagation and the NewSession custom model UI. Residual risk: no automated web interaction test covers the custom-model field/validation path.

Testing

  • Not run (automation)

HAPI Bot

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Minor] Reuse the shared Claude preset list — this helper now hard-codes the same preset aliases that already live in @hapi/protocol, so the next preset addition can make runner-spawned preset sessions look like custom models and set ANTHROPIC_DEFAULT_HAIKU_MODEL unexpectedly. Evidence cli/src/runner/run.ts:28.
    Suggested fix:
    import { CLAUDE_MODEL_PRESETS } from '@hapi/protocol';
    
    const CLAUDE_BUILT_IN_MODEL_ALIASES = new Set<string>(CLAUDE_MODEL_PRESETS);

Summary

  • Review mode: follow-up after new commits
  • Reviewed the full latest diff, using the previous no-finding bot review and compare diff as context. One minor maintainability issue found; no blocker/major correctness or security issue found in the custom model submit/spawn path.

Testing

  • Not run: bun is not installed in this runner image (bun: command not found).

HAPI Bot

Comment thread cli/src/runner/run.ts Outdated
import { resolveWorkspaceRoot } from '@/utils/workspaceRoot';
import { hashRunnerCliApiToken } from './runnerIdentity';

const CLAUDE_BUILT_IN_MODEL_ALIASES = new Set(['opus', 'opus[1m]', 'sonnet', 'sonnet[1m]']);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MINOR] This duplicates the canonical Claude preset list from @hapi/protocol (CLAUDE_MODEL_PRESETS). If a new built-in preset is added there, runner-spawned sessions using that preset will be treated as custom here and will set ANTHROPIC_DEFAULT_HAIKU_MODEL unexpectedly.

Suggested fix:

import { CLAUDE_MODEL_PRESETS } from '@hapi/protocol';

const CLAUDE_BUILT_IN_MODEL_ALIASES = new Set<string>(CLAUDE_MODEL_PRESETS);

Replace hard-coded preset aliases with the shared constant so new presets
are automatically picked up without requiring a parallel update here.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings
No issues found.

Summary
Review mode: follow-up after new commits
Reviewed the full latest diff, with the prior bot review and the 40db34c1f7c27b05187cc913dca6b4b66b962e0c...c2f8107ea5e2044dc312591bd3ff632e12c9e22d compare as follow-up context. The previous minor finding is addressed by using CLAUDE_MODEL_PRESETS; no blocker/major/minor correctness, security, regression, data loss, performance, or maintainability issues found. Residual risk: tests were not executed in this automation pass.

Testing
Not run (automation)

HAPI Bot

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings
No issues found.

Summary
Review mode: follow-up after new commits
Reviewed the full latest diff, using the prior HAPI Bot review at c2f8107ea5e2044dc312591bd3ff632e12c9e22d and the compare to ca5222b6fc2f482197692d72da322184ff9f2f34 as follow-up context. No blocker/major/minor correctness, security, regression, data loss, performance, or maintainability issues found. Residual risk: the custom Claude startup path is covered by focused unit coverage, but I could not execute it in this environment.

Testing
Not run: bun test cli/src/runner/buildCliArgs.test.ts web/src/components/NewSession/types.test.ts failed because bun is not installed in the runner environment.

HAPI Bot

Resolve conflicts by combining:
- Custom Claude model support (shouldSetClaudeHaikuModelEnv, customModel state, ModelSelector props)
- Upstream multiple workspace roots support (workspaceRoots plural)
- Upstream OpenCode model selector (OpencodeModelSelector conditional)
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Findings
No issues found.

Summary
Review mode: follow-up after new commits
No blocker/major/minor issues found in the latest diff. Residual risk: the custom Claude model flow only has unit-level coverage changes here, and I could not execute the Bun test suite in this environment.

Testing
Not run (automation)

HAPI Bot

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