Commit Graph

1597 Commits

Author SHA1 Message Date
Codex
0ce79c8d0c fix: do not treat an approved reviewer STEP_DONE with progress as a deadlock
The reviewer prompt defines STEP_DONE as 'this step is acceptable, send the
task back to the owner without escalating to the arbiter', but once
round_trip_count reached ARBITER_DEADLOCK_THRESHOLD (2) every STEP_DONE
requested the arbiter, and with ARBITER_MAX_INTERVENTIONS=1 the next one
closed the task as escalated. Long multi-step requests (wargame room) were
stopping every 2-3 approved steps and needed a human 'continue'.

A reviewer STEP_DONE now counts as a deadlock only when the owner made no
committed change since the start of its latest turn (task.source_ref).
When it did, the task goes back to the owner and round_trip_count resets
so the deadlock counter measures rounds since the last approved step.
No-progress STEP_DONE loops and DONE_WITH_CONCERNS loops still go to the
arbiter as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 15:14:56 +09:00
Codex
720223eb10 fix: keep paired rooms moving when owner turn preparation fails
A wargame room stalled after its owner ran npm install in a bun project:
both bun.lock and package-lock.json existed, so every owner turn threw
'Ambiguous package manager' while provisioning the workspace. The queue
had already claimed the turn, nothing released the claim, and the 5s
backoff retry was skipped as 'already claimed elsewhere', so the room
sat idle until a human wrote again (and then failed the same way).

- Owner workspace provisioning and the review handoff no longer fail
  when the dependency install step throws; they log a warning and go on.
- If preparing a paired run throws, mark the claimed turn failed and
  release its execution lease so the retry can run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-29 15:10:00 +09:00
Codex
fdd98e9eb8 feat: keep typing during scheduled tasks and tell waiting users
A group-context scheduled task occupies the room queue, so a human message
sent meanwhile waited silently (up to the whole task run) with no typing
indicator; the room looked unresponsive.

- Scheduled tasks (not CI watchers) hold the room's typing indicator for
  their whole run (DiscordChannel.setTypingHold: typing stays on while any
  hold is active, independent of message-turn setTyping(false)).
- A human message that has to wait behind a running scheduled task gets a
  one-time notice per wait: "지금 예약 작업을 진행하고 있습니다. 이 작업을
  마친 뒤 바로 답변드리겠습니다." (GroupQueue.claimScheduledTaskWaitNotice,
  reset when the waiting messages run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 23:12:00 +09:00
Codex
fdfdd384bf fix: mark untranslated fallbacks and drop English progress text
- When the Korean rewrite errors, the stream ends before it arrives, or a
  final must go out without a result event, append a Korean notice to the
  English text instead of sending it bare (content is kept: dropping a
  NEEDS_CONTEXT question would be worse than English).
- A still-English rewrite is sent unchanged: the nudge tells the model to
  repeat only when the user explicitly asked for English.
- Intermediate progress text cannot be rewritten mid-turn, so English
  progress (>= 20 Latin letters, Hangul < 10%) is dropped before it is
  flushed by tool_progress / tool results / the result event.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 02:11:42 +09:00
Codex
98011e282b fix: rewrite English final answers in Korean before delivery
A sketchup-app turn spent on English login pages (Trimble/Edge) ended
with an English NEEDS_CONTEXT answer. The Korean rule was only a prompt
line, the answer went straight to the user (no reviewer gate), and it was
carried forward into the next task, so the next turn answered in English
too.

- Claude runner: when a final answer is mostly English (Hangul < 10% of
  Latin letters, >= 150 letters, code/links/boilerplate ignored), ask the
  same session once to rewrite it in Korean and emit only the rewrite.
  Falls back to the original on error or early stream end; disabled when
  AGENT_LANGUAGE is set to a non-Korean language.
- Let handleResultMessage settle the buffered final text instead of
  pre-flushing it as progress, so the English draft never surfaces.
- Platform prompt: explicit "Reply language" section; owner rule no longer
  says "unless the user wrote in another language".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 02:07:17 +09:00
