📎 Webclip
I let AI agents run my production site for 6 months. Here's everything they broke.
The author runs ryzenstudy.com, a Next.js site for AKTU students to download old exam papers, and has been using an AI coding agent with SSH access to handle much of the server work. Over six months, the agent caused and encountered several concrete issues, from deployment loops and misdiagnosed latency to incomplete deploys and broken links, while also catching subtle configuration problems and handling large volumes of repetitive tasks. These experiences led the author to adopt stricter deployment practices and verification habits rather than abandoning the agent.
Reading notes#
- The site serves about 1,400 PDFs and has around 2,600 URLs in its sitemap, runs on a single VPS with Next.js, and uses no database.
- An AI coding agent can SSH into the server, read logs, edit code, run deploys, purge Cloudflare cache, and maintain a notes folder so new sessions know past actions.
- A naive deploy command (
npm run build && pm2 restart) left stale.nextchunks on the server, causingChunkLoadError, repeated crashes, and 176 PM2 restarts. - During the restart loop, Googlebot crawled the site, received many 5xx errors, and search rankings were negatively affected.
- The deploy problems were fixed with a
deploy.shscript that backs up the current build, builds fresh, restarts only on success, rolls back on failure, purges Cloudflare, and checks the response. - The deploy script is now the only allowed deployment method for both the author and the AI agent, and this rule is written prominently at the top of the instructions file.
- The admin panel frequently hung for 20 seconds or more; the agent initially concluded the author’s ISP was at fault and recorded that verdict as a solved issue.
- Despite fast loading for other sites and fast curl results from the author’s laptop, the agent continued to rely on its earlier note blaming the ISP when the issue was raised again.
- After the author pushed back, the agent tested different paths: direct to server was consistently fast, Cloudflare cached paths were fast, but uncached paths through Cloudflare had 40% of requests delayed between 2 and 40 seconds.
- Cloudflare analytics showed origin response times around 1,020 ms, hinting at packet loss between Cloudflare and the VPS rather than an application issue.
- Because the admin panel is not cached, it was most affected by the packet loss problem.
- Setting up a Cloudflare Tunnel resolved the latency, with the slowest of 30 test requests dropping to 0.17 seconds.
- The author accepts that misdiagnosing once is understandable but was bothered that the agent wrote its guess into notes and then treated it as established fact.
- The project has no git remote, and code is copied to the server using
scpinstead of pushes to a remote repository. - In one session, the agent implemented a full feature, made multiple clean commits locally, and reported completion without copying any files to the server, leaving the new pages returning 404 in production.
- A similar issue happened when copying files into Next.js dynamic route folders with brackets like
[subject], where only 1 out of 33 files was actually copied. - The file copy commands for bracketed folders ran in quiet mode, so failed copies produced no visible error and went unnoticed.
- To avoid missing files in bracketed folders, anything targeting those directories is now first archived into a tar file and then verified on the server.
- When testing integration of a second ad network, the agent added the script tag and used curl to confirm the tag existed in the HTML, then declared it functional.
- In real browsers, the site’s Content Security Policy blocked the ad network’s script, so no ads actually loaded despite curl seeing the tag.
- The discrepancy occurred because curl does not execute JavaScript or enforce CSP, so it cannot detect blocked scripts that browsers would prevent.
- The author confirmed the failure by opening the page in Chrome and checking the network tab, which revealed that the ads were not running.
- The author decided to remove the second ad network, judging that loosening the CSP to allow scripts from arbitrary ad domains on a student-focused site was not worth the potential revenue.
- Some paper entries in the site’s data lack real PDF files, and a few even had the site’s homepage stored as their supposed download link.
- A helper function
paperHasFile()exists so that any page listing papers can check whether a valid file is associated. - The agent implemented the
paperHasFile()check correctly once, but later built new page components listing papers without using the function. - A crawl audit eventually reported 82 broken links, all originating from components created after the initial fix that did not use
paperHasFile(). - The author concludes the agent is effective at fixing the specific bug it is directed to, but it does not proactively search for or generalize that fix to future code.
- New agent sessions start without carrying over an understanding of patterns like “always call this helper when listing papers,” contributing to repeated mistakes.
- The agent successfully tracked down occasional 10-second 502 errors that were happening even though the app itself was healthy.
- It discovered that nginx was using
localhost:3000as the upstream, and becauselocalhostresolved to both IPv4 and IPv6, a single hiccup could mark both as down, causing 502 errors. - Changing a single configuration line to avoid the
localhostdual-resolution issue removed those intermittent 502 responses. - When edge caching was introduced, the agent correctly excluded
/api/routes and explained that otherwise endpoints like/api/auth/sessioncould be cached and leak one user’s session to another. - The author believes they would likely have shipped such a caching bug without that precaution.
- The agent handled large volumes of “boring” maintenance work, including checking around 2,600 URLs, cleaning up 156 fake download links, and rewriting titles on 369 pages.
- The author admits they probably would have abandoned such bulk cleanup tasks midway without the agent’s help.
- The current workflow uses a single deploy script with automatic rollback, and all deployments must go through it.
- The definition of “done” has changed so that a task counts as finished only when the author can see the change live on the site, not just when code is committed or a command exits successfully.
- The author now chooses tools that mirror user experience: curl for inspecting headers, a real browser for behavior involving scripts, and adding a
?_cb=query parameter after deploys. - The extra
?_cb=parameter is necessary because nginx has its own 60-second cache behind Cloudflare, which once made a correct deploy appear broken until the cache expired. - Old diagnostic notes written by the agent are re-tested whenever new measurements contradict them, instead of being treated as unchangeable.
- Any changes involving money, ads, or security headers require explicit approval from the author before deployment; routine fixes can be deployed automatically by the agent.
- The author now treats their own report that “my internet is fine” as a valid input the system should respect when diagnosing issues.
- Despite the problems, the author intends to keep using an AI agent because managing a site of this size alone would be difficult.
- Rather than trusting “it’s working” at face value, the author now consistently asks the agent for details on how it validated that something is functioning.
