Skip to content

fix(desktop): clear stale instance agent args on harness switch - #4670

Open
joshualwrnc wants to merge 1 commit into
block:mainfrom
joshualwrnc:pixel/clear-stale-agent-args
Open

fix(desktop): clear stale instance agent args on harness switch#4670
joshualwrnc wants to merge 1 commit into
block:mainfrom
joshualwrnc:pixel/clear-stale-agent-args

Conversation

@joshualwrnc

Copy link
Copy Markdown

Problem

Instance agent_args are harness-specific and win over the harness definition's default args at spawn. apply_agent_command_update updated the runtime pin without touching record.agent_args, so switching an agent's harness (e.g. Grok Build → Oh My Pi) left the old harness's flags in place and every spawn passed them verbatim to the new binary: omp launched as omp agent --always-approve stdio and crash-looped on unknown flag: --always-approve.

Fix

Clear record.agent_args when the edit changes the effective command. Same-command re-saves keep customized args, and replacement args sent in the same update are applied after the clear, so the edit dialog's harness-switch flow (which sends the new harness's defaults) is unaffected.

Testing

  • Full test suite green: 2,109/2,109
  • Added regression coverage in managed_agents/discovery/tests.rs for the harness-switch clear, same-command preserve, and replace-after-clear paths

Instance agent_args are harness-specific and win over the harness
definition's default args at spawn. apply_agent_command_update updated
the runtime pin without touching record.agent_args, so switching an
agent's harness (e.g. Grok Build to Oh My Pi) left the old harness's
flags in place and every spawn passed them verbatim to the new binary:
omp launched as `omp agent --always-approve stdio` and crash-looped on
`unknown flag: --always-approve`.

Clear record.agent_args when the edit changes the effective command.
Same-command re-saves keep customized args, and replacement args sent
in the same update are applied after the clear, so the edit dialog's
harness-switch flow (which sends the new harness's defaults) is
unaffected.

Co-authored-by: joshualwrnc <75241961+joshualwrnc@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: joshualwrnc <75241961+joshualwrnc@users.noreply.github.com>
@joshualwrnc
joshualwrnc requested a review from a team as a code owner August 4, 2026 06:06
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.

1 participant