Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

fix(tui): render inline tool labels as text strings#32

Merged
devinoldenburg merged 1 commit into
mainfrom
fix/tui-textnode-renderable-crash-20260601
Jun 1, 2026
Merged

fix(tui): render inline tool labels as text strings#32
devinoldenburg merged 1 commit into
mainfrom
fix/tui-textnode-renderable-crash-20260601

Conversation

@devinoldenburg
Copy link
Copy Markdown
Collaborator

Summary

  • Prevent OpenTUI <text> nodes from receiving Solid JSX children by precomposing inline tool labels as strings.
  • Apply the same string-only label handling to the v2 session debug renderer.
  • Harden spinner and pending labels by coercing unknown children through textValue before rendering.

Verification

  • bun --cwd packages/codeplane typecheck
  • bun --cwd packages/codeplane test test/tui/text-value.test.ts
  • bun lint (0 errors)
  • bun script/build.ts --skip-embed-web-ui --skip-install --single from packages/codeplane

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>
Copilot AI review requested due to automatic review settings June 1, 2026 11:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 InlineTool children to string and 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 textValue to 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.

Comment on lines +1020 to +1022
function valueText(value: unknown, fallback = "") {
return textValue(value) || fallback
}
Comment on lines 13 to +16
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>}>
@devinoldenburg
Copy link
Copy Markdown
Collaborator Author

Triage — Keep Open

Confirmed real defects in this PR. Copilot review flagged them; no past agent commentary here.

Defects found

  1. valueText mis-fallback logic (packages/codeplane/src/tui/feature-plugins/system/session-v2.tsx): textValue(value) || fallback treats an intentional empty string "" as missing and replaces it with the fallback. Changes behavior vs the prior stringValue(x) ?? fallback pattern and can show pending input unexpectedly.
  2. Redundant textValue recomputation (spinner.tsx): textValue(props.children) is evaluated multiple times per render via the label() helper. Should be memoized to keep rendering predictable.

Why not close

Both are real behavioral bugs — one strips intentionally-empty labels, the other adds unnecessary per-frame recomputation. Keep open.

@devinoldenburg
Copy link
Copy Markdown
Collaborator Author

Review: render inline tool labels as text strings

Status: 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.

@devinoldenburg devinoldenburg merged commit 8121f84 into main Jun 1, 2026
12 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants