I interviewed a customer’s AI agent, then built what it told me into the Cache Upgrader Kit

Dave Hilditch •

On 19 November I published the ArredoItaliano case study: an Italian store whose basket pages went from about 1 second to 0.03 s, with the work done by the owner’s own AI agent using my Cache Upgrader Kit for WooCommerce.

That agent knows the job better than I do, and better than the owner does, so I asked the owner to paste seven questions into the same session. He did. The answers are below exactly as the agent wrote them, with one change: where it names the owner, I’ve put “[the owner]”. The owner added a couple of comments of his own, and I’ve added mine.

Then I went through every problem it described and asked two things. Did the kit catch it, or did the agent have to? And what can the kit do so the next store’s agent is told, instead of having to think of it? The answers to the second question are in Cache Upgrader 1.8.0, and I’ve shown each one under the problem it came from, including the instructions your agent reads.

One of its answers is about a bug in xSpeed, the store’s page cache. I reported that bug on wordpress.org on 19 November, the xSpeed team confirmed it within the hour, and the fix was released three days later. That’s in here too, with screenshots.

How the kit works, in one paragraph

The kit is two things. The first is a set of deterministic safety checks that run on your store: they render and load your pages as a guest, a shopper with a basket and a logged-in customer, compare what each one gets, and give a row per check that passes, warns or fails. The second is a set of instructions (skills) your AI agent follows: run the checks, read each failing row, fix it with a recipe from my library or one it writes for your site, and run again until it’s green. A check is worth more than an instruction, because a check can’t be skipped or forgotten, so wherever I could turn one of this agent’s lessons into a check, I did. Every check is described in What the Safety Checks Test.

The product page was the hardest to cache, and the problem was timing

Which part of the store was hardest to make safe to cache, and why?

“The product page, especially variable products and bundles. We wanted to share the same HTML without sharing anyone’s prices, basket, or payment-session data. The tricky part was timing: PayPal, Klarna, and Woo4Etch could read a security token before the shopper’s own token arrived. Getting the right value into the page wasn’t enough; it had to be there before the script started.”

This is the same problem the case study called “scripts that read a token too early”. A cached page carries nobody’s security token, so each shopper’s own token arrives a moment after the page does. A payment script that reads the token as it starts gets an empty one, and the store refuses its first request. Nothing looks wrong on the page (the buttons are all there), which is why it’s easy to miss.

What the kit did then. The checks compared renders of the page, and that caught one PayPal problem on this store: the amount in PayPal’s script changed with the visitor’s basket. But a token that’s right once it arrives, and read too early, isn’t a difference in the page. The run was green, nothing in the instructions said to watch a payment button’s first request, and the agent found Klarna’s 403 with a test of its own.

What the kit does now. The safety run does the agent’s test itself. It loads each page as a new visitor, and the product page also as a shopper with a basket and as a logged-in customer, and records the first request every payment button makes to your store. If one is refused over its token, the run fails, even when a retry gets through a moment later. I rebuilt the half-fixed state on a test store (each visitor gets their own PayPal tokens, but PayPal’s script isn’t held until they arrive), and this is what the checks say:

Three failing rows in the Cache Upgrader safety checks: "Payment buttons: the first request is accepted" for a new visitor, a shopper with a basket and a logged-in customer, each naming WooCommerce PayPal Payments, the refused request and the empty token
The new row on a test store with PayPal Payments 4.2.2, where the tokens are per visitor but PayPal’s script starts too early. Before 1.8.0, every row for this page passed.

Each row names the plugin, the request, its status, the token and that it was sent empty, how long before the visitor’s data it was sent, and which recipes handle that plugin. It doesn’t work from a list of payment gateways. It recognises a refused token from WordPress itself and works out which plugin owns the request, so the same row covers whichever express checkout your store runs. I’ve run it for real against PayPal Payments, and against a test gateway that stands in for one the kit has never seen.

This is what your agent now reads in the kit’s safety loop:

**Payment and express-checkout buttons.** The run loads each page as a new visitor, and a
product page also as a shopper with a basket and as a logged-in customer, and records the
first request every payment button makes to the store. If one is refused over its security
token, the row **"Payment buttons: the first request is accepted"** fails and names the
plugin, the request and its status, the token and whether it was sent empty, whether the
request went before or after the per-visitor data arrived, and the recipes that handle that
plugin.

Its advice to the next agent: two browsers, ordinary URLs, and watch the first payment request

What would you tell another agent starting the same job tomorrow?

“Map the private URLs and the existing cache layers before enabling anything. Then test with two independent browser sessions on ordinary URLs. Prove both sides: the catalogue serves a real cache hit, and each shopper still sees their own prices, basket, and wishlist. Test a real variation and bundle, and watch the first payment requests – not just whether the buttons appear.”

“Prove both sides” is the bit I’d underline. It’s easy to prove a page is safe by never caching it, and easy to prove it’s cached by ignoring who gets what. You need the cache hit and the separate baskets in the same test.

What the kit did then. The checks already proved both sides for the catalogue: the same new visitor gets a real page-cache hit, and a basket shopper and a customer each get their own prices and basket. The private pages were the gap. Nothing listed them for the agent and no check asked for one, so it was the owner who asked for a wider look before going live, and the agent’s own inventory that found the withdrawal form page being given to a customer as a guest. It also worked out why its earlier tests hadn’t shown it: they’d used the checks’ signed links, and a link with a query string wasn’t treated like the ordinary address.

What the kit does now. “Map the private URLs” is done for the agent. The kit lists every path that always keeps the visitor’s identity, and where each one comes from:

The private path list on the Cache Upgrader tab: wp-login.php and wp-json from WordPress, cart, checkout and my-account from WooCommerce, and wishlist from the owner's own list
The private pages the kit is working from, with the source of each, on the Cache Upgrader tab and in the agent’s status call.

Three checks then test it, on ordinary addresses:

  • Each private page is requested as a logged-in customer on its plain address, twice. It fails if the page came from the page cache or was given to the customer as a guest.
  • Every other published page is rendered as a guest and as a customer. If the customer sees something the guest doesn’t, the run warns and names the page, because that’s a page that probably belongs on the list.
  • The checks confirm that they themselves leave a private page as its plugins print it.
A warning row in the safety checks naming /returns-form/ as a page where a logged-in customer sees something a guest does not, and which is not private
A returns form that’s on no list, found by the run. This is the check that would have named the withdrawal form.

And the agent is told to put the list in front of the owner, who knows the store:

Before you call a run finished, read `private_paths` from `ssapco/get-status` to the owner:
the paths that always keep the visitor's identity, each with where it comes from (WooCommerce's
basket, checkout and account pages, the owner's own list, or a recipe). Ask what is missing: a
wishlist, a returns or withdrawal form, a members' area, an order-tracking page.

The checks also read the status headers of more page caches than they did (GridPane, xSpeed, nginx FastCGI and Cache Enabler were added between 1.7.16 and 1.7.27), so the report names the layer that answered.

It trusted a green run too early, and it misread a cache header

Where did you go wrong, and how did you find out?

“I trusted a green safety run too early. A focused customer test showed Klarna returning 403 even though the general run had passed. I also misread an xSpeed bypass: the headers looked private, but the body hash and render marker showed it was still serving the warmed HTML. Those were two different lessons: check the request the customer actually depends on, and verify what was served rather than trusting the label.”

What the kit did then. These are two different stories. Klarna is the payment request above, which the run didn’t watch. xSpeed is the opposite: the kit’s checks are what raised it. The row “Staff no-cache marker stays out of the shared cache” has been in the checks since August, and it decides by comparing what was served, not by reading headers. The agent’s mistake came afterwards, when it looked at the response headers, saw a private page, and nearly talked itself out of a real failure before it compared the bodies.

