fix(slack): preserve complete executor summaries safely#92
Conversation
📝 WalkthroughWalkthroughSlack final summaries now normalize multiline content, select compact sections, truncate rendered mrkdwn to 2500 characters, and use explicit mrkdwn handling for Slack callbacks and Slack presentation fallbacks. ChangesSlack rendering and callback delivery
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request updates the Slack text rendering logic by changing how text is normalized and increasing the summary truncation limit from 360 to 2800 characters. Feedback suggests lowering the truncation limit to 2500 to safely accommodate character escaping and prepended text within Slack's 3000-character limit. Additionally, it is recommended to update the line ending normalization regex to handle classic Mac OS line endings as well.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Slack presentation bodies are already provider-rendered, so callback delivery now marks them as mrkdwn instead of encoding entities and links a second time. Final-summary normalization is separated from shared one-line truncation, and the only length cap now runs after mrkdwn rendering on code-point boundaries. Constraint: Slack section summaries must stay below the 3000-character provider limit Rejected: Re-encode callback bodies in payload builders | corrupts escaped entities and Slack link syntax Rejected: Truncate source summaries before mrkdwn rendering | can split Unicode and undercount escaped output Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep raw Markdown payload callers on the default format and mark provider-rendered callback bodies as mrkdwn Tested: full build, lint, typecheck, 1516 tests, focused Slack post/update payload regressions Not-tested: live Slack API delivery
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/dispatcher/src/callbacks.ts`:
- Around line 462-469: Escape the fallback Slack text before passing
message.body to createSlackPostMessagePayload with textFormat "mrkdwn". Update
the relevant callback path, including doctor_summary and source_thread_status
flows, to apply the existing Slack mrkdwn escaping utility while preserving the
current blocks and message structure.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 40ace511-90d2-4da8-a581-2d06fbd03b57
📒 Files selected for processing (4)
packages/dispatcher/src/callbacks.tspackages/dispatcher/test/callbacks.test.tspackages/slack/src/render.tspackages/slack/test/render.test.ts
Doctor and source-thread status presentations still supplied raw plain text as their Slack fallback while other callback bodies were already rendered as mrkdwn. Convert only those two provider-specific fallbacks at the presentation boundary so the shared callback sink can preserve its existing transport contract. Constraint: The Slack callback sink receives both raw semantic fallbacks and already-rendered mrkdwn bodies. Rejected: Escape every message.body in createSlackCallbackSink | this would double-encode final, action, approval, and run-status callbacks. Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep Slack mrkdwn ownership in provider presentation renderers; do not globally re-encode callback bodies. Tested: 82 focused tests; dispatcher build and lint; full typecheck; 119 files and 1517 full tests. Not-tested: Live Slack API delivery.
Problem
Slack final replies could silently discard most executor output: only the first paragraph was selected, the remaining text was capped at 360 characters, and shared whitespace normalization collapsed line breaks.
Fix
What changedsection when the executor returns a structured summary.chat.postMessageandchat.updatedo not encode entities and links twice.Regression coverage
Verification
pnpm buildpnpm lintpnpm typecheckpnpm test— 119 test files, 1517 tests passedgit diff --checkFiles changed
packages/slack/src/render.tspackages/slack/test/render.test.tspackages/dispatcher/src/callbacks.tspackages/dispatcher/test/callbacks.test.tspackages/dispatcher/src/presentation.tspackages/dispatcher/test/presentation.test.tsSummary by CodeRabbit
textFormatoption for Slack message payloads (and setting it tomrkdwnin the callback flow).