Files
EJClaw/.env.example
Codex 8c68577a24 refactor: replace the Claude→Codex failover with a usage-limit notice
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>
2026-10-01 20:14:48 +09:00

69 lines
3.0 KiB
Plaintext

# ===== EJClaw Environment Configuration =====
# Copy this file to .env and fill in the values.
# Single unified service manages all three Discord bots in one process.
# --- Discord bots (canonical role-fixed names) ---
DISCORD_OWNER_BOT_TOKEN= # Owner bot
DISCORD_REVIEWER_BOT_TOKEN= # Reviewer bot
DISCORD_ARBITER_BOT_TOKEN= # Arbiter bot
# Old service-based token names are no longer accepted.
# Rename any existing values to the three canonical role-based keys above.
# --- Agent type configuration ---
OWNER_AGENT_TYPE=codex # codex | claude-code
REVIEWER_AGENT_TYPE=claude-code # claude-code | codex
# ARBITER_AGENT_TYPE=codex # optional: codex | claude-code
# --- API keys ---
CLAUDE_CODE_OAUTH_TOKEN= # Claude Code OAuth token (single account)
GROQ_API_KEY= # Voice transcription (Groq Whisper, free: console.groq.com)
# --- Bot identity ---
ASSISTANT_NAME=claude # Trigger name (@claude)
# --- Claude model ---
CLAUDE_MODEL=claude-opus-5-5 # Claude model
CLAUDE_EFFORT=high # Claude effort level
CLAUDE_THINKING=adaptive # Claude thinking mode
# --- Codex model ---
CODEX_MODEL=gpt-5.5 # Codex model
CODEX_EFFORT=xhigh # Codex reasoning effort
# Codex fast mode / goals: ~/.codex/config.toml:
# [features]
# fast_mode = true
# goals = true # /goal — opt-in, default OFF on Codex 0.133+
# --- Usage dashboard ---
STATUS_CHANNEL_ID= # Discord channel ID for live status updates
# STATUS_SHOW_ROOMS=true # Show room status in dashboard
# STATUS_SHOW_ROOM_DETAILS=false # Show detailed room info
# --- Discord image attachments ---
# Extra local directories that agents may attach from. Keep this narrow:
# prefer screenshot/output folders over /home. Comma or path-delimiter separated.
# EJCLAW_ATTACHMENT_ALLOWED_DIRS=~/Pictures/Screenshots,~/Downloads/ejclaw-images
# --- Codex usage primer ---
# The usage primer sends a tiny real Codex prompt at fixed KST slots
# (08/13/18/23). These keys override its prompt, model and timeout.
# CODEX_WARMUP_PROMPT=Reply exactly OK. Do not run tools.
# CODEX_WARMUP_MODEL= # Defaults to CODEX_MODEL
# CODEX_WARMUP_COMMAND_TIMEOUT_MS=120000
# --- Per-role model overrides (paired rooms) ---
# Override global CLAUDE_MODEL/CODEX_MODEL per role.
# Model is injected based on each role's agent type (claude-code → CLAUDE_MODEL, codex → CODEX_MODEL).
# OWNER_MODEL=gpt-5.5 # Owner model override
# OWNER_EFFORT=xhigh # Owner effort override
#
# REVIEWER_MODEL=claude-opus-5-5 # Reviewer model override
# REVIEWER_EFFORT=high # Reviewer effort override
#
# ARBITER_MODEL=gpt-5.5 # Arbiter model override when ARBITER_AGENT_TYPE=codex
# ARBITER_EFFORT=xhigh # Arbiter effort override
# --- Advanced ---
# MAX_CONCURRENT_AGENTS=5 # Max parallel agent processes