What the kit does now. The Klarna half is the new payment row. For xSpeed there’s a library recipe, so the next store on xSpeed doesn’t have to read xSpeed’s code (1.7.19), the checks read xSpeed’s own status header and report HIT, MISS or BYPASS (1.7.20), and the staff check sends both cookies that real staff carry (1.7.29).

That xSpeed finding is the one that turned into a bug report.

xSpeed confirmed the bug within the hour and fixed it in 1.4.10

Cache Upgrader gives admins and shop staff a cookie called wordpress_no_cache, so every cache layer keeps them on fresh pages while customers share cached ones. It’s an old convention (WP Super Cache started it), and I’ve written up what the cookie is and why it matters.

On xSpeed 1.4.8 and 1.4.9, a request carrying that cookie got the response headers of a private page and the body of the cached one. xSpeed’s drop-in and its server rules both stepped aside for the cookie, then its PHP path treated the cookie as xSpeed’s own leftover record, deleted it and served the stored copy anyway. Nothing private went to anyone. It was the shared guest page going to someone who’d asked not to get it.

The agent worked around it on the store with xSpeed’s own xspeed_should_cache filter. I reproduced it on a clean WordPress with stock xSpeed, wrote a patch, and posted both on the xSpeed support forum on 19 November.

My report on the xSpeed support forum on wordpress.org: "PHP serve path hands a cached page to requests carrying wordpress_no_cache"
The report, on the xSpeed support forum on wordpress.org.

Nahid from the xSpeed team replied within the hour:

Nahid Hasan, an xSpeed plugin contributor, confirming the bug on 1.4.9 and saying the team is going with the suggested approach
Confirmed on 1.4.9, with the approach they’d take.

“We’re going with your approach. Our own record cookie gets its own value, any other value is treated as a real “don’t cache” instruction, and we never delete a cookie we didn’t set.”

xSpeed 1.4.10 came out on 22 November with this line in its changelog:

The xSpeed 1.4.10 changelog on wordpress.org, dated 22 November 2026, with the caching fix for the wordpress_no_cache cookie
xSpeed 1.4.10’s changelog: “A visitor whose wordpress_no_cache cookie was set by another plugin no longer gets a cached page, and the cookie is left in place.”

They asked me to update and check again, so I did, on 23 November, on a clean WordPress with stock xSpeed 1.4.10 and nothing of mine installed. The test page prints a random token on every render, so a stored copy and a fresh one are easy to tell apart:

RequestxSpeed 1.4.9xSpeed 1.4.10
Guest, twiceHIT (php), same pageHIT (php), same page
With wordpress_no_cache=1HIT (php), the same stored page, cookie deletedBYPASS, a fresh page, cookie kept
With xSpeed’s own record cookieHIT (php), cookie clearedHIT (php), cookie cleared

It’s fixed. The kit’s xSpeed recipe still passes its checks on 1.4.10 too, so a store on an older xSpeed is covered either way.

Three days from a forum post to a release is quick, and they said plainly what they’d missed. Thanks Nahid and the xSpeed team! If you maintain a page cache, that public filter is worth copying as well: it’s what let the agent fix the store in a few lines without editing xSpeed.

The slowest page it measured is checkout: 1.83 s as a guest

Look at the store now: which page is slowest for a logged-in customer, and what makes it slow?

“Populated checkout is the leading candidate, but I haven’t verified that ranking signed in. In three live desktop guest runs on November 19, checkout was slowest of the eight routes sampled: 1.83 s median to browser load, versus 1.24 s for the populated cart and 0.58 s for the sampled product page. About 1.04 s elapsed before checkout sent its first byte. It correctly bypasses shared caching and has to build the live WooCommerce checkout; the browser then loads the checkout and payment scripts.”

Those are the agent’s measurements, not mine, and I like that it says what it hasn’t checked: I asked about a logged-in customer, and it measured as a guest and told me so.

It fits what I measured for the case study, where the account page (also never cached) took about 0.7 s to send its first byte while the cached pages took 0.03 s. Once the catalogue comes from the cache, the pages that can’t be cached are the slow ones.

