Skip to content

Fix: Forward customModel to batch synopsis call#581

Merged
pedramamini merged 2 commits into0.16.0-RCfrom
fix/batch-synopsis-custom-model
Mar 17, 2026
Merged

Fix: Forward customModel to batch synopsis call#581
pedramamini merged 2 commits into0.16.0-RCfrom
fix/batch-synopsis-custom-model

Conversation

@pedramamini
Copy link
Collaborator

Summary

Context

Follow-up to #563 — the task-execution call got customModel forwarded but the synopsis call was missed.

Test plan

  • Existing agent-spawner tests pass (verified via pre-push hook)
  • Batch processor with custom model uses that model for both task execution and synopsis

The task-execution call forwards customModel but the synopsis call did not,
causing synopsis generation to use the default model instead of the user's
configured custom model.
@coderabbitai
Copy link

coderabbitai bot commented Mar 17, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 778f4407-eeb3-4251-973c-8befaa3fadf7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/batch-synopsis-custom-model
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@greptile-apps
Copy link

greptile-apps bot commented Mar 17, 2026

Greptile Summary

This PR is a targeted follow-up to #563 that forwards customModel to the synopsis spawnAgent call in batch-processor.ts, ensuring synopsis generation uses the user's configured model consistently with the task-execution call. It also includes a cosmetic reformatting of CLAUDE_ARGS in agent-spawner.ts.

  • batch-processor.ts: Adds { customModel: session.customModel } as the options argument to the synopsis spawnAgent call (lines 483–484), making it symmetric with the already-fixed task-execution call.
  • agent-spawner.ts: Collapses the multi-line CLAUDE_ARGS array to a single line — no functional change.
  • Pre-existing gap: customModel is extracted inside spawnAgent but is never forwarded to spawnClaudeAgent. Claude Code users who configure a custom model will still see it silently ignored in both task-execution and synopsis paths. The comment in spawnClaudeAgent acknowledges this limitation, though Claude Code CLI does accept --model. This is not introduced by this PR, but the fix is incomplete for the claude-code tool type.

Confidence Score: 4/5

  • Safe to merge — the change is minimal, correct for non-Claude-Code agents, and introduces no regressions.
  • The fix is a one-liner that makes the synopsis call consistent with the task-execution call. The only concern is a pre-existing limitation where customModel is silently ignored for claude-code agents, but this PR doesn't worsen that situation — it simply doesn't fix it either.
  • No files require special attention; the pre-existing spawnClaudeAgent limitation in agent-spawner.ts is worth addressing in a follow-up if Claude Code custom model support is desired.

Important Files Changed

Filename Overview
src/cli/services/batch-processor.ts Adds { customModel: session.customModel } as the options argument to the synopsis spawnAgent call, making it consistent with the task-execution call added in #563. The change is minimal, correct, and addresses the stated goal for non-Claude-Code agents.
src/cli/services/agent-spawner.ts Pure formatting fix — collapses the multi-line CLAUDE_ARGS constant to a single line. No functional change, but highlights a pre-existing gap: customModel extracted in spawnAgent is never forwarded to spawnClaudeAgent, so Claude Code users with a custom model still won't see it applied in either task execution or synopsis calls.

Sequence Diagram

sequenceDiagram
    participant BP as batch-processor.ts<br/>(runPlaybook)
    participant SA as agent-spawner.ts<br/>(spawnAgent)
    participant CL as spawnClaudeAgent
    participant JL as spawnJsonLineAgent

    Note over BP: Task Execution
    BP->>SA: spawnAgent(toolType, cwd, finalPrompt, undefined,<br/>{ customModel })
    alt toolType === 'claude-code'
        SA->>CL: spawnClaudeAgent(cwd, prompt, agentSessionId, readOnly)
        Note over CL: ⚠️ customModel silently dropped
    else usesJsonLineOutput
        SA->>JL: spawnJsonLineAgent(..., customModel)
        Note over JL: ✅ customModel applied via def.modelArgs
    end

    Note over BP: Synopsis Generation (this PR's fix)
    BP->>SA: spawnAgent(toolType, cwd, BATCH_SYNOPSIS_PROMPT,<br/>result.agentSessionId, { customModel })
    alt toolType === 'claude-code'
        SA->>CL: spawnClaudeAgent(cwd, prompt, agentSessionId, readOnly)
        Note over CL: ⚠️ customModel silently dropped (pre-existing)
    else usesJsonLineOutput
        SA->>JL: spawnJsonLineAgent(..., customModel)
        Note over JL: ✅ customModel now correctly forwarded
    end
Loading

Comments Outside Diff (1)

  1. src/cli/services/agent-spawner.ts, line 518-520 (link)

    P2 customModel silently dropped for claude-code

    customModel is extracted from options (line 516) but is never forwarded to spawnClaudeAgent — the function signature doesn't even accept it. This means that even after this PR's fix in batch-processor.ts, synopsis (and task-execution) calls for Claude Code users who configure a custom model will silently ignore it and fall back to the default model.

    The spawnClaudeAgent JSDoc acknowledges this ("Custom model … [is] not supported in CLI mode"), but Claude Code CLI does accept a --model flag. If supporting customModel for Claude Code is in scope, spawnClaudeAgent would need a customModel?: string parameter and the corresponding --model <value> args appended — similar to how spawnJsonLineAgent handles it via def.modelArgs. At minimum, it may be worth updating the comment to explicitly note that customModel is intentionally unsupported rather than merely a missing feature.

Last reviewed commit: a787abb

@pedramamini pedramamini merged commit 413acaa into 0.16.0-RC Mar 17, 2026
5 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