SmolForgeField Notes

Notes on systems,
code, and craft.

SmolForge journal

Field notes

All notes21
All notes

Engineering

Auditing an AI-Built GitHub Clone

Forge looked crafted. Its numbers were wrong, its buttons were all orange, and 14 pages said “Error: Not found”.

A severity-ranked audit of Forge’s agent-built web UI found counts capped at 30, fake diff stats, purged button variants and dead-end error pages; four small PRs fixed them and a guardrails check plus a browser sweep keep them fixed.

TLDR: Forge, our GitHub clone, was built mostly by AI agents, and it looks great. It has a workshop theme, custom type and a mascot. When we finally had an agent audit it like a picky design reviewer, the problems weren't aesthetic. The UI was confidently showing wrong information. PR counts stopped at 30. Every PR said it changed zero files. Every button was the primary color. And 14 pages had no real error state. Fixing them took four small PRs. Making sure they stay fixed took a fifth, which turns each bug into a test.

Why audit at all

Forge is a git host, CI runner and deploy platform in one, running on Cloudflare. Agents write most of its code and open most of its PRs, and swyx reviews and merges. That works well for backend work, where tests tell you when you're wrong. Frontend is different. An agent can build a page that renders, passes typecheck and looks plausible in a screenshot, while showing numbers no one checked against real data.

So we asked for an audit, done against the live site, signed in and signed out, at 1440px and phone width. The instruction was to rank findings by severity, not by how easy they were to fix.

The findings: plausible but wrong

The top of the list was all "the UI is lying":

  1. Closed and Merged counts stopped at 30. swyx/forge has 229 merged PRs. The list fetched one page per state and counted the page.
  2. Every PR row said "+0 -0 across 0 files". The list API never returns diff stats, so the UI printed zeros. Nobody notices a plausible zero.
  3. Repo tabs past about 8 were clipped off the right edge, with no scrollbar or hint. Branches and Settings were unreachable without a trackpad swipe.
  4. Status was nearly invisible. It was a 10px uppercase mono "OPEN" stamp in the PR header, and 12px pale text on a pale fill in lists.
  5. Branch names were forced to UPPERCASE (CLAUDE/PROJECT-THREAD-888AAN), which misstates a case-sensitive ref.

16 findings ranked by severity

16 findings ranked by severity.

Then the overlap bugs. A floating "Contents" box opened by default over the README and the PR sidebar, and it stacked one box per markdown block, so a PR body plus five comments meant six boxes. Truncated labels had no tooltip. And there were no hover previews anywhere, in a product whose whole UI is links to other PRs, commits and runs.

The fixes: four small PRs

Each one was web only and mergeable on its own. All four are merged into main and go out with the next release.

  • PR 274, readable status and true numbers. Counts come from the API's pagination.total, with a "Show more (N more)" button past 30. The fake "+0 -0" line is gone. There's one shared state pill for open, draft, merged, closed and queued, with an icon and a 13px label. PR numbers became bold mono chips, and branch names keep their case.
  • PR 275, a repo nav you can see all of. Open PR and issue counts sit on the tabs. Sections you've never used (no issues ever, no publications) collapse to a muted icon with a tooltip that says why. Tabs are ordered by use, and when they don't fit, they wrap or scroll with an edge fade instead of clipping.
  • PR 276, no more overlap. The Contents box only shows for documents with 4+ headings. It starts collapsed as a "Contents · 33" pill, and only one appears per page.
  • PR 277, hover peeks and agent hooks. Hover or focus on any PR, issue, commit, run or user link and you get a card with its state, key fields and a JSON link to the API object.

That last one is the part we're most excited about. Every peek target carries data-forge-kind, data-forge-ref and data-forge-api. So the same markup that gives humans a hover card gives agents a stable, machine-readable map of the page. An agent browsing Forge doesn't need to scrape "#270" out of a byline. It can read pull:swyx/forge#270 and fetch the object directly. If agents are going to be the main users of developer tools, the DOM should be an API too.

The DOM is an API too: data-forge attributes

The DOM is an API too: data-forge attributes.

The best bug: every button was orange

After the audit, swyx noticed the sign-in page was a wall of identical orange buttons, and delete buttons looked like the main action.

The cause was a perfectly normal-looking line of code:

className={`forge-button forge-button--${variant}`}

Tailwind v3 only keeps rules in @layer components whose class names appear literally in your source. forge-button--secondary never appears literally, so Tailwind purged it, along with --danger and every size variant. Every variant="secondary" button on the site rendered in the primary color. We confirmed it in the browser: the computed button face on a secondary button was #c96b43 (primary) before the fix and #e7ddc8 after (PR 299).

This is exactly the kind of bug agents make and reviewers miss. The code reads correctly. The types are correct. The test, if there is one, checks that the class string is right, and it is. Only the built CSS is wrong.

How every button became orange

How every button became orange.

Sign-in page before and after

Sign-in page before and after.

Designed dead ends

The second sign-in-adjacent PR (300) dealt with what happens when things go wrong. Fourteen pages showed nothing but a red Error: Not found line when a load failed. /explore was read as a username and said "User not found". And any URL no route matched rendered a completely blank page, because the app had no catch-all route.

