Skip to content

feat: improve error info for debugging (WS logs, /debug/processes, /api/status, docs)#241

Open
shingo257 wants to merge 5 commits intocloudflare:mainfrom
shingo257:feat/error-info-expansion
Open

feat: improve error info for debugging (WS logs, /debug/processes, /api/status, docs)#241
shingo257 wants to merge 5 commits intocloudflare:mainfrom
shingo257:feat/error-info-expansion

Conversation

@shingo257
Copy link

Summary

Improves error and debug information to make troubleshooting easier (wrangler tail, debug endpoints, and public status).

Changes

  1. WebSocket proxy logging (src/index.ts)

    • Emit structured one-line logs for close and error with side, code, and reason/message so wrangler tail can be grepped easily.
  2. /debug/processes (src/routes/debug.ts)

    • Query ?failed=1: return only gateway-related failed/completed processes (start-moltbot, clawdbot gateway).
    • When logs=true or failed=1, add lastFailedStderrPreview: sanitized stderr (first 500 chars) from the most recent failed start-moltbot process.
    • New helper src/utils/sanitize.ts to redact secrets (e.g. sk-ant-*, Slack tokens) from log excerpts.
  3. /api/status (src/routes/public.ts)

    • When the gateway process has failed or exited with non-zero code, fetch its stderr and expose a sanitized prefix as lastStderrPreview (300 chars) so callers can see a hint without calling /debug/processes.
  4. Docs (AGENTS.md)

    • New Troubleshooting section: “Health OK but no reply” (check /api/status, /debug/processes?logs=true, wrangler tail for [WS] close/[WS] error), and exit code 126 (CRLF, tr -d '\r', chmod in Dockerfile).

Notes

  • “Can’t automatically merge” is expected if cloudflare/moltworker main has new commits. You can still open this PR; maintainers can merge after resolving conflicts, or we can rebase this branch on upstream main and push again.

Your Name and others added 5 commits February 12, 2026 02:37
Co-authored-by: Cursor <cursoragent@cursor.com>
…us lastStderrPreview

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…ts keeping error-info expansion

Co-authored-by: Cursor <cursoragent@cursor.com>
…s (LF for *.sh); ignore local PR docs

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant