Bring back the dawn gap that keeps Claude's 5h windows on the primer
slots (08-13, 13-18, 18-23, 23-04): it was dropped by the 2026-06-08
upstream merge (1dd948a).
- usage-alignment-hold.ts: hold during 04:00-08:00 KST, or until the ISO
time in router_state `usage_alignment_hold_until` (ignored once past,
so only the daily gap remains). A one-off end inside the gap runs on to
08:00.
- Claude turns during a hold pause through the existing usage-pause path
(messages kept, room resumed at the hold end) with an alignment notice.
The stored pause is marked alignmentOnly so it does not act as an
account-wide usage limit.
- Due Claude scheduled tasks stay due until the hold ends (Codex and
GitHub CI watchers are not held).
- Urgent bypass like the old gate: a human @-mention lets that room run
until the hold ends.
- Tests stub the wall-clock hold in test/vitest-env.ts so the suite does
not pause when run between 04 and 08 KST.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Before, a Claude run that hit the account usage limit closed the open
paired task as claude_usage_limit, posted the reset time and consumed the
user's messages, so the work was lost and had to be re-requested.
Now the room is paused instead:
- The failed turn is released without touching the paired task (no
failure count, no status change, no follow-up) and the queue keeps the
human messages unconsumed, so the same turn can run again.
- The room is recorded in router_state `claude_usage_pause` with the reset
time (error text, else cached usage API reset, else a 10 min retry). A
banner time that just passed is read as "now", not tomorrow.
- While the limit lasts, paused rooms run nothing and any other room's
Claude turn pauses that room without spawning a run (the limit is
account-wide). A stop request still goes through and drops the room
from the resume list.
- The scheduler tick clears the pause 1 min after the reset, posts a
resume notice and re-queues the rooms; the pending turn or the kept
messages then run again. The state survives restarts.
Safety refusals keep closing the task as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When Claude hit a limit the run was handed to a Codex service
(codex-main/codex-review) through service_handoffs and a global owner
failover. That service does not exist in this deployment, so handoffs
stayed pending forever (2 rows since May) and the user got no answer.
Removed:
- handoff creation (message-agent-executor-handoff, paired-turn-fallback)
and the delegated paired-execution path
- the pending-handoff poll/claim worker (message-runtime-handoffs) and the
service_handoffs CRUD module (db/service-handoffs, db exports)
- global owner failover in service-routing, its recovery timer in index,
the dashboard failover line, the codex-review failover prompt pack and
prompts/codex-review-failover-platform.md
- failoverOwner in RoomRoleContext and the `failover=` ROOM_ROLE field
- OWNER_/REVIEWER_/ARBITER_FALLBACK_ENABLED and FAILOVER_MIN_DURATION_MS
- tests for the removed behaviour
Now, when a Claude run fails with a usage/rate limit (trigger reason
429 or usage-exhausted) the executor closes the open paired task as
completed/claude_usage_limit and sends the room one final notice:
"Claude 사용 한도에 도달했습니다. 21:40에 재개할 수 있습니다." The reset time
comes from the error text (CLI banner "resets 9:40pm (Asia/Seoul)", dated
banners, "try again at ...", ISO timestamps), else from the cached usage
API window at 100%, else "잠시 후 다시 시도해 주세요". Nothing retries
silently; the next user message starts a new task. Other Claude failures
(session failure, org access denied) now end as ordinary run errors.
The service_handoffs table, its columns on paired_turn_attempts and the
migrations stay untouched for the later migration squash; the runtime no
longer reads or writes them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>