Skip to content

fix(slack): route HITL input-request prompts through GFM → mrkdwn conversion - #1528

Open
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/slack-hitl-mrkdwn-1293
Open

fix(slack): route HITL input-request prompts through GFM → mrkdwn conversion#1528
iroiro147 wants to merge 1 commit into
vercel:mainfrom
iroiro147:fix/slack-hitl-mrkdwn-1293

Conversation

@iroiro147

Copy link
Copy Markdown
Contributor

What

Model-authored prompts in Slack HITL input-request widgets were being placed into { type: "mrkdwn" } blocks verbatim — **bold**, __bold__, ~~strike~~, and [label](url) rendered as literal punctuation instead of formatting. The asymmetry with thread.post(string) (which converts via eve's gfmToSlackMrkdwn) made every eve+Slack app rediscover the workaround.

renderInputRequestBlocks and buildFreeformModalView now both pass the prompt through gfmToSlackMrkdwn before truncating, matching the rest of the Slack surface. Code fences and inline code are preserved untouched by the fence-aware splitter already used elsewhere.

Why this approach

Eve already owns the right primitive — gfmToSlackMrkdwn in packages/eve/src/public/channels/slack/mrkdwn.ts. It's used on the thread/post path and handles:

  • **bold** and __bold__*bold*
  • ~~strike~~~strike~
  • [label](url)<url|label> (via formatSlackLink)
  • ``` code fences and single-backtick inline code are passed through untouched

Routing both HITL input-request surfaces through the same function removes the asymmetry the issue describes. Truncation stays after conversion so the limit applies to the rendered text, not the source markdown.

Tests

Adds two regression tests in hitl.test.ts:

  • renderInputRequestBlocks — asserts a mixed-GFM prompt produces a section block whose text collapses **bold***bold*, rewrites [label](url)<url|label>, and leaves **...** inside a code fence untouched.
  • buildFreeformModalView — same assertions against the modal prompt header.

Both paths still declare type: "mrkdwn" on the resulting section (verified).

Full Slack surface suite:

Test Files  15 passed (15)
Tests       291 passed (291)

pnpm exec tsc -p tsconfig.json --noEmit is clean.

Linked issue

Closes #1293

…version

Model-authored prompts in Slack HITL input-request widgets were being placed
into `{ type: "mrkdwn" }` blocks verbatim — `**bold**`, `__bold__`,
`~~strike~~`, and `[label](url)` rendered as literal punctuation instead of
formatting. The asymmetry with `thread.post(string)` (which converts via
eve's `gfmToSlackMrkdwn`) made every eve+Slack app rediscover the same
workaround.

`renderInputRequestBlocks` and `buildFreeformModalView` now both pass the
prompt through `gfmToSlackMrkdwn` before truncating, matching the behavior
of the rest of the Slack surface. Code fences and inline code are preserved
untouched by the fence-aware splitter already used elsewhere.

Includes regression coverage in `hitl.test.ts` for both the block-renderer
path and the modal path:
- `**bold**` and `*italic*` collapse to Slack's single-asterisk bold.
- `[label](url)` becomes Slack's `<url|label>` form.
- Backtick fences pass through untouched (no `**` inside ```` ``` ```` is
  rewritten).
- Each path still declares `type: "mrkdwn"` on the resulting section.

Verified:
- `pnpm exec vitest run --config vitest.unit.config.ts src/public/channels/slack` — 15 files / 291 tests green
- `pnpm exec tsc -p tsconfig.json --noEmit` — clean

Closes vercel#1293

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@vercel

vercel Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@iroiro147 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@vercel vercel Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Additional Suggestion:

Slack HITL card body renders the model-authored prompt as raw GFM instead of converting to Slack mrkdwn, so [label](url), **bold**, __bold__, and ~~strike~~ appear as literal punctuation.

Fix on Vercel

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.

Slack channel: HITL input-request prompt text skips markdown→mrkdwn conversion, so model-authored **bold** renders literally

1 participant