Merged
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a task is cancelled via x reaction, the "Error: cancelled" message and session info were being posted publicly to the channel. Now both are sent as ephemeral messages visible only to the requesting user. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
요구사항
Slack에서 Claude 작업을 트리거한 후 중간에 멈출 수 없는 문제가 있었습니다. 작업이 오래 걸리거나 잘못된 방향으로 진행될 때 취소할 수 있는 방법이 필요했습니다.
구현
트리거한 메시지에
x이모지 리액션을 달면 해당 메시지에 연결된 진행 중인 Claude 작업을 즉시 중지합니다. 취소 성공 시 본인에게만 보이는 ephemeral 메시지로 안내합니다.src/slack/cancelMap.ts(신규):Map<messageTs, AbortController>기반 CancelMap 클래스. 작업 등록/취소/해제 담당src/claude/runner.ts:ClaudeOptions에signal?: AbortSignal추가.runClaude와runClaudeStream모두 abort 시proc.kill()처리src/slack/handler.ts:createMentionHandler와createAssistant에 cancelMap 연결.createReactionCancelHandler추가 —x이모지 + allowedUsers 체크 후 취소 및 ephemeral 전송src/index.ts: CancelMap 인스턴스 생성,reaction_added이벤트 등록reactions:read스코프,reaction_added이벤트 추가 안내동작 방식
엣지 케이스 처리:
Slack 앱 설정 필요
reactions:read스코프 추가reaction_added이벤트 추가Test
101개 테스트 PASS, 타입체크 통과
tests/slack/cancelMap.test.ts: CancelMap 5개 테스트tests/claude/runner.test.ts: AbortSignal pre-abort 테스트 2개 추가tests/slack/handler.test.ts: createReactionCancelHandler 4개 테스트