Commit Graph

1583 Commits

Author SHA1 Message Date
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
Codex
8b688853cc chore: upgrade claude-agent-sdk 0.3.153 -> 0.3.286 for Opus 5.5
Claude Opus 5.5 (claude-opus-5-5) is rejected by the bundled Claude Code CLI
2.1.153 with "does not support this model; version 2.1.280 or newer is
required". Bumping the SDK brings the bundled CLI to 2.1.286.

Verified end-to-end against EJClaw's own credentials through the real SDK and
binary: claude-opus-5-5 returned a normal completion after the upgrade (it
errored with the 400 before), and claude-opus-5 still works.

The model switch itself lives in .env (untracked): CLAUDE_MODEL=claude-opus-5-5.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-10-01 14:09:41 +09:00
Codex
69ae3342db fix: stop the progress ticker when a run loses its paired turn attempt
syncTrackedProgressMessage() logged "no longer owns the active paired turn
attempt" and returned, but left the 5s progress ticker running. Losing the
attempt is permanent — ownership only flips back to 'active' when a new
attempt claims the turn under its own runId — so a superseded run kept waking
every 5s for the entire life of the following turn (165 wakeups observed in
one room) while editing nothing. The channel's progress message stayed frozen
for the whole next turn, so a room that was actively working looked hung.

Clear the ticker on ownership loss, matching the repeated edit-failure path.

The regression test asserts on the ownership probe rather than editMessage:
a leaked ticker and a stopped one both produce zero edits, so counting edits
cannot distinguish them.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-28 10:41:36 +09:00
Codex
c7a8a4339c fix: let tribunal rooms self-heal a missing work_dir instead of going silent
preparePairedExecutionContext bailed out early when group.workDir was null,
which made the ensurePairedProject() self-heal directly below it unreachable.
A tribunal room registered without work_dir therefore produced no paired
execution context at all: the turn output was never persisted, the task
revision stayed frozen and the 10-minute execution lease was never released,
so every follow-up human message inside that window was silently dropped and
the room appeared to stop answering.

Single-mode rooms still bail out via ensureActiveTask returning null.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-19 20:35:09 +09:00
Codex
4485a7fd72 Cap owner/reviewer pending prompts to recent turn outputs
The owner and reviewer each resume a persistent session that already
holds the running paired thread, yet buildOwnerPendingPrompt /
buildReviewerPendingPrompt re-sent the ENTIRE accumulated turnOutputs
list every turn, so the prompt grew linearly with round-trips for no
benefit. Only the arbiter path was capped.

