Skip to content

gut(config): remove dead agent params bags (#2481)#2487

Merged
alexey-pelykh merged 1 commit intomainfrom
refactor/gut-agent-params-2481
Apr 22, 2026
Merged

gut(config): remove dead agent params bags (#2481)#2487
alexey-pelykh merged 1 commit intomainfrom
refactor/gut-agent-params-2481

Conversation

@alexey-pelykh
Copy link
Copy Markdown

Summary

Per-agent AgentConfig.params and per-model agents.defaults.models[<id>].params were placeholders for LLM request parameters (temperature, cacheRetention, thinking mode, etc.) with zero production readers. RemoteClaw is middleware that delegates LLM execution to CLI runtimes (Claude, Gemini, Codex, OpenCode), so those knobs belong to the runtime, not middleware config.

Closes #2481.

Changes

  • src/config/types.agents.ts: remove params?: Record<string, unknown> field from AgentConfig. This field was TypeScript-only — it was never in the AgentEntrySchema zod schema (which is .strict()), so real configs with agents.list[].params were already being rejected at validation.
  • src/config/zod-schema.agent-defaults.ts: remove per-model params: z.record(z.string(), z.unknown()).optional() from the models schema entry.
  • src/config/schema.base.generated.ts: regenerated via scripts/generate-base-config-schema.tsparams key no longer appears under agents.defaults.models.*.properties.
  • src/config/legacy.rules.ts: add two rules warning users about obsolete agents.list[].params and agents.defaults.models[<id>].params fields.
  • src/config/legacy.migrations.ts: add strip-agent-params-bags migration that walks agents.list[] and agents.defaults.models[<id>] to remove params before strict zod validation.
  • src/config/config-misc.test.ts: add regression tests for both the legacy-issue flagging path and the auto-strip migration path.

Migration choice

Option B (migration warning + strip) — consistent with #2479 (embeddedPi gut) and #2480 (thinkingDefault gut). Users with params under an agent list entry or per-model section will see a legacyIssues diagnostic and the field is silently stripped before the strict zod schema runs, so existing configs continue to parse.

We rejected Option A (passthrough) because weakening .strict() to .passthrough() would silently swallow typos and leftover fields with no user-visible signal.

Coordination

Issue #2481 flagged orphan tests in src/commands/agent.test.ts overlapping with #2480 and #2482. Since #2480 landed first, the "prefers per-model thinking over global thinkingDefault" test it referenced is already gone — no coordination needed with #2482.

The runEmbeddedPiAgent = vi.fn() mock identifiers remaining in test files are historical names for mocked module exports, not live calls, and are out of scope.

Test plan

  • pnpm tsgo — no TypeScript errors
  • pnpm lint (oxlint --type-aware) — 0 warnings, 0 errors
  • pnpm vitest run src/config/ — 96 test files, 740 tests, all pass (including 2 new regression tests for this PR)
  • rg "AgentConfig.*params\?|config\.params|agent\.params" src/ — only pre-existing generic function-param refs (no production reads of the removed field)
  • rg "models\.\w+\.params|model\.params|\.params\?\.thinking" src/ — 0 matches
  • Fork-integrity gates (rebrand-leakage, zombie-imports, stub-debt, throwing-stub-callers, obsolescence-audit, attestations) — all pass

🤖 Generated with Claude Code

Per-agent `AgentConfig.params` (types only, never in zod schema) and
per-model `agents.defaults.models[<id>].params` (zod-accepted, strict)
were placeholders for LLM request params (temperature, cacheRetention,
thinking mode, etc.) with zero production readers — the middleware
delegates LLM execution to CLI agents, so those knobs belong to the
runtime, not middleware config.

- Remove `params?: Record<string, unknown>` from `AgentConfig` type
- Remove per-model `params: z.record(...)` from agent-defaults zod
- Regenerate `src/config/schema.base.generated.ts`
- Add legacy rules + migration (`strip-agent-params-bags`) to warn and
  strip `agents.list[].params` and `agents.defaults.models[<id>].params`
  before strict zod validation — chose Option B (migration warning) over
  Option A (passthrough) for consistency with #2479/#2480
- Add regression tests for both the flagging path and the strip path

Orphan `agent.test.ts` thinking test referenced in the issue was already
removed by #2480 — no coordination needed with #2482.

(#2481)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@alexey-pelykh alexey-pelykh merged commit 9e0ae8e into main Apr 22, 2026
15 checks passed
@alexey-pelykh alexey-pelykh deleted the refactor/gut-agent-params-2481 branch April 22, 2026 21:44
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.

refactor(config): remove dead agent params bags

1 participant