feat(health-monitor): host-side silent-fail detection and operator alerting#2498
Open
alexli-77 wants to merge 1 commit into
Open
feat(health-monitor): host-side silent-fail detection and operator alerting#2498alexli-77 wants to merge 1 commit into
alexli-77 wants to merge 1 commit into
Conversation
This was referenced May 16, 2026
…erting
Detects "can't run" level failures that the existing stuck-container
detection misses: sessions that produce a processing_ack=completed but
zero messages_out in the same 2-hour window — the signature of a silent
OAuth 401 auth failure swallowed by the agent-runner.
New module: src/modules/health-monitor/
- setup.ts: idempotent DB bootstrap — agent group, Discord messaging
group, wiring, named 'keepalive' destination. Discord guild/channel
IDs read from HEALTH_MONITOR_DISCORD_GUILD_ID and
HEALTH_MONITOR_KEEPALIVE_CHANNEL_ID in .env.
- checks.ts: checkSilentFail() (ack=completed + messages_out=0 in 2h,
container stopped) + checkTokenExpiry() (minutesLeft < 60)
- alert.ts: direct Discord REST POST to keepalive channel (bypasses
nanoclaw routing, fires even when the host is degraded) + task
injection into the health-monitor agent session for investigation
- index.ts: 5-min timer, 1h dedup per issue key, startHealthMonitor()
(must run after initDb)
src/index.ts: MODULE-HOOK to start health-monitor after DB init
src/modules/index.ts: import health-monitor module
src/container-runner.ts: pre-spawn Keychain copy — reads
'Claude Code-credentials' before every container spawn so the
claude.json always reflects the current token
Upstream issues: nanocoai#730 (token expiry), nanocoai#2492 (health-monitor proposal)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0dbfb73 to
5ddeaba
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/modules/health-monitor/module: 5-min timer that detects silent task failures and posts direct Discord alertsbuildMounts()Problem
Stuck-container detection catches hung containers but misses containers that complete with zero output — the silent 401 auth failure pattern:
processing_ack = completed(processed the message, result was empty)absolute-ceilingkills itChanges
src/modules/health-monitor/(new module):setup.ts— idempotent DB bootstrap (agent group + messaging group + wiring + named destination)checks.ts—checkSilentFail()(ack with no output in 2h window, container stopped) +checkTokenExpiry()alert.ts— direct Discord REST to configurable keepalive channel (bypasses routing — works even if routing is broken) + task injection into health-monitor sessionindex.ts— 5-min timer, 1h dedup per issue key,startHealthMonitor()called afterinitDb()via MODULE-HOOKsrc/container-runner.ts: pre-spawn Keychain token refresh inbuildMounts(). try/catch, no-op on non-macOS.src/index.ts+src/modules/index.ts: MODULE-HOOK wiring.Test plan
[health-monitor] Startedin logs<message to="keepalive">to Discordpnpm run buildpassesRelated upstream issues
🤖 Generated with Claude Code