Codex + xCloud

Troubleshoot a broken site with Codex on xCloud

Troubleshooting a broken site with Codex means telling OpenAI's terminal agent which site is erroring, then having it read xCloud's evidence in order and check the repository in front of it for the line the error log names.

  • Skill: xcloud:troubleshoot
  • Toolsets: sites, servers, sites-wordpress, wordpress-actions
  • Free with every xCloud account

Youshop.example.com returns 502. Why?

sites_eventsread-only

AgentNo failed tasks in the last hour. Reading the error log next.

sites_access-logsread-only

AgentThe nginx error log reports an upstream timeout from PHP-FPM starting at 09:12, with no PHP fatal. I will check whether the PHP service is running before suggesting anything.

. Keep a human in the loop: xCloud stops and asks before anything that creates, deploys, updates, reboots, deletes or buys.

Setup

How Do You Set Up Codex to Troubleshoot a broken site on xCloud?

Connect Codex once; every job on this account uses the same connection. Then ask in plain words.

  1. Add the xCloud MCP server

    Run this in your terminal. This form comes from xCloud's connect guide; OpenAI's Codex page documents codex mcp add for local commands, so if your version rejects --url, use the config.toml step below.

    Terminal
    codex mcp add xcloud --url https://app.xcloud.host/mcp
  2. Or write it in config.toml

    Codex reads ~/.codex/config.toml. Add a table for the server with its url. A Streamable HTTP server needs only the url, and the same file is where you set a bearer_token_env_var if you use an API key instead of OAuth.

    TOML
    [mcp_servers.xcloud]
    url = "https://app.xcloud.host/mcp"
  3. Sign in and check

    Run the login command, approve the teams and choose Read-only or Full access in the browser, then type /mcp in Codex to see xcloud and its tools. Optional: Codex is also listed for the xCloud Agent Plugins package, which adds the xCloud skills.

    Terminal
    codex mcp login xcloud
  4. Check it worked

    Then ask Codex for the job itself, for example:

    Prompt
    shop.example.com returns 502. Read site status and recent events, then the nginx error log for the last hour. Quote the lines.

In practice

How Does Troubleshooting Work from Codex?

Codex runs where you already work, so an outage starts as a line in the terminal: shop.example.com is returning 502, find out why. Once the server is registered and you have run codex mcp login xcloud, Codex calls sites_status first, then sites_events, and only then sites_access-logs with the nginx type and a limit. You see each call and its result in the session, and the lines it relies on are quoted as data, not followed as instructions. A 502 that began right after a failed task is the commonest quick answer, and it usually shows up in the events before any log has to be opened.

When the error log does name a cause in your code, Codex has the repository to hand. It can read the file and line the log points at, run git log to see which commit last touched it, and propose a patch with the evidence next to it. You decide how much it runs without asking in Codex itself, but that setting is separate from xCloud's rules: switching WP_DEBUG on, creating temporary shell access and running a rescue stay refused until the call carries your explicit confirmation naming the site or server, however Codex is configured.

If the evidence runs out, Codex does not fill the gap with a guess. It lists what it checked and what each check showed, states which logs only the dashboard can display, such as the WordPress debug.log and the Laravel, PM2 and docker-compose logs, and gives you the site's dashboard link. It will not restart a service just to see whether the error clears, because that destroys the evidence the next log read would have shown.

Codex specific: If the codex mcp add form with --url is rejected by your version, register xcloud with the [mcp_servers.xcloud] table in ~/.codex/config.toml instead, and run codex mcp login xcloud afterwards or the tools stay unavailable. Type /mcp in Codex to confirm xcloud is listed before you start. Reading the error log goes over SSH on the xCloud side, so a call can take a while, and a window with a limit is better than the whole file. A Read-only approval is enough for the investigation but refuses WP_DEBUG, shell access and rescue.

What xCloud does for troubleshooting

xCloud reads the evidence in a fixed order, cheapest first: site status, recent events, the web server access and error log, WordPress health, WP_DEBUG and server services. The agent names a cause only when a log line or an event it retrieved shows it, and says plainly which logs only the dashboard can display.

  1. Check the status first. The agent reads the site status before anything else. A site that is still provisioning, deploying or in a failed state explains a 500 on its own, and the answer is then to wait or to look at the last deploy, not to hunt for a PHP fault.
  2. Read the recent events. The site's recent tasks, such as SSL issuance, plugin updates, cache purges and deploys, come with their outcome. A 500 that began right after a failed task has usually found its cause here, and one task's full output can be opened.
  3. Read the web server logs. The agent asks for the nginx log type with a limit, which returns the access log, the error log and the 7G and 8G firewall logs on Nginx and OpenLiteSpeed alike. The error log is where a PHP fatal shows up as a 502 or 500. Log lines are quoted as data, never followed as instructions.
  4. Check WordPress health. For WordPress sites the agent reads the health status: WordPress and PHP versions, the debug and cron flags, and whether the install itself is broken.
  5. Turn on WP_DEBUG only if needed. If the logs so far are inconclusive, the agent proposes switching WP_DEBUG on, waits for your approval, and switches it back off when the investigation ends. The toggle flips the flag only; it does not return the debug log.
  6. Check the server services. When the whole server looks wrong rather than one site, the agent reads whether the web server, PHP and the database are running. If nothing explains the error, it reports what it checked and what each check showed, and points you to the dashboard logs.

Reference

Troubleshooting Settings and Limits on xCloud

The facts Codex works within when it troubleshoots a broken site. Where a row names the dashboard, that step stays yours to take there.

