feat: replace session commands with a natural-language stop

Remove the /compact, /clear and /stop session commands. They were gated
to the main room or SESSION_COMMAND_ALLOWED_SENDERS, neither of which
exists in this deployment, so nobody could use them. The agent-runner
/compact passthrough goes with them.

Instead, a short human message whose whole intent is "stop" (그만, 멈춰,
중단해, 하지 마, 취소, stop, cancel, ...; see src/stop-intent.ts) stops the
room when it has something to stop: a running or queued run, an open
paired task, or unprocessed human messages before it. The message loop
then
- advances the room cursors past the stop message (memory + router_state)
- completes the open paired task as user_stopped, cancels its open turns
  and drops its execution lease
- closes stdin with a user-stop reason and kills the agent through the
  existing GroupQueue.closeStdin/killProcess
- replies "진행 중이던 작업을 중단했습니다." once
When nothing is running the message is handled as a normal message.

The user-stop close reason is treated like a human interruption, so the
killed paired turn releases its lease without counting a failure and
queues no follow-up, and the turn controller does not post the generic
failure text on top of the stop reply.

advanceLastAgentCursor no longer moves a cursor backwards, so a run that
finishes after the stop cannot rewind the cursor and re-dispatch the
stop message (the respawn seen when an agent was only killed).

Stale SESSION_COMMAND_* keys in .env are now ignored instead of failing
startup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codex
2026-10-01 19:26:10 +09:00
parent fe7c5a7b23
commit ce4547daa6
40 changed files with 949 additions and 1084 deletions

View File

@@ -31,6 +31,7 @@ EJClaw는 Discord 위에서 동작하는 Tribunal 멀티에이전트 개발 보
- Claude 장애 시 Codex로 넘기는 global failover
- Claude OAuth 멀티 토큰 로테이션
- `assign_room` 기반 명시적 room assignment
- 자연어 중단: 작업 중인 방에 "그만", "멈춰", "중단해", "취소", "stop" 같은 짧은 메시지만 보내면 실행 중인 에이전트를 끝내고 열린 paired task를 닫음
- Bun + SQLite 기반 빠른 런타임
## 운영 적용 사항
@@ -67,6 +68,15 @@ GitHub `main` 베이스 위에 운영 중 검증된 변경을 현재 코드 구
→ 왕복이 누적되면 arbiter 자동 요청 가능
```
### 작업 중단
방에서 에이전트가 실행 중이거나, 대기 중인 메시지·열린 paired task가 있을 때 사람이 중단 의도만 담긴 짧은 메시지를 보내면 그 방의 작업을 멈춥니다.
- 인식하는 표현: `그만`, `그만해(줘)`, `그만하자`, `멈춰(줘)`, `중단(해)`, `중지`, `하지 마`, `취소(해)`, `스톱`, `stop`, `cancel` 등. 앞뒤 봇 멘션과 끝의 `. ! ~ ㅠ ㅜ`는 무시하고, "작업 중단해줘", "제발 그만"처럼 짧은 수식어는 허용합니다.
- "그거 하지 말고 이거 해줘", "중단하지 말고 계속해", "로그인 취소 기능 만들어줘"처럼 다른 지시가 섞인 메시지는 중단으로 보지 않습니다. 애매하면 일반 메시지로 처리합니다.
- 중단 시: 실행 중인 owner/reviewer/arbiter 프로세스를 종료하고, 열린 paired task를 `completion_reason = 'user_stopped'`로 닫고(남은 turn 취소, 실행 lease 해제), 중단 메시지까지의 메시지를 처리된 것으로 넘긴 뒤 "진행 중이던 작업을 중단했습니다."라고 한 번 답합니다.
- 멈출 것이 없으면 그 메시지는 평소처럼 에이전트에게 전달됩니다.
## 방 설정 모델
현재 room 설정의 기준은 다음과 같습니다.