Codex
e3308eb119 feat: give owner runs a headless chrome-devtools MCP
Adds chrome-devtools-mcp 1.11.0 to the Claude runner so the owner (or a
single-mode room) can open pages, click/fill, take screenshots and read
console/network errors. Reviewer, arbiter and read-only runtimes do not
get it. Chrome runs headless with an isolated temp profile under TMPDIR,
Google usage statistics and CrUX lookups are off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 12:25:04 +09:00
Codex
97cc670e34 fix: show a rolled-over usage window as unknown, not 0%
91203d8 rendered an expired window as 0% unconditionally. If the post-reset
refetch fails (network error, 429) the 0% stayed for as long as fetches
kept failing, the same stale-value bug in the other direction. An expired
window now renders as -1 (the empty "─────" unknown cell) until a fetch
succeeds and brings the new window's real value.

Tests: expired window -> -1 for Claude and Codex rows; refetch failing at
+1 min and +60 min stays unknown, then success shows 3%; 429 shows the
429 indicator; renderer draws -1 as the placeholder cell.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:10:51 +09:00
Codex
91203d84fc fix: dashboard usage no longer shows a rolled-over window's old value
At 23:00 on 2026-10-19 the Claude 5h window reset, but the dashboard kept
showing "99% reset" until 23:04:34 (real value 3%): the 5-minute fetch
throttle replayed the 22:59:04 snapshot. Codex rows were also formatted
once per 5-min poll, so their % and countdown froze between polls.

- A window whose resets_at has passed renders as 0% with no countdown.
- Claude usage fetch skips the throttle once when a cached window reset
  fell after the last attempt (429 cooldown still honoured).
- Codex rows are rebuilt from cached state at every render.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 23:06:16 +09:00
Codex
d1068f1627 fix: don't drop human messages that paste a bot status prefix
A user copy-pasted a bot progress message into joke-app; the invisible
U+2063 status prefix came along and getProcessableMessages dropped the
human message as a task-status control message, so it was never answered.
Only treat the prefix as control when the message is bot-authored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 17:56:33 +09:00
Codex
0d7e345d3d fix: check every scheduled Claude attempt for the usage limit
The alignment-hold check in runTask only looked at the first attempt's
streamed trigger. A limit that came back only as the final error (no
streamed output) or on the retry after an auth refresh extended nothing.
holdAlignmentAfterClaudeTaskLimit now runs inside runTaskAttempt for
every Claude attempt and reads the streamed trigger, the final error and
the attempt error (classifyClaudeTrigger), then calls the shared
holdUntilSlotAfterLimitReset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:09:03 +09:00
Codex
0a5436e4ad fix: alignment hold also covers scheduled-task limits and the primer
- A scheduled Claude task that hits the usage limit now extends the
  alignment hold to the next slot when the reset is off the grid, like a
  room turn (it called runAgentProcess directly and skipped that path).
- The Claude primer is skipped while a hold outlasts its slot (e.g. the
  08:00 primer during a realignment hold until 13:00). A hold ending at
  the slot itself does not count: the slot timer fired at 07:59:59.999
  for 08:00 on 2026-10-16.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 13:04:44 +09:00
Codex
a2b9898c0b fix: keep usage resets on the slot grid when Claude hits 100%
Evidence (journal): 10/04 and 10/05 08:00 and 10/12 23:00 the primer
failed (exit 1) because the account was at 100% in an off-slot window
(resets 9am / 3am); the first request after that reset then opened the
next window off the slot too, and the drift carried on.

- Usage limit that resets off the slot grid (not ~04/08/13/18/23:00 KST):
  extend the alignment hold to the next window start (08/13/18/23), so
  nothing opens a window between the reset and the primer. The pause
  notice names both times. Rooms paused by the limit stay paused
  (silently, now alignment-only, @-mention bypass works) until the hold
  ends; an expired real limit no longer counts as a limit.
