fix(desktop): open agent settings against a host without resumeArgs
Problem
Opening an agent in Settings → Agents crashes the page for some users. The render stops in AgentDetail when it calls joinArgs(config.resumeArgs) and resumeArgs is undefined. Sentry shows the crash on about 8 machines, from 1.20.1 to 1.39.0.
Root cause
A current host-service always returns resumeArgs: toOutput in agent-configs.ts fills it with parseArgv, which always gives an array. So the config comes from a host-service older than #6253, which added the field. The desktop adopts any healthy host-service that its manifest points to (tryAdopt checks health only, not the version), so the renderer can talk to such a host. forkArgs (#6962) has the same gap and is already read as config.forkArgs ?? [] in this file. resumeArgs was not.
Fix
Read a missing resumeArgs as [] in AgentDetail, the same way as forkArgs. No other renderer code reads resumeArgs from a host config.
Verification
$ bunx biome check apps/desktop/src/renderer/.../AgentDetail/AgentDetail.tsx
Checked 1 file in 56ms. No fixes applied.
$ cd apps/desktop && bun run typecheck
$ tsc --noEmit (no errors)
$ bun test src/renderer/routes/_authenticated/settings/agents
2 pass
0 fail
Not verified in a running app against an old host-service.
Refs DESKTOP-QC
Summary by cubic
Fixes a crash when opening agent settings against a host-service that doesn't return resumeArgs. The render now treats a missing resumeArgs as an empty array, the same way forkArgs already is.
Summary by CodeRabbit
- Bug Fixes
- Improved handling of optional resume arguments in agent settings.
- Resume argument updates now reliably detect changes in both values and item count.