Skip to content

fix: add gateway check and diagnostics to sync endpoint#211

Open
isaacrowntree wants to merge 1 commit intocloudflare:mainfrom
isaacrowntree:fix/sync-diagnostics
Open

fix: add gateway check and diagnostics to sync endpoint#211
isaacrowntree wants to merge 1 commit intocloudflare:mainfrom
isaacrowntree:fix/sync-diagnostics

Conversation

@isaacrowntree
Copy link

@isaacrowntree isaacrowntree commented Feb 8, 2026

Summary

Fixes #214

When the sync endpoint is called and the config file check fails, this PR adds diagnostic information to help understand why:

  • Checks if gateway process is running
  • Collects gateway stderr logs
  • Lists local /root/.openclaw/ directory contents
  • Lists R2 backup directory contents
  • Checks R2 mount health via .last-sync file

Also adds a gateway-running pre-check to the sync endpoint, returning 409 if the gateway isn't running yet.

Note: This PR provides diagnostics for the sync failure. The root cause fix for exitCode returning null is in #215.

Test plan

  • Existing sync tests updated and passing
  • New test: returns diagnostic info when config file missing
  • Deploy and verify diagnostics appear in logs when sync fails

🤖 Generated with Claude Code

The manual sync endpoint was returning 500 errors when triggered before
the gateway had started (or when config files were missing). This adds:

- Gateway-running check before attempting sync (returns 409 if not ready)
- Diagnostic info when config files are missing: checks gateway status,
  gateway logs, local config directory contents, R2 backup contents,
  and R2 mount health
- Correct HTTP status codes (400 for client errors, not 500)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

Sync endpoint returns 500 with unhelpful error when gateway not running

1 participant