- A real limit takes precedence over the hold in the pre-run gate.
- Primer: when the current 5h window (cached usage) ends within 10 min
  after the slot, wait until 5 s after that reset before firing, so the
  primer is not counted in, or rejected by, the old window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-16 06:03:38 +09:00
Codex
f944f97e54 feat: usage-alignment hold (04-08 KST daily + one-off hold until a set time)
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>
2026-10-16 05:54:39 +09:00
Codex
9dc5d9ea70 fix: stop the usage-limit loop (new banner, RESET misread, arbiter cap)
During the 2026-10-15 02:17-03:20 Claude session limit one task cycled
owner -> arbiter -> owner ~300 times:

- The CLI banner changed to "You've hit your session limit · resets
  3:20am"; only "hit your limit" was recognised, so the banner was a
  successful answer instead of a usage-limit pause. Match "hit your
  <0-2 words> limit".
- classifyArbiterVerdict matched the keyword anywhere in a line,
  case-insensitively, so "resets 3:20am" read as RESET. Require the
  upper-case keyword to lead the line as a whole word (the arbiter
  prompt already asks for that).
- The "reviewer failed repeatedly -> request arbiter" path did not pass
  arbiter_intervention_count, so ARBITER_MAX_INTERVENTIONS never applied
  there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 05:08:08 +09:00
Codex
aed7371cfa feat: pause room work on the Claude usage limit and resume after reset
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>
2026-10-13 13:14:56 +09:00
Codex
1167023a13 fix: cap inline prompt documents, raise Discord upload cap to 10 MiB
joke-app finalize failed with "Prompt is too long (~1.18M tokens)": the
runner inlined a 162-page, 8.3 MB PDF as a base64 document block for every
[Document: ...] reference, and the prompt referenced it twice.

The Claude runner now inlines a document at most once per prompt, only
PDFs up to 20 pages / 10 MiB (512 KiB when the page count is unknown) with
at most 40 PDF pages per prompt, and text documents up to 256 KiB. Larger
ones become a path note telling the agent to use the Read tool.

The same PDF was also rejected as an outbound attachment by our local 8 MiB
cap, although Discord's default per-file limit is now 10 MiB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:26:58 +09:00
Codex
f579b4f406 fix: treat Claude safeguards refusals as failures, reset the session
Claude Code returns "API Error: <model>'s safeguards flagged this message"
as a success-typed result. EJClaw delivered it as the owner's answer,
handed it to reviewer/arbiter, resumed the refused session (refused again)
and carried the banner forward into the next task.

Now it is a `safety-refusal` trigger: the raw banner is suppressed, the
Claude session is cleared, the paired task closes as
`claude_safety_refusal`, the room gets a short Korean notice, and refusal
banners are never carried forward. Global memory gains a rule not to read
thinking blocks from session transcripts (the reasoning_extraction trigger
of the 2026-10-12 incident).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 13:17:22 +09:00
Codex
e22feb0215 feat(attachments): allow Office documents as outbound attachments
Bots had to zip .pptx decks because the outbound allowlist only covered
images, audio/video, pdf, zip and plain-text files. Add docx/xlsx/pptx
(checked for the ZIP local-file-header signature) and legacy doc/xls/ppt
(checked for the OLE2 compound-file signature). The 8MB cap and the
allowed-directory rules are unchanged. Prompt format lists are updated so
agents stop zipping these files.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 17:59:49 +09:00
Codex
23f9271d04 docs: remove resolved router_state incident report
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 14:03:16 +09:00
Codex
20f829a73a docs: update router_state incident report to the committed state
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:31:58 +09:00
Codex
11c179c565 fix: allow paired_session_task router_state keys and guard new keys at write time
Commit c858b6e started writing paired_session_task:<folder> keys into
router_state, but the startup check only allowed last_seq/last_agent_seq.
The first restart after those keys existed (2026-10-03 05:11) exited with
code 78 and crash-looped ejclaw.service for 11 minutes.

