Conversation
…ixes #3218) hooksConfig and hooks are llxprt-internal hooks-system config, but separateSettings() treated them as unknown keys, which default to the modelParams pass-through bucket. They then flowed into outbound request bodies and backends rejected them with "400 Unsupported parameter: hooksConfig" (observed on the Codex provider after saving the model config screen). Route both keys to cliSettings via INTERNAL_SETTINGS_KEYS, the same classification used for the tools object, so hooks config stays available to the CLI while never being serialized onto a request.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughChangesHooks configuration boundary
Estimated code review effort: 3 (Moderate) | ~20 minutes Mergeability Score: ⚪ Minimal · up to The change keeps internal hooks settings out of outbound API requests while preserving CLI access, and no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
WalkthroughBefore this change, hooks-related configuration could still be classified as a regular setting and therefore travel through Release NotesNew Features
Bug Fixes
Tests
Refactor
Changes
Sequence DiagramsequenceDiagram
participant Config as Settings Config
participant Registry as Settings Registry
participant Separator as separateSettings()
participant Provider as Provider Request Builder
participant API as Outbound API
Config->>Registry: Provide settings including hooksConfig and hooks
Registry->>Registry: Classify hooksConfig and hooks as internal settings
Registry->>Separator: Pass settings with internal classification
Separator->>Separator: Route internal keys to cliSettings bucket
Separator->>Separator: Exclude internal keys from modelParams
Separator->>Provider: Return SeparatedSettings without hooks in modelParams
Provider->>Provider: Build request body from modelParams only
Provider->>API: Send API request without hooks configuration
Magnitude🎯 1 (S) RelatedNo related items found. Pre-merge Checks
Walkthrough generated by LLxprt PR Review. Planner issue: #2256 |
OpenCodeReview — PR #3223
|
TLDR
Fixes a model-config leak where
hooksConfig(andhooks) — llxprt-internal hooks-system configuration — was serialized into outbound API request bodies, causing backends to reject requests with400 Unsupported parameter: hooksConfig. The root cause is a single missing classification in the settings registry: unknown keys default to themodelParamspass-through bucket and flow to the wire.Dive Deeper
Root cause
When settings flow from the global settings store into the runtime invocation context, they pass through
separateSettings()(settings package). This function categorizes each key into one of four buckets:cliSettings,modelBehavior,modelParams, orcustomHeaders. Keys not registered inSETTINGS_REGISTRYand not inINTERNAL_SETTINGS_KEYSfall through to the unknown-key default:modelParams(pass-through to API).hooksConfig(the hooks-system toggle/notifications/disabled config) andhooks(hook event definitions) were never registered in the settings package'sSETTINGS_REGISTRY. They are defined in the CLI's settings schema (for the dialog UI) but that schema is separate from the settings package's runtime categorization registry. So both keys were treated as unknown and routed tomodelParams.The data flow:
hooksConfig) are loaded into the ephemerals snapshot viabuildEphemeralsSnapshot()separateSettings()categorizes the snapshot —hooksConfigfalls through tomodelParamsbecause it has no specmodelParamsis spread into the request body by the provider's request builderhooksConfigparameter with HTTP 400Fix
Add
hooksConfigandhookstoINTERNAL_SETTINGS_KEYSinpackages/settings/src/settings/settingsRegistry.ts. This is the same classification used for thetoolsobject — another llxprt-internal config that must never reach the API. Both keys now route tocliSettingsinstead ofmodelParams, keeping them available to the CLI viacontext.getCliSetting()while preventing serialization onto any request body.This fixes the leak for all providers (Codex/OpenAI Responses, OpenAI Chat Completions, Anthropic, Gemini), not just the Codex path where it was observed.
Files changed
packages/settings/src/settings/settingsRegistry.ts— AddhooksConfigandhookstoINTERNAL_SETTINGS_KEYSpackages/settings/src/__tests__/settingsRegistry.test.ts— 4 behavioral tests proving both keys route to cliSettings, not modelParams, across providerspackages/providers/src/openai-responses/__tests__/OpenAIResponsesProvider.hooksConfigLeak.test.ts— 3 end-to-end provider tests provinghooksConfig/hooksdo not appear in the Codex and non-Codex Responses request bodiesReviewer Test Plan
Settings-level: Run
bun test packages/settings/src/__tests__/settingsRegistry.test.tsand verify the 4 new tests under "hooks system config never leaks into modelParams" pass.Provider-level: Run
bun test packages/providers/src/openai-responses/__tests__/OpenAIResponsesProvider.hooksConfigLeak.test.tsand verify the 3 tests pass. These tests construct a realOpenAIResponsesProviderin Codex mode, injecthooksConfiginto the ephemerals snapshot, capture the fetch request body, and asserthooksConfigis absent.Regression verification: Temporarily revert the
settingsRegistry.tschange and re-run the provider tests — they will fail withhooksConfigpresent in the request body, confirming the tests are genuine regression guards.Testing Matrix
Verified on macOS: typecheck, lint, eslint guard, format, build, smoke test, settings + providers + core workspace test suites all pass.
Linked issues / bugs
Fixes #3218
Summary by CodeRabbit
Bug Fixes
Tests