Block slash commands missing a required argument
What does this MR do and why?
It validates that a flow command has accompanying context after the user submits it. /flow: dispatches a command that starts a session given user-provided parameters: flow-id and a context parameter used by the flow to accomplish a goal. Without the context parameter, flows fail predictably, e.g.
This Merge Request adds a validation step that checks whether a user provided a context parameter to a flow started using the /flow:[flow-name] slash command. This validation helps to avoid a failing session and guides the user towards using this slash command correctly.
Next steps
Ideally, the chat agent would help the user to build context for the flow command using the ambient context (current page, existing conversation, etc.). We will implement this improvement in the follow-up issue: Let the agent start flows referenced with `/flo... (#629760)
References
No issue is linked — this came out of hands-on use of the slash commands.
Screenshots or screen recordings
Composer with /flow:code-review and no argument given, before and after this MR.
| Before | After |
|---|---|
![]() |
![]() |
Before: no explanation, and pressing send starts the flow with an empty goal. After: pressing send keeps the prompt where it is and says what is expected.
Goal mode with an image attached and no condition typed, which used to send with goal: null:
How to set up and validate locally
- Open a project that has at least one AI Catalog flow enabled — on GDK,
gitlab-duo/testis seeded with several. - Open the GitLab Duo Chat panel and type
/to open the command menu. - Pick a flow from the Flows section. The composer fills with
/flow:<name>and stops there. Confirm the send button is still enabled and nothing is being asked of you yet. - Press Enter. Confirm no turn starts, the prompt is still in the composer, the caret is in it, and the notice above it reads "Describe what you want this flow to work on."
- Type a single character. The notice goes. Finish the goal and send — the flow starts with that goal.
- Submit again and dismiss the notice with its ×; confirm a fresh submit brings it back.
- Type
/goal, attach an image and type nothing. Confirm sending is refused with "Describe the condition Duo should work until it achieves." and that goal mode and the image are left alone. - Confirm
/compactand/neware unaffected.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.



