Skip to content

fix(app): tolerate incomplete agent configuration - #44025

Closed
OpeOginni wants to merge 2 commits into
anomalyco:v2from
OpeOginni:normalize-agent-list
Closed

fix(app): tolerate incomplete agent configuration#44025
OpeOginni wants to merge 2 commits into
anomalyco:v2from
OpeOginni:normalize-agent-list

Conversation

@OpeOginni

@OpeOginni OpeOginni commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Fixes #44023

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes a whole-app crash on desktop when a connected server runs an older opencode version.

normalizeAgentList reads agent.request.settings.temperature unguarded. Servers built before 140224b (2026-07-02) serialize agents as request: { headers, body } without settings, the client stores API responses without validation, and the normalizer runs inside a reactive computation during bootstrap — so the TypeError escapes to the root error boundary and the app never loads. Restarting refetches the same response and crashes again.

The fix defaults the missing fields (agent.request?.settings ?? {}, agent.permissions ?? []) so a malformed agent degrades to default temperature/topP instead of killing the app. Output is unchanged for well-formed agents.

How did you verify your code works?

  • Added unit tests feeding the exact old-server shape into normalizeAgentList — they throw the reported TypeError before the fix and pass after (bun test src/runtime/server/global-sync/utils.test.ts).
  • Reproduced end-to-end: ran opencode-ai@0.0.0-beta-202607011659 serve, confirmed its /api/agent returns request without settings, and that the desktop app loads fine against it with this fix.
  • bun run typecheck in packages/app passes.

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant