Skip to content

feat: allow empty /btw command#378

Merged
kermanx merged 2 commits into
MoonshotAI:mainfrom
kermanx:xtr/btw-empty-panel
Jun 3, 2026
Merged

feat: allow empty /btw command#378
kermanx merged 2 commits into
MoonshotAI:mainfrom
kermanx:xtr/btw-empty-panel

Conversation

@kermanx
Copy link
Copy Markdown
Collaborator

@kermanx kermanx commented Jun 3, 2026

Related Issue

No linked issue. This addresses the limitation that /btw required a question inline instead of allowing users to open the side-channel panel first.

Problem

Users who invoke /btw without arguments currently get a usage error, so they cannot open the side-channel panel first and type the question there.

What changed

  • Allows /btw with no arguments to start the side agent and mount the existing BTW panel in its empty state.
  • Routes the first typed panel input through the existing /btw prompt flow, and cancels an unused empty side agent when the panel is closed.
  • Updates the bilingual slash command reference and adds TUI coverage for empty /btw, first panel input, and closing an unused empty panel.

Validation:

  • pnpm --filter @moonshot-ai/kimi-code test -- test/tui/commands/resolve.test.ts test/tui/kimi-tui-message-flow.test.ts --runInBand
  • pnpm --filter kimi-code-docs run build
  • Read-only diff audit for context-specific internal identifiers: no issues found.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 3, 2026

🦋 Changeset detected

Latest commit: c1ae2bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 3, 2026

pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@c1ae2bb
npx https://pkg.pr.new/@moonshot-ai/kimi-code@c1ae2bb

commit: c1ae2bb

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

💡 Codex Review

const agentId = await session.startBtw();
host.btwPanelController.open(agentId, prompt);

P2 Badge Defer forking /btw until the first panel prompt

When /btw is opened without arguments during an active main turn, this forks the side agent immediately, before the user types the panel question. startBtw() snapshots the parent context in SessionSubagentHost.startBtw() via useProjectedHistoryFrom(parent.context), so any main-agent output or tool results that arrive while the empty panel is open are missing from the first side question. Please defer startBtw() until the first non-empty panel submit, or refresh the snapshot, so empty /btw behaves like /btw <question> at submission time.

ℹ️ 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".

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

💡 Codex Review

const agentId = await session.startBtw();
host.btwPanelController.open(agentId, prompt);

P2 Badge Mount the empty /btw panel before awaiting startBtw

When /btw is invoked without arguments, the panel is not mounted until session.startBtw() resolves. Because dispatchInput fires slash-command execution without awaiting it, if startBtw() is slow and the user types the intended side question immediately, btwPanelController.sendUserInput() still sees no active panel and the text falls through to the main prompt/queue instead of the new side agent. The inline /btw question path is safe because the prompt is captured before this await, but the new empty-panel flow needs to reserve/mount the panel or otherwise buffer the first input while the side agent is starting.

ℹ️ 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".

@kermanx kermanx merged commit e0d28b4 into MoonshotAI:main Jun 3, 2026
8 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 3, 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