v3: rewrite — structured logging, config hot-reload, request tracing

- Binary-safe multipart parser (Buffer-based)
- Structured JSON logging with daily rotation (7-day, 10MB)
- Config hot-reload (5s TTL, mtime-based)
- Request tracing: X-Request-ID, crypto.randomUUID()
- Enhanced /health: uptime, voice config, stats, RouterAI probe
- Graceful shutdown: SIGTERM/SIGINT with drain
- Timeout 30s on all https.request calls
- Body size limit 50MB
- Replace url.parse() with WHATWG new URL()
- Sanitized error responses
- Modular handler architecture

Reviewed by: kimi-k2.7-code, qwen3.6-plus, deepseek-v4-flash
Spec by: Roko (architect)
Rewrite by: kimi-k2.7-code via OpenCode
This commit is contained in:
Roko
2026-07-08 13:24:35 +07:00
parent c68ee43232
commit 98eb5c6257
2 changed files with 508 additions and 216 deletions
+29
View File
@@ -0,0 +1,29 @@
# Changelog
## v3.0.0 (2026-07-08)
### Added
- Structured JSON logging with daily rotation (7-day retention, 10MB limit)
- Config hot-reload — reads openclaw.json every 5s, no restart needed
- Request tracing via `crypto.randomUUID()` and `X-Request-ID` header
- Health endpoint: uptime, current voice config, RouterAI connectivity probe, request stats
- Graceful shutdown on SIGTERM/SIGINT with in-flight request draining
- Upstream request timeout (30s) on all RouterAI calls
- Body size limit (50MB) to prevent DoS
### Fixed
- **CRITICAL:** Binary-safe multipart parser — no longer corrupts non-ASCII audio bytes
- Replace deprecated `url.parse()` with WHATWG `new URL()` API
- `response_format` removal now logged as WARN (was silently mutating)
- Whisper stderr captured and logged (was silently discarded)
- Error responses sanitized — no raw upstream errors leaked to client
- Root path (`/`) redirects to `/health` (was shadowing health endpoint)
### Changed
- Refactored into modular handler functions (`handleModels`, `handleSpeech`, `handleTranscriptions`, `handleHealth`)
- Config now has safe defaults; survives missing/broken `openclaw.json`
- `/v1/models` returns the configured TTS model from config, not hardcoded
- All file operations in `~/openclaw/logs/` directory
### Removed
- v2 monolithic request handler