Skip to content

fix(tui): make websearch provider label reactive#26943

Merged
nexxeln merged 1 commit into
anomalyco:devfrom
NormallyGaussian:fix-tui-websearch-provider-label
May 12, 2026
Merged

fix(tui): make websearch provider label reactive#26943
nexxeln merged 1 commit into
anomalyco:devfrom
NormallyGaussian:fix-tui-websearch-provider-label

Conversation

@NormallyGaussian
Copy link
Copy Markdown
Contributor

@NormallyGaussian NormallyGaussian commented May 11, 2026

Issue for this PR

Closes #26942

Type of change

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

What does this PR do?

The TUI's WebSearch component captured props.metadata into a const. The component first renders while the part is in pending state — at that point the toolprops.metadata getter returns {} — so the snapshot has no provider. Solid only invokes the component once, so later metadata updates from ctx.metadata({ metadata: { provider } }) never reach the JSX, and webSearchProviderLabel(undefined) falls back to "Web Search" regardless of which provider actually ran.

Switching const metadata = props.metadata to const metadata = () => props.metadata (and calling metadata() at each read) makes every access flow through Solid's reactive tracking, so the label updates when the part transitions to running/completed. The sibling renderer at feature-plugins/system/session-v2.tsx already does this with createMemo and works correctly.

How did you verify your code works?

  • bun test test/tool/websearch.test.ts — 10 pass
  • bun typecheck in packages/opencode — clean
  • bun lint — 0 errors
  • Ran the dev TUI on a free Zen model with OPENCODE_WEBSEARCH_PROVIDER=parallel, ran a web search, confirmed the label renders as ◈ Parallel Web Search "..." instead of ◈ Web Search "...". The persisted state.metadata.provider in opencode.db was already correct before the fix — only the render was stale.

Screenshots / recordings

Before: ◈ Web Search "latest news today"
image

After: ◈ Parallel Web Search "latest news today 2026"
image

(attaching shortly)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
The WebSearch component captured props.metadata into a non-reactive const
at first render. Since the component initially renders while the part is
in 'pending' state (toolprops getter returns {} for pending), the captured
snapshot was always {}, and subsequent metadata updates from the
ctx.metadata call in the websearch tool never propagated to the TUI.
The displayed label fell back to 'Web Search' instead of
'Parallel Web Search' / 'Exa Web Search'.

Convert the local to a getter function so each property read flows
through props.metadata reactively, matching the session-v2 renderer.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@NormallyGaussian NormallyGaussian marked this pull request as ready for review May 11, 2026 22:25
Copy link
Copy Markdown
Member

@nexxeln nexxeln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ty

@nexxeln nexxeln enabled auto-merge (squash) May 12, 2026 07:52
@nexxeln nexxeln merged commit 61174b7 into anomalyco:dev May 12, 2026
14 checks passed
sdeonvacation added a commit to sdeonvacation/opencode-x that referenced this pull request May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants