Commit Graph

38 Commits

Author SHA1 Message Date
Codex
c016b9c2fa port: apply 7 upstream security/robustness patches
Ports from isolated upstream-port branch (base b3c5a4b), verified in
isolation via baseline-vs-port failure-set diff and re-verified live
(195 pass / 0 fail on affected tests):
- redact Discord bot tokens in outbound (router.ts SECRET_PATTERNS)
- block SSRF to private hosts in MoA base URL (moa.ts)
- refuse public dashboard bind without auth token (web-dashboard-server.ts)
- merge upstream .gitignore rules for python/build/secret noise
- real CPU utilization from /proc/stat instead of load avg (unified-dashboard.ts)
- width-safe placeholder for missing usage window on mobile (unified-dashboard.ts)
- bump direct deps to patch known vulnerabilities (discord.js/yaml/cron-parser)

Risky upstream commits (d5a94af phantom reset-time, patch 6 Codex usage)
intentionally skipped to avoid touching the credential-isolation tree.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-24 19:35:59 +09:00
Codex
d57dd68fc0 feat(dashboard): align base refresh to wall-clock minute boundary
Instead of a fixed 60s interval from an arbitrary start offset, the base status
refresh now fires on each wall-clock minute boundary (:00), keeping the
minute-precision timestamp shown in the message accurate. Event-driven updates
(new message / agent activity) still refresh in between. Adds
msUntilNextMinuteBoundary with tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-21 13:01:02 +09:00
Codex
65ef6e8830 fix(dashboard): bind editMessage to channel to stop repost loop
The retry refactor captured `const editMessage = channel.editMessage` and
called it detached, losing `this`. Every status edit then threw
"this.client is undefined", so each cycle failed all retries and reposted a
fresh (notifying) status message — ~50 reposts in 30 minutes. Bind the method
to the channel so the edit runs in place. Adds a regression test showing a
detached method fails while a bound one succeeds.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-21 12:58:04 +09:00
Codex
8600213bcc feat(dashboard): 60s base refresh with event-driven immediate updates
Raise the status dashboard base refresh from 10s to 60s, and refresh
immediately (debounced 1.5s) on events between ticks:
- a real chat message arrives in a registered room (index.ts onMessage)
- an agent starts/finishes a run, i.e. activity moves between rooms
  (GroupQueue.setOnActivityChange fired on activeCount changes)

requestImmediateStatusUpdate() drives updateStatus out-of-band via a coalescing
trigger. The existing re-entrancy guard means the base periodic refresh does not
run while an edit-retry is in flight; a refresh requested during that window is
remembered and runs once afterward. Adds createCoalescingTrigger with tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-21 12:53:39 +09:00
Codex
9108174380 feat(dashboard): repost status immediately on first render after restart
The 15s x2 edit-retry-before-repost policy is meant for transient blips during
steady-state operation, not the moment right after a (re)start. On the first
render after startup, use 0 retries: still edit the stored message in place if
possible, but if that edit fails, repost a fresh status message immediately
instead of waiting through the retry cycle. Subsequent ticks use the 2-retry
policy.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-21 12:34:34 +09:00
Codex
cf6d1f89fc feat(dashboard): retry status edit before reposting
A transient Discord error (e.g. HTTP 503) on the periodic status-message edit
previously caused an immediate repost of a fresh status message. Now the edit
is retried up to 2 more times at 15s spacing, and a fresh message is only sent
if every attempt fails. Retry logic is extracted into the testable
editStatusMessageWithRetry helper (injectable sleep). Added a re-entrancy guard
so overlapping interval ticks are skipped while a slow retry runs, preventing
double-posts.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-08-21 12:23:14 +09:00
Codex
2be6c8db8d fix(usage): honor 429 Retry-After to stop self-sustaining rate-limit loop
The Claude usage poller retried /api/oauth/usage every 60s, but the endpoint
returns 429 with a longer Retry-After window (~93s). Retrying mid-cooldown
re-tripped the limit so the 429s never cleared and usage data never populated.

Record a cooldownUntil from the 429 Retry-After header (5min fallback when
absent) and skip the API until it closes; cleared on success. Dashboard now
shows a "429" indicator instead of a stale value when rate-limited.

Adds regression tests proving the cooldown outlasts the 60s throttle and
releases once the window passes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-20 20:55:35 +09:00
Codex
e14ac3dfca Merge remote-tracking branch 'gitea/main'
# Conflicts:
#	prompts/owner-common-paired-room.md
#	src/channels/discord.ts
#	src/codex-warmup.ts
#	src/db/bootstrap.test.ts
#	src/db/migrations/index.ts
#	src/paired-execution-context-reviewer.ts
#	src/usage-primer.test.ts
#	src/usage-primer.ts
2026-06-18 05:41:07 +09:00
Codex
ee4c5559b1 feat(dashboard): add GPU/VRAM usage to status channel server section
Show NVIDIA GPU utilization and VRAM used/total in the 서버 status block,
matching the existing CPU/Memory/Disk bar format. Gracefully omitted when
nvidia-smi is unavailable.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-12 19:14:36 +09:00
claude-bot
f924db78ed fix(dashboard): preserve registered room aliases
Stop overwriting the user-registered group/room name with the live Discord
channel name during channel-meta refresh; keep the alias and log the
divergence at debug instead.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
2026-06-01 17:29:19 +09:00
Eyejoker
bc78d43967 Poll dashboard duplicate cleanup between status updates
Run duplicate dashboard cleanup on a short interval so stale external Status messages are removed between normal status updates.
2026-05-04 00:02:27 +09:00
Eyejoker
2be267c51e Clean duplicate dashboard status messages
Clean duplicate Status dashboard messages by marker, preserve the tracked message, and avoid full-channel purge on startup.
2026-05-03 23:56:07 +09:00
Eyejoker
490ae7d324 Reuse status dashboard message and simplify settings actions 2026-05-02 02:06:20 +09:00
Eyejoker
646bc34372 [codex] Improve mobile dashboard UX (#19)
* feat(dashboard): improve mobile control plane UX

* fix(dashboard): improve mobile nav accessibility

* feat(dashboard): add mobile drawer and usage glance cards

* feat(dashboard): add compact usage matrix and i18n

* fix(dashboard): make usage-first console layout

* fix(dashboard): remove chrome and group usage rows
2026-04-26 21:29:13 +09:00
ejclaw
bd56a5d765 feat: add optional Codex warm-up scheduler 2026-04-24 18:40:36 +09:00
ejclaw
4e05f60400 refactor: land approved runtime cleanup and room binding cutover 2026-04-10 21:04:23 +09:00
ejclaw
8b9bebd29e refactor: complete config unification and split db helpers 2026-04-08 19:05:19 +09:00
Eyejoker
f4410be779 fix: show only fallback model when failover is active 2026-04-01 05:04:04 +09:00
Eyejoker
5a109e3717 feat: show fallback model in status dashboard
When global failover is active, claude-code roles now display
the fallback model inline: `claude-opus-4-6 (fallback → codex)`
2026-04-01 05:03:29 +09:00
Eyejoker
862881ac91 fix: show actual memory usage (exclude cache) + add build:container script
- Dashboard memory: use /proc/meminfo MemAvailable instead of os.freemem()
  to exclude Linux buffer/cache from reported usage
- Add build:container npm script for reviewer Docker image rebuild
- Update deploy commands in CLAUDE.md and README.md to include build:container
2026-03-31 02:17:44 +09:00
Eyejoker
e9f9340ece chore: update README for MAGI/MoA/Bun + show model names in MoA dashboard 2026-03-31 01:51:44 +09:00
Eyejoker
a89ab757b6 feat: restore Kimi usage dashboard (api.kimi.com/coding/v1/usages)
Recovered kimi-usage.ts from bot session logs — original was deleted
during March 27 fallback cleanup. Shows 5h/7d usage bars in dashboard
alongside Claude and Codex, using sk-kimi-* coding plan API key.
2026-03-31 01:46:19 +09:00
Eyejoker
68901e5da9 feat: global failover + dashboard model config section
- Failover is now global (account-level, not per-channel)
- Dashboard shows role model config (Owner/Reviewer/Arbiter + MoA refs)
- Dashboard shows failover status when active
- Auto-clear failover on successful Claude rotation
- Remove per-channel lease writes from failover path
2026-03-31 00:38:29 +09:00
Eyejoker
96ca9c0655 fix: use in-process Codex usage cache for unified service dashboard 2026-03-30 02:58:28 +09:00
Eyejoker
c7725b1cb4 fix: run Codex usage collection in unified service mode 2026-03-30 02:55:18 +09:00
Eyejoker
4b4863330b fix: add debug log for dashboard channel discovery failure 2026-03-30 02:50:37 +09:00
Eyejoker
ba9f6871b6 feat: add codex review failover and suppress output hardening 2026-03-28 05:40:38 +09:00
Eyejoker
5c2e8e4fdc feat: allow status dashboard header without room details 2026-03-25 23:00:39 +09:00
Eyejoker
c7ba983ea6 feat: show watcher counts in status dashboard header 2026-03-25 22:52:02 +09:00
Eyejoker
61786cacbf test: add streamed-output-evaluator unit tests
22 tests covering all code paths: success/error forwarding,
Claude banner detection (usage-exhausted, auth-expired), duplicate
trigger suppression, auth error suppression, null-result tracking,
fallback/rotation trigger dispatch, and state immutability.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 12:40:44 +09:00
Eyejoker
fc85fece0f refactor: split unified-dashboard into usage-rows and codex-collector modules
Extract dashboard-usage-rows.ts (UsageRow, formatResetRemaining,
mergeClaudeDashboardAccounts, buildClaudeUsageRows, extractCodexUsageRows)
and codex-usage-collector.ts (fetchCodexUsage, applyCodexUsageToAccount,
buildCodexUsageRowsFromState, refresh functions returning data instead of
mutating module state). unified-dashboard.ts drops from 926 to 563 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 12:32:41 +09:00
Eyejoker
83aedba7f3 Harden usage dashboard and codex auth 2026-03-25 10:40:02 +09:00
Eyejoker
00ffde7623 fix: remove Codex API key auth path, add secret redaction and d7 auto-rotation
- Remove OPENAI_API_KEY from .env and Codex child process env to prevent
  API billing when subscription quota is exhausted
- Remove writeCodexApiKeyAuth entirely — Codex now uses OAuth only
- Add 9-pattern secret redaction in formatOutbound() to prevent key leaks
- Fix Codex usage bucket aggregation: use 'codex' bucket only instead of
  max across all buckets (bengalfox = Codex Spark, not needed)
- Add d7≥100% auto-rotation in updateCodexAccountUsage to skip exhausted
  accounts and prevent API billing fallback
- Add findNextCodexAvailable that checks both rate-limits and d7 usage
- Clean stale apikey auth.json files from all session directories
- Update tests: OAuth-only auth, d7 auto-skip (3 new tests), dashboard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-25 10:39:42 +09:00
Eyejoker
db223f0793 fix: clamp bar() and padName() to prevent negative repeat count
Usage dashboard crashed with RangeError: Invalid count value: -7
when pct exceeded 100 or name exceeded maxNameWidth.
2026-03-25 07:18:04 +09:00
Eyejoker
3467e245d5 feat: auto memory pipeline — host-driven Memento recall/reflect
Add automatic memory integration so EJClaw host directly calls Memento
MCP for recall at session start and reflect on compact, removing
reliance on agent voluntary tool use.

Stage 1: New sessions get room memory briefing injected into system
prompt (CLAUDE.md / AGENTS.md) via host-side MCP client.

Stage 2: PreCompact hook automatically calls reflect + remember to
persist session summaries as room-memory fragments.

Also restores missing source files (token-rotation, codex-token-rotation,
claude-usage exports) to fix full build from source.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 03:48:36 +09:00
Eyejoker
f42234bc65 refactor: split runner env and slim dashboard facade 2026-03-23 07:30:55 +09:00
Eyejoker
867a6a80ef style: format extracted helpers 2026-03-23 07:00:22 +09:00
Eyejoker
a2db8f6c0e refactor: extract dashboard and task helpers 2026-03-23 06:59:59 +09:00