Skip to content

fix(hooks): extract text from multimodal input for UserPromptSubmit prompt field#1813

Open
kevinWangSheng wants to merge 1 commit intoMoonshotAI:mainfrom
kevinWangSheng:fix/hook-prompt-submit-text
Open

fix(hooks): extract text from multimodal input for UserPromptSubmit prompt field#1813
kevinWangSheng wants to merge 1 commit intoMoonshotAI:mainfrom
kevinWangSheng:fix/hook-prompt-submit-text

Conversation

@kevinWangSheng
Copy link
Copy Markdown

@kevinWangSheng kevinWangSheng commented Apr 9, 2026

Related Issue

Resolve #1779

Description

The UserPromptSubmit hook event was sending an empty string in the prompt field whenever the user submitted multimodal content (e.g. text with images or other media). This happened because user_input is list[ContentPart] for multimodal messages, and the code fell through to a hardcoded "" default.

The fix extracts text from all TextPart items in the content list and joins them with newlines, so the hook payload contains the actual user text even when the input includes non-text parts. Pure text input (str) is unchanged.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open with Devin

…rompt field

When user_input is a list of ContentPart (multimodal input with images,
videos, etc.), the hook payload's prompt field was always set to an
empty string. Now we join the text from all TextPart items in the list
so hook scripts receive the actual user text.

Closes MoonshotAI#1779
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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.

[Bug] UserPromptSubmit hook event sends empty prompt field

1 participant