Skip to content

fix(code): show user skills in running tasks and trigger / after spaces#2229

Open
richardsolomou wants to merge 2 commits into
mainfrom
posthog-code/fix-slash-command-popup-skills
Open

fix(code): show user skills in running tasks and trigger / after spaces#2229
richardsolomou wants to merge 2 commits into
mainfrom
posthog-code/fix-slash-command-popup-skills

Conversation

@richardsolomou
Copy link
Copy Markdown
Member

Problem

The slash-command popup in the prompt input had two annoyances reported on Slack:

  1. In a running local/worktree task, typing / only showed the built-in /good /bad /feedback commands — none of the user's own skills.
  2. The popup only appeared when / was the very first character of the prompt. Typing a space and then / (e.g. please /skill) did nothing.

Changes

Trigger / after a space, not just at start of line. CommandMention was configured with startOfLine: true, which is inconsistent with @ (files) and # (issues). Dropped the option so / now also triggers after a space — matching the rest of the mention extensions.

Show user skills while waiting for the agent's command list. In getCommandSuggestions, the fallback to the locally-fetched skills list (draftStore.commands[sessionId]) was gated on the absence of a taskId. That meant a running session would only ever show the built-in commands until available_commands_update arrived from the agent (fire-and-forget after a small delay). Switched the gate so the fallback kicks in whenever the session hasn't yet reported its commands — agent-supplied commands still win once they arrive.

Populate the fallback for session-view inputs too. Previously only TaskInput (new-task screen) loaded trpcClient.skills.list into draftStore. SessionView's PromptInput never did, so the fallback was empty there. Moved the loader into PromptInput itself so it runs for any prompt with commands enabled.

How did you test this?

  • pnpm --filter code typecheck
  • pnpm lint
  • pnpm --filter code test — 1317 tests pass (5 new in getSuggestions.test.ts covering: built-ins always present, agent commands surfaced from session events, draft fallback when session is empty, agent commands win over draft, draft used outside a running task).

Publish to changelog?

no


Created with PostHog Code

The slash-command popup in the prompt input had two annoyances:

1. In a running session, the / popup only showed the built-in /good /bad
   /feedback commands until the agent's `available_commands_update` arrived.
   The fallback to the locally-fetched skills list was gated on the *absence*
   of a taskId, so running sessions never used it.

2. The popup only triggered when `/` was the first character of the prompt,
   because `CommandMention` was configured with `startOfLine: true`. Typing
   `please /skill` mid-prompt did nothing — inconsistent with `@` and `#`.

Fixes:
- Drop `startOfLine: true` from `CommandMention` so `/` works after a space.
- Fall back to draft-store skills in `getCommandSuggestions` when the session
  hasn't yet emitted `available_commands_update`.
- Move the skills loader from `TaskInput` into `PromptInput` so the
  session-view editor also populates the fallback list.

Generated-By: PostHog Code
Task-Id: 300b3a9a-c74e-42a2-9099-5ede198c7570
@richardsolomou richardsolomou requested a review from a team May 19, 2026 16:51
@richardsolomou richardsolomou marked this pull request as ready for review May 19, 2026 16:51
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
apps/code/src/renderer/features/message-editor/suggestions/getSuggestions.test.ts:89-148
**Prefer parameterised tests for the fallback/override scenarios**

Tests 2 and 3 share identical setup (`seedSessionContext(TASK_ID)`) and differ only in whether `seedSessionAvailableCommands` is called; likewise tests 3 and 5 both exercise the draft-store fallback path but from different context states. Expressing these as `it.each` suites would satisfy the team's parameterised-test preference and make adding future cases (e.g. empty `availableCommands` from agent) a one-liner rather than a new `it` block.

Reviews (1): Last reviewed commit: "fix(code): show user skills in running t..." | Re-trigger Greptile

Comment thread apps/code/src/renderer/features/message-editor/suggestions/getSuggestions.test.ts Outdated
Address review feedback — tests 2-5 shared most of their scaffolding;
collapse into an `it.each` table so adding scenarios is a row, not
another `it` block.

Generated-By: PostHog Code
Task-Id: 300b3a9a-c74e-42a2-9099-5ede198c7570
@adboio
Copy link
Copy Markdown
Contributor

adboio commented May 19, 2026

this is a regression, i'm gonna take a peek in case there's a smaller/simpler bug here we can fix!

@adboio adboio self-assigned this May 19, 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.

2 participants