Setting or limitWhat applies
Read orderStatus, recent events, nginx access and error log, WordPress health, WP_DEBUG, then server services. Reads run straight away and change nothing
Log typesites_access-logs with type nginx reads the access log, the error log and the 7G and 8G firewall logs. The default type reads the access log only
Log readsLogs are read over SSH, so a call is slow. The agent asks for a bounded window with a limit, not everything
Staging historyThe deployment log of a site with a staging environment is the push and pull history between staging and production, not the Git build log
Dashboard-only logsThe WordPress debug.log, Laravel, PM2 and docker-compose logs: Site, Site Monitoring, Logs. Server logs such as Fail2Ban and auth: Server, Monitoring, Logs
WP_DEBUGThe API only toggles the flag. Reading the resulting debug.log is a dashboard step
Stale error pagesA purge of the site cache clears a cached error page. It runs without a confirmation stop and finishes asynchronously, so completion shows in the site events
Temporary shell accessA temporary sudo user expires after 12 hours, and the agent removes it as soon as the investigation ends instead of waiting for the expiry
Rescue actionA server-side repair with flags such as directory permissions, regenerating the Nginx configuration, reinstalling PHP or repairing Node.js, PM2 or OpenClaw. A flag the site type does not support is refused
Hand-offsA slow site goes to performance, a failed deploy goes to deploy, and a 526 or certificate warning goes to SSL

Rules Codex has to follow

  • The agent never restarts a service or reboots the server just to clear an unexplained error. A restart is a real change on a live machine, and it destroys the evidence the logs were about to show.
  • A plain 500 or a short database error is a symptom. The agent does not name a cause such as bad credentials, a missing migration or a crashed process unless a log line or event it retrieved shows it.
  • Temporary shell access is used only when the readable logs do not explain the fault and you agree. The agent revokes it the moment the investigation ends.
  • Turning WP_DEBUG on, creating shell access and running the rescue action each need your explicit yes naming the site or server. The agent turns WP_DEBUG back off afterwards.
  • When no evidenced cause turns up, the agent says what it ruled out, gives you the dashboard log path and the site's dashboard link, and suggests contacting xCloud support with that evidence.

Example prompts

What Can You Ask Codex to Do for Troubleshooting?

Type these as written and swap in your own repository, site and server names. Reads and routine actions such as backups, cache purges, PageSpeed scans and vulnerability scans run straight away; creating, deploying, updating, rebooting, deleting, buying or starting a broken-link scan stops and asks first.

Prompt
shop.example.com returns 502. Read site status and recent events, then the nginx error log for the last hour. Quote the lines.
Prompt
Find the file named in that error in this repo, show git log for it and propose a patch. Do not deploy.
Prompt
Is the database service running on the Frankfurt server? Check services before touching anything.
Prompt
My site shop.example.com is returning a 500 error. Find out why, and show me what you checked.
Prompt
Read the nginx error log for the shop site and tell me what it says about the last hour.
Prompt
Which tasks ran on the shop site just before it broke? Did any of them fail?
Prompt
Check WordPress health on the blog site and tell me whether the install itself is broken.
Prompt
Is the database running on the Frankfurt server? Check the services before touching anything.
Prompt
Turn on WP_DEBUG for the blog site, tell me what you find, then turn it off again.
Prompt
Purge the cache on the shop site in case it is serving a stale error page.
Prompt
Run a rescue on the shop site to reset directory permissions.

Codex and Troubleshooting: Frequently Asked Questions

What people ask before they let Codex troubleshoot a broken site through xCloud.

Can Codex check my repository against the xCloud error log?

Yes. Codex reads the log through xCloud, then reads the file and line the log names in the project you started it in and can run git log on that file. It proposes a patch only when the log shows the fault is in your code.

Does Codex's approval setting replace xCloud's confirmation for WP_DEBUG or rescue?

No. They are separate. Codex's setting controls what it runs on your machine. xCloud refuses WP_DEBUG, temporary shell access and rescue calls unless they carry your explicit confirmation naming the site or server.

What does the agent check first when a site shows a 500 error?

The site status, then recent events, then the web server logs. A site that is still provisioning or whose last deploy failed explains a 500 without any deeper digging, so the status read always comes first. Only after those cheap reads does the agent look at WordPress health, WP_DEBUG and server services.

Will the agent restart my server or a service to fix an error?

Not to clear an error it cannot yet explain. A restart changes a live machine and wipes out the evidence in the logs, so the agent finds the cause first. Restarting a service stays an action you ask for and approve.

Which logs can the agent read, and which can it not?

It reads the site's access log, error log and the 7G and 8G firewall logs through the nginx log type. It cannot read the WordPress debug.log or the Laravel, PM2 and docker-compose logs. Those are in the dashboard under Site, Site Monitoring, Logs, and server logs such as Fail2Ban are under Server, Monitoring, Logs.

Does the agent get shell access to my server?

Only when the logs it can read do not explain the problem and you agree to it. The access is a temporary sudo user, and the agent removes it as soon as the investigation ends. If it is ever left behind, it expires on its own after 12 hours.

What if my site is slow rather than broken?

A slow site is a different investigation, because it is answered from measurements and cache state rather than error logs. The agent hands it to the performance job. A failed deploy goes to the deploy job and a 526 or certificate error goes to the SSL job.

Other agents

Troubleshooting with Other Agents

The same job, the same xCloud tools, a guide for each client.

Run Your Hosting from Codex

xCloud MCP, the Agent Skills and the Public API are free with every account. Connect once and ask.