refactor: scope harness configuration by target - #294
Conversation
Move Harness-specific launch settings under HarnessTarget entries and let each Harness validate its own fields. Add configured Target selection to the CLI and TUI, including /target for multiple instances of the same Harness. The old flat Harness fields are intentionally unsupported.
| const base = DEFAULT_CONFIG.targets[targetId]; | ||
| const supplied = record(configured[targetId]); | ||
| const candidate = { ...(base ?? {}), ...(supplied ?? {}) }; | ||
| if (typeof candidate.harness !== "string" || !candidate.harness.trim()) continue; |
There was a problem hiding this comment.
🤖 devloop code-review · seed-2.1-pro
The loadTargets function silently drops misconfigured targets with no feedback to the user. Two cases are affected:
-
Invalid target ID (line 60): If a target ID doesn't match
/^[A-Za-z0-9][A-Za-z0-9._-]*$/, the entire entry is skipped withcontinue. For example, a target namedmy codex(with a space) would be silently ignored. -
Missing
harnessfield (line 64): If the merged config has no validharnessstring, the entry is skipped. A user who configurestargets: { my-codex: { command: ["codex", "app-server"] } }(forgettingharness: "codex") gets no indication their target was dropped.
Since the config module has no logging mechanism (console.warn/console.error are not used anywhere in this file or the config directory), user-facing misconfiguration goes entirely unnoticed. The user's only symptom would be that their target doesn't appear in CLI/TUI selection, with no explanation.
ccr:fp=707cede1efb7
There was a problem hiding this comment.
ccr:label=minor — 属实:src/config/config.ts:60/64 会丢弃非法 Target id 或缺失 harness 的自定义 Target,调用方只收到缩减后的 targets,CLI/TUI 无法解释该 Target 为何消失;合法配置执行不受影响,属于配置可诊断性问题。
|
🤖 devloop code-review · 1 finding(s)(1 条已作为独立 review thread 发布) |
Move Harness-specific launch settings under HarnessTarget entries and let each
Harness validate its own fields. Add configured Target selection to the CLI and
TUI, including /target for multiple instances of the same Harness.
The old flat Harness fields are intentionally unsupported.