- Keep the allowed keys/prefixes in one list in src/db/router-state.ts and
  use it for both the startup check and setRouterStateInDatabase, so an
  unregistered key fails on its first write and in tests instead of at the
  next startup.
- paired-session-binding imports the prefix constant instead of redefining it.
- Regression tests: app-written keys survive a re-init; unregistered keys are
  rejected on write.
- Add the incident report (docs/fix-2026-10-03-router-state-startup.md).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:28:40 +09:00
Codex
2e285c5d78 docs: slim the shared global memory and move details to ops notes
The global memory was ~40KB (~11k tokens) and loaded into every agent call.
Keep only rules every room needs and move host, credential, EJClaw ops and
project notes to groups/global/ops/*.md, referenced on demand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:52:33 +09:00
Codex
50f149dd0f Merge branch 'slim/db' into slim/all 2026-10-01 20:52:21 +09:00
Codex
0283abbb56 feat: skip or slim down the owner finalize turn
(a) When the reviewer approves the owner's first TASK_DONE answer on the
first review (one review round, outputs are exactly owner -> reviewer, no
revision or arbiter turns) and the owner workspace still matches the
approved tree with a clean working tree, no owner run happens: the task is
completed as done and the reviewed answer (status line stripped) is posted
as the final message. If the review was requested with a bare "검토해줘"
after a review-skipped answer, a one-line confirmation is posted instead of
repeating the answer.

(b) Every other finalize turn runs in a fresh, non-persisted session (no
resume of the task's long working session, no room memory briefing) with a
self-contained prompt: this task's user messages, the latest six turn
outputs and the finalize instructions/format. All three finalize entry
points (pending turn, inline bot-only follow-up, queued turn) use it.

The owner prompt now states that the first TASK_DONE answer must already
follow the final-message format because it may be posted as the final
message unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:42:12 +09:00
Codex
7f54c47e64 feat: let the owner skip review for change-free explanation answers
The owner may end a TASK_DONE answer with "리뷰 불필요: <reason>". The
host treats it as a request and honors it only when every guard holds:

- workspace content equals the task base (hasCodeChangesSinceRef), the
  working tree is clean, and HEAD did not move during the owner run
- the run used no file-mutating tool (Edit/Write/MultiEdit/NotebookEdit),
  no subagent (Agent/Task) and no state-changing or unknown MCP tool
- every Bash command is classified read-only by a conservative
  quote-aware classifier (src/bash-command-classifier.ts); anything
  unknown counts as mutating
- tool usage was reported and not truncated (agent-runner now reports
  tool names and Bash commands as toolUsage on its terminal output)
- the user did not ask for a review in this task

When honored the task completes as review_skipped with no reviewer or
finalize turn; the answer is delivered with the marker line removed and a
small "-# 검토 생략 …" note. Otherwise the marker is stripped and the
normal review runs. A bare "검토해줘"-style message right after a
review-skipped answer reopens that task for the reviewer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:36:53 +09:00
Codex
0dc0dad22a refactor: squash DB migrations 1-22 into a single baseline schema
base-schema.ts now holds the full schema at version 22, taken from the
production database (column order, indexes, provenance triggers), so a
fresh database is identical to the live one. Previously a fresh DB
differed: it had an extra idx_messages_chat_timestamp index and a
different column order in paired_tasks and paired_turn_outputs.

The migration runner keeps schema_migrations:
- empty DB: apply the baseline and record version 22 ('baseline')
- existing DB: must already be at version >= 22 (the live DB records
  1-22), otherwise startup refuses it without touching it
- later migrations (23+) run once each inside a transaction

Removed the 22 historical migrations, the legacy schema bundle, the
paired-turn provenance rebuild/backfill helpers that migration 10 replayed
on every start (all no-ops on the live DB), legacy session migration
helpers, the unused service handoff metadata helpers, and the tests that
only exercised legacy-schema upgrades. New schema tests check a fresh DB
against a snapshot dumped from production and that reopening a DB at the
baseline changes neither schema nor data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:26:15 +09:00
Codex
c858b6e446 feat: scope paired owner/reviewer sessions to one paired task
Each paired room used to resume one owner (and one reviewer) session for
weeks, so every call re-read a huge unrelated history (median ~260k input
tokens). A stored session is now resumed only while it belongs to the
running paired task; the first turn of a new task starts fresh and the new
session is bound to that task (router_state paired_session_task:<folder>,
survives restarts). Later turns of the same task (revisions, follow-up
human messages while the task is open) keep resuming it. Arbiter was
already fresh per call; single rooms are unchanged.

The previous task's final answer still reaches the new session through the
carried-forward turn-0 output, so PAIRED_CARRY_FORWARD_LATEST_OWNER_FINAL
now defaults to true.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:25:35 +09:00
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
Codex
a9eab5cb94 refactor: run Claude and Codex on one fixed account each
The deployment has a single Claude OAuth credential and a single Codex
ChatGPT account, so the N-account rotation machinery only added state
files, cooldown bookkeeping and code paths that never ran.

Removed:
- Claude token rotation (token-rotation.ts, token-rotation-base.ts):
  rotate-on-limit, per-token cooldowns, token-rotation-state.json.
  CLAUDE_CODE_OAUTH_TOKENS is still read, but only its first entry.
- Codex account rotation (codex-token-rotation.ts): account pool,
  rotate-on-429/auth, dead-auth/cooldown tracking, round-robin advance,
  d7 auto-rotate, codex-rotation-state.json, manual account switch.
- Account index plumbing in token-refresh, claude-credentials-path
  (CLAUDE_ACCOUNTS_DIR / ~/.claude-accounts/<n>), Claude/Codex usage
  collectors, the dashboard rows and the Codex warm-up.
- provider-retry.ts rotation loops and the Codex retry path.

Kept:
- Codex exclusive auth lease (one Codex run at a time), the 15-minute
  waitForCodexAuthLease, and a usage-poll lease that skips while a run
  holds the account (codex-auth.ts).
- Session auth copy and write-back of refreshed tokens
  (syncCodexSessionAuthBack, syncClaudeSessionAuthBack).
- Codex auth path: ~/.codex-accounts/0/auth.json, else ~/.codex/auth.json
  (now resolved per run, so a re-login needs no restart).
- Claude token refresh loop, CLAUDE_CREDENTIALS_PATH and the
  CLAUDE_TOKEN_REFRESH_* / CLAUDE_USAGE_USE_HOME_CREDENTIALS flags; an
  auth-expired run still force-refreshes the token and retries once.
- Error classification (classifyClaudeTrigger, classifyCodexTrigger).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 20:14:38 +09:00
Codex
f127ac7a2b refactor: remove the main room concept
No room has room_settings.is_main = 1, so every main-only path was dead,
and admin work is done from the host shell. Each room's agent may now
only act on its own room:

- IPC: messages/inbound injection only to the source room; schedule,
  update, pause, resume and cancel only for the source room's tasks;
  drop the assign_room and refresh_groups IPC tasks and the deps they
  needed (assignRoom/syncGroups/getAvailableGroups/writeGroupsSnapshot)
- DB/host evidence is always scoped to the source group folder
- runner MCP server: drop the assign_room tool, the target_group_jid
  parameters and the isMain flag; list_tasks shows only the room's tasks
- drop EJCLAW_IS_MAIN, RunnerInput.isMain and AgentInput.isMain; the
  global CLAUDE.md memory is now included for every room
- drop the available_groups.json snapshot (available-groups.ts), the
  inferred restart announcement that only went to the main room, and
  the unused Channel.syncGroups hook
- setup register: drop --is-main; deregister-room: drop the main-room
  refusal and --force, and fix its unknown[] binding type error
- remove the groups/main/ template

The room_settings.is_main column and migrations are untouched; new rows
get the column default (0) and nothing reads it anymore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:37:29 +09:00
Codex
ce4547daa6 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>
2026-10-01 19:26:10 +09:00
Codex
fe7c5a7b23 refactor: remove the disabled periodic Codex warm-up loop
CODEX_WARMUP_ENABLED defaulted to false and was never set, so the
warm-up loop in unified-dashboard never ran. Remove the loop, the
`enabled` / `intervalMs` config keys, the `disabled` result and the
`shouldSkip` hook it alone used. The fixed-slot usage primer keeps
calling runCodexWarmupCycle with forceAttempt exactly as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00
Codex
12b262eaa9 chore: drop root yaml, zod and @modelcontextprotocol/sdk dependencies
Nothing in src/, setup/, scripts/ or test/ imports them; only
runners/agent-runner uses zod and the MCP SDK, and it declares both in
its own package.json. bun.lock regenerated with --lockfile-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00
Codex
e999ce9a33 refactor: drop macOS launchd and nohup service install paths
The service only runs under Linux systemd. Remove setupLaunchd,
setupNohupFallback, buildLaunchdPlist, the launchd/nohup service checks
in setup/verify-services.ts, ServiceDef.launchdLabel, launchd/ and the
unused repo-tokens/ GitHub action. Without systemd, `setup --step
service` now fails with systemd_unavailable instead of writing a nohup
wrapper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00
Codex
a9fe9dac54 refactor: remove dead exports and orphan modules
Delete exported symbols that nothing in src/, setup/, scripts/ or
runners/ references (and no test exercises), iterated to a fixed point:
service-routing lease/failover helpers, paired-workspace-manager
fingerprint/registration helpers, message-runtime-rules trigger helpers,
utils.fetchWithTimeout, detectPnpmStorePath, isCodexMainService,
isDeltaHandoffEnabledForGroup with the unused DELTA_HANDOFF config, the
deprecated db/schema.applySchemaMigrations alias, unused db wrappers
(memories, router state, sessions-by-agent-type, room skill override
writes, recent chat/turn-output queries) and a few unused type aliases.

Orphan files: src/dashboard.ts + src/dashboard-status-content.ts (only
referenced each other), src/restart-context-cli.ts (never invoked) and
the unused src/config/index.ts barrel.

Service-handoff / channel-owner-lease code is left for a later batch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00
Codex
02ea212be0 refactor: remove unwired auto-paired-mode and usage exhaustion gate
src/auto-paired-mode.ts had no production importer. Remove it together
with the helpers only it used: getClaudeUsageExhaustion /
isClaudeUsageExhausted in claude-usage.ts and getCodexUsageExhaustion /
isCodexUsageExhausted in codex-usage-collector.ts, plus their tests.

auto-paired-mode-state.json stays in the data-state allowlist: the live
data dir still has that file and an unknown state file is a startup
precondition failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00
Codex
60ff19177a refactor: remove Mixture of Agents and Kimi usage
MOA_* was never configured, so enrichArbiterPromptWithMoa always
returned the prompt unchanged and the Kimi usage fetch only produced an
empty dashboard row. Remove src/moa.ts, src/kimi-usage.ts, the arbiter
prompt enrichment, MoA config/schema, the Kimi row and MoA line in the
Discord status dashboard, and the MOA_* / unused FALLBACK_* provider
examples from the docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 19:10:19 +09:00
Codex
1c0fbaf26a refactor: remove web dashboard, Android app and Glasses UI
WEB_DASHBOARD_ENABLED defaulted to false and was never set, so nothing
served the dashboard. Remove the server/routes, apps/dashboard,
apps/android, the dashboard-only settings modules (settings-store,
settings-store-moa, room-skill-settings, runtime-inventory,
codex-live-status, settings-effort), WEB_DASHBOARD_* config, the
web-dashboard-only startup mode, dashboard/android scripts and the
react/vite/playwright dependencies.

The Codex account refresh loop in settings-store is dropped with it: it
refreshed account index 0 through the shared ~/.codex/auth.json instead
of the isolated ~/.codex-accounts/0 used by the reviewer.

Host evidence loses the dashboard_dist / android_debug_apk artifact
kinds. The Discord status dashboard is unchanged. Room skill overrides
are still read from the DB by agent-runner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:47:55 +09:00
Codex
f1abe037e9 perf: cut background polling and log noise
- Codex usage poll: run the repo-pinned CLI (0.159.3) instead of a global
  0.128 install, hold the account lease while polling (skip if a run holds
  it, so the poller cannot rotate a token under a live reviewer session), and
  poll every 5 min instead of every minute (~1,440 app-server spawns a day).
- Claude usage poll: 5 min instead of 1 min. The 1-minute cadence only served
  the auto-paired-mode gate, which is not wired into the runtime; it drew ~32
  HTTP 429s a day.
- Dashboard duplicate cleanup: was a 2 s poll fetching 100 messages (~43k
  Discord REST calls a day) plus a fetch after every edit. Clean up only when a
  fresh status message is posted or on first render, with a 5 min sweep.
- Logging: one line per event and no ANSI colors outside a TTY (events were
  split into ~11 journal lines). Progress-edit audits, Discord progress edits,
  streamed-activity and per-bucket Codex usage logs move to debug; sends,
  agent output and the usage summary stay at info.
- Two tests wrote under the real data/ipc and left fake room folders that the
  live 1 s IPC watcher kept polling; they now clean up after themselves.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:32:14 +09:00
Codex
de2de33c3e fix: send NEEDS_CONTEXT straight to the user instead of the arbiter
A NEEDS_CONTEXT from the owner or reviewer is a question only the user can
answer, and the arbiter's own rules say to ESCALATE it. Routing it through the
arbiter added a full turn first (13 of 23 arbiter calls in 30 days). Escalate
directly; BLOCKED and deadlocks still go to the arbiter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:32:08 +09:00
Codex
3fcb4efa43 fix: give the reviewer and arbiter their own paired-room rules
Codex sessions always received owner-common-paired-room.md ("You are the
owner", branch rules) whatever the role, so the Codex reviewer never saw the
reviewer rules and answered with PROCEED/REVISE (26x/8x in 30 days).

The Claude arbiter runs with CLAUDE_CONFIG_DIR pointed at a directory that is
wiped before every run, and its CLAUDE.md was only written on the unsafe-host
path. In normal mode it ran with no rules at all, so 20 of 23 arbiter verdicts
in 30 days were free-form text the verdict parser could not read.

Pick the paired-room prompt by role (owner / reviewer / arbiter) for Codex
AGENTS.md, and write the role CLAUDE.md into the reviewer/arbiter config dir
in normal mode as well. The readonly-session builder now shares that code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 18:32:02 +09:00
Codex
3a05c5c754 docs: retitle decided section in slimming plan
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 16:35:25 +09:00
Codex
d0a8dbcb5b docs: finalize slimming plan decisions (owner-declared review skip, finalize C, drop main room)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 16:35:13 +09:00
Codex
a04cd92e88 docs: revise slimming plan with user decisions
Mark confirmed items (prompt bugs, failover removal, web dashboard /
android / glasses deletion, rotation simplification, natural-language
stop replacing session commands, launcher old-installer cleanup), drop
the single-mode conversion, and explain the three remaining decisions
(review skip, finalize-turn alternatives, main room role) in plain terms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 16:14:15 +09:00
Codex
a83d4e1fb6 docs: add EJClaw slimming and optimization plan
Evidence-backed audit (code, runtime, token usage) with 36 numbered
candidates, priorities, risks and open decisions. Includes two prompt
wiring bugs (arbiter gets no rules in normal mode, Codex reviewer gets
owner rules) and the dead codex-main failover handoff path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 15:41:10 +09:00
Codex
af28bae365 docs(memory): per-account model tests must pass CLAUDE_CODE_OAUTH_TOKEN
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:51:06 +09:00
Codex
4a419846f3 docs(memory): GPU module reload, KAclaw Opus 5.5 + expired OAuth, git credential helper
- GPU: driver/library mismatch can be fixed by reloading the nvidia modules
  (procedure + what to stop), done 2026-10-01 without a reboot
- KAclaw: now claude-opus-5-5 on SDK 0.3.286, backup location, the expired
  refresh token and the re-login runbook; note that the Claude CLI ignores
  CLAUDE_CREDENTIALS_PATH so per-account tests need CLAUDE_CODE_OAUTH_TOKEN
- git.tkrmagid.kr remotes no longer carry the token; document the
  secrets.json-backed credential helper

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:50:51 +09:00
Codex
e4828896f6 docs: sync memory, docs and skills with the current runtime
Global memory (groups/global/CLAUDE.md):
- add a model/runtime section: current versions (Opus 5.5, SDK 0.3.286,
  Codex 0.159.3), the model upgrade checklist, the stale nested
  node_modules and single-Codex-account gotchas, and the 09-19..10-01 fixes
- fix the garbled credentials paragraph and list every stored credential key
- correct the reviewer description (reviewer is codex, arbiter claude-code)
- the tmpfs/RAM watchdog it described no longer existed; point to the
  restored /home/claude/tmpfs-ram-watchdog.sh
- refresh stale host facts (tmpfs/disk sizes, nvidia-smi version-mismatch
  after driver auto-updates means "reboot pending", not "GPU broken")
- include the Windows CI runner section written on 2026-09-23 that was
  already live but never committed

Docs and skills:
- README / configuration.md / .env.example: current SDK and model
  versions, per-room reviewer/arbiter override, real attachment types,
  existing OpenAI Whisper fallback, src-based service and detached restart
- architecture.md: registered_groups is gone; RestartPreventExitStatus only
  applies to setup-rendered units
- setup/debug/customize skills: canonical DISCORD_*_BOT_TOKEN keys (the old
  alias now aborts startup), Bun instead of Node, Codex OAuth login instead
  of OPENAI_API_KEY, drop ignored register flags, journald instead of
  logs/*.log, room_settings query instead of registered_groups, bun run test
- CONTRIBUTING: drop the reference to the nonexistent /add-telegram skill
- legacy-compat-removal-spec: mark as implemented/historical
- CHANGELOG: add an Unreleased section for the recent fixes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:35:53 +09:00
Codex
a7f2e02699 chore: upgrade @openai/codex 0.133.0 -> 0.159.3
The reviewer's Codex app-server logged "failed to refresh available models:
failed to decode models response: unknown variant `max`" on every run: the
server now advertises a `max` reasoning effort the old CLI cannot parse. Each
failure also dumped the whole models payload (instruction templates included)
into the service journal.

The pin was misleading: codex-runner actually resolved an untracked stale
runners/codex-runner/node_modules/@openai/codex 0.124.0 from 2026-04-26 that
shadowed the root workspace copy, so earlier version bumps never reached the
runner. That nested copy (not in bun.lock, gitignored) was removed on the host
so the runner resolves the lockfile-managed root install.

End-to-end check through the real CodexAppServerClient with the reviewer's
account: thread start, turn, goal set/get, close and thread resume with context
retained all succeed, with 0 app-server errors (was 2 per run) and a simple
turn taking 5s instead of 49s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:25:36 +09:00
Codex
30ba51016a fix: wait for a busy Codex lease instead of skipping the review
The Codex auth lease is exclusive per account so two Codex processes never
rotate the same refresh token at once. With the single configured account that
also serializes every Codex run, and claimCodexAuthLease() failed immediately
while another room's Codex run held it: the turn errored with "Codex rotation
pool unavailable", the task closed as reviewer_codex_unavailable and the
review was silently skipped.

All three such failures on 2026-09-28 coincided exactly with another room's
Codex run holding the lease (10:25:55, 18:08:25, 18:22:50 KST).

runAgentProcess now waits (up to 15 min, polling every 2s) when the only
obstacle is a lease held by a live run. A dead or rate-limited pool still
fails fast, and the normal path adds no async hop because the wait is only
entered when the lease is actually busy. The exclusivity itself is kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-01 14:25:36 +09:00