1jehuang / 1jehuang/jcode

Bug Report: `swarm spawn` `model` parameter is ignored and inherits coordinator model

Open
#1,175 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug question ux
Dominant language
Rust
Stars
19.9k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
30

Description

Bug Report: swarm spawn model parameter is ignored and inherits coordinator model

  • Reporter: yamada-masa
  • Date: 2026-09-04
  • Version: jcode v0.81.6 (4f0f9819a)
  • Severity: High (Directly causes self-review failures)

Summary

When specifying the model parameter in swarm spawn, the swarm worker inherits the coordinator's model instead. The specified model is completely ignored.

This completely breaks use cases like "spawning a worker with a different model for code review":

  • Results in a self-review (reviewing oneself using the same model), making the review meaningless.
  • Prevents split-role workflows (e.g., Coder using one model and Reviewer using another, per Constitution Article 7).

Reproduction Steps

Experiment 1: Specifying a bare model
{
  "action": "spawn",
  "model": "z-ai/glm-5.2:free",
  "prompt": "(short prompt)",
  "label": "PR82 reviewer"
}

  • Actual Model Used: deepseek-v4-flash (same as coordinator)
  • Expected: z-ai/glm-5.2:free
Experiment 2: Specifying a route-pinned model
{
  "action": "spawn",
  "model": "openrouter/z-ai/glm-5.2:free",
  "prompt": "(short prompt)",
  "label": "model probe"
}

  • Actual Model Used: deepseek-v4-flash (same as coordinator)
  • Expected: z-ai/glm-5.2:free

In both cases, the spawned session's journal (~/.jcode/sessions/session_*.journal.jsonl) recorded "model":"deepseek-v4-flash", and the specified z-ai/glm-5.2:free was never used.


Expected Behavior

When model (and optionally provider) is passed to swarm spawn, the worker should start with the specified model.

The list_models help text states:

"configure agents.swarm_model with a bare model or route-pinned value"

This implies setting agents.swarm_model pins the worker model, but having spawn-time parameters ignored is clearly an inconsistency.


Actual Behavior

  1. Ran swarm spawn model="z-ai/glm-5.2:free".
  2. Checked the journal of the spawned agent.
  3. Found that "model":"deepseek-v4-flash" (inherited from the coordinator) was used instead.

Impact

  • Self-Review Failures: Intending to review with a different model fails silently, using the same model instead and rendering reviews meaningless.
  • Breakdown of Role-Based Model Operations: Impossible to delegate tasks (e.g., Coder = minimax-m3:free / Reviewer = glm-5.2:free).
  • Potential Cost Incidents: If using a paid model for the coordinator, all workers might unintentionally run on paid models.

Environment

  • jcode: v0.81.6 (4f0f9819a)
  • settings.json:
{
  "default_provider": "openrouter",
  "model": "openrouter/free"
}

  • config.toml [agents]:
[agents]
swarm_spawn_mode = "inline"
swarm_strip_layout = "vertical"
memory_sidecar_enabled = true
memory_rerank_cadence = 3
memory_rerank_votes = 2
memory_rerank_min_agree = 2
memory_embedding_backend = "local"
swarm_max_concurrent_agents = 32

swarm_model not set (Could this be the cause? Though spawn parameters being ignored is a separate issue).

  • agents.swarm_model is single-value only (multiple not allowed).
  • Coordinator model: deepseek-v4-flash (via OpenCode Go? Evidence found in journal under "provider":"openai-compatible:opencode-go").
list_models Header (Relevant Output)
Current coordinator model: deepseek-v4-flash
No agents.swarm_model pin configured (workers inherit the coordinator's model).
(configure agents.swarm_model with a bare model or route-pinned value)


Possible Causes (Hypothesis)

  1. Spawn API ignores the model parameter: The spawn tool schema might include it, but implementation is missing.
  2. Hardcoded coordinator inheritance when agents.swarm_model is unset: Spawn-side models only take effect if swarm_model is configured globally.
  3. Model name normalization issue: z-ai/glm-5.2:free fails to resolve in the backend, triggering a fallback.

Suggested Fixes

  1. Ensure spawn model / provider parameters are respected (Highest priority).
  2. Prioritize spawn-parameter models even if agents.swarm_model is unset.
  3. Documentation: Either document the limitation that models cannot be overridden at spawn time, or fix the implementation.

Workaround (Current)

  • Set swarm_model = "z-ai/glm-5.2:free" under [agents] in ~/.jcode/config.toml (unverified, though suggested by list_models help text).
  • However, this forces a single fixed model globally, making role-based separation impossible.

Attachments

  • Reproduction session journal: session_hog_1788536706117_67b74ae9a3cf5916 (Experiment 1)
  • Reproduction session journal: session_kitten_1788537002476_f9127c22cd55af65 (Experiment 2)
    (Actual measured values are logged in the "model" field of these files)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the swarm spawn model-selection path and compare it with the agents.swarm_model handling described by list_models. Reproduce both model forms from the issue, then inspect the referenced session journals and confirm that the requested model and provider are recorded instead of deepseek-v4-flash; done means both spawn requests select their specified models.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
ai, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.