[PR #204] [MERGED] ComfyPR-Bot improvements: webhook retry, faster ack, sectioned progress, image vision, ❌-cancel #204

Closed
opened 2026-10-27 21:10:36 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Comfy-Org/Comfy-PR/pull/204
Author: @snomiao
Created: 4/24/2026
Status: ✅ Merged
Merged: 4/25/2026
Merged by: @snomiao

Base: main ← Head: sno-bot


📝 Commits (10+)

  • 22b2c99 refactor: rename msgs.yaml to inbox.yaml for clarity
  • 22c5580 Squashed 'lib/slack-cli/' content from commit 0e5b912
  • 77898c2 Merge commit '22c558089a' as 'lib/slack-cli'
  • 30b9f3e feat: add subtree sync script and slack-cli subtree
  • e0abd3e fix: extract Slack update fn, add throttling, fix final update and input drain cleanup
  • ace0f4f fix(slack-cli): use shared reqwest Client via LazyLock for connection pooling
  • cf0707c fix(slack-cli): use valid Slack Block Kit section/mrkdwn instead of invalid markdown type
  • b8669f1 feat(slack-cli): add TS utility layer with URL parsing, markdown conversion, caching, and safe messaging
  • e481a94 feat: add prbot feedback command — posts to private #prbot-feedback Slack channel
  • 771e1d5 feat(feedback): auto-detect repo URL and CLI version in feedback posts

📊 Changes

26 files changed (+1307 additions, -508 deletions)

View changed files

📝 .bot/AGENT.md (+50 -0)
📝 .gitignore (+5 -0)
📝 app/(dashboard)/details/page.tsx (+0 -1)
📝 app/(dashboard)/totals/page.tsx (+0 -1)
📝 app/auth/login/page.tsx (+18 -1)
📝 app/tasks/github-contributor-analyze/githubContributorAnalyze.ts (+7 -2)
📝 bot/cli.ts (+33 -0)
📝 bot/error-collector.ts (+53 -3)
📝 bot/index.ts (+48 -1)
📝 bot/slack-bot.ts (+549 -296)
➕ bot/spawn-as-user.ts (+82 -0)
➕ bot/task-user.ts (+136 -0)
➕ bot/taskInputFlow.spec.ts (+87 -0)
📝 docs/perf/README.md (+8 -8)
📝 docs/perf/build-and-typecheck.md (+29 -17)
📝 docs/perf/caching-strategy.md (+21 -21)
📝 docs/perf/client-bundle.md (+13 -8)
📝 docs/perf/dependency-bloat.md (+31 -30)
📝 docs/perf/mongodb-queries.md (+14 -13)
📝 docs/perf/server-rendering.md (+19 -15)

...and 6 more files

📄 Description

Summary

ComfyPR-Bot behavior improvements (16 items total), shipped in phases across Slack webhook, UX, cost, features, and reliability.

Reliability (Phase 1)

  • #8 Webhook retry dedup — fix the case where Slack's 3s-timeout retries cause the same event to run 3x (1h TTL event_id dedup).
  • #10 .env.local override + secret-prefix log on startup — prevent the recurring incident (2026-04-24) where pm2 carried stale shell env that shadowed .env.local.
  • #11 taskUser PATH (verification of the existing implementation only).

UX / response quality (Phase 2)

  • #1 Quick Respond sectioned structure (📋 Understanding / 🔍 Progress / 📎 Deliverables / ✅ Done) — drop the "one line per update" constraint so long-running tasks show real progress.
  • #2 Async intent analysis — post the "👀 Received..." placeholder immediately and run the GPT call in parallel, then edit the placeholder (first reply 5-10s → ~1s).
  • #12 Dynamic update model — diffs <2000 chars use gpt-4o-mini, only large diffs use gpt-4o (~70-80% cost reduction).

Feature additions (Phase 3)

  • #7 Auto-surface PR URLs — extract github.com/.../pull/N from agent output and pin them under 📎 Deliverables.
  • #16 ❌ reaction cancel — reacting to the original message with ❌ aborts the matching AbortController. Author-only.
  • #14 Image vision input — download attached images to ./attachments/ so the agent can read them via the Read tool.

Cost / reliability finalization (Phase 4)

  • #4 Dynamic maxTurns — the intent LLM classifies complexity (simple=40 / medium=100 / complex=200) and the agent gets that turn budget.
  • #5 ErrorCollector switched to fs.watch — 10s polling → event-driven + 60s safety-net poll.
  • #6 Content-based dedup — event.ts + sha256(text)[:8] so an edit with new intent retriggers, but identical retries within 10s do not.
  • #3 Thread context compression — when a thread exceeds 20 messages, summarize older ones with gpt-4o-mini (decisions / open questions / referenced URLs / errors).
  • #9 CI strict (already in place via bun run check in test.yaml).
  • #13 Agent self-update — .bot/AGENT.md delegates prbot slack update to the agent itself. The GPT-4o synthesizer is demoted to a 30s safety net.
  • #15 TaskInputFlow drain spec — unit tests for the TransformStream contract used to ingest follow-up messages.

Test plan

  • typecheck (bunx tsc --noEmit)
  • bun test bot/taskInputFlow.spec.ts (4/4 pass)
  • Webhook retry dedup live test — confirmed Ignoring duplicate webhook event log
  • Env prefix log on startup — [env] SLACK_SIGNING_SECRET=f944ab... | ...
  • Bot running under PM2, listening for webhooks on port 3475
  • End-to-end Slack DM check: placeholder → intent analysis → sectioned progress edits
  • Confirm 📎 Deliverables surfaces PR URLs after a PR-creation task
  • Confirm ❌ reaction aborts a running task
  • Confirm Claude vision input works on a DM with image attachments

Design notes in tmp/improvement-plan.md (gitignored).

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Comfy-Org/Comfy-PR/pull/204 **Author:** [@snomiao](https://github.com/snomiao) **Created:** 4/24/2026 **Status:** ✅ Merged **Merged:** 4/25/2026 **Merged by:** [@snomiao](https://github.com/snomiao) **Base:** `main` ← **Head:** `sno-bot` --- ### 📝 Commits (10+) - [`22b2c99`](https://github.com/Comfy-Org/Comfy-PR/commit/22b2c996fb7350faef0ada19dbdb97839496f62a) refactor: rename msgs.yaml to inbox.yaml for clarity - [`22c5580`](https://github.com/Comfy-Org/Comfy-PR/commit/22c558089aa94d1bbc42e28cd7ea0cb0dc825b5e) Squashed 'lib/slack-cli/' content from commit 0e5b912 - [`77898c2`](https://github.com/Comfy-Org/Comfy-PR/commit/77898c2ce1b324223444a9d057ba2ea5b41f3203) Merge commit '22c558089aa94d1bbc42e28cd7ea0cb0dc825b5e' as 'lib/slack-cli' - [`30b9f3e`](https://github.com/Comfy-Org/Comfy-PR/commit/30b9f3e3977c7f305892a2efd0e5333d959b66c3) feat: add subtree sync script and slack-cli subtree - [`e0abd3e`](https://github.com/Comfy-Org/Comfy-PR/commit/e0abd3ea246258a39adceff2caba945cdcd5f481) fix: extract Slack update fn, add throttling, fix final update and input drain cleanup - [`ace0f4f`](https://github.com/Comfy-Org/Comfy-PR/commit/ace0f4f523a1ad71e176747b07c40483b00d3ca3) fix(slack-cli): use shared reqwest Client via LazyLock for connection pooling - [`cf0707c`](https://github.com/Comfy-Org/Comfy-PR/commit/cf0707c53b27e87ae732da8e3e61bb54baf44ae2) fix(slack-cli): use valid Slack Block Kit section/mrkdwn instead of invalid markdown type - [`b8669f1`](https://github.com/Comfy-Org/Comfy-PR/commit/b8669f17ee1cb509915f3cd5a552a1e9ed6c6061) feat(slack-cli): add TS utility layer with URL parsing, markdown conversion, caching, and safe messaging - [`e481a94`](https://github.com/Comfy-Org/Comfy-PR/commit/e481a9439ec270cfec0975ef39d96ecc09375ce8) feat: add prbot feedback command — posts to private #prbot-feedback Slack channel - [`771e1d5`](https://github.com/Comfy-Org/Comfy-PR/commit/771e1d53afa93825fab6d75b664dbaed285a9bd5) feat(feedback): auto-detect repo URL and CLI version in feedback posts ### 📊 Changes **26 files changed** (+1307 additions, -508 deletions) <details> <summary>View changed files</summary> 📝 `.bot/AGENT.md` (+50 -0) 📝 `.gitignore` (+5 -0) 📝 `app/(dashboard)/details/page.tsx` (+0 -1) 📝 `app/(dashboard)/totals/page.tsx` (+0 -1) 📝 `app/auth/login/page.tsx` (+18 -1) 📝 `app/tasks/github-contributor-analyze/githubContributorAnalyze.ts` (+7 -2) 📝 `bot/cli.ts` (+33 -0) 📝 `bot/error-collector.ts` (+53 -3) 📝 `bot/index.ts` (+48 -1) 📝 `bot/slack-bot.ts` (+549 -296) ➕ `bot/spawn-as-user.ts` (+82 -0) ➕ `bot/task-user.ts` (+136 -0) ➕ `bot/taskInputFlow.spec.ts` (+87 -0) 📝 `docs/perf/README.md` (+8 -8) 📝 `docs/perf/build-and-typecheck.md` (+29 -17) 📝 `docs/perf/caching-strategy.md` (+21 -21) 📝 `docs/perf/client-bundle.md` (+13 -8) 📝 `docs/perf/dependency-bloat.md` (+31 -30) 📝 `docs/perf/mongodb-queries.md` (+14 -13) 📝 `docs/perf/server-rendering.md` (+19 -15) _...and 6 more files_ </details> ### 📄 Description ## Summary ComfyPR-Bot behavior improvements (16 items total), shipped in phases across Slack webhook, UX, cost, features, and reliability. ### Reliability (Phase 1) - **#8** Webhook retry dedup — fix the case where Slack's 3s-timeout retries cause the same event to run 3x (1h TTL `event_id` dedup). - **#10** `.env.local` override + secret-prefix log on startup — prevent the recurring incident (2026-04-24) where pm2 carried stale shell env that shadowed `.env.local`. - **#11** taskUser PATH (verification of the existing implementation only). ### UX / response quality (Phase 2) - **#1** Quick Respond sectioned structure (📋 Understanding / 🔍 Progress / 📎 Deliverables / ✅ Done) — drop the "one line per update" constraint so long-running tasks show real progress. - **#2** Async intent analysis — post the "👀 Received..." placeholder immediately and run the GPT call in parallel, then edit the placeholder (first reply 5-10s → ~1s). - **#12** Dynamic update model — diffs <2000 chars use gpt-4o-mini, only large diffs use gpt-4o (~70-80% cost reduction). ### Feature additions (Phase 3) - **#7** Auto-surface PR URLs — extract `github.com/.../pull/N` from agent output and pin them under 📎 Deliverables. - **#16** ❌ reaction cancel — reacting to the original message with ❌ aborts the matching AbortController. Author-only. - **#14** Image vision input — download attached images to `./attachments/` so the agent can read them via the Read tool. ### Cost / reliability finalization (Phase 4) - **#4** Dynamic maxTurns — the intent LLM classifies complexity (simple=40 / medium=100 / complex=200) and the agent gets that turn budget. - **#5** ErrorCollector switched to fs.watch — 10s polling → event-driven + 60s safety-net poll. - **#6** Content-based dedup — `event.ts + sha256(text)[:8]` so an edit with new intent retriggers, but identical retries within 10s do not. - **#3** Thread context compression — when a thread exceeds 20 messages, summarize older ones with gpt-4o-mini (decisions / open questions / referenced URLs / errors). - **#9** CI strict (already in place via `bun run check` in `test.yaml`). - **#13** Agent self-update — `.bot/AGENT.md` delegates `prbot slack update` to the agent itself. The GPT-4o synthesizer is demoted to a 30s safety net. - **#15** TaskInputFlow drain spec — unit tests for the TransformStream contract used to ingest follow-up messages. ## Test plan - [x] typecheck (`bunx tsc --noEmit`) - [x] `bun test bot/taskInputFlow.spec.ts` (4/4 pass) - [x] Webhook retry dedup live test — confirmed `Ignoring duplicate webhook event` log - [x] Env prefix log on startup — `[env] SLACK_SIGNING_SECRET=f944ab... | ...` - [x] Bot running under PM2, listening for webhooks on port 3475 - [ ] End-to-end Slack DM check: placeholder → intent analysis → sectioned progress edits - [ ] Confirm 📎 Deliverables surfaces PR URLs after a PR-creation task - [ ] Confirm ❌ reaction aborts a running task - [ ] Confirm Claude vision input works on a DM with image attachments Design notes in `tmp/improvement-plan.md` (gitignored). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-27 21:10:36 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Comfy-Org/Comfy-PR#204
No description provided.