You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds /btw (alias /aside) to the TUI: while the agent is mid-task, ask a question and get an answer without steering or interrupting the run. The command captures the question in a prompt dialog, forks the current session so the side question sees the conversation so far, and prompts the fork; run loops are keyed per session, so the fork answers concurrently while the original session keeps streaming untouched. The answer pops in an alert dialog when it arrives:
// Fork the session so the side question sees the conversation so far;// the fork runs on its own per-session runner, so the original run// keeps streaming untouched.constfork=awaitsdk.client.session.fork({sessionID: route.sessionID})// ...constresult=awaitsdk.client.session.prompt({sessionID: fork.data.id,parts: [{type: "text",text: `The user has a side question about the work above. ...`}],})voidDialogAlert.show(dialog,`btw: ${label}`,answer)
Details a reviewer can't infer from the diff:
session.fork has no busy assertion server-side; mid-run it snapshots whatever messages are committed, which is exactly the context a side question wants.
The fork inherits the model from the copied last user message (server model resolution), so no model wiring is needed; the question text also instructs the model to answer directly and not touch files, since the original session owns the task.
The fork is retitled btw: <question>, so if the answer dialog is dismissed (or the toast is missed) the full markdown-rendered answer is one /sessions away.
Failure modes degrade to toasts (fork failed, no answer came back); a dismissed or empty prompt dialog is a no-op.
How did you verify your code works?
bunx tsgo --noEmit in packages/tui: clean
bun test in packages/tui: 198 pass
Screenshots / recordings
N/A (uses the existing DialogPrompt / DialogAlert components)
Checklist
I have tested my changes locally
I have not included unrelated changes in this PR
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is enabled.
Summary by CodeRabbit
New Features
Added /btw and /aside commands for asking side questions during a session.
Side questions are handled separately without modifying files or interrupting the original task.
Added progress and completion feedback while side questions are processed.
Bug Fixes
Added clear error notifications when side-question sessions fail or produce no response.
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 180fd67a-b69e-4f69-a5b5-11f0c972bcfe
📥 Commits
Reviewing files that changed from the base of the PR and between 6d1df88 and 2d8d076.
📒 Files selected for processing (1)
packages/tui/src/routes/session/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
packages/tui/src/routes/session/index.tsx
📝 Walkthrough
Walkthrough
The session route adds /btw and /aside commands. The command collects a side question, forks the current session, submits isolated instructions, reports failures with error toasts, and displays successful answers in an alert dialog.
Changes
Side-question session flow
Layer / File(s)
Summary
Side-question command and forked response flow packages/tui/src/routes/session/index.tsx
The route imports DialogPrompt and adds session.btw with /btw and /aside aliases. The command validates input, forks the session, submits side-question instructions, handles failures with error toasts, and displays the response in an alert dialog.
The title clearly summarizes the main change: adding /btw side questions without interrupting the active task.
Description check
✅ Passed
The description includes the required issue, change type, implementation details, verification, screenshots note, and completed checklist.
Linked Issues check
✅ Passed
The changes implement /btw by forking the session, prompting concurrently, displaying the response, and preserving the original run [#71].
Out of Scope Changes check
✅ Passed
The changes are limited to the TUI session route and directly support the linked issue objectives.
Docstring Coverage
✅ Passed
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
Fix failing CI checks
📝 Generate docstrings
Create stacked PR
Commit on current branch
🧪 Generate unit tests (beta)
Create PR with unit tests
Commit unit tests in branch btw-command
Warning
There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.
🔧 ESLint
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.
Comment @coderabbitai help to get the list of available commands.
We reviewed changes in ba2adba...2d8d076 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.
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.
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.
The reason will be displayed to describe this comment to others. Learn more.
Function has a cyclomatic complexity of 6 with "medium" risk
A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.
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.
The reason will be displayed to describe this comment to others. Learn more.
void for fire-and-forget promises is the established convention in this file (11 existing usages, e.g. lines 365, 621, 709); changing it would deviate from local style.
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.
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/tui/src/routes/session/index.tsx`:
- Line 573: Update the session fork and prompt error handling around
sdk.client.session.fork and sdk.client.session.prompt to retain the caught error
instead of replacing it with undefined, then include its message in the
corresponding failure toasts while preserving the existing generic context and
empty-response handling.
- Line 579: Add a rejection handler to the fire-and-forget
sdk.client.session.update call in the title rename flow, preserving the existing
title update behavior while ensuring rejected promises are contained.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
Push a commit to this branch (recommended)
Create a new PR with the fixes
ℹ️ Review info⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 444ba354-3039-4f9b-aa2c-63beff65e171
📥 Commits
Reviewing files that changed from the base of the PR and between ba2adba and 6d1df88.
The reason will be displayed to describe this comment to others. Learn more.
Function has a cyclomatic complexity of 8 with "medium" risk
A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.
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.
The reason will be displayed to describe this comment to others. Learn more.
void for fire-and-forget promises is the established convention in this file (11 existing usages, e.g. lines 365, 432, 2355); changing it would deviate from local style.
The reason will be displayed to describe this comment to others. Learn more.
Unexpected empty arrow function
Having empty functions hurts readability, and is considered a code-smell. There's almost always a way to avoid using them. If you must use one, consider adding a comment to inform the reader of its purpose.
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.
The reason will be displayed to describe this comment to others. Learn more.
void for fire-and-forget promises is the established convention in this file (11 existing usages, e.g. lines 365, 432, 2355); changing this one line would deviate from local style.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #71
Type of change
What does this PR do?
Adds
/btw(alias/aside) to the TUI: while the agent is mid-task, ask a question and get an answer without steering or interrupting the run. The command captures the question in a prompt dialog, forks the current session so the side question sees the conversation so far, and prompts the fork; run loops are keyed per session, so the fork answers concurrently while the original session keeps streaming untouched. The answer pops in an alert dialog when it arrives:Details a reviewer can't infer from the diff:
session.forkhas no busy assertion server-side; mid-run it snapshots whatever messages are committed, which is exactly the context a side question wants.btw: <question>, so if the answer dialog is dismissed (or the toast is missed) the full markdown-rendered answer is one/sessionsaway.How did you verify your code works?
bunx tsgo --noEmitinpackages/tui: cleanbun testinpackages/tui: 198 passScreenshots / recordings
N/A (uses the existing DialogPrompt / DialogAlert components)
Checklist
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.Summary by CodeRabbit
New Features
/btwand/asidecommands for asking side questions during a session.Bug Fixes