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:
@@ -39,7 +39,6 @@ vi.mock('./config.js', () => ({
|
||||
normalizeServiceId: vi.fn((serviceId: string) => serviceId),
|
||||
isClaudeService: vi.fn(() => true),
|
||||
isReviewService: vi.fn(() => false),
|
||||
isSessionCommandSenderAllowed: vi.fn(() => false),
|
||||
TIMEZONE: 'Asia/Seoul',
|
||||
}));
|
||||
|
||||
@@ -270,13 +269,6 @@ vi.mock('./sender-allowlist.js', () => ({
|
||||
loadSenderAllowlist: vi.fn(() => ({})),
|
||||
}));
|
||||
|
||||
vi.mock('./session-commands.js', () => ({
|
||||
extractSessionCommand: vi.fn(() => null),
|
||||
handleSessionCommand: vi.fn(async () => ({ handled: false })),
|
||||
isSessionCommandAllowed: vi.fn(() => true),
|
||||
isSessionCommandControlMessage: vi.fn(() => false),
|
||||
}));
|
||||
|
||||
import * as agentRunner from './agent-runner.js';
|
||||
import * as db from './db.js';
|
||||
import { resolveGroupIpcPath } from './group-folder.js';
|
||||
@@ -359,7 +351,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
enqueueMessageCheck: vi.fn(),
|
||||
@@ -429,7 +420,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
enqueueMessageCheck: vi.fn(),
|
||||
@@ -507,7 +497,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -559,7 +548,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -627,7 +615,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -753,7 +740,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -865,7 +851,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -949,7 +934,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1039,7 +1023,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1122,7 +1105,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1216,7 +1198,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1337,7 +1318,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1430,7 +1410,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1526,7 +1505,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1603,7 +1581,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1723,7 +1700,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -1830,7 +1806,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2203,7 +2178,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2322,7 +2296,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2431,7 +2404,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2559,7 +2531,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2659,7 +2630,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2755,7 +2725,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2848,7 +2817,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -2943,7 +2911,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel, arbiterChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3056,7 +3023,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel, arbiterChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3172,7 +3138,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3264,7 +3229,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3353,7 +3317,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3417,7 +3380,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel],
|
||||
queue: {
|
||||
enqueueMessageCheck: vi.fn(),
|
||||
@@ -3491,7 +3453,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3561,7 +3522,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3679,7 +3639,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'Asia/Seoul',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, reviewerChannel],
|
||||
queue: {
|
||||
enqueueMessageCheck: vi.fn(),
|
||||
@@ -3795,7 +3754,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'Asia/Seoul',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [ownerChannel, arbiterChannel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3873,7 +3831,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 60_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -3957,7 +3914,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4049,7 +4005,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4140,7 +4095,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4241,7 +4195,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4322,7 +4275,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4424,7 +4376,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 20_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4541,7 +4492,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4647,7 +4597,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4725,7 +4674,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4786,7 +4734,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4874,7 +4821,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -4949,7 +4895,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5055,7 +5000,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5181,7 +5125,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5297,7 +5240,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5378,7 +5320,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 60_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5454,7 +5395,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5537,7 +5477,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5610,7 +5549,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [channel],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5668,7 +5606,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [makeChannel(chatJid)],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
@@ -5728,7 +5665,6 @@ describe('createMessageRuntime', () => {
|
||||
idleTimeout: 1_000,
|
||||
pollInterval: 1_000,
|
||||
timezone: 'UTC',
|
||||
triggerPattern: /^@Andy\b/i,
|
||||
channels: [makeChannel(chatJid)],
|
||||
queue: {
|
||||
registerProcess: vi.fn(),
|
||||
|
||||
Reference in New Issue
Block a user