Skip to content

fix: wire worker model from preferences through to lane runner#522

Merged
HenryLach merged 4 commits into
HenryLach:mainfrom
NerfEko:fix/worker-model-from-preferences
May 4, 2026
Merged

fix: wire worker model from preferences through to lane runner#522
HenryLach merged 4 commits into
HenryLach:mainfrom
NerfEko:fix/worker-model-from-preferences

Conversation

@NerfEko
Copy link
Copy Markdown
Contributor

@NerfEko NerfEko commented Apr 28, 2026

Summary

Mirrors the existing reviewer model pipeline (buildReviewerEnvTASKPLANE_REVIEWER_MODELextraEnvVarsLaneRunnerConfig) for workers, so taskRunner.worker.model in preferences.json actually takes effect.

Type of Change

  • fix (bug fix)

Problem

The reviewer model flows through a dedicated pipeline:

buildReviewerEnv() → TASKPLANE_REVIEWER_MODEL → extraEnvVars → LaneRunnerConfig.reviewerModel → --model flag

No equivalent exists for workers. Three specific gaps:

  1. TaskRunnerConfig has reviewer?: { model, thinking, tools, … } but workers only get workerExcludeExtensions?: string[] — no model field
  2. buildReviewerEnv() exists but no buildWorkerEnv()
  3. LaneRunnerConfig hardcodes workerModel: "" while reviewerModel reads from env

Changes

File Change
types.ts Add worker?: { model, thinking, tools, excludeExtensions } to TaskRunnerConfig
config-loader.ts Add worker field to toTaskRunnerConfig() return value
execution.ts Add buildWorkerEnv(), add workerConfig param to executeWave(), wire into extraEnvVars, read workerModel/workerTools/workerThinking from env vars
engine.ts Pass worker config in executeWave() calls, wire buildWorkerEnv() into executeLaneV2 retries

Key before/after

execution.ts — LaneRunnerConfig builder:

- workerModel: "",
- workerTools: "read,write,edit,bash,grep,find,ls",
- workerThinking: "",
+ workerModel: extraEnvVars?.TASKPLANE_WORKER_MODEL || "",
+ workerTools: extraEnvVars?.TASKPLANE_WORKER_TOOLS || "read,write,edit,bash,grep,find,ls",
+ workerThinking: extraEnvVars?.TASKPLANE_WORKER_THINKING || "",

engine.ts — executeWave call:

+ runnerConfig?.worker ? {
+     model: runnerConfig.worker.model || "",
+     thinking: runnerConfig.worker.thinking || "",
+     tools: runnerConfig.worker.tools || "",
+     excludeExtensions: runnerConfig.worker.excludeExtensions ?? [],
+ } : undefined,
  runnerConfig?.workerExcludeExtensions ?? [],

Validation

  • npm test — config-loader: 95 pass / 0 fail, lane-runner: 47 pass / 1 fail (pre-existing, fails on clean branch too)
  • Manual smoke test performed — configured taskRunner.worker.model: "openrouter/moonshotai/kimi-k2.6" in preferences.json, verified kimi-k2.6 usage appears in OpenRouter dashboard. Reviewer model continues to work as before.
  • taskplane doctor — all checks passed
  • All test failures are pre-existing, not caused by this change

Documentation

  • Docs updated for user-facing changes
  • Reference docs updated (commands/config/task format), if applicable
  • CHANGELOG.md updated (for release-relevant changes)

Checklist

  • Changes are scoped and focused
  • No secrets/private data introduced
  • No breaking changes — backward compatible (empty string = inherit, as before)
  • Follows reviewer model pattern exactly

Related Issues

None (new bug discovered)

Mirrors the existing reviewer model pipeline (buildReviewerEnv) for workers.

4 files, 62 insertions, 6 deletions
- types.ts: Add worker?: { model, thinking, tools, excludeExtensions } to TaskRunnerConfig
- config-loader.ts: Add worker field to toTaskRunnerConfig() return value
- execution.ts: Add buildWorkerEnv(), add workerConfig param to executeWave(),
  wire into extraEnvVars, read workerModel/workerTools/workerThinking from env vars
- engine.ts: Pass worker config in executeWave() calls, wire buildWorkerEnv()
  into executeLaneV2 retry call sites

Tests: project-config-loader 95/95 pass
Fixes: worker model from preferences.json being ignored
Copilot AI review requested due to automatic review settings April 28, 2026 06:54
@NerfEko NerfEko requested a review from HenryLach as a code owner April 28, 2026 06:54
Copy link
Copy Markdown

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

Fixes worker agent configuration propagation so taskRunner.worker.* in preferences.json (and project config) actually affects Runtime V2 lane execution, mirroring the existing reviewer model pipeline.

Changes:

  • Extends TaskRunnerConfig to include worker model/thinking/tools (+ excludeExtensions) configuration.
  • Adds buildWorkerEnv() and wires worker env vars through executeWave() into executeLaneV2() / LaneRunnerConfig.
  • Updates engine wave execution and retry paths to pass worker config through to execution.

Reviewed changes

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

File Description
extensions/taskplane/types.ts Adds TaskRunnerConfig.worker shape for worker agent configuration.
extensions/taskplane/config-loader.ts Adapts unified config → legacy task-runner config to include worker fields.
extensions/taskplane/execution.ts Adds buildWorkerEnv(), extends executeWave() signature, and reads worker model/tools/thinking from env when building LaneRunnerConfig.
extensions/taskplane/engine.ts Passes worker config into executeWave() and includes worker env vars in certain retry env injections.

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

Comment thread extensions/taskplane/execution.ts
Comment thread extensions/taskplane/execution.ts
Comment thread extensions/taskplane/execution.ts Outdated
Comment thread extensions/taskplane/engine.ts Outdated
Comment thread extensions/taskplane/execution.ts
@NerfEko NerfEko force-pushed the fix/worker-model-from-preferences branch 2 times, most recently from 3763b3e to d319e27 Compare April 28, 2026 07:07
1. resume.ts: add workerConfig param to executeWave call
2-3. execution.ts: remove excludeExtensions from buildWorkerEnv (sole owner: buildWorkerExcludeEnv)
4. engine.ts: no buildWorkerEnv in modelFallbackRetry (preserves fallback semantics)
5. tests/worker-model.test.ts: 11 tests for buildWorkerEnv
HenryLach added 2 commits May 4, 2026 12:34
…test window

- Retag @SInCE TP-183 → @SInCE TP-181 in types.ts, execution.ts,
  worker-model.test.ts (PR author guessed at the task ID; this work is
  tracked as TP-181 in taskplane-tasks/CONTEXT.md).
- Widen lane-runner-v2.test.ts test 3.6's executeLaneV2 source slice
  from 5000 to 6000 chars. The new TASKPLANE_WORKER_{MODEL,THINKING,TOOLS}
  env reads pushed runGit( past the 5000-char window. Both target calls
  (commitTaskArtifacts, runGit) are still present in the function — the
  test was brittle to function body growth, not detecting a real regression.
- CHANGELOG: add Unreleased/Fixed entry crediting @NerfEko (HenryLach#522).
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.

3 participants