Slack: dedupe partial streaming replies#62859
Conversation
Greptile SummaryThis PR adds turn-local deduplication for Slack partial-stream delivery: a Confidence Score: 5/5Safe to merge; deduplication logic is correct and well-tested, with no P0/P1 findings. All findings are P2 (minor style). The tracker key construction is deterministic, state-variable consistency is preserved across suppression paths, and the lastText() fallback correctly handles the empty-string/undefined boundary. Tests cover the new tracker and the lastText accessor. No files require special attention.
|
There was a problem hiding this comment.
Pull request overview
This PR improves Slack partial streaming reliability by deduplicating repeated deliveries within a single dispatch turn and by avoiding unnecessary fallback re-sends when the preview already matches the final reply text.
Changes:
- Add a turn-local delivery tracker to suppress duplicate normal and streaming (start/append) sends on the same Slack thread.
- Skip fallback sending when the existing preview text already matches the final normalized outbound text.
- Add regression tests for the new delivery tracker and for draft stream preview text visibility.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| extensions/slack/src/monitor/message-handler/dispatch.ts | Adds turn-local delivery dedupe and preview/fallback suppression logic for streaming + preview finalize paths. |
| extensions/slack/src/monitor/message-handler/dispatch.streaming.test.ts | Adds a focused unit test for the new turn delivery tracker behavior. |
| extensions/slack/src/draft-stream.ts | Exposes lastText() on the draft stream API for downstream finalize/fallback logic. |
| extensions/slack/src/draft-stream.test.ts | Adds a test asserting lastText() reflects the latest preview content after a flush. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 73a7d52746
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
🔒 Aisle Security AnalysisWe found 1 potential security issue(s) in this PR:
1. 🟡 Potential per-turn memory/CPU DoS from unbounded Slack delivery deduplication keys
DescriptionThe new per-turn delivery de-duplication uses a
This can enable a denial-of-service scenario (high CPU due to repeated stringify and increased memory usage from the growing Set) if an attacker can induce many unique payloads/updates in a single turn (e.g., very long/rapid streaming or repeated slightly-different tool outputs). RecommendationAvoid building/storing de-duplication keys from full payload bodies. Safer options:
import { createHash } from "node:crypto";
function safeKey(input: unknown): string {
const json = JSON.stringify(input);
const capped = json.length > 10_000 ? json.slice(0, 10_000) : json;
return createHash("sha256").update(capped).digest("hex");
}
Additionally, consider rejecting/limiting unusually large Analyzed PR: #62859 at commit Last updated on: 2026-04-08T21:56:59Z |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b33084b2d3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Triage update on automated feedback:
Security-bot notes:
No further action on those security-bot comments in this PR. |
5b2fb2e to
cbecb50
Compare
|
Merged via squash.
Thanks @gumadeiras! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cbecb50c06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Merged via squash. Prepared head SHA: cbecb50 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Merged via squash. Prepared head SHA: cbecb50 Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com> Reviewed-by: @gumadeiras
Summary
Testing