Repository navigation
fix(agentsetup): preserve user settings across setup runs - #366
Conversation
People often add credentials and other settings to an MCP server after setup. Replacing the entry on the next setup run discards those settings and can interrupt their connection. Keep user-owned values while applying the application's launch settings. Checks use the same ownership rule so those extra settings do not trigger unnecessary repairs.
Codex rejects settings that belong to a different transport, so carrying those settings across a switch prevents it from loading the config. Preserve settings that remain valid for the selected transport. Inline tables can also contain arrays of tables. Their elements must stay in an array when setup updates the surrounding server entry.
Codex reports an empty tool list for a disabled server. A generic success message makes that look like a running server with no tools. Name the disabled state while keeping the setup result current.
A disabled server cannot serve tools even when its configuration matches. Tell the user how to enable it so readiness reflects what the agent can use. A transport switch can leave Codex unable to load the old settings. Stop and name those settings so users can resolve the conflict without losing their choices. Header names need case-insensitive matching, and Copilot's default tool list must not replace a selection made by the user.
Codex prefers a retained bearer token over a supplied Authorization header. Report the conflict so users can choose which credential to keep without losing their existing configuration. Nested tables inside arrays must stay with their array elements. Moving them outside the array makes the entire Codex config unreadable.
Apps need to rerun setup as agent configs change. Replacing a whole MCP entry erased user settings, while checking only the app's old executable path marked a working hook as stale.
roborev: Combined Review (
|
Users need setup to keep their own settings and trusted hook registrations when an application changes its launch path. A disabled Codex server also needs an actionable status even when its command has drifted. Preserving settings is limited to launch-only updates on the same transport. Applications that supply other fields replace the entry so kit does not need to infer each agent's credential and transport rules.
Setup must retain user settings without changing large numbers in Claude Code's configuration. Keep the original encoded values intact while comparing registrations. The existing matching and reporting paths already cover the same cases, so the extra passes and duplicate tests add maintenance without extending the supported behavior.
A launch update must retain user settings without rounding large numbers. One registration exercises both requirements and keeps the regression close to the ownership rule it protects.
Setup spans config writes, native hook checks, and command output. Keeping each behavior at the layer that owns it makes failures easier to diagnose while retaining coverage of user settings and trusted moved hooks. Manual commands use different shell quoting on Windows, so the print check must match the platform's output.
roborev: Combined Review (
|
Users switching Claude Code between HTTP and SSE need settings from the old transport removed. Keeping them can leave a registration with settings intended for a different connection. Manual setup should explain when a selected agent or server name has no CLI command and continue to the remaining agents. Existing JSON values also need to retain their number and URL text when setup updates a registration.
A hook can carry commands for more than one platform. Callers need to know which arguments determine whether a moved executable keeps its registration.
Windows short paths can contain a tilde, so rejecting that character makes an installed hook look unavailable and can replace it on the next setup run. Relative PATH entries also need to resolve in the workspace where the hook runs. Keep JSON encoding errors visible so an unsupported value cannot be mistaken for a successful update.
roborev: Combined Review (
|
The manual setup command needs PowerShell's call operator on Windows. The check must accept that operator so it can verify the command remains available after an unsupported agent.
roborev: Combined Review (
|
Codex and Muse run Windows hooks in PowerShell. Commands with special characters must remain literal so checks can find the executable and setup can keep an existing hook after its executable moves.
roborev: Combined Review (
|
A caller that passes its own Windows command but no PowerShell one got a Codex or Muse hook with only the Unix command, which fails on Windows. Fall back to the caller's Windows command instead of dropping it. PowerShell runs a quoted executable only after the & call operator, so a hook written as 'C:\hook.exe' arg never runs. Treat it as needing repair instead of matching the generated command.
roborev: Combined Review (
|
Codex and Muse run hooks in PowerShell, which treats a leading quoted path as a string instead of a program. A caller's Windows command such as "C:\Program Files\hook.exe" run therefore installed cleanly but never ran. Prefix the call operator so the same command runs.
roborev: Combined Review (
|
…itten Codex and Muse run commandWindows in PowerShell and command in a POSIX shell. Converting a caller's Win32 command into PowerShell let PowerShell expand values such as $HOME, so a caller that sets CommandWindows for these agents now gets an error asking for CommandPowerShell instead. Writing command with Windows quoting on Windows broke the moved-hook check, which reads it as POSIX, so these agents now always get a POSIX command there. A moved hook is kept only when the other platform's command names the same executable with the same arguments. A stale or replaced override gets rewritten instead of silently surviving. Double-quoted literal words count as plain text, so a hand-written command quoted that way no longer reports unknown.
roborev: Combined Review (
|
…able Every unavailable-command error already names its agent, so the extra prefix printed it twice, as in "# cursor: manual MCP command unavailable for agent "cursor"".
roborev: Combined Review (
|
Apps can rerun setup without losing user settings on MCP entries or replacing hooks whose current executable path still resolves. Hook checks use the workspace the app names, and kit reports
unknownfor agents it can't inspect while continuing with the others. Missing items that setup can repair point to the app's repair command.Codex and Muse hooks now run on Windows even when a path or argument contains spaces,
$, or%, because kit writes them as literal PowerShell commands such as& 'C:\Program Files\hook.exe' 'run'. The next setup run rewrites hooks in the old form. An app that passes its own Windows command for these agents gets an error asking for a PowerShell one.Used by kenn-io/kata#1105 and kenn-io/roborev#1778.