What the kit did then. Nothing. When this store went live the kit had no speed measurement at all, so the agent built its own.

What the kit does now. The kit has a speed check (since 1.7.22) that your agent runs before switching on, straight after and 7 days later, as a guest, as a shopper with one item in the basket and as a logged-in customer, using a test customer it creates only on your yes. From 1.8.0 it times the basket and checkout pages too, for the two shoppers who have a basket, so the question I asked this agent is answered by the kit’s own table. It also doubles as a safety check: basket and checkout must never come from the cache, and if either does, the tool stops.

These two pages are never cached, in any phase: expect `bypass` or
`miss`, and a time that is what the shopper waits for WordPress. What can change after
switching on is that time, because fewer PHP workers are busy with pages the cache now serves.
**If either page comes back as a cache `hit`, the tool stops and exits 1** ("a private page was
served from the cache"): another shopper's basket or checkout could be shown.

Next it would profile the first second of checkout, and keep checkout private

What’s the next performance improvement you’d suggest for the store?

“Profile that first second of checkout with a populated basket. Split the server time between WooCommerce totals, shipping and tax, and payment extensions; then measure when the payment controls are usable. I’d optimize the biggest measured cost and keep checkout private.”

The owner’s reaction: “I’d love if we could cache the checkout, but that looks very iffy and risky.”

I agree with both of them about the checkout page. Every line of it is personal and a mistake costs an order, so the kit keeps account, basket and checkout out of the shared cache on purpose. (For finding where a checkout spends its first second, Super Speedy Performance Analysis measures the server time at every step of one real purchase.)

Express checkout is a different matter, and it’s the part of checkout that can be cached. The PayPal, Apple Pay, Google Pay or Klarna button on a product page isn’t on the checkout page. It’s on a page the cache serves to everyone, and that’s exactly where this store’s payment trouble was.

What the kit does now. The payment row above is the express checkout check: it runs on cached product, shop and category pages, for whichever provider’s buttons are on them. When it fails for a provider my library has no recipe for, the kit helps your agent write one. A new tool maps every token in the page: where it is, which script it was printed for, and whether that script starts with the page. For PayPal on the test store it lists 14, and the first looks like this, trimmed to the lines that matter (it never returns a token’s value):

"location": "wc_ppcp_sdk_v6.ajax.client_token.nonce",
"kind": "script object",
"action": "ppc-sdk-v6-client-token",
"in_shared_page": false,
"regenerated_per_visitor": true,
"script": { "handle": "wc-ppcp-sdk-v6-boot", "position": "body", "held": false }

"held": false is the fault: the token is regenerated for each visitor, but the script that reads it isn’t waiting. The fix has two halves, and the kit now has a helper for the second one, drawn from my PayPal recipe. This is the pattern the agent’s guide gives it:

// 1. Empty in the shared page, minted for each visitor in the per-visitor request.
SSAPCO_Runtime_Data::register_object('my-provider-tokens', 'providerConfig', array(
    'ajax.client_token.nonce' => function () { return wp_create_nonce('provider-client-token'); },
));
// 2. The provider's script is added only once that value is in window.providerConfig.
SSAPCO_Runtime_Data::hold_script('provider-sdk-boot', 'providerConfig', 'ajax.client_token.nonce', 'my-provider-tokens');

If the visitor’s token never arrives, the script doesn’t start and the browser console says so. There’s no falling back to somebody else’s token. On the test gateway, that two-line recipe takes all three visitors from refused to accepted.

The owner refused one more compatibility recipe

What did you decide that it wouldn’t have?

“Another compatibility recipe for the old Variation Swatches plugins. I had a workaround for their failed first request, but [the owner] asked whether we still needed the plugins. We replaced their frontend with an Etch component using the existing ACF finish data and Woo4Etch controls. WooCommerce still resolves variations, prices, and stock. The old plugins stayed inactive as a fallback. We also deliberately kept account, cart, and checkout out of the shared page cache.”

An ArredoItaliano product page with the finish swatches, grouped by material, that replaced the old swatches plugin
The swatches on the store now: an Etch component reading the store’s own ACF finish data.

The owner filled in what the agent left out:

“I told it to create ACF fields and do it properly, or it was going to create another of its snippets, but that’s unrelated to cache everything, it’s just in their nature.”

(He’s right about their nature. Left alone, an agent will add a snippet before it’ll ask whether the thing it’s patching should exist.)

What the kit did then. Nothing flagged the swatches. The agent saw their failed first request in the browser and had a recipe ready, and it was the owner who asked whether the plugin should be there at all.

What the kit does now. Both halves are covered. The same recorder that watches payment buttons watches every other plugin’s first request, so a wishlist, a form or a swatches plugin whose first request is refused over its token gets its own warning row, “Other scripts: the first request is accepted”. And the instructions put the owner’s question to the agent before it writes anything (since 1.7.14):

Before writing a new recipe, ask what the plugin still does for this store. If it does little,
or something else on the site already does it, tell the owner: switching it off or replacing
it may be simpler than a recipe someone has to maintain. That decision, and any change beyond
cache compatibility, is the owner's.

The one change it wants in the kit’s instructions

If the kit’s instructions could change one thing, what should it be?

“Add a decision before “write a recipe”: identify what owns the failing behavior, ask whether the store still needs it, and check whether a native setting or component already solves it. The swatches workaround passed in the browser, but it would have left us maintaining a fix for an integration we didn’t need.”

What the kit does now. All three parts of that are in the safety loop. Every failing row names the plugin or theme that owns it. The order for fixing a failure is a library recipe first, then the plugin’s own setting, and a new recipe last. And the “does the store still need it” question is the paragraph quoted above, which went in after I read this agent’s implementation report.

The owner’s view of the same lesson:

“Every store is… a work of years, so there’s always some refactoring that can get more benefit than just patching an issue. And when you get to do big optimization work, it’s better to be open-minded and be ready to refactor rather than accept the status-quo as is. But this is more for us humans than for the LLM.”

Who caught what, and what the kit does about it now

ProblemWho caught it on this storeWhat the kit does now
Payment scripts reading a token too earlyThe agent’s own test (the run was green)A failing row for the first request of every payment button, for a new visitor, a basket shopper and a customer (1.8.0)
PayPal amount changing with the basketThe safety checksLibrary recipes run on the tested plugin version or newer, and say when they’re skipped (1.7.11)
No recipe for an express checkout providerThe agent, reading the plugin’s codeA map of every token in the page and a helper that holds a script until its token arrives (1.8.0)
Withdrawal form page given to a customer as a guestThe owner asked, the agent found itThe private page list with sources, and checks that request private pages on their plain address and name pages that look personal (1.8.0)
xSpeed serving the cached page to staffThe safety checks, then the agent’s body hashxSpeed recipe (1.7.19), its status header read (1.7.20), and fixed in xSpeed 1.4.10
Checkout is the slowest pageThe agent, with its own timingBasket and checkout timed for a basket shopper and a customer, and the tool stops if either is a cache hit (1.8.0)
Old swatches plugin failing its first requestThe ownerA warning row for any other plugin’s refused first request (1.8.0), and “is this plugin still needed?” before any new recipe (1.7.14)

What I took from it

  • A green safety run is only as good as what it watches. The agent tested the request the customer depends on, and now the run does.
  • Check what was served, not what the headers say. Comparing the body found a bug that the headers hid, in a cache plugin with over 10,000 installs, and it’s now fixed for everyone on xSpeed.
  • Before patching a plugin, ask whether the store still needs it. The owner asked, and the store got a native component instead of one more recipe to maintain.
  • Ask the agent. Seven questions pasted into a finished session gave me the work that became Cache Upgrader 1.8.0, and every part of it came from a real store.

If you’d like your own agent to do this job on your store, the checks, recipes and instructions are in the Cache Upgrader Kit for WooCommerce. And if it finishes and you’re happy to paste seven questions into the session, I’d love to read the answers.

Comments