fix(tui): render inline tool labels as text strings#32
Conversation
Prevent OpenTUI text nodes from receiving Solid JSX children by stringifying inline tool labels in both session renderers and hardening spinner/pending labels. Co-Authored-By: codeplane-agent[bot] <287208015+codeplane-agent[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR hardens the TUI session renderers against OpenTUI <text> child type errors by ensuring inline tool labels (and spinner/pending labels) are rendered as plain strings rather than Solid JSX nodes.
Changes:
- Narrow
InlineToolchildren tostringand precompose tool labels as strings in the session route renderer. - Apply the same string-only inline label rendering approach to the session v2 debug renderer (including helper formatting functions).
- Coerce spinner and pending indicator labels through
textValueto safely render unknown values.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/codeplane/src/tui/routes/session/index.tsx |
Converts inline tool labels to precomposed strings and updates InlineTool to accept string children. |
packages/codeplane/src/tui/feature-plugins/system/session-v2.tsx |
Mirrors string-only inline tool label rendering in the v2 session debug renderer and adds label helpers. |
packages/codeplane/src/tui/component/spinner.tsx |
Makes spinner/pending labels robust by coercing unknown children/labels via textValue. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| function valueText(value: unknown, fallback = "") { | ||
| return textValue(value) || fallback | ||
| } |
| const color = () => props.color ?? theme.textMuted | ||
| const label = () => textValue(props.children) | ||
| return ( | ||
| <Show when={kv.get("animations_enabled", true)} fallback={<text fg={color()}>⋯ {props.children}</text>}> | ||
| <Show when={kv.get("animations_enabled", true)} fallback={<text fg={color()}>⋯ {label()}</text>}> |
Triage — Keep OpenConfirmed real defects in this PR. Copilot review flagged them; no past agent commentary here. Defects found
Why not closeBoth are real behavioral bugs — one strips intentionally-empty labels, the other adds unnecessary per-frame recomputation. Keep open. |
Review: render inline tool labels as text stringsStatus: Merge candidate All CI checks are green. The textValue coercion and string-only label handling correctly fixes the OpenTUI text node crash. Spinner and pending labels are hardened. Applies the same pattern to v2 session debug renderer for consistency. |
Summary
<text>nodes from receiving Solid JSX children by precomposing inline tool labels as strings.textValuebefore rendering.Verification
bun --cwd packages/codeplane typecheckbun --cwd packages/codeplane test test/tui/text-value.test.tsbun lint(0 errors)bun script/build.ts --skip-embed-web-ui --skip-install --singlefrompackages/codeplane