Skip to content

chore(fix-sentry): add daemon script and single-issue mode#1759

Merged
piorpua merged 1 commit intomainfrom
chore/fix-sentry-daemon
Mar 26, 2026
Merged

chore(fix-sentry): add daemon script and single-issue mode#1759
piorpua merged 1 commit intomainfrom
chore/fix-sentry-daemon

Conversation

@kaizhou-lab
Copy link
Copy Markdown
Collaborator

Summary

  • Add scripts/fix-sentry-daemon.sh: daemon that polls Sentry API and launches one Claude process per issue in isolated git worktrees
  • Remove auto-merge from fix-sentry skill (delegated to pr-auto-merge-daemon)
  • Add single-issue mode to skill (issue_url= parameter, skips batch triage)

Key changes

  • Sentry auth token auto-read from ~/.claude.json MCP config
  • Each issue runs in its own git worktree (no interference with main working dir)
  • ./scripts/fix-sentry-daemon.sh stop to cleanly kill daemon + all child processes
  • < /dev/null on claude subprocess to prevent stdin leak from while-read loop

Test plan

  • Run ./scripts/fix-sentry-daemon.sh and verify it fetches issues
  • Verify each issue gets its own Claude process and worktree
  • Verify ./scripts/fix-sentry-daemon.sh stop kills all processes
  • Verify main working directory is not affected during daemon run

…e mode

- Add scripts/fix-sentry-daemon.sh: polls Sentry API, launches one Claude
  process per issue in isolated git worktrees
- Remove auto-merge from fix-sentry skill (delegated to pr-auto-merge)
- Add single-issue mode to skill (issue_url= parameter, skips batch triage)
- Auto-read Sentry auth token from ~/.claude.json MCP config
- Add stop command: ./scripts/fix-sentry-daemon.sh stop
- Mark processed before launch to prevent re-processing on restart
- Improved PR dedup check using branch name matching
@kaizhou-lab kaizhou-lab force-pushed the chore/fix-sentry-daemon branch from 86a0d86 to fa42e58 Compare March 26, 2026 13:25
@piorpua piorpua added the bot:reviewing Review in progress (mutex) label Mar 26, 2026
@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 26, 2026

Code Review:chore(fix-sentry): add daemon script and single-issue mode (#1759)

变更概述

本 PR 包含三处独立改动:① 从 fix-sentry skill 中移除自动合并逻辑(委托给 pr-automation 处理);② 新增 scripts/fix-sentry-daemon.sh 守护进程,对每个 Sentry issue 独立创建 worktree 并启动 Claude 进程;③ fsBridge.ts 补充对 EBUSY(Windows 文件锁)错误的 null 返回处理。


方案评估

结论:✅ 方案合理

守护进程设计合理:锁文件防止重复启动、worktree 隔离避免主目录干扰、< /dev/null 防止 stdin 泄漏、caffeinate 防止 macOS 睡眠。fsBridge.ts 的 EBUSY 补丁简洁正确,与现有 ENOENT 处理对称。将自动合并职责从 skill 中剥离并统一由 pr-automation 管理,符合单一职责原则。


问题清单

🔵 LOW — 守护进程在 Claude 完成前即标记为已处理

文件scripts/fix-sentry-daemon.sh,第 215–218 行

问题代码

# Mark as processed BEFORE launching Claude (so daemon restart won't re-process)
mark_processed "$issue_id"

问题说明:若 Claude 进程因 worktree 创建失败、网络中断等原因未能成功创建 PR,该 issue 已被标记为已处理,7 天内不会重试。当前代码在 worktree 创建失败时会 continue,但 mark_processed 已执行。

修复建议:将 mark_processed 移至 worktree 创建成功之后,或在 worktree 失败时主动清除该标记:

git -C "$REPO_ROOT" worktree add "$WORKTREE_DIR" origin/main --detach 2>/dev/null || {
  log "  [${short_id}] Failed to create worktree, skipping"
  continue
}

# Mark as processed only after worktree is ready
mark_processed "$issue_id"

🔵 LOW — readFileBuffer 测试缺少 ENOENT 和正常读取用例

文件tests/unit/process/bridge/fsBridge.readFile.test.ts

问题说明readFile 有 ENOENT、EBUSY、EPERM、正常读取四个用例,但 readFileBuffer 仅有 EBUSY 一个用例,缺少 ENOENT 和正常返回 ArrayBuffer 的测试,对称性不足。


汇总

# 严重级别 文件 问题
1 🔵 LOW scripts/fix-sentry-daemon.sh:215 worktree 失败后 issue 仍被标记为已处理
2 🔵 LOW tests/unit/.../fsBridge.readFile.test.ts readFileBuffer 缺少 ENOENT 和正常读取测试

结论

批准合并 — 无阻塞性问题,两处 LOW 问题均为边缘情况,不影响主流程正确性。


本报告由本地 pr-review skill 生成,包含完整项目上下文,无截断限制。

@piorpua
Copy link
Copy Markdown
Contributor

piorpua commented Mar 26, 2026

✅ 已自动 review,无阻塞性问题,正在触发自动合并。

@piorpua piorpua added bot:done Auto-merged by bot and removed bot:reviewing Review in progress (mutex) labels Mar 26, 2026
@piorpua piorpua merged commit 818bf29 into main Mar 26, 2026
17 checks passed
@piorpua piorpua deleted the chore/fix-sentry-daemon branch March 26, 2026 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:done Auto-merged by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants