Engineering
Forge CI Got 4x Faster
Smol = speed: where the seconds went, and the Cloudflare features that won them back.
A full Smol CI run fell from 24 minutes to 6 and per-job setup from 80–100 seconds to about 13, using per-repository Container images and snapshots; R2 conditional writes, in-Worker pack ingest, a D1 commit index and Smart Placement put a typical push on track to fall from 34 seconds to about 1.
TLDR: Forge is our GitHub + Actions + Vercel clone, built mostly by agents and running entirely on Cloudflare. This week we profiled it end to end. A full CI run went from 24 minutes to 6 (measured). Per-job setup went from 80-100 seconds to about 13 (measured). And a typical git push is on track to go from 34 seconds to about 1 (estimate, partly shipped). None of it came from clever algorithms. Almost all of it came from finding work we were doing one at a time, or doing again, or doing far away, and stopping. And almost every fix was a Cloudflare feature we hadn't been leaning on hard enough.
The name of the company is smol. Smol should mean fast. For a while it didn't.
The Cloudflare features doing the work
Forge is a Worker-first system. Git objects live in R2, metadata lives in D1, and CI and native git run in Containers. That turned out to matter more than any code we wrote this week. Each bottleneck below had a platform feature that already solved most of it, and the fix was to stop working around the platform and use it directly:
- Workers are fast enough to decode and check a whole git pack inline, so small pushes no longer boot a container at all.
- R2 conditional writes (
If-None-Match: *) make "write this object unless it exists" a single request, so we dropped aheadper object and ran 32 writes in flight. - D1 runs a recursive CTE, so walking 2,000 commits of history is one query instead of one R2 read per commit.
- Containers take a per-repository image, so a repo's toolchain and dependencies are already installed when a CI job starts.
- Container snapshots let one trusted run install dependencies and every later run restore them in under a second.
- Smart Placement and service bindings let the API run next to its database while users still connect to the nearest edge.

The Cloudflare features doing the work. Measured unless marked as projected, estimated or pending.
Part 1: git push was slow because of object count, not bytes
It started with swyx staring at this in a terminal:
remote: Indexing received pack...
remote: Indexing received pack...
remote: Indexing received pack...
One line every 10 seconds, no progress, no ETA. That push to smol-ai/smol2026 was 71 objects and 5 MiB, and it took 34 seconds on the server (measured).
Forge already records per-phase timings for every push in a git_ingest_diagnostics table, so we didn't have to guess. That push broke down like this (measured):
| phase | time |
|---|---|
| stage the pack to R2 | 2.9 s |
| copy the pack into the sandbox | 1.3 s |
index-pack + unpack-objects |
0.6 s |
| sandbox start | ~3.3 s |
| publish objects to R2 | 23.0 s |

Where a 34 second push went: 23 of 34 seconds publishing objects.
Native git was the cheap part. The expensive part was taking each unpacked object out of the sandbox and putting it in storage: one sandbox read RPC, one R2 head, one R2 put, four objects at a time. That works out to about 1.3 seconds per object. A 13-object push earlier the same day spent 43 seconds on the same step. The cost tracked object count, not pack size, which is the opposite of what you'd assume.
So the fixes, in the order we shipped them:
- Batch the copy out of the sandbox and lean on R2 conditional writes (PR 272, merged and live). Small objects now leave the sandbox in one
tararchive per batch, read with a single RPC, then go to R2 with 32 conditional puts in flight. R2's conditional put withIf-None-Match: *already tells you "this object exists", so the separateheadper object went away. On the new runner, publishing dropped to about 240 ms per object (measured: 23 objects in 5.6 s). That's 5x better, but a typical push still spent 8-15 seconds on fixed overhead. - Skip the container entirely and ingest small pushes in the Worker (PR 293). Most pushes are a few dozen objects and well under a megabyte, so booting a container to run
index-packis overkill. Packs up to 8 MiB are now decoded, checked and written in the Worker itself. A 5 MB, 62-object pack takes about 0.12 s locally (measured locally, not in production). The important design choice is that the Worker only accepts what it's sure about. It runs a subset ofgit fsck(tree order, modes, no.gitin any case or NTFS spelling, header formats), and anything it's unsure of gets replayed byte for byte into the old native path. That covers.gitmodules, non-ASCII paths, decode errors and oversized packs. So a push the old path would have accepted can never fail on the new one. - Stop making round trips one after another (PR 295). From Singapore, every D1 or R2 call from the Worker is about 150 ms to US West, and a push made 25-30 of them in sequence. We now run the permission, deletion and protected-branch checks in parallel, skip a redundant R2
headfor objects the Worker just wrote, and move bookkeeping (diagnostics, event annotation, ref-change publishing) after the client gets itsok. That's about 8 fewer sequential trips, or ~1.2 s at that distance (estimate). - Cache verified tokens for 15 seconds (PR 298). A push is 2-3 HTTP requests a few seconds apart, and each one repeated a 0.6 s token lookup (measured:
server-timing: auth;dur=624). We picked 15 s over 60 s: it captures nearly all the saving while keeping revocation lag short. - Run the Workers next to the data (PR 288, Smart Placement, merged). More on this in part 3.

Before and after: small pushes skip the container.
Put together, the 34 s push becomes roughly 11 s with batching, ~4 s with the in-Worker fast path, 2.5-3 s with fewer round trips, and ~1 s with Smart Placement. That's the 20-30x. To be clear, only the first step is measured in production so far; the rest are projections from each PR, and the new progress line will tell us the real number on every push once they're all deployed.

A typical push: 34 seconds to about 1, projected.
Pulls had the same disease
A pull of 152 new commits sat on Walking object graph... for 62 seconds (measured). The fetch walk only learned a commit's parents by reading that commit from R2, so a linear history cost one round trip per commit.
PR 278 puts D1 to work as a commit index: one row per commit with its tree, time and parents. A recursive CTE returns up to 2,000 ancestors in a single query, so a 150-commit walk becomes one R2 round plus one D1 query (estimate). The index is a cache, never an authority. Commits are content-addressed, so the rows are immutable facts, and a missing row just means "go read R2". It fills itself after each push and lazily on first fetch, and the walk queries it alongside R2 reads, so a cold or broken index adds zero latency.
And we made the wait visible
Even before the speedups, the worst part was not knowing. Git's sideband demuxer splits on \r as well as \n, so a server can rewrite one progress line in place just like local git does. Pushes now say:
remote: Indexing received pack: publishing objects 59% (40/67) (12s, ~6s left)
remote: Indexing received pack: done (71) in 9.8s [sandbox 3.1s, stage 2.9s, copy 1.3s, publish 1.2s, ...]

Before and after: push progress lines.
That final line is now our best profiling tool. Every push tells you where its time went.
We also asked an agent to go through two years of git changelogs for protocol wins. The answer was a bit of a letdown: there's no protocol v2 push, and bundle-uri, packfile-uris and promisor remotes are all off by default on stock clients. The speedups available to a git host are all server-side.
Part 2: CI was slow because we kept reinstalling the world
Smol's Linux CI took 24.0 minutes for a full run on main when we started (measured, one container). The first 18 minutes came off the usual way:
- split one container into eight parallel jobs
- checkpoint the checkout instead of cloning cold
- a shared run queue so every job pulls work and only runs what a change touches
- move the build into the job that actually needs it
That got to 6.0 minutes on a warm run (measured). Then it hit a floor. Every job paid about 45 s before its first step, then 1-1.7 minutes of setup: about 30 s of pnpm relinking and 30-50 s of apt installing browser system libraries (measured). Eight jobs, each doing the same setup from scratch, every run.

Smol's full CI run: 24 minutes to 6.
Bake it into the image
Forge runs CI jobs in Cloudflare Containers, which can run a different image per container class. Until this week every repository still shared one runner image. So we added per-repository images (PR 235). CI_REPOSITORY_IMAGES maps a repo to its own container class and image revision. We then built one for Smol with the apt packages, FFmpeg, pnpm, Playwright's Chromium and WebKit, and Smol's installed dependency tree all baked in. It builds FROM the exact live runner image digest, so the toolchain health check still matches. And Smol's CI script falls back to a normal install wherever the image is missing or stale.
Results:
- Start plus setup for a Chromium job went from 55 s to 13 s in a local test (measured locally).
- On the exact production image: 1 s start and 9 s setup for both a Chromium job and the typecheck/unit job, against 80-100 s in production (measured).
- In production, pnpm install took a median of 7 s, down from 30-85 s, and jobs reached their first test about 70 s after starting (measured, runs 459 and 462).

Per-job setup and pnpm install times before and after the baked image.
A small war story: building an amd64 image on an arm Mac crashed Node under emulation, twice. We ended up building in a cloud session on native amd64 instead, which took about 4 minutes.
Snapshots, and the time they made things slower
Baked images go stale whenever the lockfile changes, and Smol's lockfile changes daily. So the next step was a CI snapshot lane built on Cloudflare's container snapshots (PR 237). A trusted run on main installs dependencies once, then snapshots the running container. Later runs restore from that snapshot instead of installing. Once a host has the snapshot cached, a restore takes under 0.6 s. The first restore on a new host takes 17-45 s (measured).
Then we turned it on for Smol and CI got slower. pnpm install went from 7 s back up to 59 s (measured). Joining the lane had moved Smol off its baked image onto the shared browsers image. Then the browsers image hit an apt error on a Chrome download, and the one snapshot build that ran failed and used up the day's build budget.
The fixes were all boring. Failed builds retry and don't count against the daily limit. A repo keeps its own image inside the lane. The browsers image dropped the apt source that broke. The lane is off for Smol while it runs green for a day; we'll add restore numbers here when it's back on. The lesson we keep relearning: measure the first real run after every change, because "this should be faster" and "this is faster" are different claims.
The fastest CI job is the one you don't run
One more from this week. Forge can reuse a passed result when a run's files and workflow are identical to one that already passed. But the reuse check ran after the run had been admitted to a sandbox slot. One exact-tree run waited 164.7 s in the queue and then executed 0 jobs. The median pre-admission wait across ten first attempts was 109 s (measured). PR 291 moves the check in front of admission, so those runs finish instantly instead of waiting in line behind real work. It's going through our merge queue as this is written.

Run 1007988 waited 164.7 s in the queue and executed 0 jobs.
Part 3: 7 milliseconds of work, 2.6 seconds of waiting
The last one is almost funny. Authenticated page loads from a Mac in Singapore were slow (measured, 20 requests each, p50):
| endpoint | p50 |
|---|---|
/api/auth/me |
1,262 ms |
| repo page | 2,273 ms |
| open PRs list | 3,312 ms |

7.4 ms of CPU, 2.6 s of wall time.
Connecting to the edge took 9 ms. Over 24 hours the repository Worker's CPU p50 was 7.4 ms against a wall-clock p50 of 2.6 s (measured). The Worker was running in Singapore, right next to the user. The database was in Oregon. Every page made 6-15 sequential D1 round trips across the Pacific.
Two fixes:
- Fewer trips per request (PR 289). Every
/apirequest paid about 200 ms of middleware before its handler (measured from Chicago: 94 ms for a health check with no D1, 295 ms for a 404). The rate limiter did two sequential primary writes when one upsert would do. PATs wrotelast_used_aton every request, so now it's at most every 5 minutes. And a storage-quotaSUMran on every GET just to set a header nothing read. - Cloudflare Smart Placement (PR 288, merged). One config block tells Cloudflare to run the API and repository Workers near the services they call, not near the user. Your connection still terminates at the nearest edge. The edge Worker that serves HTML stays local and forwards
/apiover a service binding, so you pay one long hop instead of 6-15. The tradeoff is that requests that barely touch D1 now pay that one hop too. For a git host whose data lives in one region, that's a good trade. It merged this morning; we'll update this post with before/after p50s once Cloudflare has moved the Workers.
Smart Placement: cross the Pacific once, not fifteen times. Before numbers are measured p50s. After numbers are pending until Cloudflare has moved the Workers.
The obvious next step is D1 read replication, which puts read copies near users. We haven't done it yet because it only kicks in once every query goes through the Sessions API. It also lets a git fetch right after a push briefly see the old branch tip. That's a project, not a config change.
What we took away
- Profile in production, with data the system already records. Every fix here started from a diagnostics table, a
[ci:timing]log line or aserver-timingheader. Our first guess about the slow push (container start) was wrong, and the data corrected it within minutes. - "Per item" costs hide everywhere. Per object, per commit, per CI job, per request. Each one was cheap on its own. Each one was paid serially.
- Make the fast path conservative and the slow path the authority. The in-Worker ingest only accepts packs it's certain about. The commit index is a cache that can't give a wrong answer. The baked image falls back to a normal install. That's what let us ship all of this quickly without breaking anyone's repo.
- Check what the platform already does before building around it. R2 already had conditional writes, D1 already had recursive queries, Containers already had per-class images and snapshots, and Workers already had Smart Placement. Most of our slowness came from code written before we reached for them.
- Agents are good at this kind of work. Most of this was agents reading diagnostics, writing the PR and stating plainly which numbers were measured and which were projected. The human's job was mostly saying "merge 293" and asking "is that cheap? why not do this".
Smol is speed. We're not done. If you want to poke at it, Forge is at forge.smol.ai.