Reuse the arbiter's latestTurnOutputMessagesWithOmissionMarker cap
(now a shared TURN_OUTPUT_CONTEXT_LIMIT = 6) so owner/reviewer prompts
send at most the 6 most recent outputs plus an omission marker. On a
long ping-pong task this bounds per-turn prompt size instead of
re-sending every prior round's output. Behavior for tasks with <=6
outputs is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-09-01 17:12:44 +09:00
Codex
84672590d7 Make arbiter ESCALATE self-contained so the user decides from one message
The user should be able to choose from the last arbiter message alone, without
scrolling back through the owner↔reviewer conversation. Instruct the arbiter, on
ESCALATE, to restate the decision in one sentence and list the options as a
short numbered list with per-option consequences, including only the minimum
context needed. Prompt files are read per-turn, so this is live immediately.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-28 20:47:17 +09:00
Codex
41b3b4e0e2 style: prettier formatting for paired-execution-context
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-28 20:44:34 +09:00
Codex
2259471b66 Carry forward the arbiter verdict too, not just the owner final
When a paired task ends on an arbiter ESCALATE (asking the user to choose), the
user's next reply was carried into the fresh task with the owner's earlier final
as context — not the arbiter message they were actually responding to. Generalize
the carry-forward to the latest user-facing final (owner final OR arbiter
verdict, whichever the task ended on), so the user can choose based on the last
arbiter message without the new turn re-reading the whole prior conversation.
The carried-forward guidance marker is now matched by a shared prefix so it
triggers for both. Adds tests for the arbiter-escalation carry and the prefix
guidance.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-28 20:44:22 +09:00
Codex
5376df5389 style: prettier formatting for phantom-notification guard test
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 23:12:35 +09:00
Codex
007e95fe40 Extract + unit-test the phantom auto-continue injection path
Move the storeMessage → enqueueMessageCheck side effect out of the delivery
callback into scheduleAutoContinueForPhantomFinal so the injection path is
directly unit-tested: an auto-continue outcome for a delivered final injects the
corrective nudge as an ipc_injected_human message and re-enqueues a turn, while
a non-auto-continue outcome or an undelivered final does nothing. Behavior is
identical to the inline version — this only adds test coverage and a no-op
refactor, so no redeploy is required.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 23:12:18 +09:00
Codex
bc9ba1c2d2 style: apply prettier formatting to paired-execution-context test mock
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 23:05:56 +09:00
Codex
984922884c Auto-continue after a phantom-notification dead-end instead of just warning
Extends the phantom-notification guard: when a non-paired turn dead-ends on an
"I'll wait … I'll be notified" final with no watcher registered, re-invoke the
agent once (inject a corrective nudge as an inbound instruction + re-enqueue) so
it actually finishes the work in the foreground, rather than only appending a
"send a follow-up" notice. A hard per-chat cap (max 1 re-run per phantom streak,
reset on any clean final) makes it loop-safe — a model that keeps producing the
dead-end can never spin the bot. Paired rooms are excluded because they already
continue on their own (owner → reviewer → …). Pure cap/decision logic is unit-
tested; reuses the proven ipc_injected_human + enqueueMessageCheck path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 23:05:29 +09:00
Codex
f5d1ec302d Guard against phantom "I'll be notified" dead-end finals at delivery
An agent could end a turn with "I'll wait for the build to complete — I'll be
notified" without registering any watcher, so nothing ever resumed and the user
was left staring at a dead-end (observed in the tts_site room). The prompt rule
alone did not stop the model. At final-delivery time, when the final reads like
such a phantom-notification dead-end AND no CI watcher is active for the chat,
append an explicit notice telling the user no notification is coming and to send
a follow-up — turning a silent hang into an actionable prompt. Pure detector +
guard with unit tests; wired into the owner/reviewer final-delivery path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 21:02:23 +09:00
Codex
03e6f8bcc6 Self-heal tribunal rooms with no work_dir so the owner never goes silent
A tribunal room whose work_dir was never provisioned (null) made
resolveOwnerTaskForHumanMessage return a null task, so the owner never ran and
the room went completely silent — the user's messages got no reply at all (seen
in the tts_site room, where days of requests were dropped). ensurePairedProject
now provisions the canonical workspace on demand when work_dir is missing,
guarded to tribunal rooms so a single-mode room never gets a spurious paired
workspace. Idempotent via ensurePairedWorkspaceProvisioned. Adds tests for both
the tribunal self-heal and the single-mode no-op.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 20:47:00 +09:00
Codex
6fad6dcfab Pin carry-forward flag off in default-behavior test; ignore test scratch
The "does not carry forward by default" test in paired-execution-context.test.ts
read the real config, so enabling PAIRED_CARRY_FORWARD_LATEST_OWNER_FINAL in
this deployment's .env flipped its result and it failed. Pin the flag to false
in that suite (mirroring the flag-on carry-forward.test.ts which pins true) so
the unit test is deterministic regardless of the ambient .env. Full suite is
green again with the flag enabled: 1595 pass / 3 skip / 0 fail.

Also gitignore the .ejclaw-*images-*/ and .ejclaw-attachment-*/ scratch dirs
that outbound-attachments tests create in the repo root; they only leak when a
test run is interrupted mid-flight and would otherwise clutter git status.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-25 18:48:40 +09:00