Skip to content

fix(tui): show /btw answers inline in the chat instead of a dialog - #77

Merged
A-x6 merged 1 commit into
devfrom
btw-inline
Jul 31, 2026
Merged

A-x6 merged 1 commit into
devfrom
btw-inline

Conversation

@A-x6

@A-x6 A-x6 commented Jul 31, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #76

Type of change

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

What does this PR do?

/btw answered side questions in a modal alert dialog: it blocked the view of the running session and the answer vanished on dismiss. Now each side question becomes an inline block appended to the end of the transcript, tracked in a small signal on the session route:

const [asides, setAsides] = createSignal<{ id: number; question: string; answer?: string; error?: string }[]>([])

The command pushes an entry as soon as the question is submitted (shown as btw: <question> with a "thinking..." state), then patches it in place with the answer or an error message when the forked session responds. The block is rendered inside the scrollbox after the messages, styled like the existing revert notice, so it scrolls with the conversation and the sticky-bottom scroll keeps it in view while the main run streams. The fork/prompt flow itself is unchanged; the error and "thinking" toasts are gone since the inline block covers both states.

Entries are client-side only and reset when you leave the session — same lifetime the dialog had, minus the interruption.

How did you verify your code works?

  • bun typecheck and bun test in packages/tui (198 pass)
  • Ran the TUI, asked /btw questions during a run: the block appears at the bottom of the chat with "thinking...", fills in with the answer, and error paths (fork/prompt failure) render inline.

Screenshots / recordings

Terminal UI change; behavior described above.

Checklist

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

View with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.

@vercel

vercel Bot commented Jul 31, 2026

Copy link
Copy Markdown

Deployment failed with the following error:

Resource is limited - try again in 24 hours (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/adevloper152s-projects?upgradeToPro=build-rate-limit

@A-x6
A-x6 merged commit 7b87f26 into dev Jul 31, 2026
15 of 25 checks passed
@github-actions

Copy link
Copy Markdown

The following comment was made by an LLM, it may be inaccurate:

@deepsource-io

deepsource-io Bot commented Jul 31, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 38ab443...aec6c5f on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

Important

Some issues found as part of this review are outside of the diff in this pull request and aren't shown in the inline review comments due to GitHub's API limitations. You can see those issues on the DeepSource dashboard.

PR Report Card

Overall Grade  

Focus Area: Reliability
Security  

Reliability  

Complexity  

Hygiene  

Feedback

React hooks and type safety getting bypassed

  • The useDialog calls inside callbacks, the any, and the multiple non-null assertions all point to React/TS safety rails being side-stepped to get the behavior working.
  • It’s worth treating this file as a hotspot: tightening types and hook usage in one pass will likely prevent subtle runtime bugs here.

Local complexity building up in one file

  • The early use of PART_MAPPING and the fragment misuse both come from this component doing a lot in one place and juggling several concerns.
  • As this TUI evolves, this file may be a good candidate for breaking out helpers/components so state and rendering stay easier to reason about.

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Jul 31, 2026 7:00a.m. Review ↗
Shell Jul 31, 2026 7:00a.m. Review ↗
Secrets Jul 31, 2026 7:00a.m. Review ↗
Docker Jul 31, 2026 7:00a.m. Review ↗
Python Jul 31, 2026 7:00a.m. Review ↗
CSS Jul 31, 2026 7:00a.m. Review ↗
Rust Jul 31, 2026 7:00a.m. Review ↗
Ruby Jul 31, 2026 7:00a.m. Review ↗
Swift Jul 31, 2026 7:00a.m. Review ↗
PHP Jul 31, 2026 7:00a.m. Review ↗
Lua Jul 31, 2026 7:00a.m. Review ↗
Java Jul 31, 2026 7:00a.m. Review ↗
Go Jul 31, 2026 7:00a.m. Review ↗
C & C++ Jul 31, 2026 7:00a.m. Review ↗
Ansible Jul 31, 2026 7:00a.m. Review ↗
Apex Jul 31, 2026 7:00a.m. Review ↗
Elixir Jul 31, 2026 7:00a.m. Review ↗
Groovy Jul 31, 2026 7:00a.m. Review ↗
Objective-C Jul 31, 2026 7:00a.m. Review ↗
PowerShell Jul 31, 2026 7:00a.m. Review ↗
Terraform Jul 31, 2026 7:00a.m. Review ↗
VB.NET Jul 31, 2026 7:00a.m. Review ↗
SQL Jul 31, 2026 7:00a.m. Review ↗
Scala Jul 31, 2026 7:00a.m. Review ↗
Perl Jul 31, 2026 7:00a.m. Review ↗
Kotlin Jul 31, 2026 7:00a.m. Review ↗
Helm Jul 31, 2026 7:00a.m. Review ↗
Erlang Jul 31, 2026 7:00a.m. Review ↗
Dart Jul 31, 2026 7:00a.m. Review ↗
C# Jul 31, 2026 7:00a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

// Best-effort rename; a failed title update should not block the side question.
void sdk.client.session.update({ sessionID: id, title: `btw: ${label}` }).catch(() => undefined)
toast.show({ variant: "info", message: `btw: thinking about "${label}"`, duration: 5000 })
void sdk.client.session.update({ sessionID: forkID, title: `btw: ${label}` }).catch(() => undefined)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expected 'undefined' and instead saw 'void'


The void operator takes an operand and returns undefined. It can be used to ignore the value produced by an expression. However, this can lead to code that is difficult to understand and maintain. Historically, the void operator was used to get a "pure" undefined value, as the undefined variable was mutable prior to ES5.

Comment on lines +1362 to +1368
<box
marginTop={1}
flexShrink={0}
border={["left"]}
customBorderChars={SplitBorder.customBorderChars}
borderColor={theme.backgroundPanel}
>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

JSX tree is too deeply nested. Found 6 levels of nesting


Nesting JSX elements too deeply can confuse developers reading the code. To make maintenance and refactoring easier, DeepSource recommends limiting the maximum JSX tree depth to 4.

<For each={asides()}>
{(item) => (
<box
marginTop={1}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'marginTop' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

{(item) => (
<box
marginTop={1}
flexShrink={0}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'flexShrink' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

marginTop={1}
flexShrink={0}
border={["left"]}
customBorderChars={SplitBorder.customBorderChars}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'customBorderChars' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

<box marginTop={1}>
<Switch>
<Match when={item.error}>
<text fg={theme.error}>{item.error}</text>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'fg' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

<text fg={theme.error}>{item.error}</text>
</Match>
<Match when={item.answer}>
<text fg={theme.text}>{item.answer}</text>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'fg' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

<Match when={item.answer}>
<text fg={theme.text}>{item.answer}</text>
</Match>
<Match when={true}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Value must be omitted for boolean attribute `when`


When using a boolean attribute in JSX, you can set the attribute value to true or omit the value. This helps to keep consistency in code.

<text fg={theme.text}>{item.answer}</text>
</Match>
<Match when={true}>
<text fg={theme.textMuted}>thinking...</text>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'fg' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

)}
</For>
</scrollbox>
<box flexShrink={0}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Unknown property 'flexShrink' found


React components use JSX, not HTML.
So we need to use JSX attributes and React replicate the respective HTML property/attribute while rendering.
Use of HTML property in JSX can sometimes lead to errors.
For example, class is a keyword in JavaScript (JSX is an extension of JavaScript), so it will throw an error.
However, in HTML it is a valid attribute.

Note: If you use React with Web Components, use the class attribute instead.

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.

/btw should show the answer inline in the chat, not a popup

1 participant