Skip to content

feat(web): ToolSearch verification UI (panel row + parsed-result card variant) - #44

Merged
helebest merged 2 commits into
mainfrom
feat/playground-tool-search
Jul 4, 2026
Merged

feat(web): ToolSearch verification UI (panel row + parsed-result card variant)#44
helebest merged 2 commits into
mainfrom
feat/playground-tool-search

Conversation

@helebest

@helebest helebest commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

What

v0.13.0 slice 2 (W4, final slice of the approved extensibility roadmap): the playground's tool search verification UI, pairing with #43's runtime knob.

  • Runtime panel rowtool search from /config.toolSearch; null renders as off (e.g. the graceful-degrade state on the MiniMax backend). Tooltip states the honest boundary: this is the configured value; whether a turn actually used tool search is observable only as a ToolSearch call in that turn's stream.
  • ToolSearch card variant — search icon, the query as the summary line, and a parsed Matched tools · N list (name + description) from the CLI's <functions> result block (<function>{…json…}</function> per tool, format verified against the CLI binary).
  • Never render-failparseToolSearchResult is best-effort: unparseable entries are skipped; when nothing parses the card falls back to the raw result text. The block format is a CLI-internal contract, so an unexpected shape must degrade, not break the stream.

Why

Completes the plan's verification story for tool search: the panel shows what is configured, the card shows what actually happened. Pure client-side; the SSE contract and runtime are untouched, and the new DTO field is optional so the playground degrades gracefully against older runtimes.

Verification

  • TDD: 6 red-first vitest cases for parseToolSearchResult (well-formed block, surrounding prose, partial-parse, missing/invalid name, raw-text fallback, null/empty).
  • biome ci clean on changed files; pnpm -r typecheck / web tests (57) / build all green.
  • Browser walkthrough against a deterministic fake runtime implementing the v0.13.0 contract: panel shows tool search auto; a turn renders two ToolSearch cards — one parsing to Matched tools · 2 (mcp__demo__ping/mcp__demo__pong with descriptions), one falling back to raw text; v0.12.0 regressions checked (Task-card nesting, orphan-parent visibility, subagent-delta drop, MCP badges, error card); zero console errors across two passes including a fresh page load.

🤖 Generated with Claude Code

…ard variant

The Runtime panel gains a 'tool search' row from /config.toolSearch (null
renders as 'off'), with a tooltip stating the honest boundary: this is
the configured value; actual per-turn activation shows as a ToolSearch
call in the stream. That call now renders as a card variant: search
icon, the query as summary line, and a parsed 'Matched tools' list from
the CLI's <functions> result block. Parsing is best-effort
(parseToolSearchResult): unparseable entries are skipped and when
nothing parses the card falls back to the raw text — an unexpected
shape never render-fails (the block format is a CLI-internal contract).

Pure client-side change; new DTO field optional so the playground
degrades gracefully against older runtimes. Verified in a browser
against a deterministic fake runtime emitting both a well-formed
<functions> result and a plain-text fallback result.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aafd17c2a4

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

{cfg.toolSearch !== undefined && (
<Row
k="tool search"
v={cfg.toolSearch ?? "off"}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Render unset tool search as unset, not off

When RUNTIME_TOOL_SEARCH is unset but a bare ENABLE_TOOL_SEARCH exists in the runtime environment, the runtime intentionally leaves the child env untouched; the test at apps/runtime/test/runtime.test.ts:709-716 asserts that this passthrough still enables values like auto:3, and the README documents /config.toolSearch null as unset/default. Rendering that null as off makes the Runtime panel report tool search as disabled even though the next turn may still use it via ENABLE_TOOL_SEARCH or the CLI default, which undermines this verification UI; please show an unset/default state instead of off.

Useful? React with 👍 / 👎.

…unset knob as 'default'

Review SHOULD-FIXes, both adversarially confirmed against evidence:

1. The CLI returns ToolSearch matches as tool_reference content blocks
   (verified across 182 real tool_result payloads in local CLI
   transcripts, 2.1.183-2.1.199, bracketing the pinned 2.1.197) — the
   <functions> block only exists in the API's server-side expansion for
   the model, so the previous parser never matched on the real wire and
   the card always fell back to raw JSON. parseToolSearchResult now
   parses the stringified tool_reference array as the primary shape and
   keeps the <functions> parser as a defensive fallback.

2. /config.toolSearch null means 'unset -> the CLI decides' (which can
   be ON for official backends, and a bare ENABLE_TOOL_SEARCH
   passthrough is invisible to /config), so rendering it as 'off'
   actively misled; it now renders as 'default', matching the skills
   row's convention, with the tooltip spelling out the semantics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@helebest

helebest commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

Independent pre-merge review (3 lenses: correctness / UI-consistency / scope-tests-docs, each material finding adversarially verified): 0 BLOCKER, 2 SHOULD-FIX confirmed — both fixed in d694d52.

  • FixedparseToolSearchResult only understood a <functions> text block, but the verifier proved empirically (182 real ToolSearch tool_result payloads across CLI 2.1.183–2.1.199 in local transcripts, bracketing the pinned 2.1.197) that the real wire shape is a tool_reference content-block array — the <functions> encoding exists only in the API's server-side expansion for the model. The parsed card variant would have been silently inert against the real CLI. Now the stringified tool_reference array is the primary parsed shape (+3 red-first tests, 9 lib tests total), <functions> kept as a defensive fallback, and the fake runtime + CHANGELOG corrected to the real shape. Re-verified in the browser: Matched tools · 2 parses from the tool_reference array; the CLI's real no-match string falls back to raw text.
  • Fixed — the panel row rendered unset (null) as off, but unset means "the CLI decides" (can be ON on official backends; a bare ENABLE_TOOL_SEARCH passthrough is also invisible to /config) and the row's own tooltip claimed to show the configured value. Now renders default (matching the skills row's null convention), tooltip spells out the semantics; browser-verified against toolSearch: null.

NITs recorded (not fixed): duplicate tool_name entries would collide as React keys (not observed in any real payload); .ts-desc single-line ellipsis truncates long descriptions with no expansion affordance.

@helebest
helebest merged commit 93198ae into main Jul 4, 2026
6 checks passed
@helebest
helebest deleted the feat/playground-tool-search branch July 4, 2026 03:02
@helebest helebest mentioned this pull request Jul 4, 2026
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