🐛 Align ExecutorSettings across WishRefiner, Copilot, CodeWiki and Run resume #2

Open
zhanghongming wants to merge 1 commits from fix/executor-settings-alignment into review/overhaul

Summary

Align tenant claude-code ExecutorSettings (baseUrl, defaultModel, askModel, askFallbackModel) across every control-plane caller and backfill missing run.providerModel when resuming a waiting or paused Run.

 Connections.forRun / WishRefiner / Copilot / CodeWiki
-  baseUrl = providerBaseUrl(env, "claude-code")
-  model   = copilotModel(env)
+  baseUrl = effectiveBaseUrl(env, tenantId, "claude-code", settings)
+  model   = settings.askModel || copilotModel(env)

 askClaude
   env = {
     ...(home ? localCredentialEnv(home) : {}),
+    ...credentialEnv,
     ...modelEnv,
-    ...credentialEnv,
   }

 ControlPlane.command (resume / answer)
+  if (!run.providerModel)
+    run.providerModel = defaultRunModel(tx, project, bundle?.model, run.provider)
   run.status = "queued"

Evidence

  • Before:
    • WishRefiner.tenantCredentials, Copilot (ask / stream), and CodeWiki ignored tenant ExecutorSettings.baseUrl (and Copilot / CodeWiki ignored ExecutorSettings.askModel); askClaude spread credentialEnv after modelEnv, letting ANTHROPIC_MODEL in credentialEnv override an explicit model or fallback retry.
    • Runs submitted before ExecutorSettings.defaultModel was configured stayed pinned to providerModel: undefined, so resuming (resume / answer) a Run stuck in waiting (403 The requested model 'claude-opus-5-5' is not available) failed again with the CLI default model.
  • After:
    • npm run format:check && npm run typecheck && npm test -> 692 Vitest tests + 87 Node tests passed.
    • Live verification on local stack (droboticflow Run 7fe00b05-6811-42c6-ae47-540c6cf4bb5f): after configuring PUT /api/executor-settings/claude-code (defaultModel: "deepseek-flash@latest", fallbackModel: "deepseek-pro@latest") and calling POST /api/runs/7fe00b05-6811-42c6-ae47-540c6cf4bb5f/commands ({"action":"resume"}), run.providerModel backfilled to "deepseek-flash@latest" and claude ran with --model deepseek-flash@latest --fallback-model deepseek-pro@latest past the 403 gateway check.

Merge Danger

Door: two-way

Pure control-plane/runtime model & gateway resolution alignment with no schema migration.

Blast Radius: Narrow

Affects claude-code ExecutorSettings consumers (Connections, WishRefiner, Copilot, CodeWiki, askClaude) and ControlPlane.command resumption only when run.providerModel was unset; explicit wish, project, and bundle models retain precedence.

## Summary Align tenant `claude-code` `ExecutorSettings` (`baseUrl`, `defaultModel`, `askModel`, `askFallbackModel`) across every control-plane caller and backfill missing `run.providerModel` when resuming a waiting or paused Run. ```diff Connections.forRun / WishRefiner / Copilot / CodeWiki - baseUrl = providerBaseUrl(env, "claude-code") - model = copilotModel(env) + baseUrl = effectiveBaseUrl(env, tenantId, "claude-code", settings) + model = settings.askModel || copilotModel(env) askClaude env = { ...(home ? localCredentialEnv(home) : {}), + ...credentialEnv, ...modelEnv, - ...credentialEnv, } ControlPlane.command (resume / answer) + if (!run.providerModel) + run.providerModel = defaultRunModel(tx, project, bundle?.model, run.provider) run.status = "queued" ``` ## Evidence - **Before:** - `WishRefiner.tenantCredentials`, `Copilot` (`ask` / `stream`), and `CodeWiki` ignored tenant `ExecutorSettings.baseUrl` (and `Copilot` / `CodeWiki` ignored `ExecutorSettings.askModel`); `askClaude` spread `credentialEnv` after `modelEnv`, letting `ANTHROPIC_MODEL` in `credentialEnv` override an explicit `model` or fallback retry. - Runs submitted before `ExecutorSettings.defaultModel` was configured stayed pinned to `providerModel: undefined`, so resuming (`resume` / `answer`) a Run stuck in `waiting` (`403 The requested model 'claude-opus-5-5' is not available`) failed again with the CLI default model. - **After:** - `npm run format:check && npm run typecheck && npm test` -> **692 Vitest tests + 87 Node tests passed**. - Live verification on local stack (`droboticflow` Run `7fe00b05-6811-42c6-ae47-540c6cf4bb5f`): after configuring `PUT /api/executor-settings/claude-code` (`defaultModel: "deepseek-flash@latest"`, `fallbackModel: "deepseek-pro@latest"`) and calling `POST /api/runs/7fe00b05-6811-42c6-ae47-540c6cf4bb5f/commands` (`{"action":"resume"}`), `run.providerModel` backfilled to `"deepseek-flash@latest"` and `claude` ran with `--model deepseek-flash@latest --fallback-model deepseek-pro@latest` past the `403` gateway check. ## Merge Danger **Door:** two-way Pure control-plane/runtime model & gateway resolution alignment with no schema migration. **Blast Radius:** Narrow Affects `claude-code` `ExecutorSettings` consumers (`Connections`, `WishRefiner`, `Copilot`, `CodeWiki`, `askClaude`) and `ControlPlane.command` resumption only when `run.providerModel` was unset; explicit wish, project, and bundle models retain precedence.
zhanghongming added 1 commit 2026-11-12 09:39:21 +08:00
🐛 Align ExecutorSettings across WishRefiner, Copilot, CodeWiki and Run resume
Some checks failed
CI / Format, types and tests (pull_request) Has been cancelled
CI / PostgreSQL migrations and integration tests (pull_request) Has been cancelled
dbf9fbedab
Some checks failed
CI / Format, types and tests (pull_request) Has been cancelled
CI / PostgreSQL migrations and integration tests (pull_request) Has been cancelled
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fix/executor-settings-alignment:fix/executor-settings-alignment
git checkout fix/executor-settings-alignment
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: On-Prem/wishforge-ide#2
No description provided.