Now there's one ForgeErrorState that classifies the failure. Not found names what's missing ("We couldn't find that repository"). Sign in required and No access offer the right next action. Offline and Unexpected get "Try again" with the server message kept as a details line. Signed-out visitors get Sign in back to the same URL, because a private repo 404s for them. Unknown URLs get a real 404 page.

Before: /swyx/forge/commits rendered a blank page

Before: /swyx/forge/commits rendered a blank page.

Error page before and after

Error page before and after.

While we were in there, sign-in got a rethink too (PR 301). It leads with the method you last used on this device, labelled "Last used on this device". With no history, passkeys lead. And after a password or OAuth sign-in, you get one offer to create a passkey. We store method ids and timestamps locally and nothing about the account.

Remembered sign-in method and the passkey offer

Remembered sign-in method and the passkey offer.

Then make it impossible to regress

Fixing bugs one at a time doesn't scale when agents write the next thousand lines. So the last step was a guardrails PR that turns each bug class into a check that fails CI:

  • every class in @layer components must appear literally in source (the orange-button bug)
  • no @layer components class names built from template strings
  • no bare Error: {...} lines or grey "not found" early returns, so pages have to use ForgeErrorState
  • a * catch-all route must exist
  • every code path that signs someone in must record the method and offer the passkey, so a new OAuth provider can't silently skip it

Static checks can't see everything, so there's also a browser sweep, npm run ui:sweep. It opens key routes at 390px and 1280px, signed in and signed out, and flags:

  • uncaught errors and blank pages
  • sideways scrolling, naming the element responsible
  • bare Error: lines
  • secondary buttons rendering in the primary color
  • controls with no accessible name

Against production it found 12 issues across 32 page views. Locally, with everything merged, it finds 0 across 38. It also caught two things nobody had reported. On phones, swyx/forge's README was 551px wide because long inline code didn't wrap. And the top bar overflowed at 408-433px.

ui:sweep: 12 findings across 32 page views before, 0 across 38 after

ui:sweep: 12 findings across 32 page views before, 0 across 38 after.

What's still wrong: the structural stuff

The audit fixed what was broken. A second pass, the redesign proposal, looked at what was merely wrong for the job, and that list is bigger:

  • The PR page can't answer "can I merge this?" It says "Ready to merge" with zero checks listed, and nothing on the page links to the CI run for that commit. The preview deploy panel is at the very bottom, below the conversation. The proposal is a single status box at the top: merge verdict, one row per check, the preview with a thumbnail, and the merge button. That's GitHub's merge box and Vercel's preview comment in one place, plus a provenance row showing which agent opened the PR, from which thread. That last part is Forge's edge over GitHub, and today it has nowhere to live.
  • The app has four page widths and two repo header styles. In packages/web/src/pages, 25 pages use max-w-5xl, 22 use max-w-6xl, 4 use max-w-7xl, plus one-offs at 880px and 1540px. The header jumps as you navigate. The fix is one shell with a left sidebar.
  • Home is a profile, not an inbox. /dashboard redirects to a big art card and six repo cards, and the repo swyx pushed to today isn't one of them. The question you open a dev tool with is "what needs me": failing CI on my PRs, green PRs I can merge, review requests.
  • On a failed run, the failure is the last thing on the page. It's 10px grey mono under the third step of a progress line, below a release receipt, a build console, runner setup and four stages marked "Not applicable".
  • The theme leaks into the labels. 39 files put a themed eyebrow over the heading: "Joining bench", "Change gauge", "Threshold ledger", "Bounded intervention". The workshop theme is a real brand asset on the landing page. Inside the app, it adds a translation step to every screen.
  • Density. At 1440px the PR list shows five PRs per screen, in 96px cards with 12px gaps. A developer tool should show three times that.

PR page now vs proposed

PR page now vs proposed.

Failed run page now vs proposed

Failed run page now vs proposed.

Home now vs proposed work inbox

Home now vs proposed work inbox.

Deploys now vs proposed

Deploys now vs proposed.

PR list at 1440px: five PRs per screen

PR list at 1440px: five PRs per screen.

On a phone: tabs scroll off-screen and the header pushes content below the fold

On a phone: tabs scroll off-screen and the header pushes content below the fold.

What we learned about AI-built UIs

  1. Agents optimize for plausible, not true. "+0 -0 across 0 files" is a perfect example. It's well formatted, it's in the right place, and it's wrong on every row. Audit against real data, not against a screenshot.
  2. The bugs that matter live between layers. The orange buttons were correct TSX producing incorrect CSS. The count of 30 was a correct component on top of a pagination assumption. Unit tests at one layer don't catch these, but a browser does.
  3. Every bug you fix by hand, turn into a check. The agents will write the next thousand lines. Leave them a test that fails, not a lesson they'll forget.
  4. Aesthetics were never the problem. Forge has taste. What it lacked was someone asking, page by page, "what is this screen for, and does it answer that?" It turns out agents can do that too, if you ask.

Forge is at forge.smol.ai. The redesign is next.