The version-check service (startup/services/version-check.js) automatically monitors bunx-based services for available updates every 60 seconds. When newer versions are detected, it seamlessly restarts the affected service to pick up the update.
This implementation provides:
- Non-blocking background monitoring (doesn't delay supervisor startup)
- Graceful network error handling (never crashes on registry issues)
- Support for both npm and GitHub package sources
- Semantic version comparison (correctly identifies newer versions)
- Automatic service restart on update detection
- Comprehensive logging to supervisor output
The version-check service follows the gmweb supervisor pattern:
export default {
name: 'version-check',
type: 'system',
requiresDesktop: false,
dependencies: [],
async start(env) {
},
async health() {
return true;
}
};- Supervisor loads version-check service (startup/index.js)
- Service starts immediately (no blocking operations)
- Background checker begins 60-second cycle
- Each cycle:
- Query npm registry or GitHub API for latest versions
- Compare with currently installed versions
- If newer version found: kill service process
- Supervisor detects death via health check
- Supervisor restarts the service
- Service never crashes - network errors are caught and logged
| Service | Source | Package | Notes |
|---|---|---|---|
| opencode | npm | opencode-ai |
OpenCode ACP provider |
| gm-oc | GitHub | AnEntrypoint/gm-oc |
MCP tools and agents plugin |
| proxypilot | npm | proxypilot |
Proxy management service |
| moltbot | npm | molt.bot |
Moltbot workspace UI |
Location: startup/config.json
{
"version-check": {
"enabled": true,
"type": "system"
}
}Enable/Disable: Set enabled: true or enabled: false
Change Check Interval: Edit startup/services/version-check.js line:
this.checkInterval = 60000;npm Packages:
GET https://registry.npmjs.org/{packageName}
Parse: response['dist-tags'].latest
GitHub Repositories:
GET https://api.github.com/repos/{owner}/{repo}/releases/latest
Parse: response.tag_name (with 'v' prefix removed)
Semantic version comparison:
1.0.0 < 1.0.1 < 1.1.0 < 2.0.0- Compares major.minor.patch numerically
- Handles prerelease versions (e.g., 1.0.0-beta < 1.0.0)
- Works with various version formats
When update detected:
- Find all processes matching service name pattern
- Send SIGTERM to process group
- Wait 500ms
- Send SIGKILL to force termination
- Supervisor health check detects missing process
- Supervisor restarts service automatically
- Service picks up latest version from npm/GitHub
The service implements defensive error handling:
| Error | Behavior | Log Level |
|---|---|---|
| Registry timeout (8s) | Skip service, continue checking | WARN |
| Network error | Log and continue to next service | WARN |
| Invalid JSON response | Log parse error and skip | WARN |
| Process not found | Log and continue | WARN |
| Kill failed | Log but don't crash | WARN |
Critical guarantee: No scenario causes the version-check service itself to crash.
2026-02-06T12:00:00.000Z [version-check] Starting version check cycle
2026-02-06T12:00:00.200Z [version-check:opencode] Already on latest version: 1.1.53
2026-02-06T12:00:00.600Z [version-check] Version check cycle complete
Log Levels:
- INFO: Version updates found, services restarted
- DEBUG: Services already on latest, cycle complete
- WARN: Registry timeouts, network errors, parsing failures
- ERROR: Check cycle failures (non-fatal)
Validate the service definition with node --check startup/services/version-check.js. Registry reachability can be inspected with the npm and GitHub requests shown below.
- Memory: Minimal (background task)
- CPU: Negligible (~100ms per check cycle)
- Network: ~5 requests per cycle (one per service)
- Latency: Staggered to prevent thundering herd
To monitor additional services:
- Edit
startup/services/version-check.js - Add to SERVICES_TO_MONITOR:
{
serviceName: 'my-service',
bundleName: 'my-npm-package',
type: 'npm'
}
{
serviceName: 'my-service',
bundleName: 'my-service',
type: 'github',
github: 'owner/repo'
}- Restart supervisor (container restart)
Q: Version check not running?
tail -100 /config/logs/supervisor.log | grep version-checkQ: Service not restarting on updates?
ps aux | grep version-check
ps aux | grep agentguiQ: Registry connectivity issues?
curl -I https://registry.npmjs.org/express
curl -I https://api.github.com/repos/AnEntrypoint/gm-oc/releases/latestThe version-check service integrates with gmweb's supervisor system:
Dependencies: None (no blocking dependencies)
Service Type: system (background process, no health port binding)
Health Check: Always passes (background task doesn't need verification)
Restart Behavior: Supervisor restarts on crash (rare)
- Created:
startup/services/version-check.js(300+ lines) - Modified:
startup/config.json(added version-check service config) - Modified:
startup/index.js(added version-check to service loader)
After deployment:
-
Verify service starts:
tail -50 /config/logs/supervisor.log | grep version-check -
Check for updates (wait 60 seconds):
tail -50 /config/logs/supervisor.log | grep "Update available"
-
Monitor service restarts:
ps aux | grep agentgui
- Runs as
abcuser (no privilege escalation) - Only kills own processes (isolated to supervisor group)
- No arbitrary code execution
- No API credentials required (public endpoints)
- Validates all JSON responses
Potential improvements:
- Per-service check schedules
- Automatic rollback on restart failure
- Update metrics and analytics
- Admin notifications
- Staged updates (test, then deploy)