fix(session): skipped titles for local extension commands

- Classified registered extension commands before automatic title generation while preserving normal and prompt-producing slash command titles.
- Added regression coverage for one-shot local handling, unnamed-session preservation, and forwarded prompt eligibility.

Fixes #6061
This commit is contained in:
roboomp
2026-07-21 20:43:56 +00:00
parent 39c95e5e29
commit c87ee802b1
4 changed files with 115 additions and 6 deletions
@@ -822,12 +822,25 @@ export class InputController {
// First, move any pending bash components to chat
this.ctx.flushPendingBashComponents();
// AgentSession.prompt() consumes registered extension commands locally.
// Classify them here because title generation starts before prompt dispatch.
const extensionCommandSpace = text.indexOf(" ");
const isLocalExtensionCommand =
text.startsWith("/") &&
runner?.getCommand(extensionCommandSpace === -1 ? text.slice(1) : text.slice(1, extensionCommandSpace)) !==
undefined;
// Auto-generate a session title while the session is still unnamed.
// Greetings / acknowledgements / empty input carry no task, so they are
// skipped deterministically (no model invoked, no download-progress UI)
// and the session stays unnamed — the next user message gets a fresh
// chance, so titling defers past "hi" instead of latching onto it.
if (!this.ctx.sessionManager.getSessionName() && !$env.PI_NO_TITLE && !isLowSignalTitleInput(text)) {
if (
!isLocalExtensionCommand &&
!this.ctx.sessionManager.getSessionName() &&
!$env.PI_NO_TITLE &&
!isLowSignalTitleInput(text)
) {
this.#showTinyTitleDownloadProgress(this.ctx.settings.get("providers.tinyModel"));
this.ctx.session
.generateTitle(text)