Skip to content

feat(commands): add /<N> defer-send + /0 cancel per chat#309

Open
uestney wants to merge 1 commit into
xvirobotics:mainfrom
uestney:feat/per-bot-deferred-send
Open

feat(commands): add /<N> defer-send + /0 cancel per chat#309
uestney wants to merge 1 commit into
xvirobotics:mainfrom
uestney:feat/per-bot-deferred-send

Conversation

@uestney

@uestney uestney commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • /<N> <message> queues <message> to fire N minutes from now (default unit = minutes; independent of the live conversation).
  • The whole feature lives in the numeric /<digits> namespace so it can never collide with a word command: /0 cancels the chat's pending deferred message — no ID needed.
  • Per-chat single-slot rule: at most one pending deferred message per (bot, chat). A second /<N> while one is queued is rejected with the existing entry's details; /status surfaces the pending entry; max defer 7 days.
  • Scheduler injected via setter (process-singleton, mirrors setSessionRegistry); bots without one get a clear "scheduler unavailable" notice instead of crashing.

Test plan

  • npm run build (tsc + web) — exit 0
  • npm run lint — 0 errors (3 pre-existing warnings in untouched files)
  • npx vitest run --dir tests/ — all green (config-cluster failures are BOT_NAME env pollution from the test host, not this change)
  • New tests/command-handler-deferred.test.ts covers queue / single-slot / /0 cancel / no-task / trailing-body / missing-body / >7d / 7d boundary / no-scheduler / /status
  • tests/command-handler-help.test.ts asserts /0 is documented

@uestney uestney force-pushed the feat/per-bot-deferred-send branch from 636b59e to 965d11c Compare May 19, 2026 16:44
@uestney uestney changed the title feat(commands): add /<N> defer-send + /cancel per chat feat(commands): add /<N> defer-send + /0 cancel per chat May 19, 2026
`/<N> <message>` queues `<message>` to fire N minutes from now
(default unit = minutes). The whole feature lives in the numeric
`/<digits>` namespace so it can never collide with a word command:
`/0` cancels the chat's pending deferred message — no ID needed.

Per-chat single-slot rule: at most one pending deferred message per
(bot, chat). A second `/<N>` while one is queued is rejected with the
existing entry's details; `/status` surfaces the pending entry. Max
defer is 7 days. Scheduler is injected via setter (process-singleton,
mirrors setSessionRegistry); bots without one get a clear notice.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant