Experiential Labs platform · companion to the Platform Data Plan · updated 2026-11-22

Observability Architecture

How our gateway records every request, where each piece of that record lives, what kept breaking, what we tried, what we measured, and what is still waiting for a decision. It is written to be read top to bottom by someone who has never seen the system.

Cloudflare MemoryDB (Valkey) Postgres (Supabase) ClickHouse Supabase Storage (S3) PostHog
Part 1

Orientation

What this page is, how it relates to the plan, and where the work stands.

What this document is

This page is the long companion to the Platform Data Plan (platform-data-plan.html on the Desktop). The plan page is short on purpose. It lists the decisions, numbered D1 to D20, and the owner questions, each in a card marked "Decided", "Confirm" or "Your call".

This page holds the thinking behind those decisions. It explains how the system works, what went wrong with it, which experiments we ran, what the numbers were, and why each design won. Where the two pages give a number, it is the same number. Where this page once proposed something the plan later decided differently, the place is marked with the final decision (for example final: D6) or with a dated note (for example updated 2026-11-18).

The work covers five connected things:

  • Observability: the pages and API where a customer reads back every request they sent through our gateway, groups them into sessions and traces, and searches them.
  • The MemoryDB wallet: the fast, durable store that checks and charges money on every request.
  • Capture: saving prompts and responses to S3 in "segments", then loading them into ClickHouse for lists and search.
  • Retention and the Helicone move: how long data is kept, who decides, and how customers of Helicone (which we own) move to our stack with no change on their side.
  • Running through a Postgres restart: making sure a planned database restart does not break customers' API calls.

How to read it. Part 2 defines every term. Part 3 explains how the system works, piece by piece, as it runs in production. Part 4 lists what was not working, in the order we found it. Part 5 tells the story of the work, day by day: what we noticed, what we tried, what we learned, what we changed and what happened. Part 6 says where things stand. Part 7, at the bottom, lists every decision still open, with the same numbers as the plan page.

About the numbers. Every figure comes from a measurement, a log, a report or the code. Figures marked "live" were read from production on the date given (most on 2026-11-09). "Local" means a developer machine or a test cluster. "Preview" means the isolated test environment pr-902980, which is deliberately small (for example, its ClickHouse has one CPU), so preview numbers are a lower bound for production.

History of this page. It was first written on 2026-11-09 from production as built on main. The same day it gained: the glossary; the full infrastructure map; the MemoryDB double ledger in depth; the capture pipeline and the hidden Postgres write inside Supabase Storage; the November 9 refusals; the target architecture; a status table of every change; the simple diagram with every box and arrow explained; how our inboxes and outboxes work; a review against published engineering practice; every capture path; what we can learn from LiteLLM; and the sessions proposal. Dated sections were added on 2026-11-18, 11-20, 11-21 and 11-22. On 2026-11-22 the page was reorganized into this chronological order.

Status in one paragraph

Nothing of this work is merged to main, and none of it runs in staging or production. The owner's rule is that everything is proven in the isolated preview first.

All of it is one pull request, GitHub #2980, labelled do-not-merge until the owner approves it. Earlier it was split into 12 stacked PRs (#3090 to #3101); on 2026-11-21 the owner decided to land it as one PR, and the 12 were closed.

It is tested on preview pr-902980. On 2026-11-22 eight agents attacked it in rounds; twelve rounds are now merged into #2980 (head 79479dfd80) and deployed on the preview. The wallet, ClickHouse and Postgres failure tests passed there with money exact every time.

The preview ran #2980's code on main's deploy layout, so the PR's own layout changes (background units, dashboard edge, writeback app, direct announce and more) have not run anywhere yet. See What the preview could and could not test.

Still open: the owner decisions in Part 7, the speed of the Requests list at large scale, and a few gaps listed in Part 6.

Part 2

Definitions

Every term the rest of the page uses, in plain words. Skim it now and come back when a word is unclear.

The product in one paragraph

Experiential Labs runs an AI gateway. A customer's software sends its model requests to us, at https://api.experientiallabs.ai/v1, instead of sending them straight to OpenAI, Anthropic or another provider. We speak the same API as those providers (OpenAI Chat Completions and Responses, and Anthropic Messages), so a customer changes only a base URL and a key.

For each request we check the key and the organization's limits, reserve the money, pick a provider route, call the provider, stream the answer back, charge the real cost, and keep a record. If one provider fails, we can retry on another.

Observability is where the customer reads those records back: a Requests table, sessions, agent traces, search, charts and totals, in the dashboard at platform.experientiallabs.ai and through an API that their own agents can call.

The infrastructure pieces

Every piece of infrastructure the rest of this page names: what it is in general, and what it does for us. Pod counts are live production replica counts on 2026-11-09.

Cloudflare

A network company whose servers sit between the internet and your servers. Visitors connect to Cloudflare; Cloudflare forwards the traffic to you.

Ours: only api.experientiallabs.ai and platform.experientiallabs.ai. It decrypts HTTPS (TLS), runs the firewall (WAF) and sign-in rate limits, passes the real visitor IP (CF-Connecting-IP), and adds a secret header so our servers can refuse traffic that did not come through Cloudflare. Streams pass through for up to about an hour. It stores nothing and never challenges /v1. Not behind it: our GPU gateway VM, the status page and marketing site (Vercel), staging, previews, and Supabase.

AWS EKS and Porter

Kubernetes runs containers ("pods") on a pool of machines, restarts them when they crash, and scales their count. EKS (Elastic Kubernetes Service) is AWS running Kubernetes for you; you still pay for the machines and decide what runs on them. Porter is the deploy tool on top: each Porter "app" becomes one or more Kubernetes deployments.

Ours, production replicas live: edge explabs-api 12, gateway worker 30, control plane explabs-ctl 6, web 10, Project worker 64 (+1 broadcast). All in us-west-2, behind one AWS load balancer and ingress-nginx.

Gateway worker

Our serving process: a Python "front" plus the Rust engine (experiential). It authenticates the key, picks a provider lane, reserves money, calls the provider, streams the answer back, charges the real cost (settles), and buffers the capture.

The only process that talks to model providers. 30 pods, each admitting at most 64 requests at a time.

Caddy and the GPU gateway VM

Caddy is a web server and reverse proxy, a lighter alternative to nginx. It accepts HTTPS and forwards each URL path to a backend.

Ours: gateway.xplabs.ai is a GCP VM running Caddy, with one path per GPU lane (for example /ec/18160 is clef). Each GPU box (Azure, GCP, Lium, Arrakis) opens a reverse SSH tunnel to that VM, so the boxes need no public ports. Some boxes also run Caddy locally to spread requests across several model servers (clef's Azure box: 8 sglang servers behind Caddy on port 30100). Experiential Cloud models reach their boxes this way; Cloudflare is not involved.

MemoryDB

AWS's managed in-memory key-value database, compatible with Redis/Valkey. Reads and writes take well under a millisecond, and unlike a cache it is durable: a write is acknowledged only after it reaches a log copied across availability zones.

Ours: the "fast ledger". It holds each organization's live balance, open holds, spend caps and promo credits, plus the rate-limiter counters. It is the only store a production request waits on. See MemoryDB in depth.

Postgres (Supabase)

The relational database: tables, transactions, foreign keys. Supabase hosts it and adds auth, an HTTP API (PostgREST) and Storage on top.

Ours: one database, 1,336 GB live. System of record for keys, orgs, catalog, wallet history, request and attempt rows, usage events, capture pointers. Largest tables (live): audit_log 311 GB, gateway_attempts 238 GB, gateway_usage_events 188 GB, storage.objects 167 GB, gateway_requests 105 GB, gateway_chain_authority_receipts 67 GB.

S3 and Supabase Storage

S3 is AWS's object store: you put a file under a name and get it back by name. It is cheap, effectively unlimited, and has no database behind it that needs cleanup (vacuum). Supabase Storage is Supabase's file service. Its bytes sit in S3 that Supabase owns, but every file also gets a metadata row in storage.objects, inside our Postgres.

Ours: captures, capture documents and customer trace uploads go to Supabase Storage today, so each one is also a Postgres write. Our own AWS S3 holds RL artifacts, criminal-abuse artifacts, an empty capture archive bucket and Terraform state. See Captures and S3.

ClickHouse

A columnar analytics database. It scans billions of rows fast when you ask for sums, counts and percentiles over a few columns, but is poor at updating single rows.

Ours: every chart and total (usage_events, spend_facts) and uploaded external traces (trace_spans). Fed from a Postgres outbox. Not involved in gateway captures today.

SQS and dead-letter queues

SQS is AWS's message queue. A producer drops a message; a consumer takes it, works on it, and deletes it. If the consumer crashes, the message reappears after a timeout for another consumer. A dead-letter queue (DLQ) is where SQS moves a message after it failed a set number of times, so one broken message stops being retried forever and a person can look at it.

Ours: the illegal-content review queue (and its DLQ) in production, 76 messages waiting when checked. Captures do not use SQS: their queue is a Postgres table, gateway_capture_inbox, with no dead-letter shelf (298 rows stuck in metadata_pending since November 6).

ECS and Fargate

ECS and Fargate work together. ECS is AWS's simpler container scheduler (an alternative to Kubernetes/EKS). Fargate is a way to run ECS tasks without owning machines: you ask for "0.25 vCPU, 2 GiB" per task and AWS runs it. So "ECS on Fargate" means containers with no servers to manage, priced per task-second.

It suits queue workers better than EKS pods for three reasons. It scales on queue depth, separately from the serving cluster. A runaway job cannot take CPU or memory from gateway pods. A cluster release does not have to stop and drain it. Ours: the illegal-content review service and evals run on ECS Fargate. A capture-processing service exists but is switched off: its runtime setting is worker, so the 64 EKS Project worker pods do that work instead.

Outbox, writeback, drain

An outbox is a table a transaction writes "something needs to happen" into, in the same commit as the change itself, so the follow-up can never be lost. A background drain then does the follow-up and deletes the row. Writeback here means copying MemoryDB's receipts into Postgres.

Ours: receipt streams (MemoryDB to Postgres), settle_outbox (usage events), the ClickHouse outbox, and the capture inbox (which behaves like an outbox filled by Storage).

Public edge

A thin relay in front of the gateway workers. It passes each /v1 request on without reading or changing the body.

Ours: 12 pods of explabs-api. Its job is fairness: it gives each customer a share of its connections to the workers, so one heavy caller cannot block everyone. Because it is separate, a gateway release does not drop the connections callers hold to the edge.

Control plane

Our dashboard and admin API (a Python FastAPI app), plus background threads that copy data between stores.

Ours: 6 explabs-ctl pods. The threads are the ledger writeback, the settle drain, the ClickHouse exporter and the credit feed. In the new design it also receives customers' trace uploads (span ingest).

Web app

The Next.js dashboard that people use in a browser.

Ours: 10 pods. It renders pages on the server and forwards the browser's /api calls to the control plane with the signed-in user's identity.

Project worker

A pool of background worker pods that run jobs off the request path.

Ours: 64 pods (+1 broadcast) in EKS. On 2026-11-09 they processed captures and ran the wallet_check accounting pass. The new design keeps workers in EKS as separate deploy units and runs only the capture ETL on Fargate.

Preview environment

A full, private copy of the platform built for one pull request, used to test a change before it goes anywhere near customers.

Ours for this work: pr-902980, for PR #2980. It has its own AWS account, database branch and cluster, and is small on purpose: one edge pod, one control-plane process, one ETL task, and a ClickHouse with 1 CPU and 2 GiB. Its wallet runs on ElastiCache Serverless, not MemoryDB. Its real model has a fixed $5 budget for its whole life.

Helicone, Langfuse, OpenTelemetry

Helicone is an LLM observability proxy that Experiential Labs owns; its customers are to move onto our stack. Langfuse is a popular open-source tracing tool. OpenTelemetry (OTLP is its wire protocol) is the standard way programs send traces.

Ours: we accept Helicone's hosts, keys and headers, Langfuse's ingest API, and OTLP spans, so customers can send us data with tools they already use.

Request and money words

These describe one request's life and the money attached to it.

WordMeaning here
CallerWhatever sends a request to our /v1 API with an xpl_ key: a customer's app using the OpenAI or Anthropic SDK, a coding agent (Claude Code, Codex, Cursor), or a script. The caller is our customer's software, not a person. "While the caller waits" means between the request arriving and the last byte of the answer leaving.
Request idrequest-<uuid>, minted by the gateway when it authorizes the call and returned as the x-request-id header. Every row about this request, in every store, carries this id. That is how rows for the same request are matched across stores later.
AttemptOne call to one provider. A request can have several attempts when the gateway fails over from one provider to the next.
Hold and settleBefore calling a provider the gateway reserves the worst-case cost (the hold). When the answer ends it charges the real cost and releases the rest (the settle). A card terminal does the same at a gas pump.
ReceiptA small record of one money movement (settle, release, credit), MemoryDB writes it in the same step as the movement, so a movement never exists without its receipt. The receipt also carries the request and attempt rows that are later copied into Postgres.
CaptureThe saved prompt and response of one request. Kept only while the organization's capture switch is on and never for a request routed under zero data retention (ZDR).
Request pathEverything that happens while the caller waits. Anything on it adds latency to every customer request and can make requests fail.
BackgroundWork done after the caller is gone, by threads on the control plane or the Project worker. If it is slow, Postgres and the dashboards show new requests later than usual, and customer requests are still served.
Outbox, inbox, stream, drainWays of handing work from one step to the next without losing it. Explained in Inboxes and outboxes.
LagHow far a background step is behind: the age of the oldest item it has not handled yet. The writeback normally lags about a second; on November 9 it lagged up to 5.8 minutes.
BackpressureWhen a downstream step is slow and an upstream step has to wait, buffer, or refuse. The capture buffer filling up and refusing requests on November 9 was backpressure reaching the caller.
Fail closed, fail openWhat a component does when a dependency is unavailable. Fail closed: refuse the request (safer for a promise like mandatory retention). Fail open: serve it and skip the extra step (safer for availability). The capture buffer fails closed today.
Lane, rung, providerA provider is a company or server that runs models (OpenAI, Anthropic, our own GPU boxes). A lane (also called a rung) is one route to one model on one provider. A model can have several lanes in order; if the first fails, the gateway tries the next.
WalletThe live record of each organization's money: balance, open holds, spend caps and promotion credit. It lives in MemoryDB.
Double ledgerMoney is kept twice. MemoryDB holds the live balance the gateway checks on every request. Postgres holds the permanent history. Receipts carry each movement from the first to the second.
WritebackThe background job that reads receipts out of MemoryDB and writes them into Postgres, exactly once each.
SlotThe wallet spreads organizations over 64 fixed slots. Each slot has one receipt stream. A busy organization can be moved to its own slot so it cannot slow its neighbors.
Deny setThe list of blocked organizations and keys (quarantine, ban, spend lock, revoked key), kept inside MemoryDB. The hold script checks it, so a block works even when Postgres is down.
Deferred settleA settle that could not reach the wallet in time. The answer is sent to the caller anyway, the hold stays in place, and the settle is retried in the background.
SpoolA durable copy of a deferred settle, written to Postgres while the wallet is unreachable, so the charge survives even if the worker that held it dies. A replay job lands it later, exactly once.
BYOK"Bring your own key": a request served with the customer's own provider key. We charge nothing for the model, but the request still passes through the wallet with a zero-cost hold.
Nano-USDThe money unit in the ledger: one billionth of a dollar. Money tests compare totals to the nano-dollar.
Protected chainA model route whose admission writes a receipt in Postgres before it is served (a "chain authority receipt"). On 2026-11-18, 52% of production requests ran on protected chains.

Observability data words

These describe what is stored about a request and how customers read it back.

WordMeaning here
Capture switchThe organization's setting for storing prompt and response content. Metadata (model, tokens, cost, status, latency) is always recorded; content only while the switch is on.
ZDRZero data retention. A request routed under ZDR is never captured.
SegmentIn the new design, captures are not uploaded one by one. Each pod appends them to a file on its own disk (a segment) and uploads the file to S3 every second or two, or when it reaches 16 MiB.
ETLExtract, transform, load. Here: the capture loader on AWS Fargate. It reads each segment from S3, checks the organization's live erasure state, writes each request's body as its own encrypted object, and writes rows into ClickHouse.
Raw queue, control queueTwo SQS queues that announce new segments to the ETL. The raw queue carries gateway captures; the control queue carries customers' trace uploads (span ingest). They were split on 2026-11-21 so one cannot delay the other.
ClickHouse tablesusage_events and spend_facts (one row per request, for totals and charts; on main today); and in the new design: the requests table (the Requests list), spans (every step of every trace), session and trace summaries, and request_text (searchable text, up to 32 KB per request).
RollupA table of pre-computed totals (per hour, day or quarter hour), so a chart sums a few rows instead of millions.
SessionAll the requests of one conversation or agent run, grouped by a session id the caller sends (or that we read from Claude Code, Codex and similar headers).
Trace and spanA trace is one run of an agent, shaped as a tree. Each node is a span: an LLM call, a tool call, a retrieval, a step. Spans come from two places: the customer's own code (over OTLP or Langfuse ingest) and the LLM calls our gateway serves.
Tool spanA span for a tool the agent ran. We can infer it from traffic: a model answer that asks for a tool, followed by a request carrying the tool's result.
Tag, judge, scoreA tag is a question a customer defines ("did the agent give up?"). A judge model answers it for each captured request or session. A score is a number attached to a request or trace, by a judge or a person.
Dataset, review queueA dataset is a saved set of requests or traces for testing. A review queue is a list of items for people to score by hand.
Retention, expiry, erasureRetention is how long content is kept. Expiry is the date it is deleted. Erasure deletes every copy of an organization's content when it opts out or asks; one erasure job reaches every store.
Per-key storageA storage setting on each API key ("follow the organization" or "do not store"), plus a per-request header. Both can only store less than the organization's switch, never more.

Reliability and process words

These describe how the system behaves when something fails, how we measure speed, and how changes are made and tested.

WordMeaning here
ReadinessA check Kubernetes runs on each pod. A pod that fails it stops receiving traffic. If every gateway pod fails it at once, the edge has nowhere to send requests and returns 502 to everyone.
BreakerA circuit breaker. After a few failed calls to a store, it "opens": for a short time every call is refused at once instead of waiting for a timeout. Then it tests the store again and "closes" when the store answers.
ProberA background thread that tests a store while its breaker is open, so no customer request has to be the test.
Outage boundHow long the gateway keeps serving from its last good copy of keys, grants and prices during a Postgres outage: one 60-minute bound for every path, OUTAGE_SERVE_STALE_SECONDS in explabs/outage_bound.py.
Maintenance windowA planned period of 1 to 30 minutes, opened by an operator before a Postgres restart, during which Postgres refuses every chain change, so workers may keep serving protected chains from what they last read.
Admission slot, bridge threadEach gateway worker admits at most 64 requests at a time. Inside it, the Rust engine calls back into Python through 4 "bridge" threads; a request needs one to be checked and admitted.
Fair shareA rule that divides limited capacity between organizations, so one busy organization cannot take it all.
p50, p95, p99Percentiles. p50 is the median. p95 means 95 of 100 requests were at least this fast; it describes the slow tail.
Open-loop loadA load test that sends requests at a fixed rate whatever the answers, the way real clients do, so a slow server builds a real queue.
PR, CI, checkA pull request (PR) is a proposed change on GitHub. CI runs automatic checks on it (tests, lints, migration rules); each passing or failing job is a check.
Migration; expand and contractA migration changes the database schema. Because the running code keeps using the database while a new release rolls out, a breaking change ships in two steps: first add the new shape beside the old (expand), later remove the old one (contract).
RoundOne cycle of the 2026-11-22 adversarial testing: measure, compare designs, build the winner, redeploy, measure again.
!1039, #2980Change numbers. "!" numbers are GitLab merge requests (the platform lived on GitLab until it moved back to GitHub on 2026-11-17). "#" numbers are GitHub pull requests.
Part 3

How the system works

This part describes production as built on main on 2026-11-09, when this investigation started. It goes from the short version, to one simple diagram with every box and arrow explained, to the full map, and then follows one request through every store. The new design that PR #2980 builds is told in Part 5; where it changed something described here, a dated note says so.

The short version

Each store does one job. While the gateway serves a request, it waits on only one store, MemoryDB. The other stores are filled in the background after the answer is sent, with one exception for captures that the correction below explains.

  • MemoryDB is the only store a production request waits on. Before the provider is called, it checks the rate limits and reserves the request's maximum cost from the organization's balance. After the answer ends, it charges the real cost. It keeps this data in memory for speed and also writes every change to a durable log, so a crash loses nothing.
  • Postgres is the system of record. About a second after each request is charged, background threads copy it into Postgres: the request row, its attempts, the usage event, and the hourly and daily rollups.
  • ClickHouse answers every chart and total. Each usage row is saved in Postgres together with a "send this to ClickHouse" note, in one transaction. A background thread reads the notes and copies the rows to ClickHouse. Because the row and the note are saved together, ClickHouse cannot miss a request that Postgres has.
  • Supabase Storage holds the prompt and response bodies. Postgres keeps only a small pointer row per request. The gateway gives the body to a separate capture thread, so a normal request does not wait for the upload. The exception is that each worker can hold only a limited number of bodies that are not uploaded yet. When Postgres is slow, uploads take longer, that space fills up, and new requests are refused (see the correction below).
  • Cloudflare sits in front of the two public hosts. It handles HTTPS encryption (TLS), runs the web application firewall (WAF) rules, and tells us the caller's real IP address. It stores nothing for us.
  • PostHog only gets product analytics events: page views, sign-ups, and the first gateway request. No request content goes there.

Observability reads three of these stores:

  • the request list and single requests from Postgres, through an index, one page at a time;
  • every number and chart from ClickHouse;
  • bodies from Storage, one request at a time.

Since !1039 merged on November 9, any API key of an organization can make these reads. A customer's agent can use its normal key to read the organization's own request log.

Correction. "The request never waits for the body" is only true while Postgres is fast. Here is why:

  1. Each gateway worker keeps a copy of every capture in a buffer of limited size until the upload is confirmed.
  2. A Supabase Storage upload is confirmed only after Supabase commits two rows in our main Postgres: a storage.objects row for the file and a gateway_capture_inbox row.
  3. When Postgres is slow, those commits are slow, copies stay in the buffer longer, and the buffer fills.
  4. Once it is full, the engine refuses each new request that would be captured with 503 capture_unavailable.

That happened on November 9 at 12:07, 13:05 and 14:17Z (123 requests, 76 orgs). See November 9 refusals.

The simple picture, piece by piece

This is the main diagram to remember. Below it, every box and every arrow gets a row: what it is, how it works, why it is there, and what happens when it fails. The fuller maps further down add our GPU boxes, SQS and Fargate.

flowchart LR
  SDK["Caller
SDKs, agents"] -->|"1"| CF["Cloudflare
TLS, WAF, client IP"] BR["Browser"] -->|"2"| CF CF -->|"3"| EDGE["Public edge
relay + fair share"] CF -->|"4"| WEB["Web app"] EDGE -->|"5"| GW["Gateway worker
Rust engine"] GW -->|"6 dispatch"| PROV["Providers"] GW -->|"7 limit, hold, settle"| MDB[("MemoryDB")] MDB -->|"8 receipt streams"| CP["Control plane threads"] CP -->|"9 writeback, settle drain"| PG[("Postgres")] PG -->|"10 ClickHouse outbox"| CP CP -->|"11 export batches"| CH[("ClickHouse")] GW -->|"12 raw body, capture thread"| ST[("Supabase Storage")] ST -->|"13 inbox row"| PG WEB -.->|"14 reads"| CP CP -.->|"15 list, one request"| PG CP -.->|"16 charts, totals"| CH CP -.->|"17 bodies"| ST WEB -.->|"18 product events"| PH["PostHog"]
Solid arrows are writes, dotted arrows are reads. The numbers match the "Every arrow" table. Arrows 1 to 7 and 12 happen while the caller waits; 8 to 11 and 13 happen in the background.

The two tables below explain the diagram. The first describes every box: what it is, how it works and why it is there. The second follows every numbered arrow: what moves along it, when, and what happens when it fails or slows. Terms are defined in Part 2.

Every box

BoxWhat it isHow it worksWhy it is there
Caller (SDKs, agents)The customer's code calling https://api.experientiallabs.ai/v1.Speaks the OpenAI Chat Completions or Responses API, or Anthropic Messages. Usually streams the answer (server-sent events).It is the product: the gateway is a drop-in replacement for a provider's API, so customers change only a base URL and a key.
BrowserA person using the dashboard at platform.experientiallabs.ai.Loads Next.js pages; the pages call our /api routes.Observability, keys, billing and settings live here.
CloudflareA network in front of our two public hosts.Decrypts HTTPS (TLS), applies firewall (WAF) rules to the sign-in paths only, adds CF-Connecting-IP and a secret header, and forwards to our AWS load balancer. Streams can stay open for about an hour.DDoS and bot protection for sign-in, and a trustworthy client IP for geography and abuse rules. It never challenges /v1, because an SDK cannot solve a browser challenge.
Public edge12 pods of explabs-api that receive /v1 traffic.Passes requests to the gateway workers unchanged. Each pod keeps 300 connections to the workers; one API key may use at most a quarter of them, and a quarter is always kept for keys below that share. A request over its key's share waits up to 1 s, then gets a 429 the caller can retry.With a plain first-come, first-served pool, one caller streaming hundreds of long answers took every connection and blocked everyone (staging test, November 4). Because the edge is a separate, thin layer, a gateway release does not drop the connections callers hold to the edge.
Web app10 pods of the Next.js dashboard.Renders pages on the server and proxies the browser's /api calls to the control plane with the signed-in user's identity.One place for sessions, cookies and page rendering; the control plane stays a plain JSON API.
Gateway worker30 pods running a Python front and the Rust engine.Authenticates the key, mints the request id, and decides whether the request may be captured and whether it needs zero data retention (ZDR). It then picks a lane (a provider route for the model), reserves money in MemoryDB, calls the provider, streams the answer back, charges the real cost, and buffers the capture. Each pod serves at most 64 requests at a time.The only process that talks to providers, so routing, failover, pricing and limits are decided in one place. Rust keeps per-request overhead low.
ProvidersOpenAI, Anthropic, Vertex, Bedrock, OpenRouter and others, plus our own GPU boxes (Experiential Cloud).Receive the request in their own wire format. If one lane fails, the gateway can retry on the next lane for the same model.The model does the work; we route, bill and record.
MemoryDBAWS's durable in-memory database (Valkey).Each money operation is one small Lua script that runs as a single uninterruptible step on the server (shard) that holds that organization's keys. A write is confirmed only after it reaches a log copied across availability zones.In September every money operation locked the organization's row in Postgres, so one busy org's requests formed a queue that slowed everyone. MemoryDB answers in well under a millisecond and orgs never wait on each other. See MemoryDB in depth.
Control plane threadsBackground threads inside the 6 explabs-ctl pods, next to the dashboard API.The ledger writeback, the settle drain, the ClickHouse exporter and the credit feed. Each checks for new work about every second and claims a batch with a time-limited lock (a lease), so two pods never process the same batch.They must keep running while other services are released. The ClickHouse exporter moved here from the Project worker because each Project worker release paused it, and every Spend report stopped updating.
PostgresOur one Supabase database, 1,336 GB.Tables, transactions, foreign keys, triggers. In production, request data arrives a few seconds after the request, copied in by the background threads.The system of record: keys, orgs, money history, request rows, capture pointers. Authorization and billing need its transactions and constraints.
ClickHouseA columnar analytics database.Stores each column separately and compressed, so a sum over one column for one org reads a small fraction of the data. If the same row is inserted twice, ClickHouse later merges the copies into one in the background (ReplacingMergeTree). Queries add FINAL so they see one copy even before that merge.On September 19, Postgres queries that summed a busy customer's usage over a time window hit the 8 s timeout. ClickHouse answers the same question in milliseconds.
Supabase StorageSupabase's file service.Bytes go to S3 that Supabase owns; every file also gets a row in storage.objects inside our Postgres, committed with the upload.Bodies are too big for database rows (inline capture reached 748 GB in two weeks). The drawback is that each upload still commits that row in Postgres (see November 9).
PostHogProduct analytics.The browser and a few server events send named events (page views, sign-up, first gateway request).Product funnels and activation. It never receives request content.

Every arrow

#From, toWhat movesWhenIf it fails or slows
1Caller to CloudflareThe HTTPS request with the xpl_ keyEvery callThe caller sees a connection error; nothing is recorded.
2Browser to CloudflarePage loads and dashboard API callsAs the person browsesThe dashboard is unavailable; serving is unaffected.
3Cloudflare to edgeapi host traffic, plus the client IP and the secret headerEvery callOur servers refuse any request without the secret header (403). A 502 or 504 from us is changed to 503, because Cloudflare would replace a 502 or 504 body with its own page and our JSON error would be lost.
4Cloudflare to webplatform host trafficAs the person browsesAs arrow 2.
5Edge to gateway workerThe same request over a pooled connection, plus a signed note of the caller's country, valid for 60 seconds, so the worker can apply country rules without looking up the IP address againEvery callThe edge retries once on a new connection if a retry cannot run the request twice. Otherwise the caller gets a 429 or 503 it can retry.
6Gateway to providerThe request in the provider's wire format; the answer streams backEvery attemptIf the type of failure allows it, the engine retries on the next lane. The caller still gets exactly one answer.
7Gateway and MemoryDBRate-limit check, money hold, settle; the settle appends a receiptTwice per request (before and after the provider call)The request is refused. MemoryDB is the only store the gateway cannot serve without.
8MemoryDB to control planeReceipts, read from 8 streams in batches of up to 500About every secondReceipts stay in MemoryDB, which is durable, so none are lost. Postgres, the dashboards and capture processing all fall behind, because they all depend on these receipts.
9Control plane to PostgresOne transaction per batch: wallet entries, request and attempt rows, a settle outbox row; then the drain writes the usage event and its triggers fill rollups and the ClickHouse outboxAbout every secondThe batch is retried. Postgres records each receipt id and skips an id it has already applied, so a retried batch never counts a request twice.
10Postgres to control planeClickHouse outbox rows (the usage event and its spend facts)About every secondRows wait in the outbox. Spend reports show data only up to the oldest row not yet delivered, so a report never shows a period with rows missing.
11Control plane to ClickHouseBatches of up to 500 rows into usage_events and spend_facts, counted in ClickHouse before the outbox rows are deletedAbout every secondRetried, with a longer wait after each failure. If a retry sends a row that already arrived, ClickHouse keeps only one copy (ReplacingMergeTree).
12Gateway to StorageOne compressed file per record. Each request has two records: a prompt checkpoint and a complete recordAfter the request, from the capture bufferThe capture stays in the worker's buffer and is retried. If the buffer fills, new captured requests are refused with 503 (November 9).
13Storage to PostgresThe storage.objects row and a gateway_capture_inbox row, in the same commit as the uploadEvery capture uploadThe upload waits for this commit, so a slow or failed commit makes the upload slow or fail. That is why arrow 12 backs up.
14Web to control planeDashboard reads with the user's identity; agents call the same routes directly with a keyOn page load and every 10 s on RequestsThe page shows an error tile; serving is unaffected.
15Control plane to PostgresRequest list pages (index seek, up to 200 rows), one request, attemptsPer readA slow database slows the list. A sort that would have to read too many rows is refused with 422 instead of being run.
16Control plane to ClickHouseAggregate queries for one org and windowPer chartBusy: 429 with Retry-After. ClickHouse down: 503, with no Postgres fallback by design.
17Control plane to StorageOne pointer row, then one compressed objectWhen someone opens a requestThe drawer says the body is unavailable.
18Web to PostHogNamed product eventsAs the person browsesDropped silently; nothing depends on it.

System map

Solid arrows carry writes; dotted arrows carry reads or the capture side path. In production, the gateway worker does not write to ClickHouse or Postgres tables while it serves a request. There is one indirect exception, described in the warning about storage.objects below the map.

flowchart LR
  SDK["SDKs, coding agents
/v1 calls"] --> CF BR["Browser
dashboard"] --> CF PRB["Status probe Lambda
every 5 min"] --> CF CF["Cloudflare
TLS, WAF, client IP,
origin secret header"] --> LB["AWS load balancer
and ingress-nginx"] subgraph EKS["EKS cluster, deployed by Porter"] EDGE["Public edge, 12 pods
relay and fair share"] GW["Gateway worker, 30 pods
Python front and Rust engine
capture buffer: memory then disk"] WEB["Web app, 10 pods"] CP["Control plane, 6 pods
dashboard and admin API"] end LB --> EDGE --> GW LB --> WEB --> CP GW <-->|"limit, hold, settle"| MDB[("MemoryDB")] GW -->|"dispatch"| PROV["Third-party providers
OpenAI, Anthropic, Vertex,
Bedrock, OpenRouter"] GW -->|"dispatch"| VM["GCP VM gateway.xplabs.ai
Caddy, one path per lane"] BOX["Our GPU boxes
Azure, GCP, Lium, Arrakis"] -->|"reverse SSH tunnel"| VM GW -.->|"raw capture upload,
commits in Postgres"| ST[("Supabase Storage")] CP -.->|"lists, one request"| PG[("Postgres")] CP -.->|"charts, totals"| CH[("ClickHouse")] CP -.->|"bodies"| ST
The request path. Everything a customer waits on: Cloudflare, the edge, a gateway worker, MemoryDB and a provider. Our own GPU boxes are reached through the GCP VM, not through Cloudflare. The dotted capture upload is the one place a customer request can still end up waiting on Postgres.
flowchart TB
  MDB[("MemoryDB
8 receipt streams")] -->|"receipts"| WB["Control plane:
ledger writeback"] WB -->|"wallet entries, request
and attempt rows"| PG[("Postgres 1.3 TB")] PG -->|"purchases, grants"| CFD["Control plane:
credit feed"] --> MDB PG -->|"settle_outbox"| SD["Control plane:
settle drain"] -->|"usage events, rollups"| PG PG -->|"ClickHouse outbox"| EX["Control plane:
ClickHouse export"] --> CH[("ClickHouse")] GW["Gateway worker"] -.->|"raw capture"| ST[("Supabase Storage bytes")] ST -.->|"same transaction"| SOBJ[["storage.objects 167 GB
and capture inbox row"]] SOBJ -.-> PGI["in Postgres"] PGI -.-> PW["Project worker, 64 pods
capture processor"] PW -.->|"wait for request row,
write pointer"| PG PW -.->|"store document,
delete raw"| ST CPF["Fargate capture processor
built, switched off"] -.- PGI ICR["Fargate illegal-content review"] <-->|"enqueue, consume"| SQS[["SQS queue
and dead-letter queue"]] ICR -.->|"find captured traffic"| PG ICR -->|"score with clef"| VM["GCP VM to GPU boxes"] S3O[("Our S3: RL and abuse artifacts,
empty capture archive")]
Everything that happens after the caller is gone: money receipts flowing into Postgres, credits flowing back into MemoryDB, usage into ClickHouse, and the capture pipeline with its Postgres commits.

The hidden Postgres write. "Supabase Storage" looks like S3, but it uses our database. Each upload, delete and metadata read touches the storage.objects table, in the same Postgres that holds the ledger. Since !1024 (November 5) the same transaction also inserts the gateway_capture_inbox row. So the capture path still waits on a Postgres commit. Our code does not issue that commit; Supabase Storage issues it inside the upload.

Write path: one request, start to finish

This section follows one POST /v1/chat/completions through production, store by store. It shows which steps the caller waits for and which happen later. In the diagram, everything above the note runs while the caller waits. Everything below it happens on background threads, normally within a few seconds.

sequenceDiagram
  autonumber
  participant C as Client
  participant CF as Cloudflare
  participant E as Public edge
  participant G as Gateway worker
  participant M as MemoryDB
  participant P as Provider
  participant S as Storage
  participant CP as Control plane
  participant PG as Postgres
  participant PW as Project worker
  participant CH as ClickHouse
  C->>CF: POST /v1/chat/completions
  CF->>E: forward with edge secret and CF-Connecting-IP
  E->>G: relay through a fair-share slot
  G->>G: authorize, mint request id, freeze consent and ZDR verdict
  G->>M: rate limit check, wallet hold
  G->>P: dispatch, fail over on error
  P-->>G: stream tokens
  G-->>C: stream, usage.cost, x-request-id
  G->>M: settle, append receipt to stream
  G-)S: raw capture object on the capture thread
  Note over C,G: The caller is done here
  CP->>M: drain receipt streams, about every second
  CP->>PG: gateway_requests, gateway_attempts, wallet_entries
  PG->>PG: settle_outbox row
  CP->>PG: drain outbox into gateway_usage_events
  PG->>PG: triggers fill hourly and daily rollups and the ClickHouse outbox
  CP->>CH: export batch, count back, then acknowledge
  S->>PG: storage trigger writes a capture inbox row
  PW->>S: finished document, then gateway_captures pointer in Postgres
The request path writes only to MemoryDB and hands the body to a capture thread. Postgres, ClickHouse and the final capture document are all filled afterwards by background workers.

The steps in words

  1. Cloudflare. Cloudflare decrypts HTTPS (TLS) for the two public hosts. It adds the caller's IP and a secret header that proves the request came through our zone. No browser challenge ever runs on /v1, because SDKs cannot answer one. Our servers reject any request without the secret.
  2. Public edge. A thin relay that passes the request on without reading or changing it. It gives each API key a fair share of its 300 connections to the gateway workers, so one heavy caller cannot take every connection and make everyone else wait.
  3. Gateway worker. The Rust engine authenticates the key and mints the request id (request-<uuid>, returned as x-request-id). It also decides, once, whether this request may be captured and whether it must use zero data retention; later steps reuse that decision. It then dispatches to a provider and fails over between providers when needed.
  4. MemoryDB. MemoryDB first checks every rate limit in one step. It then reserves the request's maximum cost from the wallet (the hold), and when the response ends it charges the real cost (the settle). MemoryDB confirms a write only after it reaches its log in several availability zones, so the hold survives a crash without any call to Postgres. The settle appends a receipt, carrying the request and attempt rows, to one of eight streams.
  5. Capture. The response bytes go to a capture thread, never to the loop that serves requests. That thread uploads one compressed raw object to Storage. A storage trigger then writes a small inbox row in Postgres. Correction: the capture stays in the worker's bounded buffer until that upload commits. The commit is a Postgres transaction (storage.objects plus the inbox row). If the buffer is full when a new request starts, the engine refuses the request. See Captures and S3.
  6. Writeback (control plane). It reads the receipt streams in batches of 500 and writes gateway_requests, gateway_attempts and wallet_entries in one transaction. Each receipt is applied exactly once, and it is removed from MemoryDB only after the Postgres transaction commits. It is normally a few seconds behind. When Postgres was slow it fell further behind: it averaged up to 2.5 minutes behind in some hours on November 5, and fell up to 5.8 minutes behind on November 9.
  7. Settle outbox. The writeback leaves a settle_outbox row. A separate drain turns it into the gateway_usage_events row. That row's triggers fill the hourly and daily rollups, the budget counters, and the ClickHouse outbox.
  8. ClickHouse export (control plane). Takes batches of up to 500 from the outbox and inserts them into usage_events and spend_facts. It counts the rows back and only then deletes the outbox rows.
  9. Capture writer (Project worker). Turns the raw object into the final document, explabs-gateway-captures/<org>/<hash>.json.zst, and writes the gateway_captures pointer. It needs the request row first, because that row holds the consent facts. The row is written later by the writeback (money is settled in MemoryDB first), so the body can arrive before the row exists. Updated: since !1024, an item whose request row is missing stays in the inbox as metadata_pending. It is retried forever, waiting 10 s at first and doubling up to 300 s. The old five-minute discard is gone, and there is no dead-letter shelf. Live: 298 such rows have been pending since November 6.

MemoryDB and the double ledger, in depth

This section explains the store that every request waits on, and why money is kept in two places.

What problem it solves. Every request has to answer two money questions while the caller waits:

  • before calling the provider: "may this org spend up to X right now?"
  • after the answer: "what did it actually cost?"

Before the double ledger, both answers were Postgres transactions that locked the organization's single row (organizations ... FOR NO KEY UPDATE). Postgres lets only one transaction at a time change a row, so one busy org's requests queued behind each other. The waiting held database connections and worker threads, and every other customer queued behind them.

This is what happened in the Koodos incidents: 40 to 57 transactions waited on one row, and admission took 20 to 145 seconds for every customer.

What MemoryDB is. A Redis-compatible database that keeps data in memory, so a read or write takes well under a millisecond, but writes every change to a multi-zone log before saying "done", so a crash or failover loses nothing that was acknowledged. Unlike Redis used as a cache, it is configured never to delete data to free memory (noeviction).

Why it removes the queue. Each money operation (reserve, settle, release, credit) is a small Lua script that runs atomically inside MemoryDB.

  • All of an org's keys share one hash tag (the part of the key name in braces), so they are stored on the same shard. That lets one script update the balance, the hold and the receipt in one step.
  • A script runs in microseconds, so even a busy org's operations finish before the next one arrives.
  • Different orgs never wait on each other.
  • Nothing holds a database connection or a worker thread while waiting.

Why "double". There are two copies of the money. MemoryDB holds the live balance that the gateway checks on every request. Postgres holds the permanent record used for history, invoices, the dashboard and audits. Every movement in MemoryDB appends a receipt, and background workers copy receipts into Postgres exactly once. Money flowing the other way (a purchase, an admin grant, a promotion) is written to Postgres first and pushed into MemoryDB by the credit feed.

MemoryDB key (per org, n = crc32(org) mod 8)Holds
{fl:bl:receipts:n}:<org>:acctbalance, amount currently held, seed version
{fl:bl:receipts:n}:<org>:hold:<attempt>one open hold: amount, caps it counts against, state, time
{fl:bl:receipts:n}:<org>:cap:<scope>spend-cap window counters (spent, held), expiring with the window
{fl:bl:receipts:n}:<org>:promo:<promo>:<period>promotion credit: granted, spent, held, written off, expiry
{fl:bl:receipts:n}:streamthe receipt stream for every org on shard n (8 streams total)
{fl:lim:...}rate-limiter counters (requests and tokens per window)
sequenceDiagram
  autonumber
  participant G as Gateway worker
  participant M as MemoryDB
  participant W as Writeback, control plane
  participant PG as Postgres
  participant F as Credit feed
  participant R as Reconciler
  Note over G,M: First request of an org since a restart
  G->>M: reserve
  M-->>G: UNSEEDED
  G->>PG: read balance, grants, promos once
  G->>M: seed the org
  Note over G,M: Every request
  G->>M: reserve worst-case cost against balance, caps, promos
  M-->>G: OK, or INSUFFICIENT_FUNDS, CAP_EXCEEDED, PROMO_EXHAUSTED
  G->>G: call provider, stream answer
  G->>M: settle actual cost, release the rest, append receipt
  Note over W,PG: Seconds later, off the request path
  W->>M: read up to 500 receipts per stream
  W->>PG: one transaction: wallet_entries, gateway_requests, gateway_attempts, settle_outbox
  W->>M: acknowledge and delete those receipts
  Note over F,M: Money coming in
  PG->>F: purchase, admin grant, promotion
  F->>M: credit the org
  R->>M: compare balances
  R->>PG: record mismatches in wallet_differences
The gateway only ever waits on MemoryDB. Postgres learns about each request from the receipt, a few seconds later. A hold sweeper (not drawn) closes any hold still open after the late-cost window, for example when a worker crashed mid-request.

What this means for everything downstream

  • Money is right in real time even when Postgres is slow. Balances and holds never wait for the writeback.
  • Everything that reads Postgres sees each request only after the writeback copies it in: the request list, usage events, rollups, ClickHouse (fed from Postgres), and the capture processor, which needs the request row before it may store a capture.
  • The writeback is now the only path by which request data enters Postgres. When Postgres write throughput drops (an autovacuum on a 100+ GB table, a heavy migration), receipts pile up in the MemoryDB streams. Nothing is lost, because MemoryDB is durable and receipts are deleted only after commit, but every downstream consumer falls behind together.
  • Still on Postgres by design: batches, customer-plan (reseller) keys, and video jobs still reserve money in Postgres, because their money rules have not been moved to MemoryDB.
  • Pending: the "fast-ledger parity" fixes (auto top-up, credit floor, free refills, rollover, payment quarantine, signup scan, anti-abuse, grants reconciliation) are merged at 64d1d708e and verified on staging, but production runs 72edcb540 until Kion approves the deploy. See Changes and status.

Inboxes and outboxes

Data moves between our stores through a few standard handoff patterns. This section explains them, then lists every handoff we run, because the weak ones are where the November incidents started.

The problem they solve. Many steps here have to do two things: change a database and tell another system about it. For example, record a usage event and also send it to ClickHouse. If the code does the two separately, a crash between them leaves the systems disagreeing forever. This is called the dual-write problem. You cannot fix it by doing the second write first either, because then the first can fail.

Outbox. Write the message into a table (the outbox) in the same transaction as the change. Either both commit or neither does.

A separate process (the relay, or drain) reads the outbox, delivers each message, and deletes it only after the destination confirms. If the relay crashes after delivering but before deleting, it delivers again. So delivery is at least once. The receiver must therefore be idempotent: receiving the same message twice must have the same effect as receiving it once.

Inbox. The receiving side of the same idea. The receiver records each message's id as it processes it (or writes the message into an inbox table first and processes from there). A duplicate is recognized and skipped. When the sender may deliver a message more than once and the receiver skips duplicates, each message takes effect exactly once. That is the strongest guarantee that is practical between two systems.

Stream. An append-only log (here, a Valkey stream in MemoryDB). Producers add entries to the end. A group of consumers reads them, and each entry stays in the log until a consumer confirms it has handled it. It works like an outbox that lives in MemoryDB instead of Postgres.

Dead-letter shelf. Where a message goes after it has failed a set number of times, so one broken message stops being retried forever and a person can look at it. SQS has this built in. Our Postgres outboxes and the capture inbox do not.

sequenceDiagram
  participant A as Producer step
  participant DB as Its database
  participant R as Relay
  participant B as Receiver
  A->>DB: one transaction with the change and the outbox row
  Note over A,DB: both commit or neither does
  R->>DB: claim a batch of outbox rows with a lease
  R->>B: deliver the batch
  B->>B: skip ids already applied, apply the rest
  B-->>R: confirmed
  R->>DB: delete the delivered rows
  Note over R,B: a crash before the delete means the batch is delivered again, and the receiver skips it
The outbox pattern. The change and its message are saved together, so one cannot exist without the other. A retry is harmless because the receiver skips messages it has already applied.

Every handoff we run

HandoffKindWritten in the same step asDrained by, how oftenDuplicate protectionWhen the drain stopsDead-letter shelf
Receipt streams {fl:bl:receipts:0..7}Stream (outbox in MemoryDB)The money movement, in one Lua scriptLedger writeback, control plane, about 1 s, 500 per batchA unique key on (kind, receipt id) in Postgres, so a repeated receipt is skippedReceipts wait safely; Postgres and everything after it lagRejected receipts go to balance_ledger_receipt_rejects
settle_outboxOutboxThe request and attempt rowsSettle drain, control plane, about 1 s, SKIP LOCKEDUsage event is unique per request idUsage events and rollups fall behind. If the drain stops reporting that it is alive (its heartbeat), settles write the usage event directly insteadNone
gateway_usage_clickhouse_outboxOutboxThe usage event (a trigger)ClickHouse exporter, control plane, about 1 s, 500 per batch, 690 s leaseClickHouse keeps one copy of a repeated row (ReplacingMergeTree), and queries use FINAL to see one copy. Rows are counted in ClickHouse before the outbox rows are deletedCharts lag; Spend reports stop at the oldest undelivered rowNone. A row stays until it is delivered, so one row that cannot be delivered holds Spend's data cutoff at that row's time
Credit feedOutbox (Postgres to MemoryDB)A purchase, admin grant or promotionCredit feed thread, control planeMemoryDB applies each event id (wallet_entries:<id>) once; after each pass the feed records how far it has read (a cursor)New money does not reach live balances; a reconciler reports driftNone
gateway_capture_inboxInbox, filled by StorageThe storage.objects row of the uploadCapture processor, 64 Project worker podsThe object path is the primary key, so one file cannot be queued twiceCaptures wait as metadata_pending until the request row arrivesNone: 298 rows stuck since November 6
Illegal-content review queueSQS queue(a sweep finds new captured traffic)ECS Fargate serviceSQS redelivers until deletedMessages wait in SQSYes, an SQS dead-letter queue

What this table shows. The money and usage handoffs follow the standard pattern closely. The message is saved in the same step as the change, a lease stops two pods from handling the same batch, and receivers skip duplicates.

The two weak spots are the ones the November 9 incident hit:

  • The capture inbox row is created by a Postgres commit that the gateway waits for before it frees buffer space. So a slow Postgres slows the gateway.
  • None of the Postgres handoffs has a dead-letter shelf. So a single bad item can wait forever or hold others back.

Captures and what goes into S3

This section explains how prompts and responses are saved today, where the bytes end up, and how that differs from where we want to be.

A capture is the saved prompt and response of one request. It is kept only for organizations whose capture switch is on, and never for a request routed under zero data retention. Captures feed the request drawer, content review, retention contracts and training data.

Why the worker buffers in memory, then on disk

  • The complete record does not exist until the stream ends. A streamed answer arrives over seconds or minutes. The worker writes two records per request: a prompt checkpoint at the start (so a crashed or very long request still leaves its prompt) and a complete record (prompt plus response) at the end.
  • The copy must survive until the upload is confirmed. If an upload fails, the worker retries from its copy. Throwing the copy away early would lose the capture.
  • Captures go to memory first because it is fast, and to disk when memory is full. Each worker allows 256 MiB of capture memory, then spills to local disk up to 4 GiB. Coding agents send prompts of several MB, and a caller body may be up to 128 MiB.
  • Admission is bounded. A worker holds at most 2,048 captures (and a byte budget) at once. When a new request arrives and the buffer is full, the engine refuses the request with 503 capture_unavailable instead of serving it uncaptured (native_capture.py, collector.rs::begin). It refuses (fails closed) because some orgs are under mandatory retention, and serving them without keeping a copy would break that promise.
  • Memory risk. Bodies are read into memory before they spill, and a pod's limit is 4 GB, so a burst of very large captured requests can push a pod over its limit and Kubernetes kills it, dropping every request on that pod. Helicone avoids this with a separate spillover container that holds bodies outside the serving process.

How a capture flows today

  1. The gateway worker buffers the capture (memory, then disk).
  2. It uploads the raw compressed record (<digest>.prompt.zst or .complete.zst) to the Supabase Storage bucket explabs-gateway-captures. Supabase stores the bytes on its S3 and, in the same Postgres transaction, writes the storage.objects row and the gateway_capture_inbox row.
  3. Only when that commit returns does the worker free the buffer slot.
  4. A processor claims inbox rows. Live: the 64 Project worker pods (the Fargate runtime exists but the switch is set to worker).
  5. It reads the first 256 KiB of the object, then checks that the request's gateway_requests row exists (that row carries the consent, zero data retention and erasure facts). If not, the item waits as metadata_pending.
  6. It downloads the whole object, writes the final document <org>/<hash>.json.zst and the gateway_captures pointer, and deletes the raw object.
  7. Separately, the illegal-content review service (ECS on Fargate) finds newly captured traffic to uncensored models, puts it on its SQS queue, scores prompt windows with clef on our GPU boxes, and suspends abusive organizations. A message that keeps failing lands in its dead-letter queue.
WhatWhere the bytes liveWritten byPostgres rows it createsRead by
Raw capture records (prompt checkpoint, complete record)Supabase Storage explabs-gateway-capturesGateway workerstorage.objects + gateway_capture_inbox, per objectCapture processor, then deleted
Final capture documentsSupabase Storage explabs-gateway-captures/<org>/...Capture processorstorage.objects + gateway_captures pointer (59 GB)Request drawer, review, exports
Customer-uploaded external tracesSupabase Storage explabs-artifactsCustomer, through a signed upload URLstorage.objects + projection jobProject worker, into ClickHouse trace_spans
Usage exports, trace inventory ParquetSupabase StorageExport jobsstorage.objectsCustomers, admins
RL artifacts, criminal-abuse artifactsOur AWS S3RL and abuse jobsnoneThose jobs
Capture archive (free-org traces older than 14 days)Our AWS S3 explabs-capture-archive-…Nothing yetnoneEmpty (live)
Trace pipeline raw and processed buckets, SQS queue, KMS keyPlanned in our AWS S3Terraform code merged (!492)noneNot created: no such buckets or queue exist in the AWS account (checked live)

The ideal split, and how today differs

The intended shape has three parts:

  • ClickHouse holds one small row per request (metadata, cost, latency, session ids, and a short truncated preview for search).
  • S3 holds the full prompt and response.
  • The frontend lists and searches from ClickHouse. When someone opens a request, the control plane checks authorization and fetches that one body from S3.

This design is sound, and it is where we are heading. The table shows how today differs, question by question.

QuestionTodayTarget
Where is the per-request summary?Postgres gateway_requests (list) and ClickHouse usage_events (totals)ClickHouse for list, search and totals; Postgres keeps only what money and authorization need
Where are bodies?Supabase Storage, with a storage.objects row and a gateway_captures pointer row in Postgres per fileOur own S3, addressed by a deterministic key (org, request); no per-file Postgres row needed to find it
How does a body get stored?Upload commits in Postgres; processor waits for the request rowS3 PUT, S3 notifies SQS, an autoscaled Fargate consumer loads summaries into ClickHouse and Postgres; consent facts travel inside the object
Is body text searchable?NoA truncated text column with an n-gram or token index in ClickHouse, deleted with the body on erasure (Helicone keeps bodies up to 10 MB inline in ClickHouse instead)

Capture paths: what is kept on each surface

A request can reach us through many API surfaces (chat, Responses, batches, images, audio and more). This section lists what is stored for each one, and what it would take to close the gaps.

The rule on every path.

  • Content is stored while the organization's prompt storage switch is on, whatever key or plan serves the request: platform credits, the customer's own provider key, or a connected Claude or ChatGPT plan.
  • It is never stored for a request routed under zero data retention, and never stored with the switch off. Uncensored models are the exception. Their requests are always stored, and a request to them that asks for zero data retention is refused.
  • Metadata (model, tokens, cost, status, latency, key, end-user label) is recorded on every path whatever the switch says.

The list of capture paths (the catalog) lives in the repo as docs/capture-paths.md. It is on branch capture-batch-and-websocket (commit 0ed5eaaa1) together with the batch-line capture, and not yet on main.

PathPromptResponseWhy, or what blocks itWhat closing it takesEffort
Chat Completions (HTTP)keptkeptUses the full pipeline. Consent is decided once at authorization, the engine copies the response as it streams (the response tap), and the capture writer stores it.Nothing.
Responses (HTTP)keptkeptSame pipeline.Nothing.
Responses over WebSocket (Codex)keptkeptEach turn runs through the Responses handler and its tap (engine 0.7.233). The raw request and its headers are not copied, because a WebSocket turn does not pass through the HTTP relay that makes that copy.Optional: record the frame and headers too.S
Anthropic Messages (Claude Code)keptkeptSame pipeline.Nothing.
Batch linesafter !1088after !1088On the branch, each line's consent is frozen when its money is reserved. At settlement the prompt and the output line go through the same sink as a live request, and an errored line keeps the provider's error as its response. If the capture queue is full, the capture is dropped and logged, so a full queue never blocks settlement.Merge !1088.S
Request refused after it was acceptedkeptnone, there was no answerThe ledger re-reads consent and zero data retention, then keeps the prompt.Optional: store our refusal message as the response.S
Request rejected before it was accepted (bad request, rate limit)not keptnot keptOnly a content-free row in gateway_request_rejections (30 days, admin only). Many of these refusals happen before we know whose key it is or whether the body asked for zero data retention. An unknown key would store a stranger's content, and attackers can send rejected requests at almost no cost.Probably leave as is. The one safe subset: authenticated 400s from an org whose switch is on, where the body parses and does not ask for zero data retention. Store a truncated, credential-redacted body for 30 days.M
Embeddingsnot keptnot keptThe engine records only chat, Responses and Messages (CaptureRequest.protocol), and the platform records a consent decision only for those three. Output can be very large: up to 2,048 inputs times about 3,072 numbers.An embeddings capture record (the input text, dimensions, format). Store the response as metadata only (count, dimensions, usage), with vectors only behind a setting.M
Images (generation and edits)not keptnot keptSame three-surface filter as embeddings. Each image comes back as base64 (about 1 to 3 MB each, times n), and edit uploads can be up to 20 MB per part. Kept inline, they break the capture record's 8 MiB limit.Store each image as its own object in the capture bucket. The record carries a reference (hash, type, size, key). The drawer shows thumbnails through short-lived signed links.L
Speech (text to speech)not keptnot keptThe prompt is at most 4,096 characters, but the response is raw audio (up to 64 MiB), which the response tap cannot read.A binary response kind in the Rust tap, stored as an object reference; an audio player in the drawer.M
Transcription (speech to text)not keptnot keptThe prompt is the audio upload (up to 25 MB), and the bytes never reach Python, only their size and hash. The response is a small JSON transcript. Voice can identify a person, so it is sensitive.Capture the upload inside the Rust data plane to the spill directory, then store it as an object reference beside the transcript.M to L
Videonot keptnot keptAn asynchronous job: create, poll, download. The job record holds no prompt. Providers keep the video only briefly (Veo: 2 days). Consent has to survive the job's life of about two hours.Capture the prompt and reference image at create, the same way as Images. At the end, store the job's final JSON (small), or copy the MP4 (tens to hundreds of MB, a storage cost).L
Decisions (/v1/systemone, /v1/decisions; the Clef judge)not keptnot keptThe shapes are small JSON, so capturing them is technically easy. The risk is who calls it. Our own illegal-content review sends excerpts of other tenants' prompts to Clef, and the signup scan sends personal data (email, IP, name), both through an Experiential Labs org key. Capturing those would copy tenant content and personal data into our own org's store, outside the tenants' deletion rules. The docs state "decision requests are never captured". Volume is high: about 30k calls an hour by your figure, with Clef capped near 30 requests a second.A decisions capture record (state or input as the prompt, the questions in the envelope, the answers as the response), plus a no-capture rule for our internal callers (per key, or the switch off on the Experiential Labs org).S to M

Why the gaps exist

No document records a decision to leave media out. The gaps come from how the code is built. The capture record is shaped like a conversation (a list of messages and a JSON or streamed response), and four places each accept only the three conversation surfaces (chat, Responses, Messages):

  • the engine's capture start (native_capture.py);
  • its record type (capture/record.rs);
  • the platform's consent step (control_store.py, which passes over the other surfaces);
  • the platform's capture writer (capture_writer.py).

As a side effect, media requests have no stored zero-data-retention verdict. The settle step treats a missing verdict as "do not keep", so the gap errs toward keeping nothing, which is the safe direction.

Closing them, in order

  1. Merge !1088 (batch lines). Already built.
  2. A media reference part in the capture document. One shared design for bytes: each image, audio clip or video is its own object in the capture bucket, under the same key prefix as its document. The record holds the reference, and deleting the capture deletes the media with it.
  3. Consent for every surface. Decide consent once at authorization and write the consent record (gateway_capture_authority, the row that says "this request may be captured") for embeddings, images, audio, video and decisions, so the zero-data-retention verdict is always definite.
  4. Small text surfaces first: decisions (with the internal-caller rule), embeddings (metadata only) and speech prompts.
  5. Byte surfaces next: images, then transcription, then video. Each needs a drawer view (thumbnail, audio player, transcript, video job card).
  6. Fix the drawer's wording for surfaces that are never captured. Today it says "Nothing was kept … only while prompt capture is on", which suggests turning on capture would help.

Stored outside Observability's request log

  • Responses API conversation state, for 30 days (only while capture is on).
  • Batch input and output files, until shortly after the batch expires.
  • exp capture traffic from local machines, shown only as admin run statistics.
  • Traces customers upload or pull in through connectors (OTLP, Langfuse, Braintrust), in ClickHouse trace_spans.
  • Capture broadcast copies sent to the organization's own destinations.
  • Guardrail decisions, kept only as content-free counts.

Read path: what Observability calls

This section shows the other direction: what the dashboard and agents read when they open Observability, and which store answers each read. In short, lists and single requests come from Postgres, numbers come from ClickHouse, and bodies come from Storage.

flowchart LR
  subgraph Readers
    AN["Analytics tab"]
    RQ["Requests tab
refreshes every 10 s"] DR["Request drawer"] AG["Agent with an org key
new in !1039"] end API["Control plane
gateway_usage.py, spend.py"] AN --> API RQ --> API DR --> API AG --> API API -->|"fence: sandbox and erasure state"| PG[("Postgres")] API -->|"list: index page of up to 200
one request, attempts"| PG API -->|"totals, latency, breakdowns
8 reads per pod, 2 per caller, else 429"| CH[("ClickHouse")] API -->|"Spend analytics
snapshot fenced at the export cutoff"| CH API -->|"one body: pointer, then object"| ST[("Storage")]
Lists and single requests come from Postgres indexes; every aggregate comes from ClickHouse; bodies come from Storage one request at a time.
What you seeRouteStoreHow it stays fast
Request listGET /usage/requestsPostgresIndex on (org, created_at, request_id); cursor paging with a frozen window; 200 rows maximum per page; a sort that would need to read too many rows returns 422 instead of running
One request, attempts/usage/requests/{id}, /attemptsPostgresPrimary-key reads; attempts capped at 256
Prompt and response/prompt, or ?include_body=trueStorageOne pointer row, then one compressed object
Charts, totals, latency, by provider, label and key/usage/timeseries, /latency, /by-*ClickHouseColumnar scan of one organization's rows; per-query time, byte and memory limits; 8 concurrent reads per pod, 2 per caller
Spend analytics (Pro admins)/spend/*ClickHouseEach report reads data as of one fixed point in time (a snapshot); reads share a 12 s budget; a ready report is reused for 30 minutes
System prompt rollup/usage/by-promptPostgresThe only remaining read that sums the Postgres ledger. Results are cached in each process, and API keys cannot call it

Store by store

This table sums up each store in one row: what it holds, who writes it, whether a request waits on it, and how long data is kept. The second table shows where the database's size sits.

StoreWhat it holdsWho writes itOn the request path?Retention
Cloudflare Nothing stored. TLS, WAF, client IP header, origin secret header Zone config Yes, as a proxy None
MemoryDB Rate-limit counters {fl:lim:…}, wallet balances and holds {fl:bl:…}, receipt streams {fl:bl:receipts:0..7} Gateway worker; a credit feed from Postgres Yes, the only store it waits on Receipts until applied; 7 days of snapshots
Postgres gateway_requests, gateway_attempts, gateway_usage_events, hourly and daily rollups, settle_outbox, ClickHouse outbox, capture pointers and inbox, rejections Control plane writeback and drains; triggers No in production (yes on previews and for batches, video and plan keys) Indefinite (about 26M attempts, 38M usage events as of October)
ClickHouse explabs.usage_events, explabs.spend_facts, explabs.trace_spans, fleet tables Control plane export thread; Project worker for uploaded traces No No TTL declared
Supabase Storage Capture documents (explabs-gateway-captures), uploaded traces (explabs-artifacts), usage exports (usage-exports), trace inventory Parquet Gateway capture thread, Project worker, export jobs No, the body is handed to a separate thread Prompt and response pairs kept; unpaired prompts expire; per-contract 1 to 90 days
PostHog Product analytics events only Web app; one gateway event per org (first request) No, best effort PostHog's

Correction: the trace pipeline's AWS resources (explabs-traces-* buckets, an SQS queue and a KMS key, infra/traces) are defined in Terraform merged with !492 but were never created: none exist in AWS account 761200393827 (checked live). The code that would have used them (!493 to !525) was closed unmerged. Captures go to Supabase Storage.

Where the database's size is

Live on 2026-11-09: the database is 1,336 GB. Every update or delete leaves a dead row that autovacuum must clean up later. On large, constantly updated tables that cleanup is heavy, and it competes with every commit for disk throughput. The table lists the largest tables. Look at the "Dead rows" column: storage.objects and the chain receipts carry millions, which is what made vacuum heavy on November 9.

TableSizeDead rows waiting for vacuumRetention todayBelongs in
audit_log311 GB40 kNonePartitioned by month in Postgres, or cold storage after a window
gateway_attempts238 GB54 kNonePostgres for recent money facts; history in ClickHouse
gateway_usage_events188 GB227 kNoneClickHouse already has every row; Postgres needs only a window
storage.objects167 GB10.7 MFollows filesShrinks once captures move to our own S3
gateway_requests105 GB358 kNonePostgres for a window; history in ClickHouse
gateway_chain_authority_receipts67 GB5.8 MNoneA retention window (or partitions dropped whole)
gateway_grants62 GB1 kNoneReview it. Public grants are now computed when needed and are no longer stored as rows
gateway_captures59 GB1.0 MPairs kept; unpaired prompts expirePointer index moves to ClickHouse or a deterministic S3 key

Sessions today

Observability has no session view yet. Requests are grouped in two ways, and only the weaker one is visible.

What the log shows: content hashes

At authorize the gateway computes two hashes of the request body. prompt_group covers the system prompt and tool definitions (the same agent configuration). conversation_group adds the first user message, because agents resend it every turn. The request list can filter by conversation_group, and the drawer has a "Show only this conversation" action. The hashes have known weaknesses:

  • Two conversations that start with the same message merge into one group.
  • When an agent compacts (summarizes) a conversation, the first user message changes, so the rest of the conversation lands in a new group.
  • A Responses API continuation sends only its new turn, so the hash covers that turn alone and does not match the earlier requests.

What is written but not read: the session key

Since October 16 every request records:

  • session_key: from our X-Explabs-Session-Id header, the Claude Code or Codex session headers, metadata.user_id, or prompt_cache_key, with the content hash as a fallback;
  • parent_response_id;
  • agent_key for Claude Code subagents.

These columns sit on gateway_requests only. They are not on the usage event and not in ClickHouse, and no index covers them. Only the admin trace inventory reads them.

Other things called "session"

  • A proxy traffic run is one run of the local capture process, from start to stop. It is not a conversation.
  • Uploaded traces land in ClickHouse trace_spans with real parent span ids, but no page shows them yet.

Why it is built this way

Most of these choices followed a specific incident. The date on each card is when the rule was set.

Sep 2026 incidents · balance ledger

Money moves in MemoryDB, not Postgres

Every reservation and settle used to lock the organization's row in Postgres. One busy tenant turned that row into a queue, and every customer waited 90 to 145 seconds before admission (September 12, 14 and 19). MemoryDB takes the hold and the settle; Postgres gets the rows a second later from the receipt streams.

Nov 4 · settle outbox

Usage events are written by a drain, not inside the settle

The usage event's triggers (rollups, budgets, the ClickHouse outbox, erasure) ran inside the settle transaction under the organization lock. Now the settle only writes a settle_outbox row, and a drain that runs every second writes the usage event, so those triggers no longer run under the lock. If the drain stops reporting that it is alive, settles go back to writing the usage event themselves.

Sep 19 · no ledger scans

Charts read ClickHouse, never the ledger

Six tenant usage reads summed gateway_usage_events over the window and hit the 8 second timeout for a tenant at 180,000 requests a day. Since then every chart and total reads ClickHouse, with no Postgres fallback, and a CI lint fails any new read that scans the ledger.

Sep 2026 · outbox to ClickHouse

ClickHouse is fed by an outbox, not a dual write

The usage event and the "send this to ClickHouse" outbox row are saved in one database transaction, so either both are saved or neither is. That means ClickHouse can never miss a request that Postgres has. The exporter counts the rows in ClickHouse before it deletes the outbox rows. If an export fails partway and is retried, ClickHouse may receive the same row twice. Reads use FINAL, which keeps only one copy, so totals are not counted twice. Summing materialized views would count that row twice, so they are not used.

Oct 20 · exporter placement

The exporter runs on the control plane

Spend reports show data only up to the oldest outbox row not yet delivered. When the exporter ran on the Project worker, each Project worker release paused it, and every Spend report stopped advancing. The export stalled for 31 hours on October 12 (a dead thread) and again on October 13 (a table name clash). Now, if the exporter fails to claim a batch, it waits and tries again instead of ending the thread.

Sep 20 · Oct 18 · bodies in Storage

Bodies live in object storage, Postgres keeps a pointer

Inline capture reached 748 GB of a 941 GB database in two weeks. Bodies now go to compressed Storage objects with one small pointer row each. Reads switched to objects behind an explicit gate, after it turned out that the mirror (a background copier meant to move old inline rows into objects) had never run in production.

Sep 22 · capture off the loop

The request loop never serializes content

Twelve gateway workers froze for five minutes and crashed after large bodies started being serialized on the request loop. Now the request loop only passes raw bytes to the capture thread, which does the serializing. That thread's queue holds at most 2,000 items and 256 MiB. Each new kind of captured content gets its own switch to turn off its capture.

Nov 9 · consent and ZDR

One switch decides what is kept

The organization's capture switch decides for every lane, own keys and plans included. A request routed under zero data retention is never captured. The decision is made once, when the request is authorized. If the decision is unknown, nothing is kept.

Sep 2026 · edge

Cloudflare guards the hosts but never challenges /v1

SDK traffic cannot solve a browser challenge, so the WAF's challenge and rate rules apply only to the sign-in paths. A secret header proves the request came through our zone. 502 and 504 are rewritten to 503, because Cloudflare replaced our JSON error and its request id with its own page.

Part 4

What was not working

The problems, in the order they showed up. For each one: what we saw, the evidence, and the cause. What we did about each is told in Part 5.

How to read this part

The problems fall into three groups.

The first group is incidents in production in early November (sections for November 5, 9, 10 to 13). They all trace back to one cause: a single Postgres database does almost every job, so anything that slows it slows customers.

The second group is risks and gaps that had not yet caused an incident: a planned Postgres restart would break the API, and the product lacked sessions, search and full traces.

The third group is problems the testing found while the new design was built, from 2026-11-18 to 2026-11-22. They are listed at the end of this part in one table, and each is told in full, with its fix, in Part 5.

Some history comes first. Several rules in today's design were set after incidents in September and October:

  • Money moved out of Postgres after one busy tenant's row lock made everyone wait 90 to 145 seconds.
  • Charts moved to ClickHouse after Postgres reads hit their 8 s timeout.
  • Bodies moved to object storage after inline capture reached 748 GB of a 941 GB database.
  • Content serialization left the request loop after twelve workers froze.

Those are told in Why it is built this way.

November 5: capture refusals while the writeback lagged

What we saw. Captured requests were refused with 503 capture_unavailable, up to about 24,000 an hour at 11:00Z.

Evidence. The ledger writeback, which copies each request from MemoryDB into Postgres, averaged up to 2.5 minutes behind in some hours that day.

Cause. The capture processor needs the request's Postgres row before it may store a capture, because that row holds the consent facts. With the writeback behind, the processor waited on request rows that had not arrived yet. Captures piled up in each gateway worker's bounded buffer, and a full buffer refuses new captured requests. This is the same mechanism as November 9 below, with a different slowdown.

November 9: capture refusals from a slow database

What we saw. At 12:07, 13:05 and 14:17Z, 123 requests from 76 organizations were refused with 503 capture_unavailable.

How we know. Kion's investigation. At the same times the ledger writeback fell up to 5.8 minutes behind. The same pressure probably explains promotion-usage-rollup-tick and house-lane-usage-live-refresh timing out since November 8.

Why it happened. Autovacuum on the largest, most-updated tables used up the database's disk throughput, so every commit slowed. The diagram follows the chain from there to the refused requests.

flowchart TD
  A["Autovacuum on the largest churning tables
storage.objects 167 GB, chain receipts 67 GB,
gateway_captures 59 GB"] --> B["Postgres disk throughput used up"] B --> C["Every commit slows"] C --> D["Storage upload commits slow
storage.objects and inbox rows"] C --> E["Writeback falls behind
up to 5.8 min"] C --> F["Scheduled rollups time out"] D --> G["Captures stay in each worker's buffer longer"] G --> H["Buffer reaches its record or byte limit"] H --> I["New captured requests refused
503 capture_unavailable"] E --> J["Request rows, usage, dashboards late;
capture processor waits"]
Vacuum started it. The underlying cause is that a customer request can still wait on a Postgres write. The capture buffer frees space only after a Supabase Storage upload, and that upload commits rows in Postgres.

Why tuning vacuum or raising buffer sizes is not the fix. Either change only raises the point at which refusals start. The next slow commit (a bigger vacuum, a migration, a Supabase incident) would refuse customers again. The fix is to change the design so that no customer request depends on how fast Postgres writes, and to move the tables that change the most out of the main database.

A second capture problem, found the same day.

  • What we saw. 298 capture items had been stuck in the gateway_capture_inbox as metadata_pending since November 6 (live count). By November 10 the count was 813, retried about 1,280 times since 11-06.
  • Why, first cause. The inbox has no dead-letter shelf, so nothing ever gives up.
  • Why, second cause. A code bug. A prompt whose request row never appears returns early at capture_inbox_worker.py:207, before the step that would drop it, so it is retried every 5 minutes forever.

The fix is told under the infra plan.

November 9: slow and broken reads (the API audit)

The same day we audited every dashboard and API read for speed and errors. This section lists what was broken, what sat at the timeout, and what was slow.

How we know.

  • Source: production request logs (/explabs/production/containers, the request completed timing lines of the control plane and the web app), plus a few live Server-Timing reads.
  • Window: 2026-11-09 about 16:00 to 22:00Z, roughly 200,000 requests. Nothing was changed.
  • Not yet checked: the ClickHouse query log and pg_stat_statements (no access from here), and query plans (EXPLAIN) of the admin functions.

Broken: most calls fail At the timeout ceiling (about 8 s) Slow on a high-volume route Healthy

flowchart LR
  subgraph Callers
    ADM["Admin browser"]
    USR["Customer browser"]
    ANON["Anonymous visitors,
search engines"] AGT["Agents and SDKs
xpl_ key"] PART["Partner export key"] CRON["Cron and internal callers"] end subgraph Web["Web app routes, Next.js"] W_TEL["/admin/telemetry page
/api/admin/telemetry/usage
/api/admin/telemetry/rejected-usage
16 of 31 and 5 of 10 failed"] W_OV["/api/admin/orgs/[orgId]/overview
p95 8.2 s, 3 errors"] W_BROWSE["/api/admin/orgs/browse
/api/admin/support/orgs
p95 3.5 to 4.8 s"] W_MODEL["/models/[modelSlug] page
42k calls, p50 1.0 s, 42 errors"] W_DASH["/api/gateway/usage/daily, rollups
/api/orgs/[orgId]/spend/*
p95 1.3 to 1.6 s"] W_CRON["/api/internal/users-context-fill
p95 7.5 s, max 8.6 s"] W_FLEET["/api/internal/ec-fleet/poll
p95 48 s, 5 errors"] end subgraph CP["Control plane routes, FastAPI"] C_PD["/api/gateway/usage/platform-daily
/platform-rejected-daily
26 of 31 and 8 of 10 failed, 503 at 18 s"] C_USERS["/api/admin/users, /users/{id}
p95 8.1 s"] C_ORGS["/api/admin/orgs, /orgs/{id}
p95 8.7 s"] C_EXP["/api/admin/accounts/export
260 calls, p95 8.2 s"] C_POL["/api/admin/paid-only-lanes
17.6 s, all database"] C_Q["/api/admin/abuse/quarantined
1.1 s waiting for a connection"] C_MODELS["/api/models
10.5k calls, p50 2.0 s, 16 queries"] C_SLUG["/api/models/{slug}
46k calls, p95 2.1 s, 22 queries"] C_V1M["/api/v1/models
p50 3.6 s, p95 6.3 s"] C_ZDR["/api/orgs/{org}/zero-data-retention
3.6k calls, p50 1.2 s"] C_USAGE["/api/v1/usage, /api/v1/key
40k calls, p95 1.3 to 1.7 s"] C_APPROVE["/api/admin/catalog-drafts/approve-batch
49 to 85 s, publishes inline"] end CH[("ClickHouse
usage_events FINAL,
raw rows, all orgs")] PGBIG[("Postgres big tables
audit_log 311 GB, attempts 238 GB,
usage_events 188 GB, requests 105 GB")] PGCAT[("Postgres catalog tables
models, lanes, observed stats")] POOL[["Control plane
database connection pool"]] ADM --> W_TEL --> C_PD -->|"408 at 18 s"| CH ADM --> W_OV --> C_ORGS ADM --> W_BROWSE ADM --> C_USERS ADM --> C_POL ADM --> C_Q ADM --> C_APPROVE PART --> C_EXP C_USERS --> PGBIG C_ORGS --> PGBIG C_EXP --> PGBIG W_BROWSE --> PGBIG C_POL --> PGBIG ANON --> W_MODEL --> C_SLUG ANON --> C_MODELS USR --> W_MODEL USR --> W_DASH --> CH USR --> C_ZDR AGT --> C_V1M AGT --> C_USAGE C_MODELS --> PGCAT C_SLUG --> PGCAT C_V1M --> PGCAT C_ZDR --> PGCAT C_MODELS -.->|"holds connections"| POOL C_SLUG -.->|"holds connections"| POOL C_Q -.->|"waits for one"| POOL CRON --> W_CRON --> PGBIG CRON --> W_FLEET C_USAGE --> PGBIG classDef broken fill:#c0392b,stroke:#7f1d1d,color:#ffffff classDef ceiling fill:#d9631e,stroke:#8a3b0f,color:#ffffff classDef slow fill:#b7791f,stroke:#6b4610,color:#ffffff classDef ok fill:#2f855a,stroke:#1c5236,color:#ffffff class W_TEL,C_PD broken class W_OV,C_USERS,C_ORGS,C_EXP,C_POL,W_CRON,W_FLEET,C_APPROVE ceiling class C_MODELS,C_SLUG,C_V1M,C_ZDR,W_MODEL,C_Q,W_BROWSE slow class C_USAGE,W_DASH ok
Each box is a route with its 6-hour figures. Red routes fail on most calls, orange routes sit at or past the database timeout, amber routes are slow on high-volume traffic, green routes are fine. The admin pages read the biggest Postgres tables, Telemetry reads raw ClickHouse rows, and the catalog routes hold many of the control plane's database connections, which every other route also needs.

Broken now: admin Telemetry

  • Symptom. /api/gateway/usage/platform-daily failed 26 of 31 calls and platform-rejected-daily 8 of 10, each after about 18 s with a 503. The page's web routes (/api/admin/telemetry/usage, /rejected-usage) fail with them.
  • Cause. ClickHouse answers 408 Request Time-out: the query hits its 18 s execution limit (max_execution_time=18, log_comment=platform.gateway_usage.platform_read).
  • Why it is slow. clickhouse_usage_read.py platform() runs SELECT * FROM usage_events FINAL over every organization's raw events. For a 30-day chart, the query reads partitions back to August 27, because it allows extra days for requests that settle late. FINAL removes duplicate rows left by export retries at query time, across all those rows, and SELECT * reads every column. Traffic grew about 10x since the read was written.
  • Fix. A pre-aggregated platform rollup in ClickHouse (hour and day, by model and by organization). A finished day is summed once and never changes, so FINAL only has to run on the current day's rows. Select only the columns the chart needs. Raising the time limit would not fix it, because the scan keeps growing with traffic.

At the timeout ceiling

RouteCalls (6 h)p50 / p95Where the time goesLikely fix
/api/admin/users, /users/{id}81, 73.9 s / 8.1 s/users/{id} is 8.1 s on every call, all databaseRead the user card's usage and audit figures from rollups or ClickHouse
/api/admin/orgs, /orgs/{id}; web /admin/orgs/[orgId]/overview14, 16, 208.2 s / 8.7 sDatabase; web overview returned 3 errorsSame fix: do not sum the ledger tables while the caller waits
/api/admin/accounts/export2602.4 s / 8.2 sA partner key reads page after page. Each page joins billing and usage data and takes close to the timeoutPrecompute the per-account enrichment; page smaller
/api/admin/paid-only-lanes117.6 sAll databaseRead its query plan (EXPLAIN), then limit how much it reads
/api/internal/users-context-fill (cron)726.1 s / 7.5 s, max 8.6 sDatabase through SupabaseWill start failing as tables grow; move to a background job with its own budget
/api/internal/ec-fleet/poll3601.9 s / 48 sBackend calls to the GPU fleetBound each box poll; poll in parallel
/api/admin/catalog-drafts/approve-batch449 s / 85 sA catalog publish runs inside the requestReturn at once and publish in the background

Slow on high-volume customer and public routes

RouteCalls (6 h)p50 / p95Where the time goesLikely fix
/api/models/{slug} (model page data)46,2300.8 s / 2.1 s22 queries, 1.6 s of database time per call; about 300 ms waiting for a connectionServe anonymous reads from a precomputed catalog snapshot, cached at Cloudflare
Web /models/[modelSlug]42,0601.0 s / 2.4 sCalls the route above; 42 server errors, 372 abandoned by the visitorSame snapshot; cache the rendered page
/api/models (catalog)10,4662.0 s / 4.7 s16 queries, 1.5 s of database time, 333 KB responseSame snapshot
/api/v1/models (OpenRouter-style list)1,4353.6 s / 6.3 sDatabase; agents call it on startupSame snapshot plus the per-org overlay
/api/orgs/{org}/zero-data-retention3,6251.2 s / 3.3 sRecomputes the per-model zero-data-retention route verdicts on every callCache per org; invalidate on policy or catalog change
/api/admin/abuse/quarantined41.5 s / 6.4 s1.1 s average waiting for a database connectionCaused by the connection pool pressure described below

Connection pool pressure. Several control plane routes spend hundreds of milliseconds waiting for a database connection before running anything. The measure is db_wait_ms: /api/models/{slug} waits about 300 ms on average, and /admin/abuse/quarantined about 1.1 s. The cause is that the catalog routes make many queries per call and hold connections that every other route needs. Serving the catalog from a precomputed snapshot would free those connections for every other route.

Healthy enough for now

/api/v1/usage (32k calls, p95 1.7 s), /api/v1/key (7.7k, p95 1.3 s), /api/gateway/usage/daily and /rollups (p95 1.3 to 1.6 s), /api/orgs/{org}/spend/* (p95 under 1.6 s). Unauthenticated /v1/models answers in about 0.17 s. /api/playground/chat is slow by nature (it waits for a model).

The two patterns behind nearly every finding.

  1. Reads that sum raw rows while the caller waits: in ClickHouse for Telemetry, in Postgres for the admin directory reads. The fix is maintained rollups, which tenant usage already uses.
  2. Postgres tables with no retention, which make every scan and vacuum slower. That is the same root as the November 9 capture refusals.

November 10 to 13: dashboard overload, a hot organization, and a slow drain

The next week brought a run of incidents. None of them broke /v1 outright, but each showed the same shared-database weakness from a new side.

November 10: the dashboard incident

What we saw. For about six hours, signed-in dashboard pages were slow or failing. /v1 was not affected.

Evidence and cause, in order.

  • Model-page traffic roughly doubled, and every model page made about 24 database calls.
  • Postgres hit its disk throughput limit.
  • The control plane queued requests for 10 to 18 seconds while its CPU looked idle. Each control-plane process can make only 8 database calls at once and waits with no timeout for a free slot, so the pods were waiting, not working, and the CPU-based autoscaler saw nothing to do.
  • Scaling the control plane to 30 pods by hand then used up the database pooler's 225 session slots and failed a release.

The incident write-up is incident-2026-11-10-control-plane.md and the database resize research is postgres-zero-downtime-options.md, both on the Desktop. The incident owner handed the long-term items to this plan.

Other findings that day.

  • One hot organization fell 17 minutes behind on its shared receipt stream, because the wallet's 8 receipt streams are shared by many organizations.
  • Release tooling had five separate faults:
    • finished-release recovery needed main's newest commit, so any merge broke it;
    • merge freezes depended on sessions messaging each other;
    • one GitLab 500 aborted recovery;
    • about 3,900 stale manual preview jobs broke a listing;
    • the smoke test's usage check waited 10 s while the writeback lagged 3 to 9 minutes, so a healthy release failed.
  • Lanes pointing at test hosts (webhook.site, lhr.life, oast) were left over from a penetration test.
  • Secrets in chat: the Supabase PostgREST JWT secret, Cloudflare tokens and R2 keys appeared in a conversation.

November 11: one expensive query

What we saw. One expensive dashboard query overloaded the primary Postgres. The balance-ledger writeback slowed, and captures refused about 3,400 requests.

Later that day, ad-hoc 7-day ledger scans and one busy organization slowed the writeback again. That organization's writeback fell 55 minutes behind. The cause was an organization-row convoy: many transactions in receipt apply and the settle drain queued on that organization's one row.

Also that day. A bad environment change crash-looped control-plane pods. It showed two places where unrelated jobs shared one deploy unit:

  • The ledger writeback ran inside the control-plane app, so it shared that app's environment, release and rollback.
  • One edge app served both /v1 and the dashboard's /api relay. Slow dashboard calls (13 s /api/models calls that day) occupied the same edge workers and connections as /v1.

The post-mortem listed ways to isolate the API from the dashboard (https://incident-2026-11-11.pages.dev).

November 12 and 13: the settle-drain incidents

What we saw. The settle drain slowed on both days.

Why. Multixact churn: bookkeeping Postgres does when many transactions lock the same rows. The buffers that would help, the multixact buffers, were still at their defaults of 256 KB and 128 KB. They can only change when Postgres restarts.

That is one reason a restart is needed. The next section explains why a restart is itself a problem.

A Postgres restart takes /v1 down

This is a risk, not an incident: it had not happened yet, but it would on the next planned restart.

Why this matters. Any change to the database's size or connection limit restarts Postgres. Supabase documents "usually less than 2 minutes". On our plan it offers no failover or blue/green switch, and read replicas cannot be promoted.

What would happen. Money already settles in MemoryDB, but today a short Postgres restart still breaks /v1 in two ways:

  • After about 60 seconds without the database, every gateway worker marks itself unready (explabs/gateway/worker.py, readiness blocker around lines 1616 to 1646), so the edge has no healthy worker and returns 502.
  • Before that, any request whose API key is not in the 2-second key cache does a direct Postgres read that can wait 10 to 30 seconds.

The same is true of an AWS RDS or Aurora failover (30 to 120 seconds), so this work is needed whichever database platform we end up on. With it, a planned resize, a max_connections change, or a Supabase incident stops being an API outage. Research report: ~/Desktop/postgres-zero-downtime-options.md.

How we know: a larger blocker in the code. A closer read of the code (infra item 1, November 10) found that even with every cache warm, each request runs authorize_model_chain against Postgres (control_store.py:2684). That check reads the chain epoch, the revision row and the protected-revision row, and for protected revisions it also takes a lease and writes a receipt. So during an outage every request fails after 10 to 30 s, and a stale key cache alone would save nothing.

The table shows what each step of a request does today when Postgres is gone. Look for "no stale fallback" and "fails": those are the steps that turn a restart into an outage.

What happens today during an outage

StepBehavior
Model-chain check (every request)Waits up to 10 s to connect and 30 s to check out; every request fails, warm keys included
Key and grant caches2 s, no stale fallback
last_used updateSynchronous write once a minute per key, no error handling; that request fails
Limit policy caches (2, 10, 30 s)Raise when expired; no last-good value
Catalog refresherKeeps the last good state (fine)
ReadinessAfter about 60 s the probe pings Postgres; about 100 to 120 s in, every pod leaves the load balancer at once
MemoryDB writebackReceipts wait safely in the streams; no backlog metric or alert exists

How much traffic it affects. On 2026-11-18 a read-only production query measured it: 27,171 of 52,347 requests in 10 minutes (52%) ran on protected chain revisions, each writing a receipt in Postgres at admission. So a restart would refuse about half of /v1 even after the other fixes. How that was solved is told under November 18.

Why we cannot just avoid the restart. Production Postgres is version 17.6 on a Supabase 4XL machine. The settings that would help only change on a restart: the multixact buffers, possibly the transaction and subtransaction buffers, maximum connections, and the machine size. Supabase gives our plan no failover or blue/green switch.

What the product lacked

Alongside the incidents, customers were missing features that observability tools usually have. These are product gaps, not outages.

  • No session view. Requests were grouped only by content hashes, which merge different conversations and split one conversation after compaction. The real session key was written to Postgres and never read. See Sessions today.
  • No search of request content. Bodies were compressed objects in storage, which cannot be searched.
  • No agent traces. The gateway sees only LLM calls. Tool calls and agent steps happen in the customer's code, and uploaded traces sat in ClickHouse trace_spans with no page and no link to gateway requests. Teams that left Helicone for Langfuse named this as their reason.
  • Many surfaces stored nothing: embeddings, images, speech, transcription, video and Decisions requests. See Capture paths.
  • One all-or-nothing storage switch per organization, no customer-set expiry, and no way to move Helicone customers over without changes on their side.

The pattern behind the problems

When the incidents are put side by side, a short list of structural flaws explains nearly all of them. The plan page's "What the current system teaches us" lists them, and each maps to the decision that removes it. The figures were checked against the code in review.

Read each row left to right: the flaw, the evidence for it, the lesson, and the decision (D1 to D20, Part 7) that removes it.

FlawEvidenceWhat we learnRemoved by
One Postgres does every jobA 1,336 GB database holds money history, catalog, auth, capture pointers, audit and analytics-shaped tables. The incidents of November 5, 9, 10, 11, 12 and 13 all trace back to pressure on it: vacuum, a heavy query, connection exhaustion and row-lock convoys.A shared database turns any heavy job into everyone's outage. Isolation has to be designed in; tuning cannot add it later.D1, D3, D4, D5
Hidden synchronous dependenciesThe capture buffer waited on a Supabase Storage upload that commits a Postgres row. Every request checked the model chain in Postgres. last_used is throttled to once a minute per key but still runs inline. Readiness pinged Postgres. Promotion grants and plan caps still read Postgres on every request.A dependency nobody drew on the diagram is the one that takes production down. Every request-path call has to be listed and justified.D1, D2
Tables with no lifetimeaudit_log (311 GB), gateway_attempts (238 GB) and chain receipts (67 GB) have no retention. storage.objects carried 10.7 million dead rows.Unbounded tables slow every vacuum, scan and restart until one of them tips over.D3
Reads that sum raw rows while someone waitsAdmin Telemetry scanned every organization's raw ClickHouse events with FINAL and timed out. Admin directory pages took 8 s summing ledger tables. Model pages made 22 to 24 database calls each.The rule "read a rollup, never the raw window" existed but was enforced only for tenant usage reads. A rule that is not enforced everywhere decays.D4, D5
Queues without a shelf or an age alarmHundreds of captures stuck in metadata_pending from November 6 and retried forever. One bad ClickHouse outbox row could freeze Spend. An appeal pipeline was dead for 9 days before anyone noticed. Wallet drift is logged, not paged.Retry-forever hides failures. The signal that matters is the age of the oldest item.D9
Fail-closed side jobsCapture refused customer requests because storing a copy was slow: up to about 24,000 an hour on November 5, and 123 requests from 76 organizations on November 9.A side job may refuse a customer only when a stronger written promise requires it.D2
Limits per process, load per fleet30 control-plane pods used up the pooler's 225 sessions. The autoscaler watched idle CPU while requests queued for 18 s. One busy organization fell 17 to 55 minutes behind on a shared receipt stream.Budgets must be fleet-wide and checked before a deploy. Isolation must be per organization wherever one tenant can saturate a shared path.D6, D11
Shared deploy unitsOne edge app serves both /v1 and the dashboard. The ledger writeback has run as its own Deployment since November 11, but it still shares the control-plane app's configuration, release and rollback.Things that fail differently should deploy separately.D11
Release and repository process carried by peopleMerge holds coordinated by chat. Recovery broke when main moved. 3,900 stale manual CI jobs broke a listing. On November 10 there were 144 open merge requests, and 66 had already landed. Migration versions collided.Process that depends on everyone remembering fails at the busiest moment. Automate the guard, or remove the need for it.D17
Built but never switched onThe S3 and SQS Terraform was merged but never applied. A capture mirror had never run. A Fargate capture service was built and left at zero tasks.A merge is not a launch.Principle 7, D17
Monitoring that missed moneyWriteback lag had no alert until November 11, and wallet drift still has none.Monitor what money depends on as closely as the API.D6, D9
A dependency crash that only a real restart shows found 2026-11-18In the first preview restart rehearsal, every psycopg-based Python service segfaulted about 5 s after Postgres came back.A failure path that only runs during a real outage has to be exercised by a real outage. Simulated failures test our code, not our dependencies.D16
Secrets in chatThe Supabase JWT secret, Cloudflare tokens and R2 keys were exposed in conversations on November 10, and a GitLab token needs rotation.Credentials need a path that never passes through a chat.D18

Problems the testing uncovered, November 18 to 22

Once the new design was built, we tested it hard: restart rehearsals, end-to-end flows, security and money attacks, a load test, and on November 22 eight adversarial agents working in rounds. Every round found something. The table lists each problem with what we saw and why it happened. Some were in the new design, some were on main, and some were in the preview's own plumbing.

The last column points to where Part 5 tells the fix and the numbers after.

DateProblemWhat we sawCauseTold in
11-18Services crash after a real restartGateway worker, control plane, capture ETL and project worker all segfaulted about 5 s after Postgres returned, in both runs. A 41 s outage became 65 to 88 s of errors.psycopg 3.3.4 crashed when the Supavisor pooler greets a client without connection settings.Restart rehearsal
11-18Requests hung at the cutIn rehearsal round 2, requests at the cut still hung 22 to 37 s.Behind Supavisor a statement waits about 8 s for an upstream and fails; statement errors did not count toward the breaker, and connection validation retried up to five times before the connection could be cut. The credential release used its own connections outside the breaker.Restart rehearsal
11-18A known key refused for a whole outageIn rehearsal round 3, one worker refused a known key for the whole outage.That worker had never served the key before the cut, so its grant was not cached; the first-sight grant read hit the open breaker.Restart rehearsal
11-18Protected chains refused during an outage52% of production requests write a Postgres receipt at admission.The receipt proves the chain facts at that moment, and it needs Postgres.Protected chains
11-18Integration bugsSeventeen, found by the end-to-end flows: a ClickHouse migration that would have failed every deploy, the usage export stopping after minutes of traffic, every session read answering 500, tool spans never inferred, two segment writers destroying each other's files, and more.Pieces built in separate worktrees, first run together.Checking the build
11-18Security and money attack findingsA crafted Host header let anyone make the public edge call internal servers; read-scoped admin keys could read every org's captured prompts; the Helicone response cache could fill the wallet's MemoryDB and stop all money; a flood of random keys could lock out new keys.New routes and shared clusters without the guards the old paths had.Checking the build
11-19Clef judge calls failing/v1/systemone answered intermittent 503s, 0.8% to 2.2% of calls per hour.One of two upstreams was dead, and the remaining one sat on a 250 ms lossy tunnel where a 2 s health check sometimes failed, marking it down for 3 to 5 s.November 19
11-19Observability missing asked-for featuresThe owner: production data "isn't great", and metadata previews were missing; the top bar had too much going on. The audit found 6 of 40 asks missing.The plan's asks had not all been built.November 19
11-20Outage bound shorter than promisedThe plan said 60 minutes; the code bounded keys and grants at 900 s (15 minutes) in two places.Two separate constants.November 20
11-20Erasure missed Helicone webhook payloadsFrozen webhook payloads (request and response bodies, plain text) survived erasure; a parked delivery kept them 30 days.The erasure job did not know about them.November 20
11-20Span ingest collapsed under loadAt 50 requests a second: p50 13.9 s and 2,871 refusals. At 4x overload goodput fell to 24 requests a second with 6,861 timeouts.Each Langfuse score was its own ClickHouse insert (about 250 ms) inside the request.November 21
11-20One organization's flood slowed everyoneA quiet organization's p50 was 14.7 s, and 34% of its requests got a 503.The edge's shared shedder treated every organization the same.November 21
11-21Captures stuck behind span uploadsNo gateway capture was stored for over an hour.Captures and span-ingest segments shared one queue, and span loads waited on a single writer.November 21
11-21Session summaries got slower as sessions grewEach write read 2.8 to 3.1 million rows, 21 to 64 s, at 30,000-span sessions; ETL fell from about 480 to about 100 spans/s.Every write recomputed the whole session from every span.November 21
11-21Requests list over its speed targetp95 2.8 to 9.1 s at 1.2 million rows; target 2 s.A busy 1-vCPU ClickHouse, a union with the old usage table until the history backfill, and 13 Postgres calls per page.Remaining gaps
11-22 r1Search slow and wrongA phrase search took 2.8 s; a search with no filters read 385 MiB even with no match; a quoted search did not match the exact phrase.Table order and granules not built for search; the unfiltered query named every request id.Round 1
11-22 r1Capture pipeline slow405 spans/s on an empty table.Each segment's writes were split by API key, and each write costs about 0.2 s whatever its size.Round 1
11-22 r1History import slow73 to 195 rows/s on the preview; one day stalled 10 minutes.One delete per 1,000 touched traces with no trace-id index, then every batch rebuilding summaries by reading the whole org.Round 1, Round 2
11-22 r1A stuck wallet slot move stalled a workerNeighbors' median wait 1,188 ms.One tenant's slot move blocked every tenant on that worker.Round 1
11-22 r1Span uploads failed during a Postgres outage596 of 603 failed as bare 500s.The ingest path depended on Postgres.Round 1
11-22 r1Continuations broken by an outage, and in steady stateEvery Responses continuation needed a full resend during an outage, and conversations started during it stayed broken. Separately, with the MemoryDB ledger and async cleanup on, every continuation was dropped.Conversation state lived only in Postgres; a steady-state bug in the cleanup path.Round 1
11-22 r1One slow key froze a control-plane podA fast request waited 2,028 ms.All 49 Helicone REST handlers blocked the event loop.Round 1
11-22 r1Ingest fairness could be dodgedA tenant could dodge its per-org bucket and fill the edge's org cache; one client could hold all 8 shared admission slots.An auth-header trick.Round 1
11-22 r2New organizations failed their first call16 of 30 brand-new orgs got a 503 "account facts cannot be read".The idle gateway pool's connections were closed by the pooler, and the first-time load ran under a 0.75 s limit meant for single-row reads.Round 2
11-22 r2One heavy organization starved the restA light org failed 34 to 46% of its calls before any fault was injected.30 orgs held all 4 engine slots first come first served; listings took a slot; the edge counted fairness per key.Round 2
11-22 r2Live prompts not searchableFor 25+ minutes; 3,248 tasks queued and 380 in the dead-letter queue.The text step ran on one worker at about 2 tasks/s.Round 2
11-22 r3An unreachable wallet held requestsUp to 36 s, starving unrelated requests of admission slots.No fast fail on wallet calls.Round 3
11-22 r3Fairness tag forgeableThe edge's org tag could be forged and its memory flooded.The tag was not signed.Round 3
11-22 r4Readiness depended on the wallet storeA wallet outage over about a minute would take every worker out of service.The readiness probe pinged MemoryDB.Round 4
11-22 r4Key rotation and tool-span bugsAfter a key rotation, servers kept old model access for up to 60 s; a tool span could be renamed "tool".A longer access cache; a result arriving in a later batch.Round 4
11-22 r5 to 9Answers held back during a wallet outageServed requests finished 12 to 15 s late; unknown keys took 4.2 to 4.9 s; /v1/models up to 7.8 s.Settles retried on the request's thread; a customer request was the breaker's probe and paid the cluster rediscovery.Rounds 5 to 9
11-22 r10 to 11Workers could not boot in a wallet outage; slow listingsA worker failed its boot check; spooled requests answered after 6.8 and 9.3 s; a listing took 2.45 s.The limiter boot check raised on failure; hot wallet calls ran on the caller's thread.Rounds 10 and 11
11-22 lateLocal capture never reached Observabilityexp capture uploads, trace uploads and Langfuse and Braintrust pulls do not show in Requests, Sessions or Traces.They land in the legacy trace_spans table, not spans.Completeness check
11-22 r12Uploads still never processed on the previewAfter the span-sink fix, uploaded traces still did not reach Observability.The control pods lacked CLICKHOUSE_TRACE_PROJECTION_ENABLED; main's deploy script gives it only to the Project worker. Fixed by dropping the gate; verified on the preview at 79479dfd80.Round 12
11-22 lateThe preview ran main's deploy layout46 of 172 audited claim rows are not yet proven on the PR's layout; 23 held only because of a hand-applied step.The isolated preview controller and its deploy script come from main, so the PR's changes to them never reached the preview.What the preview could and could not test
Part 5

What we did about it

The work in the order it happened, from the first investigation on November 9 to the adversarial rounds on November 22. Each step says what we noticed, what we tried, what we learned, what we changed and what happened.

How the work unfolded

The work had three phases.

Understanding (November 9 to 11). We read production: the stores, the routes, the incidents. We read how Helicone and LiteLLM solve the same problems, and checked our design against published engineering practice. Kion set the direction: no customer request may depend on how fast Postgres writes. We wrote designs and analyses, and put the first questions to the owner.

Deciding (November 11 to 17). The designs became a final plan with twenty decisions, D1 to D20, reviewed by seven reviewers. On November 17 the wallet options were tested for real, and the owner decided to build everything in one change, now.

Building and proving (November 18 to 22). The build was checked in layers: restart rehearsals, end-to-end flows, attacks, a load test, and finally eight adversarial agents working in rounds on the preview. Each check found problems; each problem was fixed and re-measured.

The diagram below shows the shape of the timeline.

flowchart LR
  A["Nov 5 to 13
incidents in production"] --> B["Nov 9 to 11
research, target,
infra plan, Kion Sync"] B --> C["Nov 16 to 17
final plan D1 to D20,
wallet tests"] C --> D["Nov 18
reassessment,
restart rehearsal"] D --> E["Nov 19 to 20
Clef 502s, UX gaps,
plan review, retests"] E --> F["Nov 21
one PR,
load test fixes"] F --> G["Nov 22
11 adversarial rounds"]
The work from incidents to rounds. Each box is told in its own section below.

November 9: research, how others solve the same problems

Before designing anything, we looked at three things: how Helicone, which we own and whose customers would move to us, builds sessions and search; how LiteLLM, the most widely used open-source LLM gateway, moves spend into its database; and what published engineering practice says about each pattern we use. The findings shaped every later decision, so they come first.

How Helicone does it

From the Helicone source in our organization. Their proxy runs on Cloudflare Workers, logs go through SQS, and almost everything is read from one ClickHouse table.

flowchart LR
  APP["Client with Helicone-Session-Id,
-Session-Path, -Session-Name headers"] --> W["Cloudflare Worker proxy
Durable Objects, KV"] W --> LLM["Providers"] W -->|"raw body"| S3[("S3")] W -->|"log message"| Q[["SQS queue"]] Q --> J["Jawn consumer
handler chain"] J -->|"one row per request
bodies up to 10 MB inline"| CH[("ClickHouse
request_response_rmt")] J -->|"bodies over 10 MB"| S3 J --> PG[("Postgres
orgs, keys, prompts")] UI["Sessions page
polls every 1 to 2 s"] -.-> J J -.->|"GROUP BY session id at query time"| CH
Helicone stores bodies of up to 10 MB in ClickHouse beside the metadata, so search and sessions run as plain ClickHouse queries.

The table compares Helicone with us topic by topic. The "Us today" column is where the gaps show.

TopicHeliconeUs today
Session identityThree headers. A session is the requests sharing Session-Id and Session-Name. There is no session table; it is grouped on every query.session_key derived from several headers, written to Postgres only, not read
Session treeBuilt in the browser from Session-Path strings (/plan/step-1); folders aggregate latency and costNone; content-hash grouping on a flat list
Session listName picker, filters on session totals, columns for cost, tokens, requests, latency and users, live polling, exportNone
Session detailWaterfall timeline, expandable tree table, request drawer, session tagRequest drawer only
Body searchILIKE on body columns with an n-gram bloom index; bodies kept 3 months; large bodies searched by a truncated previewNo body search; bodies are only in object storage
Live updatesPolling every 1 to 2 secondsPolling every 10 seconds
Billing and limitsSeparateSame request path, settled in MemoryDB

Their weaker spots, which we should not copy:

What LiteLLM teaches

LiteLLM is the most widely used open-source LLM gateway. We read its repository at commit 1ddc9130 (November 9, 2026). It has changed a lot recently:

  • spend now flows through a Postgres outbox;
  • budgets use reserved holds in Redis, much like ours;
  • its router, Redis stores, ClickHouse writer and price-list refresher now run in Rust.

Its main weakness remains. Between the request and Postgres, the spend record is held only in memory, so a crash or a full queue can lose it.

flowchart LR
  subgraph LiteLLM
    LR["Request"] --> LW["Logging worker
in-memory queue, 50k"] LW --> LQ["Spend queue
in memory, 64 MB,
oldest dropped when full"] LQ -.->|"optional"| LRL["Redis list
100k rows"] LQ --> LPG[("Postgres:
spend log and delivery row,
one transaction")] LPG --> LWK["Projection worker
SKIP LOCKED, parks after 5 tries"] LWK --> LD[("Daily spend tables")] end subgraph Ours OR["Request"] --> OM[("MemoryDB:
settle and receipt,
one atomic step")] OM --> OW["Writeback
exactly once per receipt"] OW --> OPG[("Postgres")] OPG --> OX["Outbox drains"] --> OCH[("ClickHouse")] end
Both designs end in an outbox. LiteLLM's first hop is in memory and can drop charges under load or on a crash; ours writes the receipt durably in the same step that moves the money.

The table compares LiteLLM with us topic by topic. The last column says whether we should copy it.

TopicLiteLLMUsTake it?
Getting spend into PostgresIn-memory logging worker, then an in-memory queue that drops the oldest past 64 MB, then a Postgres transaction writing the spend row and a delivery row together.MemoryDB writes the receipt in the same atomic step as the settle; the writeback applies it exactly once.No. Ours is more durable.
Draining an outboxClaims 500 rows with FOR UPDATE SKIP LOCKED and applies them in one transaction. Retries back off with jitter up to 300 s. A row that keeps failing is parked after 5 attempts with an alert. Exposes pending count, parked count and age of the oldest. Clears applied rows after a day.Same claim-and-apply, but no parked state, no attempt cap and no oldest-age alarm on most handoffs.Yes, the parking and metrics. This is the dead-letter gap from the best-practice review.
Hot counter rowsOne multi-row upsert per batch in a fixed table order. SET LOCAL lock_timeout on every rollup, with the batch requeued when the lock times out. A single writer per job via a lease, and cron jobs staggered across replicas.Counters moved to MemoryDB and rollup triggers; cron jobs already carry budgets and staggered minutes.Yes, lock_timeout plus requeue on our rollup and drain transactions.
Pricing problemsStores unpriced cost as NULL instead of 0, records why a request cost nothing, splits each cost into its parts, and checks captured spend against the provider's bill daily, alerting below 90%.Unpriced-settle alarms and a nightly bill comparison exist (after the October incident).Partly: add a stored "why zero" reason per request and the per-part cost breakdown.
Price list refreshRejects a fetched price list with fewer than 50 models, or one that shrank by more than half, and keeps a bundled backup.Catalog drafts are reviewed; regressions need a probe.Yes, the shrink guard is cheap insurance on any automated price sync.
Large contentPrompts are off by default. Media is replaced with "[image omitted]", every string is cut to 2,048 characters, and credentials are masked. The full payload can go to S3 under a key computed at request time and written into the log row.Full content in object storage; nothing truncated.Yes, the request-time key (the body's location is known from the request, so no pointer row has to be written) and the media placeholders for previews and search text.
SessionsA session id read from many client headers: LiteLLM's own, x-claude-code-session-id, Codex session-id and thread-id, x-session-id, and the session part of Anthropic's metadata.user_id. Claude Code subagents become child sessions, and a parent-session header links them.session_key already reads the Claude Code and Codex headers and metadata.user_id, and records agent_key; not yet shown anywhere.Add x-session-id, Helicone's headers and the parent-session link.
RetentionSpend logs retained by age and by size, with Postgres range partitions dropped whole, because "batched DELETE leaves dead tuples autovacuum cannot reclaim".No retention on the largest tables.Yes. This is our November 9 cause.
Rate limitsReserves estimated tokens before the call and reconciles after. Fails open to per-pod memory when Redis is down, unless set to fail closed. Its "sliding window" is a fixed window that allows about twice the limit at a boundary.Exact rolling windows; MemoryDB required.No.
FailoverNever puts the only deployment of a model in cooldown. Needs a minimum request count before judging a failure rate. Cools down only on 429, 401, 402, 404, 408 and 5xx. Has separate fallback chains for context-window and content-policy errors.Breakers, lane demotion and slow-lane recovery.Worth comparing with ours: the "never cool down the last option" rule and the separate context-window fallback.
PrivacyLogging can be turned off per request, per key and per callback. Each team's logs can go to its own tracing account. Guardrails can be set to mask content only in what gets logged.One org-wide switch, zero data retention per request, broadcast to the org's destinations.Maybe a per-key "do not store" flag, which also solves the internal Decisions callers.

What not to copy

Best-practice review

Each row takes one well-established engineering practice, what the source says, and how our system measures up. Sources were read on 2026-11-09.

Practice and sourceWhat it saysWhere we standWhat to do
Transactional outbox
microservices.io
Write the message in the same transaction as the change; a relay publishes it afterwards; delivery is at least once. follows for money and usage: receipt streams, settle_outbox, the ClickHouse outbox and the credit feed are all written in the same step as the change. gap for captures: the inbox row is created by a Storage commit that the gateway waits for. Captures: make the durable handoff something that does not depend on our database (an S3 PUT whose event lands on SQS).
Idempotent consumer
microservices.io, AWS SQS
Because delivery can repeat, the receiver records message ids and skips duplicates. follows: receipts are unique by (kind, receipt id); MemoryDB applies each credit event id once; one usage event per request id; ClickHouse collapses repeats. Keep this rule for every new consumer, including the capture loader: S3 events can arrive twice.
Dead-letter queues
AWS SQS DLQ
After a set number of failed receives, move the message aside so it stops blocking or looping; alarm on the shelf; keep it longer than the main queue; redrive after a fix. follows on the illegal-content review queue. gap on every Postgres handoff: 298 capture items stuck in metadata_pending since November 6, and one bad ClickHouse outbox row would hold Spend's cutoff indefinitely. Give each handoff an attempt count, a parked state with the last error, an alarm, and a redrive command. SQS gives this for free in the target design.
Watch the age of the oldest item
AWS Builders' Library: queue backlogs
Queue length and failure rate show trouble late. The age of the oldest unprocessed item shows it early. A one-hour outage needs double capacity for another hour to catch up. partly: Spend reports already stop at the oldest undelivered outbox row, but there is no single alarm on oldest-item age for the receipt streams, settle outbox, ClickHouse outbox and capture inbox. One alarm per handoff on oldest-item age, plus headroom to drain faster than traffic arrives.
Shed load early, and never for a side job
AWS Builders' Library: load shedding
Reject excess work at the first service that sees it, instrument every rejection, and alarm on rejection volume. follows at the edge (fair share, retryable 429) and on key reads (!1039). gap: the capture buffer sheds the customer's request because a background step is slow, deep inside the worker. Capture should not refuse customers; spill outside the serving process, count skipped captures, and alarm. Mandatory-retention orgs need an explicit rule (decision below).
Isolate tenants in shared queues
AWS Builders' Library: queue backlogs
Backpressure on one shared queue punishes every tenant on it. Use per-tenant limits, sharding, or a spillover queue for a noisy tenant. partly: receipts are sharded by org into 8 streams; the capture buffer is one shared pool per pod, so one org's very large bodies can fill it for everyone. Per-org budget in the capture buffer, or per-org fairness in the loader queue.
Keyset pagination
Use The Index, Luke
Seek past the last row seen with a unique tiebreaker in the sort and the index; never OFFSET deep pages. follows: the request list seeks on (org, created_at, request_id) and freezes the window across pages. Keep it when the list moves to ClickHouse (seek on the sort key there too).
ClickHouse key and deduplication
ReplacingMergeTree guide, multi-tenancy
Duplicates collapse only at background merges, so reads use FINAL, which is cheap when the query filters on key columns. Put the tenant in the ordering key; order columns by increasing cardinality. follows: every read is filtered to one org and uses FINAL; we do not sum materialized views, because a retried insert would be counted twice there. A session table should order by (org, session, time) so one session's rows sit together.
Full-text search in ClickHouse
text indexes, skip indexes
The Bloom-filter indexes Helicone uses (ngrambf_v1, tokenbf_v1) are now deprecated. The dedicated text index (a real inverted index, GA from 26.2) is the recommended way, queried with hasToken, hasAllTokens and hasPhrase. not built: no body search today. A text index on a truncated, privacy-gated preview column. Check our ClickHouse version first.
Durable in-memory ledger
MemoryDB consistency, Valkey scripting, cluster spec
A MemoryDB write succeeds only once it is in the multi-AZ log; reads from the primary always see the latest write. A script blocks its shard while it runs, so keep scripts short; multi-key scripts need all keys in one slot (hash tags). follows: one hash tag per org shard, short scripts, reads from the primary, a reconciler that reports drift. Keep scripts small as money rules grow (the parity fixes add logic); watch per-shard CPU.
Retention by partition, not DELETE
Postgres partitioning, vacuum settings
Dropping or detaching a whole partition is far faster than a bulk DELETE and avoids vacuum work entirely. By default, autovacuum waits until 20% of a table's rows are dead. On a 200 GB table, that is a lot of cleanup at once. Per-table settings can lower the threshold. gap: the largest tables have no retention and no partitions; storage.objects carries 10.7 million dead rows; vacuum on these tables caused November 9. Time partitions plus a retention window for gateway_chain_authority_receipts, audit_log and the per-request ledger tables (their history is in ClickHouse); per-table autovacuum settings meanwhile.
Object events and the claim check
S3 event destinations, claim check pattern
Put the large payload in object storage and pass only a reference. S3 notifications arrive at least once, usually within seconds, possibly duplicated, and not in order. target: matches the planned S3 to SQS to Fargate pipeline. The loader must not assume order: a request's complete record can arrive before its prompt checkpoint. Treat the complete record as authoritative and deduplicate by key.
Standard session and trace attributes
OpenTelemetry GenAI conventions, Helicone sessions
OpenTelemetry names a conversation gen_ai.conversation.id (still marked Development). Helicone uses three headers: session id, a slash path like /plan/step-1, and a session name. partly: session_key accepts several inputs but neither of these. Accept Helicone's headers and the OpenTelemetry attribute as session inputs, so customers switch without code changes and traces from other tools line up.

Ideas beyond parity

Decisions this needs from you are collected, with context and recommendations, in First questions for the owner.

Gaps and best practices

This section pulls the research together into two lists: what our data needs before a real session view can exist, and which practices from the review we should adopt.

What a complete session view needs here

  1. A session id on the analytical row. Copy session_key, parent_response_id, agent_key, plus an optional session name and path, onto the usage event and into ClickHouse usage_events. Sort the ClickHouse table so one session's rows sit together.
  2. Session totals that are not recomputed per page. Turns, duration, cost, tokens and errors per session come from ClickHouse, ideally a session table kept current by the exporter. They never come from the Postgres ledger.
  3. Real parent edges. Build the tree from parent_response_id, subagent keys and an optional path header, not from strings alone.
  4. Headers that match Helicone's. Accept Helicone-Session-Id, -Path and -Name next to X-Explabs-Session-Id, so teams can switch without code changes.
  5. A session list and a session detail page. Waterfall timeline, tree, cost rollups, and the existing drawer, plus a batch body read for one session.
  6. Search inside sessions. A searchable text projection of captured bodies, kept in ClickHouse with a token or n-gram index and the same consent, ZDR and erasure rules as the objects. The full bodies stay in Storage.

Rules to keep while building it

Next: the plan for session parity and search, with the order of the changes and the decisions it needs from you.

November 9: the target Kion set

The November 9 refusals made one thing clear: a customer request could still end up waiting on a Postgres write, through the capture buffer and Supabase Storage. Kion's direction answered that directly. The section below is the target as first drawn on November 9. Two parts of it changed later in review: the spillover sidecar was cut (D2 keeps memory, then the pod's disk, then a metadata-only record), and the queue became two queues on November 21.

Target architecture, as drawn on November 9

Kion's direction for this work has three parts. First, the request path never depends on how fast Postgres writes. Second, captures land in our own S3, S3 announces each new capture on SQS, and one durable pipeline on ECS Fargate loads them into Postgres and ClickHouse in the background; the same pipeline also runs offline tagging. Third, tables that change constantly get a retention window or move out of the main database. The unmerged trace pipeline stack (!492 to !525) is the starting point.

flowchart LR
  C["Client"] --> CF["Cloudflare"] --> E["Edge"] --> G["Gateway worker"]
  G <-->|"limit, hold, settle"| M[("MemoryDB")]
  G --> P["Providers and our GPUs"]
  G -->|"capture via spillover sidecar,
S3 PUT, consent facts inside"| S3R[("Our S3 raw bucket")] S3R -->|"object created event"| Q[["SQS capture queue
with dead-letter queue"]] Q --> FG["Fargate pipeline, scales on queue depth
step 1 ETL, step 2 offline tagging"] FG -->|"processed body"| S3P[("Our S3 processed bucket
key = org and request")] FG -->|"summary row, preview, session ids"| CH[("ClickHouse")] FG -->|"only what money and authorization need"| PG[("Postgres")] M -->|"receipts"| WB["Writeback"] --> PG PG -->|"outbox"| CH UI["Dashboard and API reads"] -.->|"lists, search, totals"| CH UI -.->|"one body, after authorization"| S3P
Nothing on the left of the S3 PUT touches Postgres. A slow database delays the right-hand side, never a customer.

What changes, and why each piece is there

  • Our own S3 instead of Supabase Storage for captures. An S3 PUT writes no row in our database, so the buffer slot frees as soon as S3 confirms. storage.objects stops growing with traffic.
  • SQS instead of a Postgres inbox table. S3 announces each new object on SQS. AWS scales the queue for us, retries are built in, and a message that keeps failing moves to a dead-letter queue instead of being retried forever. updated 2026-11-21: two queues now, one for gateway captures and one for span-ingest segments, each with its own consumer and dead-letter queue, so a span flood cannot delay captures.
  • Consent facts travel with the capture. The gateway already decides consent and zero data retention once, at authorization. If it writes that decision into the capture object, the loader no longer has to wait for the writeback to create the request row. Erasure still takes priority: if an org opts out after the upload, its objects must still be deleted.
  • Fargate consumers that scale on queue depth, outside the serving cluster. One pipeline does both loading (ETL) and offline tagging. The EKS Project worker then stops processing captures.
  • Capture never refuses a customer (decision needed): when a worker's capture buffer is full, the worker either moves the capture to a separate helper container (a sidecar) or skips it and counts the skip. Either way it serves the request. Orgs under mandatory retention need an explicit rule.
  • Retention on the churning tables. A window or partitioning for gateway_chain_authority_receipts, audit_log, and the per-request ledger tables, whose history already lives in ClickHouse.

November 9 and 10: making /v1 survive a database outage

Part 4 explains why a short Postgres restart breaks /v1 today. This section is the first plan to fix it, written on November 9 and 10. The infra plan below later added a blocker this plan missed (the model-chain check on every request), and the November 18 work replaced the 5-minute stale limit with the MemoryDB deny set and a 60-minute bound.

flowchart LR
  REQ["/v1 request"] --> GW["Gateway worker"]
  GW --> KEY{"Key and grant
in cache?"} KEY -->|"fresh, under 2 s"| SERVE["Serve"] KEY -->|"stale or missing"| PG[("Postgres")] PG -->|"answers"| SERVE PG -->|"errors or slow:
breaker opens"| STALE{"Last good value
under 5 min old?"} STALE -->|"yes"| SERVE STALE -->|"no, brand-new key"| REFUSE["Refuse with a retryable 503"] SERVE --> MDB[("MemoryDB:
reserve and settle")] MDB -.->|"receipts queue,
written back when Postgres returns"| PG
During a Postgres outage the gateway keeps serving known keys from its last good data, money keeps settling in MemoryDB, and the receipts land in Postgres when it comes back. Only callers the gateway has never seen are refused. updated 2026-11-18: the 5-minute stale limit is superseded: blocks come from the MemoryDB deny set and allowed answers are served for up to 60 minutes; protected chains also need a maintenance window. updated 2026-11-21: Fixed. On 2026-11-20 keys and grants were bounded at 15 minutes in the code. Every outage path now uses one 60-minute bound, OUTAGE_SERVE_STALE_SECONDS in explabs/outage_bound.py, pinned by a test.

The table lists each change, how it works, what it buys and what it risks. Some rows carry later updates, marked with their date.

#ChangeHow it worksBenefitDrawback or risk
1Don't mark workers unready when the database is unreachableReadiness reflects whether the worker can serve: catalog loaded, MemoryDB reachable. A failed Postgres ping becomes a warning and a metric, not an unready verdict.The edge keeps routing to workers through a database restart instead of returning 502 for every request.A worker that truly cannot serve must still fail its own requests fast, which is what change 5 does. Monitoring must alert on the database itself, not rely on pods going unready.
2Serve cached key and grant data up to about 5 minutes old when Postgres errors updated 2026-11-18: superseded: blocks live in MemoryDB, so allowed answers are served for up to 60 minutes of outage. updated 2026-11-21: Fixed. On 2026-11-20 keys and grants were bounded at 15 minutes in the code. Every outage path now uses one 60-minute bound, OUTAGE_SERVE_STALE_SECONDS in explabs/outage_bound.py, pinned by a test.The authority cache keeps the last good answer per key hash beside the 2-second fresh entry. On a Postgres error or open breaker, a lookup returns the last good entry if it is under the stale limit. The limit is one setting.Every key that has called in the last few minutes keeps working through a restart. That covers nearly all real traffic.Your decision: during an outage, a key revoked, an org banned or quarantined, or a spend lock applied in the last few minutes can keep working until Postgres returns, up to the stale limit. A brand-new key cannot be served, because it has nothing cached.
3Serve the last good pricing, plan and promotion dataThe pricing, plan-discount and promotion caches already exist. On a refresh error they keep serving the previous value instead of failing the request.Requests keep being priced and admitted with the terms that applied a moment ago.A price or promotion change made during the outage applies only after recovery. Charges in that window use the previous terms. For a few minutes this is acceptable; it should be logged.
4Move the key "last used" timestamp off the request pathToday the request path writes last_used per key. Instead, record it in memory and flush it in batches every minute or so, dropping failures.Removes a Postgres write from every request, which helps load as well as outages."Last used" in the dashboard can lag by a minute or two, and can lose a value if a pod dies before flushing. It is informational, so that is acceptable.
5Fail fast with a circuit breakerA breaker around Postgres calls on the request path opens after a few consecutive errors or timeouts. While open, calls skip Postgres at once and use the fallbacks above. It probes again every few seconds.Requests stop waiting 10 to 30 seconds per lookup; a short outage costs milliseconds, not timeouts. Also protects Postgres from a thundering herd when it comes back.A wrongly tuned breaker could open on a brief blip and serve stale data unnecessarily. Thresholds need testing under load.
6Alert on the MemoryDB writeback backlogPage when receipts waiting in the MemoryDB streams exceed a threshold or their age passes a few minutes.An outage longer than planned is visible before the backlog grows large. Usage and billing in Postgres catch up on their own when it returns.None. MemoryDB is durable, and receipts are deleted only after Postgres commits them, so a backlog loses nothing.

What still breaks during a database outage

  • Responses API continuations (previous_response_id), whose state lives in Postgres.
  • An organization's or key's very first request, which has nothing cached.
  • Keys still on the Postgres ledger path: batches, customer-plan (reseller) keys and video.
  • Captures, until they move to our own S3 (see Target architecture); today a slow Postgres can refuse captured requests.
  • The dashboard, sign-in and admin pages: about 1 to 3 minutes of errors. They can show a maintenance banner.
  • updated 2026-11-18: also still broken: protected model chains outside a planned maintenance window (52% of production traffic), pods starting during the outage, and new quarantines, bans or key revokes, which are written to Postgres first.

How a resize then runs

  1. Build and test changes 1 to 6, including a 3-minute database cut under load on staging. updated 2026-11-18: rehearsals run on the preview only, per the owner, and the bar is a 10-minute cut; 41 to 70 s cuts have run so far.
  2. Rehearse the resize on the existing restored-backup project platform-2tb-rehearsal-20261029: time the restart and confirm the staged max_connections value survives it.
  3. In production, stage max_connections with no restart, pick the quietest hour, freeze deploys, and make sure no disk change happened in the last 4 hours.
  4. Announce maintenance on the status page, trigger the compute change (one restart applies both), watch /v1 keep serving and the writeback backlog drain, then raise the pooler's pool size (no restart).

Alternatives considered

The table compares the other ways to change the database size, by downtime and effort. The first row is the recommendation.

OptionDowntimeEffortNotes
Resize in place after changes 1 to 6 (recommended)/v1: none for known keys; dashboard: 1 to 3 minutes1 to 2 weeksAlso protects against unplanned Supabase incidents and future RDS failovers.
Second Supabase project kept in sync by logical replication, then switchSeconds to minutes at the switch3 to 6 weeks per moveWorks for our tables (production has wal_level=logical and 80 slots). Auth and Storage schemas need Supabase support. About 6.7 TB of capture files to copy. Scheduled jobs and webhooks must not run on both sides. Needs max_slot_wal_keep_size raised from 3 GB (about 8 minutes of writes) first.
Move to AWS Aurora or RDS (Blue/Green, or Aurora Serverless v2 online resize)Under a minute per switch afterwards2 to 4 monthsThe only path to real high availability. Means self-hosting Auth, PostgREST and Storage and replacing pg_net, Vault and preview branches.
A PgBouncer we control, paused during the switchSeconds of queued requestsPart of either move aboveDoes not cover PostgREST or Auth, and cannot hide a 2-minute restart on its own.

Also worth doing: consider point-in-time recovery, and ask Supabase about an Enterprise plan with an SLA (the Team plan has none).

November 9 and 10: the first questions for the owner, and the analyses behind them

Each decision below says what is being decided, why it matters, the options, and what we recommend.

Final: D8 · Decision 1 · search

May a text copy of prompts and responses live in ClickHouse for search?

Why it matters. Nobody can search the content of requests today. Bodies sit in object storage, which cannot be searched. Helicone keeps whole bodies inside ClickHouse, so its search works, but every search scans everything, bodies vanish after 3 months, and large bodies lose all non-English characters.

Options. (a) No search. (b) Whole bodies in ClickHouse, as Helicone does. (c) A trimmed copy of the message text only: no images, audio or files, with a size cap per request. It has a real text index and is stored under the same key as the body, so deleting the body (erasure, expiry, opt-out) deletes it too.

Recommendation: (c), worked through in Analysis 1. It gives fast search inside a session and across the organization at a fraction of the storage. It holds only what the organization already agreed to store, never zero-data-retention traffic. Build it with the S3 capture pipeline, so each capture is read once.

Final: D2 · Decision 2 · capture under pressure

When capture can't keep up, serve the request uncaptured, or refuse it?

Why it matters. Today the gateway refuses the customer's request (503 capture_unavailable) when its capture buffer is full. On November 9 that refused 123 requests from 76 organizations because Postgres was slow. Refusing protects a promise to keep everything. Serving protects availability.

Options. (a) Keep refusing for everyone. (b) Serve everyone and count the missed captures. (c) Serve and count for everyone, except traffic we must keep: uncensored models, which are always retained, and organizations with a contract to retain everything. That traffic keeps refusing.

changed in review: D2 cuts the chain to memory then a metadata-only record, counted per tier; uncensored traffic is no longer must-keep, per the live privacy policy; only written retention contracts refuse.

Recommendation: a fallback chain that ends in (c), worked through in Analysis 2, with an alarm on missed captures. Once captures go straight to our own S3, the buffer fills only when S3 itself is down, so either branch should almost never happen.

Final: D14 · Decision 3 · media

For images, audio and video, store the bytes or only a summary?

Why it matters. These requests store nothing today. An image is about 1 to 3 MB, a speech response up to 64 MB, a transcription upload up to 25 MB, and a video tens to hundreds of MB. Customers who use these surfaces will expect to see what they sent and got back.

Options. (a) Summaries only: type, size, duration, prompt text. (b) Bytes for everything. (c) By kind: store images and audio as their own objects, deleted with the capture. For video, store the prompt, the reference image and the job's result, and copy the MP4 only for organizations paying for retention. For embeddings, store the input text and a summary of the vectors.

Recommendation: (c), with costs per surface in Analysis 3. It covers what people look at, keeps the cost proportional, and lets paid retention include video.

Final: D14 · Decision 4 · Decisions traffic · decided Nov 10

Capture Decisions requests for customers, and exclude our own callers?

Why it matters. Decisions requests (/v1/systemone, /v1/decisions) are never stored, whoever calls them. Customers' decisions would be useful in Observability. But our own content review sends excerpts of other tenants' prompts to Clef, and the signup scan sends personal data, both through an Experiential Labs key. Storing those would copy tenant content and personal data outside the tenants' deletion rules.

Options. (a) Keep not storing any. (b) Store all of them. (c) Store customers' decisions under their storage switch. Mark our internal keys "do not store content", and keep only what the quarantine decision needs: scores, matched tags, which window of which request was judged, and the decision taken.

Decided: (c). The judged request's own capture is the evidence, and it follows its tenant's rules. The per-key storage setting that makes this possible is the same one customers get.

Final: D14 · Decision 5 · per-key storage

May a key store content when its organization's switch is off?

Recommendation: no. A key can only tighten the organization's setting: store less, or expire sooner. That keeps the organization's switch a promise the whole organization can rely on.

Final: D13 · Decision 6 · retention defaults

What changes first in retention?

Recommendation: ship customer-set expiry and paid retention first, since both only shorten or extend what a customer chose. A default expiry for free organizations, and an archive of valuable data for our own use, come after the terms and privacy pages are updated, because the privacy page currently promises pairs are kept "as long as capture stays on". updated 2026-11-20: the owner answered "free plan: we retain". The plan reads that as no free-plan expiry at all; that reading awaits his confirmation. Until then the code keeps the free-default switch, switched off.

Final: D12 · Decision 7 · Helicone provider keys

What happens to a provider key sent through Helicone's proxy hosts?

Decided by the no-change goal (Nov 10): on Helicone hosts, accept the customer's own provider key per request, use it for that call only, never store it, and record the request as the customer's own-key traffic. Anywhere else, the usual rule stays: a provider key is stored as a connection first.

What people need. Find the request where the agent said a certain thing, inside one long session or across the organization, in any language, within about a second. Today no content search exists. Bodies are compressed objects in storage, and the only searchable fields are ids, labels and conversation handles.

The fact that shapes the design. An agent sends its whole conversation so far on every call. In a 3,000-turn session, request 3,000 contains turns 1 to 2,999 again, request 2,999 contains turns 1 to 2,998, and so on. Indexing every request's full prompt stores turn 1 three thousand times, so storage and search time grow with the square of the session length. That is why Helicone's search is slow, and why it deletes bodies after 3 months.

The idea. For each request, index only what is new in it: the messages added since the previous turn, plus the model's response. Each piece of text is indexed once. For example, searching "refund policy" in a session returns the three requests where that text first appeared or was answered, in under a second; clicking one opens the full conversation from S3. The text index works like the index at the back of a book: it jumps straight to the matches instead of reading every request.

OptionSpeedStoragePrivacy and deletionEffort
A. Whole bodies in ClickHouse (Helicone)Slow: their n-gram index is too small to skip anything, so every search scansEvery body stored twice; grows with the square of session lengthA second full copy to delete; they expire it after 3 months, which also loses the dataM
B. New text only, in ClickHouse with a text indexFast: ClickHouse's inverted text index (generally available from 26.2; production runs 26.6) finds tokens without scanning, filtered to one organization or sessionEach request stores only the messages that are new since the previous turn, plus its response, without images or files, capped per request. Volume grows with session length, not its squareSame key as the body object, so erasure, expiry, opt-out and zero data retention delete both in one step; a test can prove nothing searchable outlives its bodyM
C. Separate search engine (OpenSearch, or a search-on-S3 engine such as Quickwit)Fast, with richer rankingSimilar to BA third system holding customer text, with its own deletion path to keep in syncL, plus a new system to run
D. Scan objects on demandSeconds to minutes for a long session; unusable across an organizationNone extraSimplestS
E. No searchn/aNoneSimplestnone

Recommendation: B. Index each request's new text plus its response, in ClickHouse, with the text index. Keep every character (no ASCII stripping), and cap each request's indexed text, for example at 64 KB, recording when it was cut. updated 2026-11-18: built at 32 KB per request with a token index. The full conversation for a match is rebuilt from the session, and the full body is one object read. Search runs scoped to the organization, optionally the session, and combines with every Requests filter.

Conditions: only content the organization already agreed to store goes in; never zero-data-retention traffic; it is built with the S3 capture loader so each capture is read once; and the privacy page names it as part of stored content.

Analysis 2: when capture cannot keep up, including fallbacks

What happens today. Each gateway pod holds a capture in a buffer until its upload commits. The buffer holds up to 2,048 records and 256 MiB in memory, then spills to up to 4 GiB of local disk. A Supabase Storage upload commits a row in our Postgres, so a slow database fills the buffer. A full buffer makes the engine refuse the customer's request: 123 requests from 76 organizations on November 9. The refusal exists so that traffic we must keep is never served without its copy.

Falling back instead of refusing. A full buffer is the last stage of a chain. Each stage should give the capture somewhere else to go before the customer is affected:

flowchart LR
  REQ["Request served"] --> B["In-memory buffer"]
  B -->|"normal"| S3A[("Our S3,
primary region")] B -->|"S3 slow"| SP["Spill to a sidecar's disk,
outside the serving process"] SP -->|"when S3 recovers"| S3A SP -->|"primary bucket failing"| S3B[("Second bucket,
other region")] SP -->|"disk full too"| META["Keep a metadata-only record:
sizes, hashes, model, reason missed;
count and alarm"] META -->|"must-keep traffic only"| REF["Refuse new requests
of that traffic"]
The customer is affected only after every other place to put the capture is full, and then only for traffic we are required to keep.

The table compares three ways to behave when capture cannot keep up. Read the "Customer impact" and "Fits the must-keep promise" columns together: only an option good on both is acceptable.

OptionCustomer impactCaptures lostFits the must-keep promiseEffort
A. Refuse (today)Requests refused whenever Postgres is slowNoneYesnone
B. Serve, count the missNoneEvery capture during the slowdownNo, for uncensored and contract trafficS
C. Fallback chain (diagram)None, except must-keep traffic after every fallback is exhaustedOnly when memory, sidecar disk and both buckets all fail; then a metadata record remainsYesM
D. Keep less (prompt only, or truncated) under pressureNonePart of each captureNoS

Details that make C work:

  • The sidecar. Spilled bytes live in a separate container in the same pod, so a burst of large bodies cannot push the serving process out of memory. Its disk should survive a container restart. A pod deletion loses whatever is still spilled, which is why the second bucket exists.
  • Must-keep traffic is known before the call. Uncensored models and organizations with a contract to retain everything are decided at authorize, so the gateway knows which requests may be served uncaptured and which may not.
  • Every miss is visible. The metadata record says why the capture was missed, and an alarm fires on the rate of missed captures per organization. A missed capture is never silent.
  • Postgres leaves the chain entirely. With captures going to our own S3, a slow database can no longer fill the buffer at all. This fallback chain only matters when S3 or the pod itself is in trouble.

Recommendation: C. Build it with the S3 capture pipeline. Until then, a smaller version is worth shipping on its own: serve and count for all traffic except must-keep traffic.

Analysis 3: images, audio, video and embeddings

What is at stake. These requests store nothing today, so a customer using them sees only metadata in Observability. Keeping media costs storage, but object storage is cheap. S3 Standard is about $0.023 per GB per month, and moving cold data to Infrequent Access (about $0.0125) or Glacier Instant Retrieval (about $0.004) cuts that by 2 to 6 times.

SurfaceTypical sizeStorage cost per 100,000 requests, per month kept (S3 Standard)What people look atRecommendation
Images (generation, edits)1 to 3 MB per imageabout $2 to $7The image itself, as a thumbnailStore each image as its own object, deleted with the capture; drawer shows a thumbnail through a short-lived link
Speech (text to speech)about 1 MB per minute of audio; up to 64 MBabout $2 to $10 for typical clipsPlaying the clipStore the audio as its own object; audio player in the drawer
Transcription (speech to text)up to 25 MB upload; small JSON transcriptup to about $58 at the 25 MB maximumThe transcript, sometimes the audioStore the transcript always; the audio only on paid retention. Voice can identify a person, so default to less
Videotens to hundreds of MB per jobabout $230 to $2,300 at 100 MB to 1 GBThe prompt, reference image, a frame, the result statusStore the prompt, reference image, the job's result and one poster frame; copy the MP4 only on paid retention, before the provider deletes it (Veo keeps videos for 2 days)
Embeddingsup to 2,048 inputs, each about 3,072 numberslarge, and rarely useful to look atThe input text, how many vectors, dimensionsStore the input text and a summary of the vectors (count, dimensions, usage); vectors themselves only behind a setting

Recommendation: store by kind, as in the last column. Images and speech are cheap and are what people want to see. Transcription audio and video files are expensive or sensitive, so they are kept in full only for organizations that pay for retention. Embedding vectors are kept only on request. In every case the media is its own object under the capture's key prefix, so deleting a capture deletes its media. After 30 days, media moves to a cheaper storage class automatically.

Order: the shared media-reference part of the capture document first, then images and speech, then transcription, then video.

November 10: the infra plan after the dashboard incident

On November 10 the dashboard overloaded for about six hours (told in Part 4). The incident owner handed the long-term items to this plan. Items 10 and 11, and the state-placement analysis, come from the November 11 post-mortem's list of ways to isolate the API from the dashboard. The detailed designs for items 1, 2, 5, 6 and 7, with code references, are at the end of this section.

One idea runs through all of these items: every wait on Postgres must be bounded, visible, and survivable. A request should give up quickly with a clear error instead of queueing. Background jobs should run at a set pace instead of as fast as possible. The paths customers depend on should keep working on cached facts for a few minutes when Postgres is gone.

#ItemWhat is wrong todayPlanSizeFirst step
1/v1 through a short Postgres outage, and the API request path off Postgres (post-mortem item 2)Every request checks the model chain in Postgres (authorize_model_chain, control_store.py:2684), even with warm caches. Key and grant caches last 2 s with no stale fallback. last_used is a synchronous write. About 100 s into an outage, every pod fails its readiness check and leaves the load balancer at once.
  1. Take the chain check off the request path first (chain revision rows never change, so they can be cached forever; protected revisions for 15 s).
  2. Then decide where each kind of per-request state lives instead of Postgres (see Where per-request state lives).
  3. Then: readiness that depends on the catalog and the money store only; last-good keys, grants, limits and prices for a few minutes; last_used buffered and flushed every 60 s; a circuit breaker with short checkouts on the request path; an alert on writeback age and backlog.
LCache immutable chain revision rows, behind a shadow comparison
2Control-plane database access8 sessions per process, borrowed with no timeout. The web app gives up after 20 s, but the control plane keeps working on the abandoned request for up to 120 s. The autoscaler watches CPU, which stays idle while pods wait.A larger bounded pool that gives up after a few seconds with a retryable 503. A deadline header from the web app, so abandoned work stops at its next database call. An alert on database wait (p95 over 2 s for 5 minutes) instead of scaling on it. A deploy guard that refuses a replica count whose connections would exceed the pooler budget (200 of 225 session slots). Finish transaction mode (!1100).S to MPool wait timeout and the deadline header
3Resize Postgres without downtimeAny change to compute size, max_connections or pool size restarts Postgres, usually for under 2 minutes. Our plan has no failover or blue/green, and read replicas cannot be promoted.Item 1 first, so /v1 rides through a restart (see Restarting the database with zero downtime). Then a rehearsed, announced in-place window that batches every restart-only setting. Longer term: a second Supabase project with logical replication for cutover, or a move to Aurora. Both are large and need their own decision.M, then LRehearse a restart on staging and measure what breaks
4Reads that grow with workers times organizationsEvery gateway worker re-reads some tables on every tick: geo_purchase_gated_orgs (scanned about once a second), organization provider policies, the paid-organizations list, and credential release, which leaves a transaction open around the credential fetch. Stale gateway_workers rows are never cleaned.Read by change: a version number per table, and re-read only rows newer than the last version seen, like the geo-gated sync already does. Close the transaction before fetching a credential. Delete worker rows not seen for a day. The per-tick reads and lane security are designed on the Catalog Architecture page, sections 11 and 12.MIndex the geo scan; close the credential transaction
5Pace wallet_check64 Project worker pods each ask every 5 s; the winner checks the next 500 organizations and starts over immediately. A full pass of 417,000 organizations finishes every 4 minutes, nonstop.The state row decides when the next batch may start: a short gap between batches, and one full pass every 45 to 70 minutes. Old pods keep asking and simply get "nothing to do". Later, check only organizations whose wallet changed, with one full sweep a day.SOne additive migration; measure one batch on production
6Capture pipeline813 captures in metadata_pending are retried every 5 minutes forever, because a prompt whose request row never arrives returns early (capture_inbox_worker.py:207) before the step that would drop it. There is no dead-letter state. Every processed capture writes storage.objects in the main database about three times. A full buffer refuses customers.Now: fix line 207, add a parked state with a reason after 24 hours or 300 attempts, page on parked rows that must be kept, add a replay command, and process claimed captures in one batch. Erasure must still reach parked rows. Then: the S3, SQS and Fargate pipeline in the database plan above, and the capture fallback chain in Analysis 2.S now, L laterFix line 207 and park the 813 rows
7Release tooling
  • Releases only need their commit to be on main, but finished-release recovery still requires main's newest commit (production-deploy.yml:396), so any merge breaks it.
  • Merge freezes rely on sessions messaging each other.
  • gitlab_ci._read fails on the first GitLab error.
  • About 3,900 stale manual preview jobs broke a listing that reads at most 500.
  • The smoke test's usage check waits only 10 s, while the writeback lagged 3 to 9 minutes that day.
  • Pin recovery by containment like releases, which removes the need for a merge freeze. Until then, the release job blocks merges through GitLab's protected-branch setting and always restores it.
  • Retry GitLab reads 4 times with backoff.
  • Stop preview tooling from creating manual jobs that are never run, and clean old ones automatically.
  • Size the smoke test's wait from the measured writeback lag, with a clear "writeback lagging" failure.
  • Let finished-release recovery refresh its fleet proof right before the evidence recheck. The proof must be under 30 s old there, but the GitLab active-jobs query alone can take about 16 s plus retries, so a recovery can expire on timing alone (it happened once on November 10; the retry succeeded).
S to MRetry in gitlab_ci._read
8Lanes pointing at test hostsSome organization-owned lanes point at webhook.site, lhr.life and oast addresses, left over from a penetration test. Customer endpoints can point anywhere except the deny lists.Disable those lanes now. Then restrict organization-owned lane hosts: refuse known request-capture and tunnel domains, and require a verified host for new custom endpoints.SDisable the lanes (a production write)
9Rotate exposed secretsThe Supabase PostgREST JWT secret, Cloudflare tokens and R2 keys appeared in chat on November 10.Rotate each, update every consumer (Porter env groups, CI variables, local operator files), and confirm the old values are refused. Rotating the JWT secret signs out every session and invalidates service tokens, so it needs a short announced window.SToday: Cloudflare and R2 first; JWT secret in a planned window
10Read replica for dashboard reads (post-mortem item 1)The control plane and web app read everything from the one primary Postgres. On November 11 one expensive dashboard query overloaded it, the balance-ledger writeback slowed, and captures refused about 3,400 requests. Later, ad-hoc 7-day ledger scans and one busy organization slowed the writeback again. A read replica already exists and is unused.
  • Route control-plane and web reads that can tolerate a few seconds of lag to the replica, through one typed replica client. It falls back to the primary when lag passes a threshold, and reads from the primary right after the user saved something.
  • Inventory every read first. Dashboard, admin, analytics and listings can use the replica. Read-after-write, money and admission, chain and release machinery, settle and writeback, and anything inside a write transaction stay on the primary.
  • Roll out behind a flag, staging first.
  • Related cheap fix: replace the control plane's per-process lock around PostgREST calls with a connection pool.
  • Whether the catalog gets its own database is evaluated, not decided (see below).
MConfirm the replica's size and lag; inventory reads; ship the replica client behind a flag
11Separate deploy units (post-mortem item 4)The ledger writeback (explabs-ctl-production-ledger-writeback) runs as a separate deployment inside the control-plane app, so it shares that app's environment, release and rollback. On November 11 a bad environment change crash-looped control-plane pods. One edge app (explabs-api-production) serves both /v1 and the dashboard's /api relay, so slow dashboard calls (13 s /api/models calls that day) occupy the same edge workers and connections as /v1, and every edge deploy touches both.(a) Make the writeback its own Porter app with its own environment, release and rollback. (b) Split the edge into one app for /v1 and one for the dashboard /api relay. This isolates processes and deploys, not the database: pods also fail on CPU, memory, connection pools, crash loops, bad configuration and failed deploys, and separate apps contain those. It belongs with the four-writeback-pod change (!1146).SWriteback as its own app; then the edge split

Where per-request state lives final: D1, D6

Taking the API request path off Postgres means every kind of state a request needs must live somewhere a request can read in microseconds to a few milliseconds, with the right guarantees.

Silen's concern about MemoryDB is that it is "just a cache store". The distinction matters. AWS ElastiCache is a cache, but MemoryDB is AWS's durable in-memory database. It acknowledges a write only after the write reaches a transaction log copied across availability zones, so an acknowledged write survives a node failure (AWS documentation).

Two questions stay open: is that durability enough for us as the system of truth for live balances, and should a single AWS service hold that role? The wallet tests answer the first question with data. The table gives the options for each kind of state a request needs, with a recommendation per row:

State a request needsHow exact it must beWorker-memory snapshot (like !1171)MemoryDBDurable ObjectsRecommendation
Key and authorization (key, organization, grants)A revoked key must stop within seconds; a new key must work at onceFits: the whole key set fits in memory, refreshed by a version poll. A brand-new key not yet in the snapshot falls back to one database readPossible, but adds a network hop for data that rarely changesPossible; another vendor on every requestWorker-memory snapshot with a version poll of a few seconds, a database fallback for unknown keys only, and never caching a refusal
Catalog, prices, routes, promotionsMinutes of staleness are acceptable; changes are publishedAlready done: the catalog is a published snapshot in worker memory, and !1171 did the same for the :free list with zero database reads per request (about 0.07 cores to refresh)Not neededNot neededWorker-memory snapshot (today)
Model-chain checksRevision rows never change; protected revisions change rarelyFits: cache revision rows forever, protected revisions for 15 sNot neededNot neededWorker-memory cache, the first step of item 1
Rate limitsApproximate within a second is fine; must be shared across workersDoes not fit: each worker would see only its own trafficFits: shared counters, today's limiterFits: one object per organizationMemoryDB (today), or Durable Objects if the wallet moves
Balances, holds, spend caps (money)Exact, durable, one organization updated in order, never overspentDoes not fit: not durable, not sharedFits: atomic scripts per organization shard, multi-AZ durable log; Silen's concern is its role, not its durabilityFits: one object per organization, strongly consistent and durable, but slower per write and on another vendorDecide with the wallet tests. Postgres stays the permanent record, written in the background either way
CapturesMust not be lost for must-keep trafficOnly as a short bufferNoNoOur S3 (database plan step 2)
Request rows and usage historyExact, but can arrive seconds laterNoOnly in transit (receipts)Only in transitPostgres and ClickHouse, written in the background (today)

Restarting the database with zero downtime final: D16

Why we need a restart. Production Postgres is version 17.6 on a Supabase 4XL machine (16 GB of shared buffers, 480 connections). Several settings that would help can only change when Postgres restarts:

  • the multixact buffers, still at their defaults of 256 KB and 128 KB. Multixact churn (bookkeeping Postgres does when many transactions lock the same rows) hurt us in the November 12 and 13 settle-drain incidents;
  • possibly the transaction and subtransaction buffers (1,024 each today);
  • the maximum number of connections;
  • the machine size itself.

We want all of them in one restart.

What a restart costs today. Set the new values without restarting (supabase postgres-config update --config multixact_member_buffers=256,multixact_offset_buffers=128 --no-restart), then resize the machine in the dashboard, which restarts Postgres once. Postgres is unavailable for about 2 to 5 minutes. During that time every route that reads the database fails, and so does /v1, because each request reads Postgres to authorize and reserve.

Why "zero downtime" can't mean Postgres never pauses. On a managed Postgres with a single primary, Supabase gives our plan no failover or blue/green switch, so the database itself always pauses during a restart. Zero downtime has to mean something else: customers notice nothing, because nothing they call needs Postgres during those minutes.

How we get there

  1. Requests stop needing Postgres (infra item 1). Money checks already run on MemoryDB. What is left is moving API key checks, permissions and the catalog into worker memory or MemoryDB, as laid out in Where per-request state lives. Then a /v1 request never makes a Postgres round trip.
  2. Every write a request causes waits instead of failing. Receipts already wait in MemoryDB's streams and are applied when Postgres returns; the writeback did exactly this at 20 times normal backlog this week. Captures and usage records get the same treatment: they queue (in S3 and MemoryDB) and are applied afterwards.
  3. The dashboard reads from the replica (infra item 10). updated 2026-11-18: no read replica exists in any environment yet, so dashboard pages error during a restart. During the window, dashboard pages keep working from the read replica. Things that write, such as creating a key or changing a setting, answer "try again in a minute". That is only visible to people in the dashboard, not to API traffic.
  4. The restart becomes one planned maintenance step, made easy by separate deploy units (infra item 11): pause the scheduled jobs and the writeback, restart Postgres, resume them, and watch the backlog drain.

What customers see after that. updated 2026-11-18: protected model chains need a planned maintenance window opened before the restart; see What changed on 2026-11-18. No /v1 errors. Dashboards and usage figures run a few minutes behind until the backlog drains.

The alternative, and why it comes second. A blue/green database copies data to a new instance by logical replication, then switches over. It still freezes writes for a few seconds at the switch, and on Supabase it is much more work. Making requests independent of Postgres also protects us from unplanned database trouble, which blue/green does not. Prefer it. The full options are in postgres-zero-downtime-options.md on the Desktop.

Until then: if the restart can't wait, do it in a short announced window at the lowest-traffic hour, with every restart-only setting in the one restart. Expect 2 to 5 minutes of /v1 errors.

Should the catalog get its own database? final: D5

Evaluated, not decided. The catalog (models, lanes, aliases, chain tables, publishing) is joined in the same transactions as keys, organizations and admission: authorization reads them together, and chain publication fences admission. Moving it to its own database would mean either giving up those joins or copying the data both ways.

The table weighs the options for where that data lives.

OptionWhat it buysWhat it costs
Keep it in the main databaseNothing changes; transactions stay simpleCatalog reads and publishes keep competing with money writes
Serve catalog reads from the replicaDashboard catalog pages leave the primary; the gateway already reads a published snapshotSmall: part of item 10. Publishing stays on the primary
Its own databaseFull isolation of catalog loadAbout the primary's compute again (around $1,000 a month), plus rewriting every transaction that joins the catalog with keys or admission, and the chain-publication fence. Large

Recommendation: serve catalog reads from the replica first. Consider a separate database only if catalog writes still hurt the primary afterwards.

Being built in the incident session, not duplicated here: per-organization write batching for receipt apply and the settle drain (removes the organization-row convoy that put one organization's writeback 55 minutes behind on November 11), a CI gate on hot-path queries with alerts, heavy cron jobs moved to ClickHouse, and blue/green deploy work (!1195, !1197).

Order of work

The table orders the infra items by when they should be done, and says why in that order.

WhenItemsWhy in this order
Today9 (rotate secrets), 8 (disable the test-host lanes), and the fixes already shipping: catalog view cache, !1104, !1105Exposed credentials and attacker-style endpoints are live risks
This week6 now (line 207, parking, batch, alerts); 7 GitLab read retry and stale job cleanup; 5 pacing; 2 pool timeout and deadlineSmall and independent; each removes a known load source or failure
Next two weeks10 read replica (inventory, client, flag); 11 writeback as its own app, then the edge split; 7 recovery pinning; 7 smoke wait; 2 database-wait alert, pooler guard and !1100; 4 read-by-change for the per-tick readsNeed a staging soak
This month1 (chain check off the request path, then stale caches and the breaker); 3 rehearsal on stagingTouches every /v1 request; ship behind a shadow comparison
This quarter6 S3 and SQS pipeline; 3 longer-term database optionsNew infrastructure

Decisions for this plan

changed in review: blocks now come from a MemoryDB deny set, so allowed answers stay valid through an outage without letting blocked organizations spend.updated 2026-11-18: stale allowed answers are now bounded at 60 minutes; protected chains are served through a planned maintenance window, after a MemoryDB witness design was built and dropped. updated 2026-11-21: Fixed. On 2026-11-20 keys and grants were bounded at 15 minutes in the code. Every outage path now uses one 60-minute bound, OUTAGE_SERVE_STALE_SECONDS in explabs/outage_bound.py, pinned by a test.

Final answers at the time:

Detailed designs

Consolidated from the load-resilience proposals page (main 01a7a4b01, 2026-11-10). The catalog follow-ups (promotions by audience, the shared catalog base, the per-tick reads, lane host security) are on the Catalog Architecture page.

What the research found

Changes item 2

Every /v1 request touches Postgres

Even with every cache warm, each request runs authorize_model_chain: the chain epoch, the revision row, the protected-revision row, and for protected revisions a lease and a receipt write (control_store.py:2684, model_chain_authority.py:110). During an outage every request fails after 10 to 30 s. A stale key cache alone would save nothing.

Changes item 5

Releases no longer need main's head

A production release checks only that its commit is contained in main (chain_release_approval.py:325). Only finished-release recovery still requires main's head (production-deploy.yml:396). The merge freeze can shrink to recovery, or disappear if recovery is pinned the same way.

Changes item 4

Stuck captures are a code bug

A prompt whose request row never appears returns before the step that would drop it (capture_inbox_worker.py:207), so it is retried every 5 minutes forever. That fits the 813 rows retried about 1,280 times since 11-06.

Design detail: control-plane database access

Each control-plane process can make 8 database calls at once and waits forever for a free slot; replace that with a larger bounded pool that gives up quickly, stop work the website has abandoned, and alert on database wait rather than scaling on it.

Today

Design

  1. Bounded pool. EXPLABS_POSTGREST_CONCURRENCY (default 32) instead of 8; borrow with get(timeout=min(remaining deadline, 5 s)); on timeout raise DatabaseBusy and answer 503 with Retry-After. Hidden queueing becomes fast, visible shedding.
  2. Deadline from the website. The website sends X-Explabs-Deadline (now + 19 s). Every database call checks the remaining time before borrowing and caps its read timeout at it. A route abandoned by the website stops at its next database call.
  3. Size against PostgREST, not just pods. PostgREST has its own Postgres pool on Supabase's side; more control-plane concurrency than about twice that pool only moves the queue. Check PostgREST's pool size for the current compute before choosing 32.
  4. Alert, do not scale, on database wait. More pods add load when the database is the bottleneck (the 2026-09-05 floor of 10 doubled database time). Publish db_wait_ms from the request log as a CloudWatch metric; page at p95 over 2 s for 5 minutes and drive the status page's Dashboard component from it. Lower the CPU target to about 40% once pods shed instead of waiting.
  5. Pooler budget as a deploy guard. Sum of session clients across apps ≤ 200 of 225; transaction pool plus PostgREST plus Supabase internals ≤ 440 of 480. Fail the deploy when replicas × connections per pod would exceed it.

Design detail: /v1 through a database outage

The Observability page's plan (readiness that ignores Postgres, stale-OK caches, a breaker, a writeback backlog alert) is right, but it misses one blocker: every request makes a Postgres round trip for the model-chain check, and that has to come off the request path first.

What happens today during an outage, step by step, is the table in Part 4. The design below changes each step.

Design

For each read the gateway needs, the table gives how fresh it must normally be, how stale it may get, and what the gateway does when Postgres fails.

ReadFreshStale allowedWhen Postgres fails
Chain revision rows (immutable)forevern/aServe from cache
Protected revisions and worker lease updated 2026-11-18: decided: a planned maintenance window; receipts are not recorded in MemoryDB.15 s5 minServe from cache; receipt writes need an owner decision (refuse protected revisions with a retryable 503, or record receipts in MemoryDB and write them back)
Key authority, grants2 s5 min (owner)Last good value; never cache a "no"
Limit policiesas now10 minLast good value, counted
Prices, promotionsas now10 minLast good value, logged
last_usedBuffered in memory, flushed every 60 s, dropped on failure

Design detail: pacing wallet_check

Keep the accounting check running, but let the state row decide when the next batch may start, so one full pass takes about 45 minutes instead of running back to back forever.

Today: 64 Project worker pods each call wallet_check(500) every 5 s; the winner checks the next 500 orgs and wraps around immediately. Production measured 1,550 to 2,000 orgs a second, a full pass every 3.5 to 4.5 minutes, nonstop.

alter table public.wallet_check_state
  add column next_run_at timestamptz, add column pass_started_at timestamptz;
-- app_settings: wallet_check_batch_gap = '3 s', wallet_check_pass_period = '45 min'

-- inside wallet_check, after the skip-locked select:
if v_state.next_run_at is not null and clock_timestamp() < v_state.next_run_at then
  return 0;                                   -- same meaning as losing the lock today
end if;
-- start of a pass:        pass_started_at = now()
-- after a batch:          next_run_at = clock_timestamp() + batch_gap
-- at the wrap-around:     next_run_at = greatest(pass_started_at + pass_period,
--                                                clock_timestamp() + batch_gap)

Design detail: the capture pipeline

Stop the endless retries with a dead-letter state and a one-line fix, process captures in batches to cut database round trips, and then move the raw hop to our own S3 and SQS so a slow database can never refuse a customer.

Why rows loop

metadata_pending covers five different conditions: no request row, org deleted, complete record waiting for its request row, projection not ready, and any write failure. Backoff caps at 5 minutes and attempts are unlimited. The bug: a prompt with no request row returns at capture_inbox_worker.py:207 before admission, which would have dropped it.

Now (one migration and a small worker change)

  1. Dead-letter. Add parked_at and park_reason; park after 300 attempts or 24 h in a waiting state; split the outcome into request_missing, projection_wait, admission_error, upload_error (still accepting the old name). Erase non-retained prompts with no request row after 6 h. Retained rows are never deleted automatically; they park and page.
  2. Erasure must still win. A parked row would block an org's opt-out forever, so the claim also returns parked rows of orgs that meet the erase rule.
  3. Replay. gateway_capture_inbox_replay(paths or reason, limit), service-role only, behind a full-scope admin route, audited.
  4. Fix line 207 so prompts without a request row reach admission's drop rule.
  5. Batch. Send all 8 claimed records through one write_batch and delete their raw objects in one call: about 3 times fewer database round trips. Process complete records first so prompts get the cheap "superseded" erase.
  6. Alerts on the existing engine: oldest ready row over 10 minutes; any new parked row; any parked retained row.
Do not add consumers blindly

Each processed capture writes storage.objects about three times in the main database, which is the mechanism behind the November 9 refusals. Add parallelism in steps, watching commit latency and capture_unavailable.

Later: our own S3, SQS and Fargate

The work is split into three phases, each with a clear "done when" test.

PhaseWorkDone when
P1Adapt the never-applied Terraform (infra/traces, !492) to an ECS task role; apply in staging, then productionReviewed plan; alarms routed
P2S3 sink (reuse !493) and SQS-to-Fargate loader; only the raw hop moves; consent facts travel in the object; the loader rechecks generation, erasure and deadline before storingEnd-to-end replay green; erasure race tests green; dead-letter queue empty
P3Production, one gateway fleet at a timeNo capture_unavailable through a vacuum window
P4Processed documents at deterministic keys in our bucket; ClickHouse rows; complete records carry settle facts so the loader stops waiting for the request rowstorage.objects stops growing
P5Remove the Supabase inbox trigger and table

Blocker carried from !509: the gateway must stop retrying a raw upload once its authority deadline passes.

Design detail: release tooling

Messages between sessions cannot enforce a merge freeze; remove the dependency where possible, enforce it with the release job where not, and make the smoke and recovery tools tolerate the conditions they are run in.

(a) Merge freeze

(b) Smoke check vs writeback lag

The usage-evidence check in smoke_gateway_v1.py:1041 polls for 10 s. On November 10 the writeback was 3 to 9 minutes behind, so a healthy release failed. Proposal: read the writeback lag (section 2's metric), set the budget to clamp(10 s + 2 × lag, 10 s, 180 s), and fail with a distinct WRITEBACK_LAGGING (lag=N s) when lag is the reason. Still fail hard if the lag metric is missing.

(c) writer_inventory GitLab 500s

gitlab_ci._read raises on the first error with no retry, so one GitLab 500 aborts recovery. Retry GETs 4 times with jittered backoff (about 15 s total) on 5xx, 429 (honoring Retry-After) and transport errors; never on other 4xx; restart the job listing from page 1 after a mid-walk failure so the result is one consistent listing. It stays fail-closed.

November 10: the database and capture plan final: D2, D3, D11

This is the work Kion's threads point to. The November 9 refusals showed that a customer request can still end up waiting on a Postgres write, through the capture buffer and Supabase Storage. The goal is that no customer request depends on how fast Postgres writes, and that the tables that change the most stop growing without limit in the main database.

Where it stands

  • Fast-ledger parity fixes (!1053, !1056, !1058, !1059, !1060, !1061, !1062, !1063, !1064, docs !1054): merged at 64d1d708e and verified on staging. They are live: production moved from 72edcb540 to ac6b6938f on November 10 (floor epoch 98), with their 9 migrations and everything merged before it, including !1039. After it lands: run the !1053 backfill with false, then bring Kion the charging-mode decision.
  • S3 and SQS capture pipeline: not built. The Terraform for our own buckets, queue and key was merged in !492 but never applied, so none of those resources exist in AWS. The code stack !493 to !525 was closed unmerged. It is the starting point, rebuilt onto current main.

The steps, in order

  1. Apply the infrastructure. Create the raw and processed capture buckets, the SQS queue with its dead-letter queue, and the KMS key from infra/traces (Terraform from !492), after review. This is a production write, so it goes to Kion.
  2. Gateway writes captures to our S3. The worker uploads each capture straight to the short-retention raw bucket. An S3 upload writes no row in our database, so the capture buffer frees a slot as soon as S3 confirms, whatever Postgres is doing. The consent and zero-data-retention verdict, which the gateway already decides at authorize, is written inside the object, so the loader never has to wait for the request row.
  3. S3 announces, SQS queues, Fargate loads. S3 sends an event for each new object to SQS. A Fargate service that scales on queue depth then, in one pass:
    • reads the object;
    • writes the processed document to the long-retention observability bucket, under a key built from the organization and request;
    • writes the summary row to ClickHouse;
    • writes only what money and authorization need to Postgres;
    • runs offline tagging.
    S3 events can arrive twice or out of order, so the loader deduplicates by key and treats the complete record as the final word.
  4. Capture never refuses a customer (decision 2 below). When the buffer is full, the worker serves the request and counts the skipped capture, except for organizations that must retain everything. Spillover moves into a sidecar outside the serving process, so a burst of very large bodies cannot push a gateway pod out of memory.
  5. Every background worker moves to ECS Fargate (Kion Sync). updated 2026-11-18: superseded: workers stay in EKS; Fargate runs the capture ETL only. The legacy Project worker pods leave EKS, and capture loading, offline tagging, exports and the other background jobs run as ECS services and batch jobs that scale on their own queues, away from the serving cluster.
  6. Dead-letter handling everywhere. Every Postgres handoff (receipt streams, settle outbox, ClickHouse outbox, credit feed) gets an attempt count, a parked state with the last error, an alarm on the age of its oldest item, and a redrive command. SQS gives the capture queue this for free.
  7. Retention on the churning tables. Time partitions with a retention window for gateway_chain_authority_receipts (67 GB, no retention), audit_log (311 GB), and the per-request ledger tables, whose history is already in ClickHouse. Old partitions are dropped whole, which costs no vacuum work. storage.objects stops growing once captures leave Supabase Storage.
  8. ClickHouse becomes the list and search store. The request list, session views and search read ClickHouse; bodies come from S3, one request at a time. See the sessions proposal.

Open merge requests that belong to this plan

Each row is one open merge request, what it does, its state on November 10, and the next step it needed.

MRWhat it doesStateNext step
!1047Moves MemoryDB billing, reservations, settlement and capture into a private Rust extensionRequired checks failing; needs unpublished engine 0.7.235; author holdOwner decision on Rust in platform images, then publish the engine, bump pins, get CI green
!1001The request row keeps the real refusal reason on the balance ledger instead of a generic quota messageClean, tested, 74 commits behindRebase, re-run checks, merge
!999A busy ClickHouse usage read waits up to 4 s for a slot instead of answering 429 at onceClean, testedRebase, merge
!1012Captures that arrive before their request row keep their 5-minute wait during an opt-out cleanupMigration version collides with mainRenumber, rebase, merge
!578Drops the retired capture copier's leftover SQL (functions, queue, trigger)Behind; edits other migrations' headers by mistakeRenumber, revert the header edits, re-derive from live definitions
!1088Captures batch lines like live requests; adds the capture-path catalogCI runningMerge when green
!972Pages when the ledger writeback or the credit feed falls behindNeeds rebaseRebase, merge (part of step 5)
!1002 / !1065Two competing ways to serve admin telemetry from ClickHouse summariesBoth cleanPick one (the review favors !1002), close the other
!1033Grouped alert rules, threshold history and PagerDuty deliveryScans the ledger every minute; no retentionRead the hourly rollup, stagger the cron minute, add retention
!588 / !596Keep sandbox demo usage current by moving it, not adding more; then drop the old generatorsHourly UPDATE on hot tables; design agedRedo as a fresh MR
!933 / !935Batched balance settlement prototype (off by default); traffic replay of the November 2 row-lock slowdownDraft and uncheckedDecide whether still needed now that MemoryDB is live

Where main stood on November 10 and 11: changes and status

This table records the changes related to this work on main as of November 10 and 11, each with its state. It shows what was already live, what was merged but waiting for a deploy, and what was still open, before the new design was built.

updated 2026-11-18: this table shows main as of November 10 and 11. The new build is on unmerged PR #2980 and 12 local split branches; see What changed on 2026-11-18. updated 2026-11-20: the split branches are now open PRs #3090 to #3101, none merged.

done live in production · built merged or provisioned, not in use · waiting merged, waiting on a deploy or a decision · not started

ChangeStatusDetail
MemoryDB balance ledger in productiondoneReserving and settling money no longer lock the org's row in Postgres. Burst test Nov 4: 30 req/s for one org with flat latency and no effect on neighbors.
Settle outbox and ClickHouse export on the control planedoneUsage events and rollups are no longer written inside the money transaction.
Gateway uploads captures without its own Postgres call (!1024)doneLive since Nov 5. The upload still commits rows in Postgres, inside Supabase Storage.
Capture inbox throughputdoneProject worker raised to 64 pods; inbox drained (62 new items when checked).
Status page and fleet-wide alarmsdonestatus.experientiallabs.ai reads the probe alarms that page PagerDuty.
Fast-ledger parity fixes at 64d1d708e (!1053 auto top-up, credit floor, Spend page; !1056 payment quarantine; !1058 free refills; !1059 publish manifest; !1060 rollover; !1061 admin readers; !1062 grants and reconciliation; !1063 signup scan; !1064 anti-abuse; !1054 docs)doneLive: production floor epoch 98 on ac6b6938f (Nov 10), which contains these. After it lands: the !1053 backfill (run with false) and a charging-mode decision for Kion.
Capture processing on Fargate (switch)builtThe service and the switch exist. The switch is set to worker, so the Project worker still does the work. The service does not yet scale on queue depth.
Illegal-content review on SQS and FargatedoneRuns in production with a dead-letter queue; scores with clef on our GPUs.
Trace pipeline AWS resources (raw and processed buckets, SQS, KMS)builtTerraform merged (!492) but never applied: no buckets or queue in the account.
Gateway writes captures to our S3; SQS-driven loader (!493 to !525)not startedStack closed unmerged; revive and rebase onto current main.
Consent facts inside the capture object (!498 idea)not startedThe loader would no longer wait for the writeback to create the request row.
Capture never refuses a customernot startedNeeds an owner decision for mandatory-retention orgs.
Capture spillover outside the serving processnot startedProtects gateway pods from out-of-memory kills on large bodies.
Dead-letter handling for capturesnot started298 rows stuck in metadata_pending since Nov 6 (live). SQS provides this built in.
Retention or partitioning for churning tablesnot startedgateway_chain_authority_receipts 67 GB with no retention; audit_log 311 GB; ledger tables whose history is in ClickHouse. The empty capture archive bucket is a first step for free-org captures older than 14 days.
ClickHouse as the list and search store for requestsnot startedSummary row with session ids and a searchable preview; Postgres keeps only money and authorization facts.
Request log API for any org key, agent prompt, per-org key read limit (!1039)doneMerged Nov 9 as 9594290d1; live since the Nov 10 release ac6b6938f. Any org key reads its own request list, one request with include_body, attempts and the ClickHouse rollups; "Copy agent prompt" above the Requests table; 10 reads/s with bursts of 30 and 4 in flight per org per control-plane pod.
/v1 survives a database outage: no unready on DB loss, stale key and grant cache, last good pricing, batched last-used, circuit breaker, writeback backlog alertnot started1 to 2 weeks. Needs your decision on the stale limit for keys (about 5 minutes). See Surviving a database outage.
Database resize and max_connections raise in one rehearsed windownot startedAfter the item above; rehearse on platform-2tb-rehearsal-20261029 first.
Admin Telemetry: platform rollup in ClickHouse instead of SELECT * ... FINAL over raw rowsnot startedPage broken: most loads time out at 18 s. See API audit.
Admin directory reads (users, orgs, overview, accounts export) off the ledger tablesnot startedAt the 8 s statement timeout. Needs query plans first.
Catalog snapshot for /api/models, /api/models/{slug}, /api/v1/models, cached at Cloudflare for anonymous readsnot startedAbout 58k database-heavy calls per 6 hours; a snapshot would free control plane database connections.
Catalog publish moved out of the approve requestnot startedapprove-batch takes 49 to 85 s inline.
Capture batch lines; capture-path catalog (docs/capture-paths.md, !1088)waitingOn branch capture-batch-and-websocket (0ed5eaaa1), not yet on main.
Infra items from the November 10 incident (outage-proof /v1, control-plane pool, resize, per-tick reads, wallet_check pacing, capture parking, release tooling, test-host lanes, secret rotation)not startedSee Infra plan after Nov 10. Rotation and the test-host lanes are for today.
Consolidate all background workers on ECS Fargate; remove the legacy Project worker pods from EKSnot startedupdated 2026-11-18: superseded: workers stay in EKS; Fargate runs the capture ETL only. Agreed in the Kion Sync, Nov 11. See Database plan.
Full agent traces: caller trace ids on every request, live OTLP span ingest, one trace view combining customer spans and our LLM calls, a trace API and exp traces CLInot startedSee Full agent traces.
Custom trace tags scored by Clef as calls arrive (customer-defined questions, online tagging step, filters, alerts, backfill)not startedSee Custom tags scored by Clef. Needs Clef capacity sized first. updated 2026-11-18: any judge model now; no longer waits on Clef capacity.
Wallet comparison tests: MemoryDB vs Durable Objects vs celld on replayed trafficnot startedSee the wallet comparison.
Gateway and per-organization wallet at the edge (Durable Objects or celld)open decisionProposed in the Kion Sync; analysis in Going faster at the edge recommends prototyping the non-money parts first. updated 2026-11-18: decided: no edge gateway; measured instead (D15).
Value-based retention and customer-set expirynot startedSee Valuable data and expiry; needs terms and privacy page updates first.
Helicone customers move with no change: same hosts, keys, headers, SDKs and API, served by us; history copiednot startedSee Helicone customers, no change.
Storage setting per API key; internal Clef keys store outcomes onlynot startedSee Storage per key.
Capture embeddings, images, speech, transcription, video and decisionsnot startedAn engine change per surface plus a shared media-reference part; decisions need a no-capture rule for our internal callers first. See Capture paths.
Per-org admission cap for high-volume customers (Koodos)waitingAll 108 failures in the Nov 4 burst were this cap; the enterprise label lifts it per org, Kion's decision.

Snapshot: every open merge request on November 10

On November 10 we reviewed every open merge request on GitLab, read-only, to see which ones belonged to this plan and which were stale. The list is kept here as a record. It went stale on November 17, when the platform moved to GitHub and GitLab main was frozen.

Show all 144 merge requests (GitLab, November 10)

updated 2026-11-18: stale. This list is from GitLab on November 10; the platform moved to GitHub on November 17 and GitLab main is frozen.

All 144 open merge requests on 2026-11-10 (73 by Kion, 71 by Silen), reviewed read-only against main. Nothing was merged, closed or commented on. Current main is being deployed to production now, so everything already merged goes live with it.

Counts: 9 ready, 21 rebase then merge, 25 need changes, 17 need a decision, 6 drafts, and 66 already on main that should be closed.

Ready to merge (9)

Checks pass and the change applies cleanly to main.

MRAuthorTitleWhat it doesNext step
!1088SilenCapture batch linesBatch requests get their prompts and responses stored like live requests when storage is on; adds the capture-path catalogMerge when CI is green
!1087SilenOut-of-credits offers onceThe out-of-credits prompt stops promising matches the org has already usedMerge
!1082SilenBulk delete private modelsOrg admins select several of their private models and delete them at onceMerge
!1049SilenOverview card overlapOverview cards stop drawing over each other on short or narrow windowsMerge, or close if !1070 lands
!1046SilenClassify org_plan_startsFixes the deletion test that broke after !910 by classifying a new tableMerge after a retention call
!1009KionE2B template built onceEach RL worker builds an E2B sandbox template once, instead of every trial racing to build it (9 of 16 episodes failed)Merge
!935SilenGateway traffic replayA load test that reproduces the November 2 hot-org slowdown locallyMerge (test tooling only)
!885KionUsage copy progress logsThe usage history copy script logs its plan, a heartbeat and time leftMerge if the copy has not run yet, else close
!302SilenTrace export scrubberRemoves secrets and personal data before any trace export and blocks ineligible tracesMerge; migration sorts below main's newest

Rebase, then merge (21)

Still needed and sound, but behind main or with small conflicts.

MRAuthorTitleWhat it doesNext step
!1076SilenPayment risk reviewRefunds wait for an operator's Keep / Refund / Email choice in Slack; single-card 3DS waiverRebase (one conflict)
!1070SilenOne Usage pageMerges Overview and Observability Analytics into one Usage pageRebase (three conflicts)
!1012KionCapture wait during opt-outCaptures that arrive before their request row keep their wait during an opt-out cleanupRenumber its colliding migration, rebase, merge
!1001KionRefusal reason on request rowOn the balance ledger, the request row keeps the real refusal reason instead of a generic quota messageRebase, re-run checks, merge
!999KionUsage reads wait for a slotA busy ClickHouse usage read waits up to 4 s for a slot instead of answering 429 at onceRebase, merge
!972SilenWriteback lag alertPages when the ledger writeback or credit feed falls behindRebase (one test conflict)
!888KionRename to offline taggingRenames the illegal content review pipeline to offline taggingRedo the rename on current main, after !628
!876KionRemove local model registrationsA full admin can remove an org's local model while keeping its historyRebase; measure catalog publish time first
!821KionRepurchase after cancelBuying a plan again after cancelling opens a fresh checkoutRebase, merge
!698KionRemove redundant HTTP testsRemoves 16 duplicate test cases; no product changeRebase and re-run CI, or close as low value
!628KionClef capture isolationWhen one capture download fails, only that capture is retried, not the whole review batchRebase, merge before !888
!477SilenDocs: unknown message fieldsDocs say unknown message keys are ignored and disclosed, not rejectedRebase
!439SilenHide drained modelsModels drained for good leave /v1/models and the storefrontRebase (two conflicts)
!436SilenDollar formatter floorDaily-cap refusals never round a total up to the limitRebase
!413SilenUncensored fallback discountUncensored requests served by the regular model bill at 50% offLarge rebase (8 conflicts)
!404SilenReconcile runtime v2Three slow nightly reconcile checks read the day efficientlyRebase (two conflicts)
!387SilenTenant origin dispatchCustomer endpoints get the engine's port and address deny listsRebase (five conflicts)
!283SilenModel page QuickstartOne closable Quickstart on every model pageRebase (one conflict)
!108KionTrim admin search whitespaceAdmin searches ignore pasted leading or trailing spacesRebase, run CI (it never ran), merge
!107KionCredit removal is not a refundAdmin copy says removing credits does not refund a Stripe paymentRebase, merge
!95KionDocs: pin one providerDocs section on pinning one provider for a requestRebase, merge

Needs changes first (25)

A colliding migration version, failing checks, or a problem the review found.

MRAuthorTitleWhat it doesNext step
!1085SilenProvider routing transparencyLane order from a visible score breakdown; provider placement controlsFix failing checks (migration guards, manifest, integration)
!1081SilenUncensored capture fix and audit APIFixes reading forced uncensored captures; admin review-score API; docs pageFix failing checks
!1080SilenPromotion free-only adminAdmins set the free-only promotion rule from the formRenumber colliding migration; resolve one conflict
!1072SilenPlayground Agent modePlayground models run as agents on a sandbox computerRenumber colliding migration; fix failing checks
!1052SilenPromotion exact build, bounded chunksFixes the nightly promotion stats job on busy promotionsRenumber colliding migration; close !705
!1051KionStaff trace content permissionLets Support Admins read captured prompts with an audited grantRenumber migration, fix failing web test, and needs your OK
!1033KionAlerts and PagerDutyGrouped alert rules, threshold history, PagerDuty deliveryRead the hourly rollup instead of the ledger every minute; add retention
!1022KionComp with conversion choiceGrants a comp and saves the convert-to-paid choice in one stepRenumber colliding migration; return 409 instead of a 500 on re-grant
!958KionAdmission reasoning probesSmall admission probes leave room for reasoningFinish per its own list, or close (draft, paused)
!791KionStripe fulfillment recoveryFinds Stripe events whose credit never landed and replays themPort two later webhook changes; add retention and paging
!705SilenPromotion exact build, chunk probesEarlier fix for the same jobClose in favor of !1052
!596KionDrop demo generatorsDrops the generators !588 replacesRedo with !588
!588KionSandbox usage conveyorKeeps sandbox demo usage current by moving it, not adding moreRedo as a fresh MR (hourly UPDATE on hot tables)
!578KionDrop capture copier SQLRemoves the retired copier's leftover functions, queue and triggerRenumber, revert header edits, re-derive from live definitions
!539KionSeed review alert ruleSeeds the default rule for !538Rework with !538 (draft)
!538KionReview backlog alertAlerts when the content review queue backs upRework on current alert vocabulary (draft)
!456SilenPromotion rollup cursorEarlier rework of the same jobClose (replaced by the exact build on main)
!417SilenWithdrawn lane refusal copyA withdrawn lane refuses as 'temporarily unavailable'Confirm replaced by lane_out_of_service, then close
!407KionDependency audit in CIOSV audit of uv.lock and pnpm-lock.yamlSplit out unrelated edits, then rebase
!388KionPro bonus eligibilityPro checkout stops showing a bonus that payment would not grantRe-derive the money functions from live definitions
!334SilenOpenRouter listing BYOK priceThe OpenRouter-style listing prices BYOK-first models at the lane the caller paysRedo on current main
!300SilenDemo content read gateDemo refresh reads captures through the read gateFix failing checks
!298SilenFirst-request sweep read gateThe farm sweep reads captures through the read gateFix failing checks and conflicts
!258SilenDrop per-org overflow (held)Removes the old per-org credits-overflow columnsHeld contract change; fix failing checks when released
!240SilenModels page speed round 2Service worker, prefetch, deferred Stripe, compressionFix failing check and four conflicts

Needs a decision from you (17)

The code may be fine; the question is whether we want it.

MRAuthorTitleWhat it doesNext step
!1065KionTelemetry from summariesLarger rewrite of the same, with a projection that slows every usage insertClose if !1002 is chosen
!1057KionWeak payment holds keep purchasesWeak payment-pattern holds still quarantine but stop auto-refunding and cancelling plansReverses your refund policy: your call
!1047KionRust MemoryDB transactionsMoves MemoryDB billing, reservations, settlement and capture into a private Rust extensionDecide on Rust in platform images; needs an unpublished engine release; checks failing; author hold
!1005KionChain route copyAn org alias may copy the route a protected alias serves, unblocking custom models and RL runsNeeds sign-off from the chain-authority owner
!1002KionTelemetry from usage cellsAdmin telemetry sums quarter-hour cells in ClickHouse instead of every eventPick this or !1065 (review favors this one)
!869KionStaging spend ceilingA $50 monthly cap on staging provider spendBuilt on deleted code; rebuild or close
!697KionPlan rolloutShared daily core tokens rollout (draft, on hold)Likely close
!624KionSubscription core v2Versions paid core token allowances per subscriptionPlans moved to daily credits; likely close
!612KionClef shared score cacheShares Clef scores across workers in PostgresDesign obsolete; re-propose or close
!609KionPaid entitlement restoreRestores advertised paid token allowances (draft)Likely close
!518KionLocal stack runs ClickHouseLocal and trial stack run ClickHouseYour call
!402KionInbox proof before accessRequires email proof before signup sessions and API keysReverses the instant-signup design: your call
!117KionTrace tags: node runnerTagging node runnerSame decision as !110
!112KionTrace tags: run APITagging runs with leased claimsSame decision as !110
!111KionTrace tags: deletionTrace tags follow their capture outSame decision as !110
!110KionTrace tags: ClickHouseTrace tag tables in ClickHouseKeep this lane beside request classification, or drop
!54KionDisable prompt-repeat sweepDisables a paused sweep that reads the retired capture tableDelete, port or leave paused

Drafts (6)

Not proposed for merging yet.

MRAuthorTitleWhat it doesNext step
!933SilenBatched settlement prototypeLighter balance locking for well-funded orgs, off by defaultDraft, do not merge; likely close now that MemoryDB is live
!487SilenMoonshot providerAdds Moonshot (Kimi) as a house and BYOK providerDraft, far behind
!318SilenNode fast cap prototypeBatch cap while a :fast request runsDraft
!311SilenJev image input docsDocuments image input for JevDraft, clean and green
!255SilenMiniMax house providerAdds MiniMax as a house providerDraft, CI failing
!53SilenPro renewal dunningOne payment-failed email, then spaced retries for past-due ProDraft; migration collides

Already on main, close (66)

Their changes landed through merge-train bundles or later work, but the merge requests were left open.

MRAuthorTitleWhere it landed
!1020KionRefusals don't reverse paymentsfolded into !1057
!955KionLedger step 4 limiter SQLlanded via !943 and !951
!928KionSettle usage off org lockreplaced by the settle outbox
!926KionQuote test records costlanded as !944
!865KionGeoIP refresh!863
!855KionEngine pin 0.7.226main is on 0.7.234
!735KionDeepSeek promo for all Procampaign ended Nov 2
!729KionFirst-purchase eligibility!815
!632KionClef chunk token count!1031 removed tokenization
!537KionReview suspension rulebundle 23
!536KionReview Clef retrybundle 23
!535KionReview release fixesbundle 23
!468SilenCapability refusals counted!663
!459KionKeep Clef outputrequest classification metadata
!432SilenEC fleet consolebundle 20
!429SilenThrottled lane not coverbundle 20
!427SilenDrain by cache sizebundle 19
!426SilenSpend gate card copybundle 19
!423SilenBedrock BYOK docsbundle 19
!412SilenDrain always stopsbundle 19
!410SilenRemove house Bedrockbundle 19
!397SilenLane status holdbundle 19
!386SilenHeader-hold capbundle 19
!382KionActivity from ClickHouse!586
!362SilenBundle 18 candidateon main; pin now 0.7.234
!361SilenPublish-deferred alertbundle 20
!355SilenName credit grantsbundle 17
!354SilenDraft snapshot tolerantbundle 17
!353SilenEvals importbundle 17
!342SilenRefusal sweep boundsbundle 17
!340SilenFast reservebundle 17
!337SilenAzure unmapped retirebundle 17
!333SilenCapture mirror budgetbundle 17
!332SilenBatch ZDRbundle 17
!331SilenOpenAI 12h cache billingbundle 17
!330SilenImage rates displaybundle 17
!324SilenReasoning header hold 300 sbundle 17
!323SilenDedicated :fast lanesbundle 17
!306Silen:fast priority tier!312
!246Silenclient_test retry filterbundle 8
!227SilenDeletion retry walkbundle 8
!226SilenVertex glm-5.2 reasoningbundle 8
!225SilenPrivate endpoint gatebundle 8
!224SilenInfra denylist privatebundle 8
!223SilenVideo generation activeon main
!220SilenAbuse private DNSon main
!206SilenDeletion cascade pgTAPbundle 6
!153SilenUncapped capture!197
!150SilenCapture completeness!197
!116KionDrop fixed-path copyfold into !578
!115KionDeploy replica URL!197
!114KionCopier reads replica!197, copier later deleted
!113KionMirror attempt protocol!197
!109KionSignup scan uncertaintyrewritten as Clef (!1074)
!69KionAdmission wait as 503main kept a retryable 429 by design
!66KionGateway cutover to Storagemain went another way (!1024)
!65KionCapture writer!197
!64KionPrompt-group labels!197
!63KionCapture writer SQL!197
!62KionPointer counts!197
!60KionPointer deleters!197
!59KionCapture writer role!197
!46KionEvaluations via signed links!197
!45KionIntelligence reads objects!197
!43KionBroadcast reads objects!197
!42KionCapture content viewsbundle !197

Kion Sync, November 11: what is agreed, new, or conflicting

From the Granola note of Silen and Kion's sync on November 11. Each point is checked against this plan and, where the note says something exists, against the code on main.

Agreed: the note and this plan say the same thing

Each row is one point from the Kion Sync note and where this plan covers it.

Kion SyncWhere it is in this plan
The gateway writes to Postgres on the hot path today; the target is to remove thatDatabase plan and infra item 1: no customer request depends on Postgres write latency
The gateway dumps raw traces straight to S3, not PostgresDatabase plan step 2: the gateway uploads each capture to our own S3
One ETL worker pipeline: ETL first (writes S3, Postgres, ClickHouse), then offline tagging downstreamDatabase plan step 3: S3 announces, SQS queues, Fargate loads, and runs offline tagging in the same pass
The API and web read from ClickHouse; opening a trace reads its body from S3Sessions proposal and storage layout
Data layer: MemoryDB, ClickHouse, Postgres, S3Same four stores, plus SQS between S3 and the loader

New: the note adds these, and the plan now includes them

Conflicting or open: needs a decision

Designing sessions, traces and search

With the research done and the target agreed, the next question was what customers should actually get. The proposal below was written between November 9 and 11. It starts from Helicone's weak spots, read in their source code, and designs each piece to avoid them. Several of its open points were later settled in the final plan; each is marked with its decision (for example final: D7).

Proposal: sessions and the Requests page

The goal is everything customers like about Helicone's sessions view, without its weak spots, built for agents rather than single LLM calls. That means:

  • one trace per agent run, shaped the way the customer's pipeline is built;
  • fully usable from an API and a CLI: everything on screen is also available through the API;
  • a three-hour agent session opens as fast as a short one;
  • search works inside a session.

The Requests page at /observability/requests stays the main table: filter it, sort it, open any request, and group it by session when you want the session view.

Where Helicone falls short, and why

From their source code (commit 6b057cd, October 19) and their public GitHub issues:

What customers seeThe cause in Helicone's codeWhat we do instead
It stopped fitting once products became agentsHelicone records one row per LLM call and groups rows by a session header. Customers who moved from single calls to agents (MCP, tool use, loops) need one trace per agent run with every LLM call, tool call and loop iteration nested in it, named and tagged their way. Teams that left Helicone for Langfuse name this as the reason, and say their agents now read traces through a CLI more than anyone opens a dashboard.Full agent traces that combine the customer's own spans with our LLM calls, custom span names and tags, and a trace API and CLI (below).
A long session is slow to openThe session page asks for 500 full requests at a time, prompts and responses included (the maximum is 1,000). An agent resends its whole conversation on every call, so each request is large. For a three-hour session with 60,000-token prompts, one page is about 120 MB of JSON. Large bodies sit in S3, so the browser fetches one link per request, and nothing renders until the slowest one arrives.The session view first loads a skeleton: one small row per request (id, parent, step, model, start, duration, tokens, cost, status), about 200 bytes each. A 5,000-request session is about 1 MB. Bodies load one at a time, only for the request you click.
The totals at the top of a session are wrong for long sessionsStart, end, cost, token and request totals are computed in the browser from the page that is loaded. On a 3,000-request session the header shows the first 500 requests' numbers as if they were the whole session. Requests older than 90 days drop out without notice.Totals come from a stored session summary row, so the header is correct on first paint, whatever the session's length. No silent age cutoff.
Sessions are hard to list and sortThere is no session table. Every view groups all of the organization's requests by session id at query time. The list can only sort by date: the page receives a sort setting and never sends it. Filters on totals run after the grouping. They added a session table once and reverted it the next day.A session summary table, kept current as requests settle. The list is a plain sorted read, sortable by cost, duration, number of requests, errors or most recent activity, with filters on any total.
Opening one session scans the whole organizationThe "switch session" menu on the detail page runs the full session-list grouping over three months of all requests, every time any session opens.Previous and next session come from the summary table's index.
The tree can be wrongThe hierarchy comes only from splitting a path string like /plan/step-1. Two calls on the same path collapse into one node, and there are no real parent links.The tree is built from real links we already record (parent_response_id, Claude Code subagent ids) plus an optional path header. Repeated steps stay separate nodes.
Sessions are not usable from the APIThere is no way to get one session by id, its tree, or its requests. The documented recipe uses an older endpoint that pages 10 at a time and probably returns broken body links for most requests. Their MCP server's session tool only lists sessions. The real workaround, raw SQL, is behind a feature flag and capped at 10,000 rows.Everything the page shows has an API endpoint: one session, its skeleton, its requests by cursor, search inside it, and a streamed export. Agents get the same endpoints through the agent prompt.
Search inside sessions misses thingsBody search is a case-insensitive substring match over full bodies. Its index is too small to skip anything, so every search scans. Bodies stored in ClickHouse are deleted after 3 months. For bodies over 10 MB, only a preview is searchable, and that preview drops every non-ASCII character, so Chinese, Japanese or emoji text is never found.A real text index over the message text of each request, keeping all characters. Search returns the matching requests with a highlighted snippet, inside one session or across the organization.
The page is heavy in the browserThe waterfall chart draws every request as SVG (1,000 requests make a 25,000-pixel image). Neither the tree table nor the waterfall is virtualized. The session is rebuilt on every render, and the whole response is serialized just to compute a cache key.Virtualized rows and a canvas timeline that draw only what is on screen; the tree is built once, in a background thread.
Live mode refetches everythingLive mode reloads the full page, bodies included, every second (every 2 seconds for the list).Live mode asks only for requests newer than the last one shown and appends them.
Navigation and export are thinNo arrow-key navigation in the session view. A link to a request on another page does not open it. Export covers one page, and selected-session export stops silently at 500 rows. An unknown session id shows an empty skeleton forever.j and k (or arrow keys) move between requests. Every request and node has a stable link that opens the drawer from anywhere. Export streams the whole session or filter. An unknown id shows "Session not found".

Full agent traces final: D7

A gateway only sees the LLM calls. Tool calls, retrieval, loop iterations and the agent's own steps happen in the customer's code. A full agent trace therefore combines two sources: the spans the customer's code emits, and the LLM calls our gateway serves. Half of this exists: the gateway reads the caller's W3C traceparent header and exports each call as a span nested under the caller's span, but only to the customer's own Langfuse (observation_export.py). We do not keep that link for our own view.

NeedTodayProposal
One trace per agent run, with LLM calls, tool calls and loops nestedSessions grouped from headers; our view has only LLM calls. Uploaded traces sit in ClickHouse trace_spans with no page and no link to gateway requests.Record the caller's trace id and parent span id on every gateway request (from traceparent). Accept the customer's own spans live over OTLP and through the SDK. Store both in one ClickHouse span table, so the trace view shows the customer's steps with our LLM calls nested where they happened. Sessions become one way of grouping traces.
Spans named, grouped and tagged the customer's wayFixed request fields; tags through one headerSpan names, types (LLM, tool, retrieval, step, custom), attributes and tags come from the customer's spans. OpenTelemetry GenAI attributes and Langfuse's and Helicone's span shapes are accepted as sent. Our LLM spans inherit the name and tags of the span that called them.
Agents read traces without a dashboardThe request log API and agent prompt (!1039); no CLIThe trace API below, plus CLI commands in the exp CLI customers already install (exp traces list, exp traces get <id>, exp traces search), with output an agent can read: the tree first, bodies only on request.
Running it in their own cloudNot offered for observabilityThe four-quadrant model allows the data layer in the customer's cloud; the same trace API then reads their stores.

The default integration: headers on the LLM requests

Customers should not need an SDK to get full traces. Everything that structures a trace can ride on the LLM requests they already send through the gateway:

  • Grouping: a session or run id (X-Explabs-Session-Id, or Helicone's Helicone-Session-Id, -Path and -Name). Coding agents already send their own session ids, which the gateway reads today.
  • Nesting: the standard traceparent header, which most HTTP and OpenTelemetry clients already send and the gateway already reads.
  • Step names, tags and the end user: a step name such as /plan/research/search-1, tags, and the user. The same fields are also accepted in the body fields provider SDKs already expose (metadata, user, safety_identifier), for clients that cannot add headers.

What we work out without being told. In agent traffic, tool use is visible in the LLM calls themselves:

  • A model response that asks for a tool (tool_calls) is followed by a request carrying the tool's result. Pairing the two gives a tool span with its name, arguments, result, and how long the tool took: the gap between the response ending and the next request starting.
  • Each round trip in a session is one loop iteration.
  • Subagents come from the subagent headers (Claude Code's agent id) or from a session nested under another one's traceparent.

When an SDK or OpenTelemetry is still useful. Only for work that never touches an LLM: a retrieval step whose output is not sent to a model, plain code a customer wants timed, or a step that fails before any LLM call. Those spans are accepted over OpenTelemetry, or through the Helicone-compatible SDKs, as an optional extra.

Custom tags scored by Clef as calls arrive final: D10

Customers define their own tags in plain words, and every new call or trace that matches is scored automatically as it arrives. Examples: "the agent gave up on the task", "the user asked for a refund", "a tool call returned an error the model ignored", "the answer cites a source". They can then filter, count, alert on and export by those tags, in the dashboard, the API and the CLI.

How it works.

  1. Define a tag: a name, a yes-or-no question or a 0-to-1 scoring rubric, a threshold, and its scope: which spans it reads (LLM calls, tool calls, or a whole session) and which traffic it covers (keys, models, tags, or a sample rate). The same registry already holds our own policy and descriptive tags (public.classifier_tags); customer tags are rows owned by their organization.
  2. Score as calls arrive: the ETL pipeline's tagging step, which runs after a capture is loaded and is the online tagging Kion is building, sends each matching span to Clef, our decision model, through /v1/systemone. Clef answers every tag question at once, with a score per tag. This is off the request path, so the customer's call is never slowed.
  3. Store the scores with the span in ClickHouse (a tag-score map, as spend_facts.tag_scores already does for our own tags), and the matched tags as span tags. A whole-session tag is scored when the session goes quiet, and again if it resumes.
  4. Use them: filter and sort the Requests table and trace views by tag, chart tag rates over time, send an alert or webhook when a tag fires, and run a tag over past traffic on request (bounded and priced up front).

Rules it follows.

  • It reads only content the organization's storage switch allows, never zero-data-retention traffic. Scores are deleted with the capture.
  • Each organization sees only its own tags and scores.
  • Each scored span is a decisions call billed to the organization at Clef's rates. A sample rate and a monthly cap keep cost predictable.

Capacity is the main constraint. Clef tops out near 30 requests a second today, shared with our own content review. Customer tagging needs either more Clef capacity on our GPU boxes or per-organization quotas, with sampling as the default for high-volume customers. This is the item to size before launch. updated 2026-11-18: superseded: any judge model, with a starvation guard that keeps our own content review served.

Where everything is stored final: D3, D4

One store per job. Money and permissions need transactions, analytics need fast scans, and bodies need cheap space, so each lives where it fits.

StoreWhat goes thereShape
MemoryDBLive money and rate limits onlyPer-organization balance, holds and limit counters. Receipts stream out to Postgres.
PostgresMoney, keys, organizations, permissions, and a short recent window of request rowsLedger tables partitioned by time, old partitions dropped; the long history lives in ClickHouse. No bodies.
ClickHouse usage_eventsOne small row per requestOrganization, time, request id, model, provider, key, end user, status, error, tokens, cost, latency, plus new fields: session id, parent id, path and name.
ClickHouse sessions (new)One row per sessionOrganization, session id, first and last time, request count, errors, tokens, cost, models, users, name. Recomputed after each export batch, so totals are always right. updated 2026-11-21: span sessions fold from per-trace parts.
Session-ordered copy (new)The same request rows, sorted by sessionOrdered by (organization, session, time), so opening one session reads a few blocks instead of scanning the organization.
ClickHouse spans (new)Every span of every traceOrganization, trace id, span id, parent span id, name, type (LLM, tool, inferred tool, retrieval, step, custom), start, duration, status, attributes, tags, and custom tag scores from Clef. The customer's own spans and our LLM calls (linked by request id) sit in one table, ordered by (organization, trace, start), so one trace reads in one pass.
ClickHouse request_text (new)Searchable textOrganization, session, request id, and that request's new messages plus its response, with a text index. Same key as the body, so it is deleted with the body.
Our S3, raw bucketWhat the gateway uploads, short retentionOne object per capture as the gateway wrote it, consent facts inside. Deleted once the loader has processed it (Kion Sync: short-retention bucket for raw gateway dumps).
Our S3, observability bucketFull bodies and media, long retentioncaptures/<org>/<day>/<request>.json.zst for the processed body, with its images and audio beside it under the same prefix. Repeated conversation chunks are stored once and referenced (the trace_dedup format). Retention follows the organization's settings.
SQS"New capture arrived" messagesS3 sends one per object; Fargate loads it into ClickHouse and Postgres. A dead-letter queue holds the ones that keep failing.

How the data gets there

flowchart LR
  GW["Gateway worker
computes session id, parent,
path and name at authorize"] -->|"rides the receipt"| PG[("Postgres
usage event row")] PG -->|"ClickHouse outbox"| EX["Exporter"] EX -->|"1 insert"| UE[("ClickHouse usage_events
now with session fields")] EX -->|"2 recompute only the
sessions in this batch"| SS[("ClickHouse sessions
one row per org and session")] CAP["Capture loader"] -->|"message text,
consent-gated"| TX[("ClickHouse request_text
text index")] CAP -->|"full body"| S3[("Object storage")] API["Observability API"] -.->|"session list, totals"| SS API -.->|"skeleton, request list"| UE API -.->|"search"| TX API -.->|"one body, after authorization"| S3
Session fields are computed once, at authorize, and travel with the usage row. ClickHouse keeps a summary row per session, recomputed from the usage rows after each export batch, so a retried batch can never double-count.
  1. Session fields on every request. The gateway already computes session_key at authorize, from our session header, the Claude Code and Codex headers, or metadata.user_id, with a content hash as the last resort. It also records parent_response_id and agent_key. Next to these we add:
    • Helicone-Session-Id, -Path and -Name, so a team can switch without code changes;
    • x-session-id and a parent-session header, as LiteLLM reads;
    • the OpenTelemetry attribute gen_ai.conversation.id on uploaded traces.
    These fields ride the existing receipt and outbox into the usage row and into ClickHouse. Nothing new is added to the request path.
  2. A session table in ClickHouse. One row per organization and session: first and last time, request count, error count, tokens, cost, models used, users, name, and the newest request id. After each export batch, the exporter recomputes the summary only for the sessions that batch touched, reading their rows from usage_events. Recomputing from the rows, instead of adding the batch's numbers to a running total, means a batch that is sent twice gives the same result. That is the same reason we read with FINAL and avoid summing materialized views today. updated 2026-11-21: for span sessions, recomputing from every row got slower as sessions grew (2.8 to 3.1 million rows, 21 to 64 s per write at 30,000-span sessions). The summary is now folded from one part per trace (ClickHouse 0053), and only the touched traces are recomputed.
  3. Fast reads of one session. To read one session's requests without scanning the organization, ClickHouse needs the rows stored in session order. That means either a copy of the session columns ordered by (org, session, time), written by the exporter, or a projection on usage_events. The trade-off: the load test in !1065 measured a projection on usage_events raising insert time by 35 to 90%, so a separate session-ordered table written by the exporter is the safer start.
  4. Search text. The capture loader writes the new message text of each captured request (only what was added since the previous turn, plus the response; see Analysis 1), without media bytes, into a ClickHouse table with a text index (an inverted index, generally available from ClickHouse 26.2). This table is keyed exactly like the capture object, so erasure, retention and zero data retention delete both together. Only requests that were allowed to be captured ever appear in it. (Decision 1 below.)
  5. The request list moves to ClickHouse as well. It keeps cursor paging on (org, time, request id) and gains sorting and filtering on any column, including session fields. Postgres then keeps only what money and authorization need.

The API

Each row is one endpoint, what it returns, and why it is better than the Helicone equivalent.

EndpointReturnsWhy it beats Helicone
GET /api/orgs/{org}/traces, /traces/{id}, /traces/{id}/searchAgent traces: list with filters, one trace as a tree of spans (customer spans and our LLM calls), and search inside itHelicone has no trace tree; Langfuse users name this as the requirement
GET/PUT/DELETE /api/orgs/{org}/trace-tagsCustom tags: define a question or rubric, threshold, scope and sample rate; read tag rates; start a bounded backfillAutomatic scoring of every new call by our decision model; Helicone has no equivalent
POST /v1/traces (OTLP)The customer's own spans, live, from any OpenTelemetry SDKToday spans can only be uploaded or pulled after the fact
GET /api/orgs/{org}/sessionsSessions, sortable by recent activity, cost, duration, requests or errors, with filters on any total and cursor pagingTheir list sorts only by date and filters after grouping
GET /api/orgs/{org}/sessions/{id}One session's summary: totals, time span, models, users, nameThey have no get-by-id
GET /api/orgs/{org}/sessions/{id}/skeletonEvery request of the session as a small row (id, parent, path, model, start, duration, tokens, cost, status), streamed as JSON linesThey send full bodies to draw a tree
GET /api/orgs/{org}/sessions/{id}/requests?cursor=The session's requests with the request list's fields, by cursorOFFSET paging capped at 1,000 per page
GET /api/orgs/{org}/sessions/{id}/search?q=Requests in the session whose prompt or response matches, with snippetsNo search inside one session
GET /api/orgs/{org}/requests/search?q=The same search across the organization, combinable with every list filterSubstring scan with a 3-month window
GET /api/orgs/{org}/sessions/{id}/exportThe whole session, bodies included, as streamed JSON linesExport stops at 500 rows
GET /api/orgs/{org}/usage/requests?after=Only requests newer than a cursor, for live tailingLive mode refetches the full page every second

Every endpoint works with any organization key, inherits the per-organization read limit from !1039, and is added to the agent prompt and the request log docs. Bodies stay one request at a time, behind the same authorization as the request drawer.

The Requests page

/observability/requests is the one table for finding and reading requests. Sessions are a way of grouping that table, not a separate product.

  • Filter on any column: model, provider, key, end user, status, error class, session, path, cost range, latency range, tokens, time. Search text and filters combine. Filters live in the URL, so a link reproduces the exact view.
  • Sort by time, cost, latency, time to first token or tokens. Sorting stays exact while paging, because the cursor freezes the window as it does today.
  • Group by session. A toggle turns the table into the session list: one row per session with its totals. Opening a row shows the session view: a summary header, a timeline that draws only the visible part, and a tree built from real parent links. The request drawer opens beside both.
  • Conversation view that shows what changed. An agent resends the whole history on every call. The session view shows each turn's new messages, with earlier turns folded, so a three-hour session reads like one conversation rather than 3,000 copies of it.
  • Keyboard and links. j and k (or the arrow keys) move between requests and between nodes, Enter opens the drawer, and Escape closes it. Every request, session and node has a stable link that opens it even when it is not on the loaded page.
  • Live. New requests are added at the top as they settle, without reloading what is already shown.
  • Columns and saved views. Choose and reorder columns; save a filter, sort and column set as a named view.
  • Traces. A request opens inside its agent trace when one exists: the customer's steps and tool calls around it, our LLM calls nested in place.
  • Export and agent access. Export streams the current filter or session. "Copy agent prompt" stays at the top right, and the prompt gains the session endpoints.

Speed targets

Each row is one action a customer takes, the speed target for it, and how the design meets it.

ActionTargetHow
Open the Requests pageunder 1 s to first rowsThe first page renders on the server; the summaries stream in after
Open a 5,000-request sessionunder 1.5 s to the full timelineThe summary row plus about 1 MB of skeleton; no bodies
Open one request's bodyunder 500 msOne authorized object read
Search inside a sessionunder 1 sText index scoped to the organization and session
Session list, any sortunder 500 msPlain sorted read of the session table
New request appears in live viewwithin about 5 s of settlingThe export lag plus the tail poll

Order of work

  1. Session fields on usage_events in Postgres and ClickHouse, the caller's trace id and parent span id from traceparent, plus the extra session headers. Additive, safe for the running build.
  2. The session table and the session-ordered copy, filled by the exporter, with a one-time backfill from history.
  3. The span table, tool spans inferred from LLM traffic, live OTLP span ingest (optional for customers), the trace and session API endpoints, the exp traces CLI, and the agent prompt update.
  4. Custom Clef tags on customer traces: the tag registry for organizations, the tagging step in the ETL pipeline, filters and alerts, after Clef capacity is sized.
  5. The Requests page "group by session" toggle and the session view: skeleton, canvas timeline, tree, folded conversation, keyboard and links.
  6. The request list on ClickHouse, with sorting and filtering on every column, and live tailing.
  7. Search text and its index, after decision 1, together with the S3 capture pipeline so each capture is read once.

The edge and the wallet: three options, then real tests

The Kion Sync raised a bigger idea: run the gateway and each organization's wallet on Cloudflare's edge. Two questions followed. Would the edge make requests faster? And is MemoryDB the right home for live money, or is it "just a cache store", as the owner worried? We compared three options on paper first, then ran the comparison for real on November 17.

Going faster at the edge: Durable Objects vs celld final: D15

The idea from the Kion Sync. Run the gateway and each organization's wallet on Cloudflare's edge. Each organization gets one Durable Object that holds its balance, holds and rate-limit counters, and the gateway runs near the caller. Helicone does this: its Cloudflare Worker uses Durable Objects for rate limiting and for its wallet.

What a Durable Object is. A small single-threaded program with its own storage, addressed by name, for example wallet:<org id>. Cloudflare runs exactly one copy of each object at a time, so every request for that organization passes through one place, one at a time. That gives the same "one organization's money is updated in order, without locks" property our MemoryDB Lua scripts give today.

What celld is. A self-hosted runtime for the same programming model, from Deno (celld.dev, version 0.6.2 beta, Apache-2.0). An existing Cloudflare app (Workers, Durable Objects, KV, Queues, D1, R2) runs on our own machines. Each object ("cell") keeps its state in its own SQLite database, replicated to a bucket we own (S3, Google Cloud Storage or Azure Blob). Exactly one machine owns a cell at a time, assigned by a conditional write to the bucket, so no separate consensus service is needed.

MemoryDB (today)Cloudflare Durable Objectscelld (self-hosted)
Where state livesOne AWS region, replicated across availability zonesCloudflare's network; each object lives in one location, near where it was first usedOur machines; durable state in our bucket
Time to make a write durableAbout a millisecond (multi-AZ log)Local SQLite write, replicated by Cloudflare; a few millisecondsAbout 90 ms per durable write in one region (their measurement)
One organization's ceilingOne shard handles the organization's scripts; microseconds eachSoft limit of 1,000 requests per second per object (Cloudflare docs)One writer per cell; bounded by the 90 ms durable write unless writes are batched
When a machine failsAutomatic failover, no acknowledged write lostCloudflare moves the objectAbout 20 s to fail over, no acknowledged write lost (their test)
Latency gain for callersNone: callers reach us-west-2The gateway answers near the caller, but the object still lives in one place, and the provider call dominates request timeOnly as close as the machines we run
CostA fixed cluster$5 a month plus $0.15 per million requests and $12.50 per million GB-seconds (Cloudflare pricing)Our machines plus bucket requests. They claim about $49 a month for up to 2,500 active cells on one 8 GB node, against about $4.15 per active object-month on Cloudflare
Four-quadrant fit (move each layer to any cloud)AWS-only service, but standard Valkey; replaceable by any Redis-compatible storeCloudflare onlyRuns anywhere with a bucket; the same code also runs on Cloudflare
MaturityIn production for our money pathGenerally available; celld's page cites a major Durable Objects incident on July 16, 2026Beta

What this means for speed. Most of a request's time is the model provider. Moving the gateway to the edge saves the trip from a distant caller to us-west-2 (tens to about 150 ms for callers far from it), and makes refusals and cached answers fast everywhere. It does not make the model faster. A per-organization object helps a different problem: it isolates a busy organization completely. That is the problem behind the 17-minute receipt lag one hot organization caused on November 10.

Durable Objects are the fastest way to get the edge and the per-organization isolation, but they put the gateway and wallet on one vendor. That conflicts with the four-quadrant goal and with customers who need their data in a specific place.

celld keeps the Durable Objects programming model while running on our machines and our bucket, so the same code could run on Cloudflare or anywhere. Its 90 ms durable write is too slow for a hold and a settle on every request (two writes would add about 180 ms), and it is beta. It is a good fit for state that changes less often, such as per-organization settings, limits configuration or session summaries, and for customer-hosted deployments that cannot use Cloudflare.

Recommendation.

  1. Keep the MemoryDB wallet for now. It is live and faster per write than either option. Run the eight tests in the wallet comparison before deciding anything else.
  2. Fix the hot-organization problem inside the current design first: give a busy organization its own receipt stream or shard, so it cannot fall behind everyone on its shard. updated 2026-11-18: built as 64 fixed slots with a move protocol, not a stream per organization.
  3. updated 2026-11-18: the prototype was cut and measured instead: a Durable Object wallet adds about 100 ms per call from Oregon. Prototype the edge for the parts that do not hold money: TLS and routing near the caller, cached key checks, and fast refusals. Measure the latency gain for callers outside the US before moving anything else.
  4. If the per-organization object model proves itself, write it against the Durable Objects API so it can run on Cloudflare or on celld. changed in review: D15 cuts this abstraction and the edge prototype until a consumer exists. Decide where it runs per quadrant and per customer, and do not move the wallet until a prototype shows write latency and failover that match MemoryDB under our heaviest organization's load.

The wallet: MemoryDB vs Durable Objects vs celld, and how to choose final: D6

Tests run, 2026-11-17. The comparison was run for real, from us-west-2, with the same wallet logic on each backend. MemoryDB hold p99 3.9 ms, Durable Objects 396 ms, celld 45 ms; a hot organization at 500 req/s: 8.7 ms, 6,549 ms with 43% refused, 172 ms. No backend lost money. MemoryDB stays. Full table and findings (slot move freeze, failover window, celld disks, far callers) under D6 in platform-data-plan.html.

What the wallet must do on every request. Before the provider call: check the organization's rate limits and reserve the worst-case cost against its balance, spend caps and promotion credit (a hold). After the call: charge the real cost, release the rest, and record a receipt that Postgres applies later. A wrong answer either lets an organization overspend or refuses a paying customer. A slow answer adds directly to every request's latency.

How each option does it.

  • MemoryDB (today): one Lua script per hold or settle, run atomically on the shard that holds the organization's keys. Every organization's receipts go to one of 8 shared streams, which the control plane drains into Postgres.
  • Durable Objects: one object per organization. It keeps the balance and holds in its own storage and handles one request at a time. Receipts go to Postgres through a Cloudflare Queue or a batch export.
  • celld: the same object model on our machines, with each organization's state in SQLite replicated to our bucket.

The table compares the three wallet backends on the questions that matter for our traffic.

Question for our trafficMemoryDBDurable Objectscelld
Added latency per request (hold plus settle)About 1 to 2 ms in-regionTwo round trips to the object, plus its storage write; depends on how far the object lives from the gatewayAbout 180 ms if each write waits for the bucket (90 ms each)
Busiest single organizationBounded by one shard and its receipt stream; a hot organization fell 17 minutes behind on November 10Soft limit of 1,000 requests per second per objectOne writer per cell; about 11 durable writes per second unless batched
A busy organization slowing othersPossible: organizations share shards and the 8 receipt streamsNo: each organization is its own objectNo, as long as the machine has capacity
A machine fails mid-requestFailover within the cluster; acknowledged writes keptCloudflare moves the objectAbout 20 s for that organization's cells to move
Data residency and portabilityAWS, standard ValkeyCloudflare onlyAny cloud with a bucket
Operating effortManaged; in production nowManaged by CloudflareWe run it; beta

Tests to run on our traffic

All three run the same wallet logic against the same replayed traffic, on staging, with no real money. The gateway traffic replay tool from !935 already reproduces the November 2 hot-organization slowdown, so it is the starting point. Each test reports the same numbers for all three.

Each row is one test, how it is run, and the bar it must pass.

TestHowPass bar
1. Everyday latencyReplay a normal production hour (all organizations, real request mix)Hold plus settle under 5 ms at p99 seen from the gateway
2. One hot organizationOne organization ramps from 10 to 500 requests per second, with streaming calls of real lengths, while all others run normallyIts own p99 stays under 10 ms; no receipt backlog older than 60 s
3. Neighbors stay unaffectedDuring test 2, measure every other organizationTheir p99 does not change by more than 1 ms; their receipts are not delayed
4. No overspend under racesMany concurrent holds against a nearly empty balance, a spend cap and a promotion; then compare the final balances with an exact replayZero overspend; every refusal correct; balances match to the nano-dollar
5. Kill a node under loadStop the node (or shard primary) holding the hot organization mid-testNo acknowledged hold or settle lost; seconds unavailable reported per organization
6. Postgres slow or downPause Postgres writes for 10 minutes during test 1Requests keep serving; receipts wait and apply exactly once afterwards
7. Callers far awayRun test 1 from clients in Europe and Asia (edge options only)Report the time-to-first-byte change against today
8. CostProject each option's monthly cost from the measured request count and active organizationsReported, not pass/fail

What would fix each option's weak spot

Expected outcome, to be confirmed by the tests: updated 2026-11-18: tested: MemoryDB stays, on 64 fixed slots rather than per-organization streams. MemoryDB with per-organization streams wins on latency and cost for our traffic. Durable Objects win on isolation and edge reach, at the price of vendor lock-in. celld is the portable choice for customer-hosted deployments once its write path is batched.

Moving Helicone customers over with no change on their side final: D12

The goal. We own Helicone and its infrastructure, so a Helicone customer should change nothing: no new base URL, no new key, no new SDK, no new header. Their code keeps calling Helicone's hosts with Helicone's keys, headers and SDKs. Behind those hosts, our gateway serves the traffic, our stores keep the data, and our dashboard shows it, with their full history.

What Helicone customers use today, and must keep working

  • Proxy hosts: oai.helicone.ai, anthropic.helicone.ai, gateway.helicone.ai (upstream chosen by Helicone-Target-URL), ai-gateway.helicone.ai (one OpenAI-compatible endpoint with model strings like gpt-4o-mini/openai), and vendor hosts such as groq, together and openrouter.
  • Keys: Helicone-Auth: Bearer sk-helicone-…, usually with the customer's own provider key in Authorization.
  • About 60 Helicone-* headers: properties, user id, session id, path and name, request id, cache, retries, fallbacks, rate-limit policy, prompts, omit request or response, moderation, security, and response headers such as Helicone-Id.
  • SDKs: @helicone/helpers and helicone_helpers (manual logger posting to /custom/v1/log), @helicone/async and helicone_async (OpenTelemetry spans to /v1/trace/log), @helicone/export, and @helicone/mcp.
  • REST API on api.helicone.ai: request and session queries, feedback, scores, properties, users, prompts, datasets, evaluators, webhooks signed with HMAC, and HQL (SQL over their own logs).

How we serve it 1:1

  1. Same hosts, our backend. Helicone's DNS and Cloudflare zone stay. Their proxy hosts route to our gateway and api.helicone.ai to our API. During the move, Helicone's own worker can run in front of our gateway, so traffic can shift one host and one customer at a time and roll back by switching the route back.
  2. Same keys. updated 2026-11-18: only organizations and keys are imported; members cannot sign in yet (owner question 8). We import Helicone's organizations, users and sk-helicone-… keys (hashed). Each Helicone organization maps to one of our organizations, and its keys authenticate on our side exactly as before.
  3. Their provider keys keep working as sent. A Helicone proxy customer sends their own OpenAI or Anthropic key with each request. On Helicone hosts our gateway accepts that key per request, uses it for that call only, never stores it, and records the request as the customer's own-key traffic. (Our usual rule is to store a connection first; here the no-change goal wins.)
  4. Every header honored. updated 2026-11-20: corrected: the moderation, LLM-security and token-limit headers are enforced, with documented differences (see What changed on 2026-11-20). Lytix forwarding, experiment columns and a few legacy headers are not served yet, and the response names them in X-Explabs-Ignored-Headers. Each Helicone-* header maps onto the matching feature: properties to tags, user id to the end-user label, session id, path and name to session fields, request id to our request id, omit headers to "do not store", retries and fallbacks to our failover, rate-limit policies to key limits, cache headers to a response cache. Responses carry Helicone's response headers (Helicone-Id, cache, rate-limit) as before. A header we do not support yet passes through harmlessly and is counted, so we know what to build next.
  5. Same SDK endpoints. The manual logger's /custom/v1/log routes and the async logger's /v1/trace/log accept exactly what Helicone's SDKs send, so the published @helicone/* and helicone_* packages keep working unchanged. We keep publishing those packages, now pointed at our endpoints by default.
  6. Same REST API. Our API answers Helicone's routes in Helicone's request and response shapes, backed by our stores. The session routes gain what Helicone never had (one session by id, its tree, search inside it), so customers get more from the same API.
  7. Same history. updated 2026-11-18: built to copy the first 32 KB of text per request, not the full bodies into S3; the copy is switched off. We copy Helicone's ClickHouse request_response_rmt rows and S3 bodies directly into our ClickHouse and S3, mapping properties, sessions, feedback and scores. Customers see their full history from the first day.
  8. Same dashboard links, then ours. Helicone's dashboard URLs redirect to the matching pages in ours once each page has parity: requests, sessions, users, properties.

Features Helicone has that we need to match

Response cache, prompt registry with versions, datasets, feedback and score APIs, HMAC-signed webhooks, per-request rate-limit policies, token-limit handling, HQL, user metrics, a per-request moderation switch, and an MCP server. updated 2026-11-20: token-limit handling and the moderation switch are now built and enforced. Each one we have not built yet is answered from Helicone's existing service during the move, so nothing breaks while we catch up.

Order of work

  1. Import organizations, users and keys; map Helicone organizations to ours.
  2. Gateway accepts Helicone hosts, keys, headers and per-request provider keys; shift one host at a time behind Helicone's worker.
  3. Copy history from Helicone's ClickHouse and S3.
  4. Serve Helicone's log endpoints and REST API from our backend.
  5. Fill the feature gaps; redirect the dashboard page by page.

Open question: updated 2026-11-18: still open as owner question 7; the original plan's "keep plan terms until renewal" is a recommendation, not a decision. do Helicone customers become ordinary Experiential organizations with our plans and billing, or keep Helicone's plans as they are for now?

Keeping valuable data, and letting customers set expiry final: D13

Some captured data is worth far more than the rest: long, successful agent sessions, expensive tasks, rare languages or countries, or anything a customer pays us to keep. Today nothing distinguishes it. Pairs are kept with no calendar expiry, unpaired prompts expire after 2 hours, contract organizations can set 1 to 90 days, uncensored traffic is kept forever, and free organizations cannot turn capture off.

changed in review: the live privacy policy says new uncensored requests follow the same capture and ZDR controls; only historical captures keep the old retention.

What exists to build on

  • Classifier tags (public.classifier_tags, scored by Clef in the offline review): policy tags for abuse, and five descriptive tags including taskKnowledge and economicValue. Scores land in ClickHouse spend_facts.tag_scores. Coverage is uncensored traffic only, with no backfill.
  • Country on every request (gateway_requests.request_country, request_region) and on every organization (organizations.geo_country), plus signup context. No retention or tagging rule reads them, and ClickHouse has no country column yet.
  • Lineage and size: prompt and conversation hashes for deduplication, session key, tokens, cost, tool calls, finish reason, client app.
  • Three eligibility verdicts that disagree: the trace inventory's training_use, the training catalog's decision (which has no permission evidence recorded yet, so everything reads "missing scoped permission"), and the capture rules themselves.
  • An empty archive bucket, explabs-capture-archive-761200393827-usw2, created by hand and tagged for free-organization traces older than 14 days. No code or decision backs it yet.

Proposal

  1. One value tag per capture, computed by the loader. When the Fargate loader processes a capture, it writes a small set of facts next to the summary row: country and region, plan tier, eligibility for our own use (never for BYOK, connected plans or zero data retention, per terms sections 4 and 6), session length, success, cost, tokens, deduplication hash, and the classifier's descriptive scores once classification covers mainstream traffic.
  2. One eligibility verdict. Fold the three verdicts into one function the loader calls, so "may we keep this for our own use" has one answer, with a reason.
  3. Retention classes instead of one rule:
    • Customer-set: the organization's own expiry, which always wins for their own copy.
    • Paid retention: organizations that pay to keep data get the period they bought, and can set their own expiry date within it, for all traffic or per tag, key or project.
    • Valuable, eligible: data our value rule marks as worth keeping (for example, sessions above a length or cost, under-represented countries or languages, high economicValue scores) moves to the archive bucket on cheaper storage and stays.
    • Everything else: expires after a default window. For free organizations, the archive bucket's plan was 14 days of hot storage.
    • Safety retention: uncensored traffic stays in its own unbounded archive, as today, and is not a training source. changed in review: applies to historical captures only; any own-use archive is opt-in and excludes own-key, ZDR, private-mode and Helicone organizations (D13).
  4. Customer expiry controls. Settings gets a retention section: a default expiry for the organization (from 1 day to the plan's maximum), overrides per API key, project or tag, and a "keep" flag on a session or request from the request drawer. The API gets the same controls. Expiry deletes the body object, its search text and its pointer together.
  5. Terms and privacy first. The privacy page promises pairs are kept "as long as capture stays on", and one of its lines about own-key traffic is already out of date. Any default expiry, and any archive for our own use, needs those pages updated before it ships.

Choosing what gets stored, per key and per caller final: D14

Today there is one switch per organization. Storing content is all or nothing for every key, and the only per-request control is zero-data-retention routing.

  • Per key: each API key gets a storage setting, "follow the organization", "store" or "do not store", plus an optional expiry. A key can tighten the organization's setting. Whether a key may loosen it (store when the organization says no) is part of the decision below; the safe default is no.
  • Per request: a header (and the Helicone Omit-Request / -Response headers) can turn storage off for one request. It can only tighten.
  • Our own Clef calls: the content review sends excerpts of other tenants' prompts, and the signup scan sends personal data, both through an Experiential Labs key. Storing those prompts again would copy tenant content and personal data outside the tenants' deletion rules. The quarantine decision does not need the prompt; it needs the outcome. So the internal keys are set to "do not store content", and the decision service keeps only the result it already records: the scores, the matched tags, the window of the source request it judged, and the decision taken. The judged request's own capture is the evidence, and it follows its tenant's rules.
  • Customers' Decisions traffic: stored like any other request under the organization's switch, once the decisions capture record exists.

November 16 and 17: the final plan, D1 to D20

By November 16 the designs and analyses above were turned into one plan, the Platform Data Plan. It answers each open question with a numbered decision. Seven reviewers then checked it from different angles: facts, reliability, money, privacy, cost, product and simplicity. Their review changed several answers this page had given.

What the review changed. Where the review changed an answer this report had given, the place is marked changed in review. The main changes:

  • Capture keeps only a memory buffer, then a metadata-only record. There is no sidecar disk and no second-region bucket.
  • Uncensored traffic follows the same capture controls as every model.
  • Blocks (quarantine, ban, revoked key) are enforced inside MemoryDB.
  • Postgres keeps request rows 120 days for money work only, and partitions drop only after ClickHouse parity.
  • Only the capture ETL runs on Fargate.
  • The Durable Objects abstraction and the edge prototype are cut.
  • OpenTelemetry and Langfuse ingest are co-primary with headers.
  • Two new decisions: erasure (D19), and scores and datasets (D20).

The seven principles

Every decision follows from seven rules. If a later change is unclear, these rules decide it.

  1. A customer request waits only on the provider and one fast, durable store. No Postgres read or write, no object upload and no analytics query sits on the request path. Everything else happens afterwards, from a durable queue. The few flows that still touch Postgres are named in D1.
  2. Each store does one job. MemoryDB holds live money, limits and blocks. Postgres holds the permanent record of money, accounts, keys and configuration. ClickHouse answers every list, total, trace and search. S3 holds bodies and media. A read has one home.
  3. Every handoff uses one outbox primitive. Each item has an idempotent receiver, a parked state, a replay command and an alarm on the age of its oldest item. Nothing retries forever, and nothing is lost without being counted.
  4. Every wait is bounded, and every shed is visible. Reads have a deadline, pools have a size, queues and streams have a memory budget, and recovery is paced with jitter. Every refusal and every dropped capture is counted. Scaling follows the real bottleneck (queue age, database wait), not CPU.
  5. Tables have a lifetime, and data has an erasure path. Every table gets a retention rule on the day it is created. Every copy of customer content, including search text, spans and tag scores, is reachable by one erasure job.
  6. Money fails closed, and side jobs fail open. A request that cannot be priced and limited correctly is refused. A request whose only problem is that a copy cannot be stored is served, and the loss is counted.
  7. Built is not live. A change is done when production shows it working: the resource exists, the switch is on, the metric moved.

The twenty decisions

Each decision is one line here; the plan page has the reasoning, the rejected options and the tests. Part 7 lists which ones still carry an open owner question.

#DecisionWhy, in one line
D1Requests never touch Postgres, and blocks never depend on a snapshotEvery Postgres incident was becoming an API incident; blocks live in the MemoryDB deny set so allowed answers can be served through an outage.
D2Captures go to our S3; a full buffer drops the copy, not the customerCapture refused customers on November 5 and 9 because a copy was slow to store.
D3Postgres keeps money, accounts and configuration, and every table has a lifetimeUnbounded tables (311, 238 and 67 GB with no retention) slow every vacuum and restart; request rows are kept 120 days for card disputes.
D4ClickHouse answers every list, total, trace and searchOne home per read; Postgres keeps the money record, not a display copy.
D5An allowlist of dashboard reads goes to the replica; the catalog stays in the main databaseTakes dashboard load off the primary without rewriting transactions that join the catalog with keys.
D6MemoryDB stays the live wallet, across 64 fixed receipt slotsThe only tested backend fast enough for the request path; slots isolate a hot organization.
D7One Requests table, agent traces from headers or OpenTelemetry, and a CLI firstCustomers moved to agents; headers need no code, OpenTelemetry covers steps the gateway cannot see.
D8Search indexes each request's new text onlyAgents resend the whole conversation; indexing only new text keeps size proportional to the session, not its square.
D9One outbox primitive with a shelf and an age alarmRetry-forever hid stuck captures and stalled exports.
D10Customers define tags; a judge scores them on captured trafficLets customers find "the agent gave up" without reading every trace; any judge model, so Clef capacity does not block it.
D11Things that fail differently deploy separately, in one orchestratorThe November 11 crash loop took the writeback down with the control plane; workers stay in EKS, only the capture ETL runs on Fargate.
D12Helicone customers change nothing, after legal clears the move"Zero customer change" covers every surface they touch; moving their stored data changes a sub-processor.
D13Customers set expiry; any archive for our own use is opt-inThe buyers we want are buying control; the privacy page promises pairs are kept while capture is on.
D14Tighten-only controls; media stored by kindThe org switch is a promise to the org's admins; media cost and sensitivity differ by kind.
D15The gateway stays in EKS; Cloudflare does TLS, WAF and cachingA Durable Object wallet measured about 100 ms more per call from Oregon; the provider call dominates latency.
D16Restarts become maintenance, not outagesDecoupling requests from Postgres protects against unplanned trouble too; blue/green does not.
D17Guards in tooling, not in chatMerge holds coordinated by chat failed; recovery is pinned by containment.
D18Credentials never pass through chatSecrets were exposed in conversations on November 10.
D19One erasure job reaches every copy, and the ETL checks it liveCopies multiply (segments, queues, text, spans, tags); a segment in flight must not recreate deleted content.
D20Scores and datasets from tracesTeams judge and test their agents from the same data they observe.

The design as built

The diagram shows the shape PR #2980 builds. Compare it with the simple picture in Part 3. The main differences: captures go to a segment file on the pod's disk and then to our own S3, not to Supabase Storage; two SQS queues feed a capture ETL on Fargate; ClickHouse holds the request list, spans, session summaries and search text; and the edge admits span ingest per organization.

flowchart LR
  C["Caller"] --> E["Edge
fair share per org"] E --> G["Gateway worker
keys, grants, catalog in memory"] G <-->|"hold, settle, deny set"| M[("MemoryDB wallet
64 slots")] G --> P["Providers"] G -->|"capture appended"| SEG["Segment file
on the pod's disk"] SEG -->|"every 1 to 2 s or 16 MiB"| S3R[("Our S3 raw bucket
7 days")] CP["Control plane
OTLP and Langfuse ingest"] --> SEG2["Control segments"] --> S3R S3R -->|"gateway segments"| QR[["Raw queue"]] S3R -->|"span segments"| QC[["Control queue"]] QR --> ETL["Capture ETL on Fargate"] QC --> ETL ETL -->|"one object per request"| S3O[("Our S3 observability bucket")] ETL -->|"requests, spans, sessions,
request_text"| CH[("ClickHouse")] M -->|"receipts"| WB["Ledger writeback"] --> PG[("Postgres
money, accounts, 120-day rows")] UI["Dashboard and API"] -.->|"lists, search, traces"| CH UI -.->|"one body"| S3O
As built in PR #2980, not merged. For a known key on a plain model chain, the request path ends at MemoryDB and the segment, and touches neither Postgres nor ClickHouse. It still touches Postgres in five named cases (D1): protected model chains outside a planned maintenance window (about 52% of production traffic), Responses continuations the outage cache does not hold, keys a worker first sees during a Postgres outage, pods starting during an outage, and new blocks during an outage.

November 17: the owner's timing call

The plan first spread the work over "this month" and "this quarter". On November 17 the owner decided to build everything in one change now. The same day the platform moved from GitLab back to GitHub, and the wallet comparison ran for real (results under the wallet: MemoryDB stays).

The full wallet test, from us-west-2, with the same wallet logic on each backend: all three were correct (0 mismatches in about 4,500 calls, 0 drift under races and faults). MemoryDB was the only one fast enough for the request path: hold p99 3.9 ms, against 396 ms for Durable Objects and 45 ms for celld. A hot organization at 500 req/s had p99 8.7 ms, against 6,549 ms (43% refused) and 172 ms. Cost per month: $946, $1,447 and $238.

The 25 places where this report and the plan disagreed, and how each was settled

A full pass over the planning conversation found 25 places where this report and the plan disagreed. Each is settled here; the ones that change a promise to customers were also listed as owner questions.

ConflictDecisionReason
Production ClickHouse version (report 26.6, repo 25.8)Measured on November 17: production runs 26.6.1.2455, so the search gate (26.2 or later) is met. CI and preview images move from 25.8 to 26.6.A decision cannot rest on an unverified number.
Search cap and index (64 KB n-gram vs 32 KB token)32 KB, token splitterAn n-gram index is 5 to 10 times larger; 32 KB covers a typical turn of about 8 KB with room.
Capture fallback chain vs pod memory on 128 MiB bodiesMemory, then the existing fsynced local-disk outbox, then metadata-onlyThe disk outbox already exists in the serving pod and answers the memory risk without a second region or a sidecar process.
Uncensored traffic "always stored" vs live privacy policyFollow the live policy: same controls as every modelThe published policy is the promise in force.
All workers to Fargate (Kion Sync) vs workers in EKSWorkers stay in EKS as separate deploy units; only the capture ETL on FargateOne orchestrator for a small team; Kubernetes is portable across quadrants.
Per-organization streams vs fixed slots64 fixed slots with a move protocolNo dynamic stream lifecycle, no polling of idle streams, wallet keys stay atomic.
Edge prototype and Durable Objects APIThe comparison tests run with real deployments; the edge gateway is not builtThe owner asked for measured outcomes.
Stale allows up to 5 minutesBlocks come from the MemoryDB deny set; allows stay valid through an outageMoney review: blocks must not depend on a snapshot.
Stale prices and limits up to 10 minutesPrices and limits live in memory and MemoryDB, refreshed by version; an unreadable fact refusesMoney fails closed.
Postgres window (short, 90 days, 120 days)120 days, money work onlyCard-dispute lookback.
Where one request's metadata is readClickHouse, like every listOne home per read.
Helicone scope (full endpoint list vs four steps)The full list: hosts, auth, every header, response headers, SDK endpoints, REST API, webhooks, history copy"Zero customer change" means every surface a customer touches.
Default integration (headers only vs headers and OpenTelemetry)Both, co-primaryHeaders need no code; tool and custom spans happen in customer code and need OpenTelemetry.
Tag judge (Clef only vs any model)Clef default, any model allowedClef capacity no longer blocks the feature.
Keeping valuable data (our own archive) vs opt-inOpt-in, broad exclusions, switched off until the terms changeThe buyers we want are buying control.
Per-key storage "opt in" beyond the org switchTighten onlyThe org switch is a promise to the org's admins.
Media to a cheaper storage classLifecycle rule for media objects only, never small chunksInfrequent Access and Glacier bill a 128 KB minimum per object.
Readiness on snapshot ageReadiness ignores snapshot age; snapshot age pagesFailing readiness on age would empty the fleet during a Postgres outage, the exact case D1 protects.
Stuck capture count (298 vs 813)Both are dated counts from different days; the fix and parking make the number zeroFacts review.
November 10 vs 11 dashboard overloadNovember 10The incident timeline.
Session list and live view targets missingAdded to the measuresRequirements from the sessions analysis.
Raw objects deleted on processing vs kept 7 daysKept 7 daysReplay and erasure checks need the raw copy for a short window.
Chunk dedup across organizationsWithin one organization onlyErasure and cross-tenant leakage.
Timing (this month vs this quarter)Everything in one MR nowOwner, November 17.
PostHog missing from the target diagramUnchanged: product analytics events still go to PostHog; it holds no request contentStated so the omission is not read as removal.

November 18: reassessment, protected chains, and the first restart rehearsal

On November 18 we stopped and checked what was really true. The build had grown fast, and several claims in this report and in the November 16 plan no longer matched the code. This section has four parts: where the build stood, which claims were superseded, how protected chains were made to survive a restart, and what the first real restart rehearsal showed.

Reassessment, 2026-11-18. Nothing of this work is merged to main, and none of it runs in staging or production. The build lived on GitHub PR #2980 (7 failing checks at the time) and in 12 local split branches. Since then the split PRs were opened; see the 2026-11-20 note above.

Several claims in this report and in the original final plan of November 16 are now superseded. Two decisions were made after the report was written:

  • protected model chains survive a planned restart through a maintenance window;
  • the MemoryDB "witness" design for unplanned outages was built and then dropped.

Every correction is listed in What changed on 2026-11-18, and the places in the text are marked updated 2026-11-18.

Where the build stands.

  • Nothing of the build is merged to main. GitHub PR #2980 (branch obs-data-plan, head 98d1ff2ed) is the reference and fails 7 checks: hot-path-query-budget:gate, migration-guard, migration-lock-budget:apply, obs-e2e, Newly introduced secrets, integration-tests (ordinary) and Web checks.
  • It is split into 12 pull requests, not 13: the wallet is folded into the request-path PR, and restart work and the GitHub guards share one PR. On 2026-11-18 the 12 branches were local only. updated 2026-11-20: they are open as PRs #3090 to #3101, none merged, all with failing checks.
  • Merged to main so far: preview plumbing (#3022, #3028, #3044, #3051, #3061), one pgTAP fix (#3024) and the psycopg upgrade (#3046, live in production since 15:58Z on 2026-11-18).
  • The owner's rule for this work: nothing goes to staging or production; everything is proven in the isolated preview first.
  • The engine change for media and Decisions capture is in progress, not released.

Superseded claims

Each row names a claim made in this report or in the original final plan (November 16), and what is true now.

ClaimWhere it was madeWhat is true now
During an outage, allowed answers up to 5 minutes old are servedOriginal plan D1; this report, Surviving a database outage and Decisions for this planBlocks come from a deny set in MemoryDB, so allowed answers are served through an outage, bounded at 60 minutes. updated 2026-11-21: Fixed. On 2026-11-20 keys and grants were bounded at 15 minutes in the code. Every outage path now uses one 60-minute bound, OUTAGE_SERVE_STALE_SECONDS in explabs/outage_bound.py, pinned by a test.
Request and attempt rows kept in a 90-day windowOriginal plan D3120 days, which covers the card-dispute lookback.
A per-organization receipt stream for busy organizationsOriginal plan D6; this report, edge and wallet analyses64 fixed slots, each with one receipt stream, and a move protocol for a hot organization.
Every background worker moves to FargateOriginal plan D11; this report, Kion Sync and Database planWorkers stay in EKS as separate deploy units scaled on queue age. Fargate runs only the capture ETL.
64 KB of search text per requestThis report, Analysis 132 KB per request, with a token-splitter text index.
A second-region bucket and a sidecar as capture fallbacksOriginal plan D2; this report, Analysis 2Removed. A full buffer serves the request and keeps a metadata-only record, counted per tier.
Helicone organizations keep their plan terms until renewalOriginal plan D12An open owner question (question 7 in the plan): which plan and price a moved organization is on.
Customer tag scoring launches after Clef capacity is sizedOriginal plan D10; this report, custom tagsAny judge model, billed as usage, with a starvation guard that keeps our own content review served.
An edge prototype is builtOriginal plan D15; this report, edge analysisCut, and measured instead: a deployed Durable Object wallet adds about 100 ms per call from Oregon.
A 3-minute Postgres cut is rehearsed on stagingOriginal plan roadmap ("Next"); this report, How a resize then runsRehearsals run on the preview only, per the owner, and the bar is a 10-minute cut. So far cuts of 41 to 70 s have run on a small preview database.
During a restart the dashboard reads the replicaOriginal plan D16; this report, Zero-downtime DB restartThe replica routing is built, but no replica exists in any environment.
During an outage, protected chain revisions are refused with a retryable 503This report, Decisions for this planInside a planned maintenance window they keep serving; outside one they still get a retryable 503. See below.
The list of every open merge requestThis report, Every open merge request (GitLab, November 10)Stale since the move to GitHub on November 17. GitLab main is frozen.
Production writes wait on Kion's goOriginal planNo longer applies. Nothing of this work goes to staging or production until the owner says so.
Helicone customers' headers are all honoredThis report, Helicone customers, no changeupdated 2026-11-20: corrected. Of 51 headers handled, the moderation, LLM-security and token-limit headers are enforced, with documented differences (see What changed on 2026-11-20). Only organizations and keys are imported, so members cannot sign in. History copies the first 32 KB of text per request, not the full bodies.
The engine change for media and Decisions capture is prepared as an engine PRThe plan, decision 12In progress, not released.

Protected model chains: a planned maintenance window, and the witness design that was dropped

Why it matters. A read-only production query on 2026-11-18 found 27,171 of 52,347 requests in 10 minutes (52%) on protected chain revisions. Each one writes a receipt in Postgres at admission. The receipt proves four facts at that moment: the worker is enrolled in the current release, the alias floor allows it, the revision is still the alias's current one, and the key and grant are live. So a Postgres restart refused about half of /v1.

First design: a MemoryDB witness (built, reviewed twice, dropped). A counter and an in-flight set in MemoryDB, required by SQL triggers on every chain-authority write, let a pod cut off from Postgres prove that no chain change had happened since its last read, and so keep admitting protected requests through an unplanned outage. It was built (nine migrations, worker code, an operator runner), then went through an adversarial review and a verification review. It was dropped for three reasons:

  • It was large: nine migrations and three moving parts (MemoryDB tokens, Postgres intents and per-worker observations).
  • Its failure mode was costly: losing MemoryDB fleet-wide while the mode was on froze every chain transition, releases included, for 61 minutes.
  • A much simpler design meets the owner's actual requirement, which is to restart Postgres without hurting API traffic. Unplanned outages were not the goal.

None of its migrations reached main or any hosted database, so removing it needed no reversal migration.

Decision: a planned maintenance window. Before a restart, an operator opens a window of 1 to 30 minutes (POST /api/admin/chain-maintenance). How it works:

  • The window starts 30 s after the call. From the call to the end, Postgres refuses every chain-authority write: release floors, revocations, alias floors, and repoints of a protected alias. Seventeen guard triggers do this, and they are disabled outside a window, so normal traffic pays nothing.
  • Workers read the window every 2 s. While Postgres is down they admit a protected request from their last read, until 5 s before the window ends, and the receipt is recorded when Postgres returns.
  • No partition can change the chain during the window, because Postgres itself refuses every change, so no witness is needed.
  • A window cannot end early, releases cannot begin during it, and catalog publication waits for it to end.
  • During an unplanned outage, protected requests still get a retryable 503.

Rejected: a setting on the hot app_settings row; refusing writes only from the start, which lets a write land after a pod's read; ending a window early, which is unsafe for a pod that is cut off; and the witness.

Tested. The window passed review fixes and a local end-to-end flow (flow 12) running production's own release code. In the final run, a 40 s cut inside a window served 1,527 of 1,527 requests. 259 protected requests were served during the cut, each with exactly one receipt, and spend equalled served cost exactly. Without a window, every protected refusal was a 503 with Retry-After.

Still open:

  • Flow 12 is not in CI.
  • The preview has no protected chains, so the window was never exercised there.
  • One protected request in flight at the cut waited 30 s before its retryable 503.

Restart rehearsal on the preview

Postgres was restarted on preview pr-902980 in four rounds under steady load, fixing what each round found.

  • Round 1: every Python service crashed after recovery; see the lesson below.
  • Round 2: requests at the cut still hung 22 to 37 s.
  • Round 3: one worker refused a known key for the whole outage, because it had never cached it.
  • Round 4: zero errors on known keys through a 46 s cut with a window and a 70 s cut without one. The slowest request took 1.41 s, and every charge was recorded exactly once, MemoryDB and Postgres equal to the nano-dollar.

Limits. The cuts were short (41 to 70 s) on a small database branch, not the 10-minute cut on production-sized data. The preview has no protected chains. The MemoryDB failover game day has not run. A key a worker had never read was refused by that worker with a retryable 503, as designed.

Lesson: a dependency crash that only a real restart shows.

  • What we saw. In round 1, the gateway worker, control plane, capture ETL and project worker all exited with a segfault about 5 s after Postgres returned, in both runs. A 41 s outage became 65 to 88 s of customer errors, and the restarting fleet hit the database a second time.
  • Why. psycopg 3.3.4 crashed when the Supavisor pooler greets a client without connection settings. No unit test or simulated outage (a pool pointed at a dead port) had shown it.
  • The fix. An upgrade to psycopg 3.3.8 in #3046, live in production since 15:58Z on 2026-11-18.

A failure path that runs only during a real outage has to be exercised by a real outage.

Why rounds 2 and 3 failed, traced from the worker logs:

  • Round 2, requests hanging 22 to 37 s. Two causes:
    • Behind the Supavisor pooler a pooled connection is handed out at once, but the statement then waits about 8 s for an upstream and fails ("Failed to connect to database"). That is a statement error, and only checkout failures counted toward the breaker. The pool then validated the next connection, which waited 8 s again, up to five times, and the validation ran before the connection could be cut.
    • The dispatch credential release used its own connections outside the breaker. Its 1 s server-side timeout never fired while Supavisor held the statement, so it waited about 8 s, then retried for about 8 s more.
  • Round 3, a known key refused. The refusing worker had served no chat for that key before the cut (another worker had). After the cut the edge moved the key's connection to it, and its first-sight grant read hit the open breaker. The 17 s after recovery is the breaker's designed close: a fleet that opened together must not close together.

A later run went further: 11 back-to-back restarts with Postgres down 525 of 604 s, still 0 errors on known keys.

Checking the build: five layers

Building is not proof. So the build went through five layers of checking, each by agents that did not write the code. By November 18 the first four had run; the fifth, the preview stress test, continued through November 22.

Requirements trace. Every owner message from the planning conversation was matched to the code that delivers it. It found 15 gaps. The worst: the new Requests page would show an empty history on deploy, because nothing backfilled it. Fixes came in three waves: history backfill, per-key do-not-store leaking conversation state, a wrong header in the docs (first); seed data, capture backfill, the value tag and country filter, prompt and conversation grouping (second); the remaining Helicone gaps, a public CLI, wallet replay, engine media capture and rehearsals (third).

End to end. Real requests were driven through gateway, segments, S3, SQS, ETL, ClickHouse, the APIs, tagging, retention and erasure on a dedicated EC2 stack, checking every store. All 11 flows ran; 10 passed, and tag scoring stopped at the judge because no local provider accepts its strict format.

Seventeen integration bugs were found and fixed, each with a regression test: a ClickHouse migration that would have failed every deploy, the usage export stopping for good after minutes of traffic, every session read answering 500, tool spans never inferred, a new lane answering 500 and idle workers 503, per-key retention never matching, two segment writers destroying each other's files, no trace tag ever scoring live traffic, and every keep-flag re-stamp failing. Five smaller issues went to owners. The suite lives in docker/tests/obs_e2e.

Tenant isolation and security.

  • High, fixed: a crafted Host header let anyone make the public /v1 edge call internal servers; read-scoped admin keys could read every org's captured prompts through 10 new routes.
  • Medium: the Helicone cache stored answers the caller asked not to store (fixed); unclamped span timestamps let one org push a whole segment to the dead-letter queue; the Helicone REST API had no rate limit; trace SQL exposed columns that do not exist.
  • Held: trace SQL tenant isolation and escapes, cursors, Target-URL, webhook SSRF guards, link signing, ingest size limits, span origin forgery.

Money (local Valkey and Postgres). Critical: the Helicone response cache could fill the wallet's MemoryDB and stop all money, so the cache moves to its own evicting cluster. High: out-of-memory and read-only errors were not treated as "wallet unavailable" (fixed); a flood of random keys could lock out new and returning keys. Medium: one long write transaction stalls the deny-set feed; usage could double count under a reclaimed export lease; a Helicone cache hit was served to blocked keys.

Load at 10x (dedicated EC2).

  • High: an unauthenticated flood of random keys could deny every real key not yet in a worker's memory. Fix: a filter of all key hashes, so unknown keys get a 401 for free.
  • Medium: the partition dual-write cost about 5% throughput and 43% more WAL on a quiet machine (the first 28% figure came from an overloaded laptop). It was redesigned as a key-only change log drained after commit, about 2% on the request path. Also medium: a few free orgs could saturate a process's report reads, and the re-file sweep could be made to rescan for days.
  • Measured: the key snapshot is 134 MB at 1M keys and 7.1 GB at 50M.
  • Held: change-table pruning, the KMS key cache, S3 request rates.

Privacy and erasure. Two holes found and fixed: a Helicone cache save landing after an org purge, and ClickHouse rows written late for records captured before an erasure.

Failure injection.

  • Critical: the Helicone cache could fill the wallet's cluster (as above); dropping a column would break every write to the three partitioned tables, which led to the dual-write redesign.
  • Fixed: MemoryDB out-of-memory is now a retryable 503; the ETL pulls only what it can work; loops back off; the sweep stops resending.
  • Open: segment directory lost on pod restart; contract traffic admitted during a long S3 outage; a pod with uncertain facts over-granting promotions; the reconnect stampede.
  • Held: a killed Valkey primary under 7,500 reservations/s gave only retryable 503s for 9 s; the ETL deletes a message only after ClickHouse confirms.

The first preview deploy found two bugs, both fixed: every database client opened 32 sessions at creation (63 MB each), and ClickHouse schema errors parked good export rows. One adversarial pass at fc396d4f2 found four issues, all fixed.

November 19: the Clef 502s, and what Observability was still missing

Intermittent failures on the Clef judge

What we noticed. Clef, our decision model, is called through /v1/systemone. It scores content for our own review, and in the new design it is the default judge for customer tags. From the evening of November 18, a small share of its calls failed fast with 503s: 0.8% to 2.2% per hour on November 19 (the ledger showed 271, 260, 670, 598, 319 and 469 an hour from 09:00Z).

How it is wired. The gateway reaches Clef through a GCP VM (exp-model-gateway-01). Its public Caddy sends Clef traffic through two more local Caddy processes. The last one, clef-priority-pool, balances between two upstreams: an Azure tunnel on port 18160 and a "U.S. Clef replica" on 18170, each capped at 32 requests. It health-checks each upstream every 5 s with a 2 s timeout, marks it down after one failure, and retries a failed request only once, after 100 ms.

What we found. Two failures combined:

  • The 18170 replica was dead. Nothing listened on it; its tunnel had disconnected at 03:50:08Z, and its owner was unknown. So the pool ran on one upstream with no slack.
  • The remaining upstream sat on a lossy tunnel with about 250 ms round trips. Now and then its health check took longer than 2 s (11 times in 90 minutes). Each miss marked it down for 3 to 5 s, and during that window every request got an instant 503. About 75% of the 503s fell inside those windows; most of the rest came from the 32-request cap filling while the box was slow.

The evidence lined up minute for minute: the VM access log and the ledger counted 86 and 73 failures at 14:23, 118 and 116 at 14:30, 49 and 42 at 14:39. The VM itself was healthy (disk 18%, 11 GiB free, load 0.2).

What we changed. With the owner's approval, only the pool's config: a 5 s health timeout, 3 consecutive misses before marking down, passive max_fails 3, and no single-retry limit, so a request can wait up to 5 s for a free slot. It was a graceful reload at 15:33:58Z, with a backup kept.

What happened. In the 30 minutes before, 20,077 calls completed and 112 failed (0.55%), p50 480 ms, p95 1,231 ms. From 15:34 to 16:05Z, 22,780 completed and 0 failed, p50 484 ms, p95 1,132 ms. The pool log showed no more "no upstreams available". Still open: replacing the dead 18170 replica, whose owner is unknown.

The UX gaps audit

What we noticed. The owner wrote on November 19: "the production data isn't great I can't test all of the different features. it's also missing a bunch of the stuff I asked for or we planned for like metadata previews of requests, etc. and the top bar for observability has too much going on right now".

What we did. An audit listed every ask from the owner's messages and the plan, 40 in all, and checked each against the code and a live preview, with screenshots. Before the pass: 27 built, 7 partial, 6 missing.

Built in the same pass:

  • a short preview of each request in the list;
  • a hover or Space "quick look" card (question, answer, tokens, cost, latency, time to first token, session, step, end user, key, error, tags);
  • a one-row top bar instead of 11 controls on two lines.

After: 30 built, 6 partial, 4 missing.

Four items went to the owner: a natural-language query box over traces (and which model pays for it); redeploying a preview with fixture data so every feature has something to show; removing the free-plan expiry switch (decision 3); and whether session-tree hovers may fetch text per node.

Also that day. #3034 merged on main at 22:39 UTC. It removed the early-access rule, so the new pages would go live for every customer on deploy, while the pipeline that fills them stays off by default.

November 20: plan review, corrections, and the security retest

A full plan review on November 20 checked the plan's claims against the code once more. It found one number that was wrong in a way customers would feel, and it proposed four simplifications. The same day a security retest and a load test ran on the preview.

Plan review, 2026-11-20. Still nothing is merged to main, and none of it runs in staging or production. The 12 split pull requests are open on GitHub as #3090 to #3101, each labelled do-not-merge, and every one has failing checks (4 to 20 per PR), PR 1 included (updated 2026-11-21: closed; everything lands as one PR, #2980). #3034 is merged, so the new pages go live for every customer on deploy.

Corrected in this report:

  • the outage bound in the code is 15 minutes, not 60 (updated 2026-11-21: fixed, one 60-minute bound);
  • the Helicone moderation, LLM-security and token-limit headers are enforced, not ignored;
  • the free-plan retention answer is not yet confirmed.

See What changed on 2026-11-20. Owner decisions that are built only as provisional defaults are listed on the plan page.

Where the build stands.

  • Nothing is merged to main. PR #2980 (head 9b88cfb95) is the reference and fails 8 checks. updated 2026-11-21: #2980 is now the one PR that lands; see What changed on 2026-11-21.
  • The 12 split PRs are open on GitHub as #3090 to #3101, each labelled do-not-merge. Every one has failing checks (4 to 20 per PR at 06:38 UTC). PR 1 (#3090) fails obs-e2e, postgres17:proofs, Web checks and integration-tests (ordinary). updated 2026-11-21: all 12 are closed.
  • The open PRs were built from c4b50c33f. The stack is rebuilt locally from 9b88cfb95, which carries the fix for PR 6, and is not pushed yet. updated 2026-11-21: superseded by the one-PR decision.
  • Migration numbers: the stack keeps its numbers (20271101000100 upward) while it is built and previewed. Each PR is renumbered above main's newest migration only at merge time, when it is pointed at main. updated 2026-11-21: #2980's migrations were renumbered above main's newest when it was squashed, and are renumbered again at merge if needed.
  • #3034 is merged (2026-11-19, 22:39 UTC). It removed the early-access rule, so the new pages go live for everyone on deploy. The pipeline that fills them (capture to segments, the ETL, the tag worker) is off by default, and its switches are not yet in the GitHub deploy workflows. updated 2026-11-21: an availability endpoint now lets each page hide a feature with no data and say why, and one release variable list feeds the GitHub production and staging workflows.

Corrections.

  • Outage bound. This report and the plan say allowed answers are served for up to 60 minutes of a Postgres outage. The code bounds keys and grants at 900 seconds (15 minutes) in two places (_MAX_STALE_SECONDS in explabs/gateway/admission_scope.py, _GRANT_MAX_STALE_SECONDS in explabs/gateway/control_store.py). An outage longer than 15 minutes would give every key a retryable 503. This is being fixed with one shared constant and a test that pins it. updated 2026-11-21: fixed in explabs/outage_bound.py (60 minutes).
  • Helicone safety headers. The moderation, LLM-security and token-limit headers are enforced, not ignored. Differences from Helicone: LLM security uses our managed guardrail models instead of Prompt Guard and Llama Guard; when the security check cannot run we refuse with a retryable 503 where Helicone lets the request through; on the AI gateway host moderation uses our safety model because the caller sends no OpenAI key; and the token-limit context window comes from our catalog. Lytix forwarding, experiment columns and a few legacy headers are still not served, and the response names them in X-Explabs-Ignored-Headers.
  • Owner decisions. Decisions 3, 4, 5, 9, 10, 13 and 14 on the plan page are built with provisional defaults, not decided by the owner. For example, the wallet runs on 1 MemoryDB shard; the Terraform comment that says "Decided: 2" is wrong, and 2 is only the recommendation.
  • Alarms. The wallet and Helicone cache alarms are created with no action by default, so nothing pages yet. updated 2026-11-21: every alarm root now requires its topic and refuses an empty one; the outbox alarms moved into an infra/ops-signals Terraform root.

The plan review's top risks, in order, are on the plan page under Shipping (updated 2026-11-21: with status for each).

Four simplifications proposed

The review also asked where the build could be smaller. It proposed four cuts, each with a trade-off: one capture destination instead of three modes (A), folding the low-volume background apps into one (B), opening the maintenance window automatically from the restart tool (C), and table lifetimes without a shadow copy (D). All four wait for the owner; they are cards A to D in Part 7.

The security retest

A security retest ran against preview pr-902980 on November 20 (build 37d8b2ef4), with org keys for three organizations, a do-not-store key, five scoped admin keys and two imported Helicone keys. The preview's API and ClickHouse were not reachable from the tester's laptop, so the Helicone host ingress was reviewed in code instead. Nothing touched staging or production, and every key and webhook made for the test was revoked or deleted afterwards.

FindingSeverityFix
Erasure left frozen Helicone webhook payloads (request and response bodies, plain text) in Postgres; a retrying delivery could still send erased content, and a parked one kept it 30 days.HighFixed (a4533c6a94). Migration 20271128010400 makes erasure clear every frozen payload of the organization's webhooks, and a parked delivery keeps no body. A new pgTAP suite fails on the old function.
Helicone webhook create stored any https destination (cloud metadata address, loopback names, our own admin URL, URLs with credentials), with no count cap, so one key could fan one request out to many outbound posts. A bad sampleRate caused a 500.MediumFixed (4a169b8161). Create applies the delivery transport's own destination rules, sampleRate must be 0 to 100, and an organization has at most 50 webhooks. Delivery already re-checked every address, so nothing internal was ever reached.
The observability fixture script, in local mode, would seed any database URL, including a hosted Supabase project.LowFixed (bad5652616). Local mode refuses hosted Supabase hosts.

What held: read-scoped and support admin keys never saw content; another organization's key got 404 on every new route and 0 rows from trace SQL; spans and Langfuse calls that named another organization still landed in the caller's own; do-not-store and per-request storage headers stored nothing; admin scopes refused everything outside their set; trace SQL escapes were refused; 40 concurrent reads got fast 429s; no new database function or table is open to the anon or authenticated roles.

Observed, not fixed:

  • the capture ETL stalled during the run (the load test found why; see November 21);
  • two branch migrations shared version 20271120600000 (a merge from main resolves it);
  • under a do-not-store key, span names and Langfuse trace names are still stored, which is documented metadata and deserves a sentence in the docs;
  • the preview's out-of-credits message links the production credits page;
  • a read admin key sees a 12-character prompt group hash, which could confirm a known prompt (low);
  • Helicone webhooks can be replayed by design (Helicone's own signature has no timestamp), while our trace-tag webhooks sign a timestamp.

The UX review with real data

An agent used Observability, Quality, settings and admin on pr-902980 as an owner would, with data made through real paths: chat, Responses and Messages sessions, OTLP and Langfuse traces, tags, scores, a review queue and a dataset. It worked in light, dark and phone widths, and compared the pages with Helicone, Langfuse and OpenRouter.

The fixes landed on November 21 (8d995b3a4f):

  • fresh rows say the text may still be processing instead of "storage was off";
  • search mode drops the empty Preview column;
  • failed requests read 0 credits, not "free";
  • the Quality page no longer says tagging is off and running at once;
  • empty charts say so;
  • score targets, dataset items and run lines read as text;
  • a failed score-type name shows the validator's sentence.

740 related web tests pass. Five questions went to the owner (cards 17 to 21), plus whether the requests read should carry a per-row "stored" flag, so a missing preview can say "not stored" or "not yet".

November 21: one pull request, and fixing what the load test broke

Two things happened on November 21. The owner decided to land the whole data plan as one pull request instead of twelve. And the load test that started the day before showed, step by step, where the new pipeline broke under realistic traffic.

How the load test worked. An EC2 load generator sent open-loop traffic to pr-902980 on November 20 and 21: arrivals at a fixed rate whatever the answers, with a 30 s client timeout like an OTLP exporter's default. The mix was 45% OTLP protobuf, 30% OTLP JSON and 25% Langfuse batches, about 74 spans per request, across 48 test organizations with skewed session sizes. About 4.2 million spans were offered; ClickHouse held 1.73 million spans, plus 1.2 million synthetic request rows inserted to test the reads.

The preview is small on purpose (one edge pod, one control-plane process, one ETL task, a 1-CPU ClickHouse that already used about 0.95 of its core at idle, a quarter of it on its own system logs), so every ClickHouse figure is a lower bound for production. The full report is /tmp/obs-build/audit/load-2026-11-20.md.

The text below is the day's account. The tables after it give the before and after numbers.

Update, 2026-11-21. Still nothing is merged to main, and none of it runs in staging or production. The owner decided to land everything as one pull request, #2980; the 12 stacked PRs (#3090 to #3101) are closed. #2980 was squashed, keeps do-not-merge until the owner approves, and is tested on preview pr-902980. The capture ETL now reads two queues, the edge admits span ingest per organization, and a load test, a security retest and a UX review ran on the preview. See What changed on 2026-11-21.

Where the build stands.

  • The owner decided to land everything as one pull request, #2980. The 12 stacked PRs (#3090 to #3101) are closed.
  • #2980 was squashed; the old history is kept on branch obs-data-plan-backup-20261120. Its migrations were renumbered above main's newest and are renumbered again at merge if needed. It keeps do-not-merge until the owner approves it.
  • CI: every check passed at 78c2ec15fc (2026-11-21, 00:13 UTC); the run at 1a9e27bf09 (00:24 UTC) failed Code checks and migration-lock-budget:apply. #2980 now conflicts with main, so its current head 7a6df21588 has no checks until main is merged in.
  • The preview pr-902980 is the test environment. Main PRs that let it run the branch: #3133, #3145, #3175, #3176, #3243, #3248 and #3252. #3238 was closed as a duplicate.

The capture ETL, redesigned under load. A load test on the preview showed gateway captures waiting behind span-ingest segments: both shared one raw queue, and span loads wait on a single writer, so no gateway capture was stored for over an hour. The fixes, in order:

  • Two queues. The raw bucket announces segments/gateway/ to the raw queue and segments/control/ (span ingest) to a new control queue. Each has its own consumer (8 slots for captures, 2 workers for spans), dead-letter queue and backlog alarm. A first fix parked span messages in memory; it held captures at 4.1 to 7.5 s until the park filled, then a capture waited over 3 minutes. The park is deleted. Being built now: the raw consumer forwards a control message that reaches the wrong queue.
  • Grouped writes. A segment's span batches are written together, at most 5,000 spans and 4 MiB per group (the first groups, 18 to 21 MB, were refused by the ClickHouse ingress). A segment the ledger already holds is skipped when the sweep announces it again.
  • Inline inference. Request text used to arrive 87 to 170 s after a gateway call: the inference message always waited 60 s, then queued behind span writes on the same writer. Now a stored request whose usage row exists is inferred at once with its own writer; otherwise it waits 10 s, doubling. Text arrived in about 18 s in 2 of 3 probes; the third waited on the usage exporter's own lag.
  • Session parts. Each write used to recompute the whole session from every span: 2.8 to 3.1 million rows and 21 to 64 s per write at 30,000-span sessions, which cut the ETL from about 480 to about 100 spans/s. Now ClickHouse migration 0053 keeps one part per session and trace, recomputes only the touched traces, and folds the parts (about 37,000 rows read, p50 330 ms). The first full rebuild of an existing big session runs in slices of 500 traces (the longest statement 3.3 s), because as one statement it took 103 to 126 s and never finished inside the 45 s timeout.
  • Throughput. About 56 spans/s before grouped writes, about 480 after on short sessions, and about 300 spans/s at the latest measurement, all on the preview's 1-vCPU ClickHouse.

Edge fairness.

  • What we saw. One organization's flood used to slow every other organization's ingest. Under a 4-organization flood, a quiet organization's p50 was 14.7 s and 34% of its requests got a 503 from the edge's shared shedder.
  • What changed. The edge now admits span ingest per organization: 8 in flight each, a 64 budget past which only organizations below their fair share get in, a 96 ceiling, and a fast 429 or 503 with Retry-After. It learns which organization a credential belongs to from the control plane's answer to an authenticated request, never from a header. The map holds at most 200,000 entries and forgets one after 10 minutes. The control plane also caps in-flight ingest per process, refusing the organizations that fill it, never a quiet one.
  • Result. The quiet organization's p50 was 0.61 s (p95 1.34 s) with no 503.

Load numbers.

  • Span ingest at 50 requests a second (about 74 spans each): p50 13.9 s and 2,871 refusals before; 0.48 s and 101 after. Langfuse scores were one ClickHouse insert each inside the request; now one write per batch.
  • At 4x overload: goodput 46.4 requests a second (capacity), p95 2.1 s, no client timeouts; before, 24 requests a second and 6,861 timeouts.
  • One control-plane process saturates near 3,600 to 3,800 spans/s, so 10x production (about 50,000 spans/s at peak) needs 18 to 20 ingest processes and a ClickHouse write group of at least 16 vCPU.
  • Reads at 1.2 million requests on the 1-vCPU preview: sessions, traces, scores and trace SQL meet the 2 s target; the Requests list does not (p95 2.8 to 9.1 s), nor does Helicone request/query (p95 6.64 s).

Production enablement. One outage serve-stale bound of 60 minutes in explabs/outage_bound.py, used by every path and pinned by a test. An availability endpoint, GET /api/orgs/{org}/observability/availability, so pages explain a missing feature instead of showing empty columns. One release variable list for the GitHub production and staging workflows. Every alarm root requires its topic.

Security retest. Three findings, all fixed: erasure now clears frozen Helicone webhook payloads when capture is turned off or content is deleted; webhook destinations are validated at create and capped at 50 per organization; the fixture script refuses hosted databases. Tenant isolation, read-scoped admin keys, do-not-store and trace SQL escapes held.

Full tables and the remaining limits are on the plan page under Load and scale, and Security.

Span ingest, before and after

Compare the rows: the same offered rate of 50 a second before and after the fixes, then a 4x overload. Watch the p50 and the refusals (503) columns.

BuildOffered/sOK/sp50p95503Timeouts
Before (37d8b2ef4)5037.313.9 s16.8 s2,87116
After the ingest fixes (1a9e27bf09)5048.00.48 s1.45 s1010
After the ingest fixes, 4x overload20024.315.7 s29.4 s6,9676,861
After edge admission (3ab24ef686), 4x overload20046.4not reported2.1 snot reported0

Fairness: a quiet organization during another's flood

Four organizations sent 150 requests a second; four quiet organizations sent 8. Before the fix, 34% of the quiet organizations' requests got a 503 from the edge's shared shedder.

RequestsOK503429p50p95
Quiet organizations, before495411168not reported14.7 s22.3 s
Quiet organizations, after5135010120.61 s1.34 s
Flooding organizations, before13,5514,2624,2275,06214.5 s24.2 s
Flooding organizations, after13,5923,77809,814 (fast)0.51 s1.18 s

Capture pipeline, before and after

Each row is one stage of the pipeline, how it behaved before, and after the fix.

StageBeforeAfter
Langfuse scoresOne ClickHouse insert per score (about 250 ms each), inside the request; 3,501 single-row inserts in 120 s; p50 13.9 s at 50 requests a secondOne write per batch
ETL span throughputAbout 56 spans/s (one write cycle per ingest request)About 480 spans/s with grouped writes on short sessions; about 100 spans/s once sessions reached 30,000 spans; about 300 spans/s in the latest measurement
Grouped inserts18 to 21 MB, refused by the ClickHouse ingress (16 MiB cap)At most 5,000 spans and 4 MiB per group, configurable
Gateway captures during a span backlogNone stored from 22:33Z for over an hour (shared queue)4.1 to 7.5 s in 13 of 13 probes with 2,500 to 4,000 span segments waiting (in-memory park). The park later filled and a capture waited over 3 minutes; now span segments have their own queue.
Session summary per write2.8 to 3.1 million rows read, 21 to 64 sAbout 37,000 rows read, p50 330 ms (folded from per-trace parts)
First rebuild of a big existing sessionOne 3.4 to 4.0 million-row statement, 103 to 126 s, past the 45 s timeout, retried on every writeSlices of 500 traces; the longest statement 3.3 s
Request text after a gateway call87 to 170 s18 s in 2 of 3 probes; the third took 86 s because the usage exporter itself lagged 43 s

Reads at 1.2 million requests

Target: p95 under 2 s for lists and under 1.5 s for detail views, measured on the busy 1-vCPU preview ClickHouse after the fixes above. Per-organization read quotas worked: 24 concurrent sorted-list readers in one organization got 402 refusals and 2 answers in 40 s, while a quiet organization kept reading (10 of 10), at p50 3.4 s instead of 1.1 s because the single core was full.

Readp50 / p95Verdict
Requests, default 24 h2.54 / 2.84 sOver
Requests, 30 days2.35 / 2.91 sOver
Requests, 30 days sorted by cost5.86 / 9.08 sOver
Requests, end-user filter4.82 / 5.27 sOver
Requests, session filter (7 days)1.20 / 1.38 sOK
Search 7 days2.18 / 3.25 sOver
Sessions 30 days, sorted by cost1.09 / 1.67 sOK
Session detail1.21 / 1.48 sOK
Traces 30 days and trace detail0.81 / 0.91 sOK
Scores0.57 / 0.61 sOK
Trace SQL0.91 / 1.23 sOK
Helicone request/query4.25 / 6.64 sOver
Helicone session/query0.58 / 0.85 sOK

November 22: the adversarial rounds

Where the day started. The build was correct in tests but untested at scale in many places, and the owner wanted maximum speed for search and everything else, deep load tests, and real comparisons of alternatives. So on November 22 a team of agents attacked the build in rounds.

Update, 2026-11-22. #2980 is now one commit, 2172de142f, on top of current main, with the customer docs on the new docs site. The secret scan flagged example values in the docs (none were real credentials); they were changed to obviously fake values. At 05:40 UTC, 32 checks pass, 2 are still running and none fail.

Still open: the owner's decisions; the Requests list speed (p95 2.8 to 9.1 s at 1.2 million rows; target 2 s); and a from-scratch rebuild of preview pr-902980 on the new head. Details are in the plan page, under Build status and Shipping.

How a round works. Each agent owns one area and works on its own branch. It measures a baseline, compares at least two designs with numbers, builds the winner with tests, and writes a report. The coordinator merges the branches into #2980, redeploys preview pr-902980, and the agents measure again. Production and staging are off limits; heavy load on the shared preview is announced first and kept under 10 minutes per run.

Eight agents attack the build in rounds. Each agent owns one area: search and reads, the gateway hot path, ingest and the capture pipeline, chaos (failures under load), security, web speed, UX and API clarity, and seed data.

Each round has the same steps:

  1. measure a baseline;
  2. compare at least two designs with numbers;
  3. build the winner on its own branch;
  4. the coordinator merges the branches into #2980 and redeploys preview pr-902980;
  5. the agents measure again.

Round 1 numbers are local (the preview was being rebuilt), on a 1-vCPU ClickHouse sized like the preview's. Round 1 is deployed to the preview as e61892b57d; round 2 follows with a from-scratch rebuild.

The day ran in this order: round 1 locally; round 2 on the rebuilt preview; round 3 with the failure tests on the live preview (12:00 to 16:20 UTC); round 4 on the live preview (17:10 to 17:50 UTC); rounds 5 to 9 closing the wallet-outage gaps (17:50 to 19:20 UTC); rounds 10 and 11 on the gateway after that; and a completeness check at 22:00 to 22:30 UTC.

Round 1: measuring locally, and the first fixes

Round 1 ran on local machines while the preview was being rebuilt. The search numbers come from a test set of 50 million requests in one organization. Every agent found something; the biggest wins were in search and in the capture pipeline, where one design choice cost more than ten times the throughput.

Search. The request text table was laid out for writing, not for searching. Sorting it by day and time, with larger granules, lets a search read newest first and stop at a full page. Two real bugs also showed: a search with no filters named every request id in the window, and a quoted search did not match the exact phrase.

Gateway. Compared with main, the new request path halves median latency, because the per-request Postgres reads are gone. The limit of one worker is Python's GIL plus the engine's 4 bridge threads, not any store.

Capture pipeline. The loader split each segment's writes by API key, and every ClickHouse write costs about 0.2 s whatever its size. One write per segment, plus a group commit across workers, gave about twelve times the throughput.

Chaos. Failures under load found that span uploads broke in a Postgres outage, and that Responses continuations broke in an outage and, through a separate bug, in steady state. Three designs were compared for continuations; the table is in the bullets below.

Round 1: search and reads

Each row is one kind of read, its time before and after round 1, and the change that made the difference.

ReadBeforeAfterChange
30-day text search, 50M requests in one org2.8 s for a phrase (1.2M rows)100 to 210 msrequest_text sorted by day and time with 256 KiB granules; read newest first, stop at a full page
Search with filters, 50M rows3.4 s0.45 stext checked batch by batch, inside each batch's time range
Search inside one small trace549 ms71 msbloom filter on trace id; trace search capped at 30 days
Requests list, key filter, 50M rows4.9 s0.75 sfilters applied first (PREWHERE); minmax indexes on sort columns
30-day sort by cost, 50M rows540 ms306 msremoved a read cap that turned off ClickHouse's top-k granule skipping
Traces list690 ms15 msone merge per page
Postgres calls per Requests page11 (320 to 480 ms)2two read-only functions; nothing per-org cached, so edits show on the next read

Bugs found: a search with no filters named every request id in the window (385 MiB read even with no match); a quoted search did not match the exact phrase. Both fixed. Two ClickHouse tables (not on main or production) were changed in place, so round 2 recreates the preview's ClickHouse.

Round 1: gateway hot path

Round 1: ingest and the capture pipeline

All runs used the preview's 1-vCPU ClickHouse. The After column gives the speed-up over Before in brackets.

Setup (1-vCPU ClickHouse)BeforeAfter
Empty table, big segments405 spans/s4,802 spans/s (11.9x)
Small segments335 spans/s4,214 spans/s (12.6x)
1.5M spans already stored333 spans/s2,074 to 2,143 spans/s (6.2 to 6.4x)

Cause. The loader split each segment's writes by API key, and every write costs about 0.2 s regardless of size.

What changed. Now one write per segment, plus a group commit across workers. Gateway captures are stored 16 at a time instead of one by one. Hostile payloads (2.3 MB body, 40 random keys, a 1,500-deep chain) all land within their caps.

Compared and rejected: ClickHouse async insert (4 to 27 times slower); protobuf over JSON (decode is under a tenth of the per-span cost); Kinesis over SQS (the queue carries only small notifications).

Found on the preview: the requests_history import, which every production org runs before the new table takes over, moves only 73 to 195 rows/s, and one day stalled 10 minutes in the trace cleanup. Lead cause: one delete per 1,000 touched traces with no trace-id index, and a failed delete grows the next batch. Round 2 fixes it.

Round 1: chaos (failures under load, local)

Round 1: security

Round 1: web speed and UX

Round 1: seed data

Every preview rebuild now seeds four extra orgs (a second tenant with storage off, a Pro ZDR org, a 1M-request org over 30 days, a sandbox), five role logins, about 70 real gateway calls and agent traces. On the preview the seed took about 32 minutes (the old history import ran first and slowly; round 2 runs the bulk first). Seeded logins now skip onboarding.

Every round-1 design comparison followed the same method. The gateway agent, for example, compared the Lua wallet script with WATCH/MULTI (the script won by 8 to 16 times), rejected local credit leases because they allow overspend, and measured settle batching (worth 9 times, but not needed yet). The ingest agent rejected ClickHouse async insert (4 to 27 times slower), protobuf over JSON (decode is under a tenth of the per-span cost) and Kinesis over SQS (the queue carries only small notifications).

Round 2: what the rebuilt preview showed (deployed as e00169bd7f)

Round 2 ran on the preview, with real pods, a real pooler and other agents' load. Problems appeared that no local test could show. The most serious: half of brand-new organizations failed their very first call, and one heavy organization could starve the others before any fault was injected.

Round 3 and the failure tests on the live preview (12:00 to 16:20 UTC)

Round 3 broke things on purpose. The chaos agent cut the wallet store off, took ClickHouse down, and restarted Postgres eleven times, all under load, and checked that money stayed exact after each. A stand-in model (a mock provider) carried much of the test traffic, so the tests did not depend on a real model's budget.

The table gives the results. Every outage was survived with money exact. The fixes listed below it close the slow edges the tests found.

TestResult
Wallet store cut off: three 10 s cuts and one 35 s cut, one gateway server deleted mid-cut (ElastiCache Serverless, new connections only)Errors only inside the cuts, all retryable, none a server error. They stopped 2.5 s after recovery. Replacement server ready in 50 s. Money exact: 2,098 served calls = 2,098 rows, charges equal to what callers were told. With the stand-in model at 5 req/s, 2,715 of 3,000 served and every served call has exactly one request, attempt and usage row.
ClickHouse down 3 min 52 s0 errors of 4,026 requests; money exact; every queue drained.
Postgres outage: 11 restarts, about 459 of 615 s unreachable, longest 74 s0 errors on 3,060 stand-in-model requests and on span uploads; money exact (3,285 rows, 112,692,400 nano both ways). The database-outage signal fired for the whole outage. 45 continuations needed a resend: the documented preview gap (no shared conversation cache).
Captures during the outagesNone lost. 335 requests waited for their pointer because their Postgres row arrived late (up to 9 minutes) during the outages; all were captured and stored, encrypted. Round 4 writes pending pointers in their own quick pass.
Ingest scale-outOne control server tops out at about 3,500 to 4,000 spans/s; three reach 13,146 (3.3x). Overload is refused fast, never a timeout. A 10-minute run at 120 req/s on three servers: 9,432 spans/s, p95 0.59 s, 0.5% fast refusals.
Live prompts searchable under that loadAll 10 checks within 0.3 to 20.7 s. Before the round-2 and round-3 fixes, a prompt waited over 35 minutes.
New org's first call8 of 8 succeeded through the real mint route (0.4 to 1.0 s); earlier today 16 of 30 failed.

What these tests found and fixed:

Round 4 on the live preview (17:10 to 17:50 UTC, build 771a91c317)

Round 4 re-ran the round-2 and round-3 checks on a build that carried their fixes. The table compares the two. It also found one new, serious problem: readiness depended on the wallet store.

CheckRound 2Round 4
First requests after 28 idle minutes4 x 5030 errors
/v1/models during wallet cuts25 x 4290 errors of 90
Successful calls held over 3 s during cuts4511
Error type during cuts429 to every organizationretryable 503 on wallet lanes only, p95 0.34 s
Moneyexactexact: 1,543 calls = 1,543 rows, charges equal to what callers were told
Failed request reason on a phone1.8 to 3.9 s0.81 to 0.84 s
CI on #29805 checks failing (round 3)all 34 checks pass

New finding (high), fixed in round 5: a gateway worker reported itself not ready whenever the wallet store was unreachable. A wallet outage longer than about a minute would have taken every worker out of service, turning a wallet-only outage into a full one. Readiness no longer depends on the wallet store; wallet outages are contained per request by the breaker.

Read concurrency: letting 4 of a user's reads run at once instead of 2 saves about 1.7 s on a large org's Overview, but needs more than one ClickHouse core. It is now a setting (default 2); production sets 4 once customer reads have their own compute of 4 or more vCPU.

A round-3 CI catch: after a key rotation, servers kept the old model access for up to 60 s because of the longer access cache, so requests in that window failed. Fixed: the cache refreshes as soon as the revision a server serves changes.

The session detail slowdown, and the read limiter

On the preview, session detail went from 0.77 s in round 2 to 2 to 3.7 s. The search agent suspected the round-3 query change and tested it under preview-like conditions: a ClickHouse 26.6 container limited to 1 CPU and 2 GiB, holding 271,606 sessions in 477,795 rows, with a background writer holding the core at about 85%. All three variants return the same neighbors.

Table state, ms p50 / p95A: round-2 one-step (2 reads)B: round-3 two-step (2 reads, shipped)C: one statement with shared keys (1 read)
unmerged, quiet279 / 293129 / 153215 / 218
unmerged, about 85% busy502 / 676378 / 422340 / 801
unmerged, busy, largest session521 / 1,001398 / 609304 / 491
merged (after OPTIMIZE FINAL), quiet76 / 8975 / 124101 / 109
merged, about 85% busy189 / 286111 / 187306 / 409

What we learned. The round-3 two-step was not the regression; it is the fastest or about equal in every state, so nothing reverted. The slowdown came from what the page waited on: the preview was 2x slower on unchanged reads, and the organization's read cap was 2 standard reads shared by every user and key of that organization. The web agent and the search agent were reading the same organization in the same windows, so one page's reads queued behind the other's on one busy core.

One session page makes at most 3 or 4 ClickHouse reads at once; a test pins that a single page never meets the read limiter at the default cap. A refusal (the 429 seen at 17:15) needs a read to wait more than 4 s. The fix: the number of reads one actor runs at once is now a setting, EXPLABS_CLICKHOUSE_READS_RUNNING_PER_ACTOR (default 2, production 4, accepts 1 to 8, a wrong value fails the boot), and an organization's cap is never below one actor's.

New keys after a cold start, and capture visible in under 5 seconds

Cold start.

  • What we saw. 120 new keys, each sending 4 concurrent requests from one address, through a cold edge: only 8 of 480 succeeded; the rest got 429.
  • What changed. Requests of the same key now wait up to 250 ms for its first answer, then join the organization it taught.
  • Result. 480 of 480.
  • Guards kept. A flood of 200 random keys from one address still meets the cap of 2 untrusted places. Waiters are bounded at 1,000 per process. A 401 or 403 forgets the key at once. Only an authenticated answer refreshes an entry, so a revoked key never keeps its share.

Capture to visible. On an idle preview a capture took p50 4.3 s and p95 5.8 s to be stored. Most of that was the 2 s seal interval plus about 1 s waiting for the S3 notification. Two changes were modeled from measured stage timings (S3 notification 0.7 to 1.2 s, queue 33 ms, load p50 1.1 s and p95 2.8 s); the model reproduced the measured baseline (5.66 s against 5.8 s).

SealAnnounced bySeal p95p50p95
2 sS3 (before)2.46 s3.84 s5.66 s
2 swriter (a)2.46 s2.93 s4.73 s
1 sS3 (b)1.30 s3.02 s4.75 s
1 swriter (a+b, shipped)1.30 s2.10 s3.82 s

Cost. Both changes together cost about $13 more per busy gateway pod a month (S3 and SQS at us-west-2 list prices: $9.08 before, $22.14 after), about $157 a month for 12 pods. Quiet traffic costs nothing extra.

How it ships. The direct announcement ships behind a switch, off by default. The S3 notification is kept as a backstop, and the ETL defers S3's copy for 30 s so the two copies do not double-load. It is not yet measured end to end (card 35).

Not pursued. Kinesis or Kafka instead of SQS: SQS's queue wait is 33 ms, so another transport cannot buy the seconds that matter.

The preview's model budget. The real preview model (preview-gpt-4.1-mini) stopped answering at 14:44:10Z: 649 attempts failed with 403 in 14 minutes. The preview relay holds the worst case for every call and never refunds it. A one-word request with max_tokens=1 holds $0.00082 against a real cost of about 150 times less; $5 over 1,366 calls is $0.0037 held per call against $0.000018 spent. Settling each call to its provider-reported cost would make $5 last about 277,000 calls instead of about 1,400 (card 33).

Rounds 5 to 9: closing the wallet-outage gaps (17:50 to 19:20 UTC)

Round 4 showed that a wallet outage was mostly contained, but not fully. Answers were still held back, unknown keys still waited, and readiness would pull every worker. Rounds 5 to 9 were one gateway agent working through those edges one at a time. The summary comes first; the round-by-round account follows.

flowchart LR
  R["Request on a wallet lane"] --> B{"Wallet breaker"}
  B -->|"closed"| W[("MemoryDB wallet")]
  B -->|"open"| F["Fast retryable 503
within about 0.5 s"] PR["Prober thread
pings every 1 s"] -.->|"closes the breaker
when the store answers"| B W -->|"settle cannot land in 2 s"| D["Answer sent anyway;
settle deferred"] D --> Q["In-memory queue
retries up to 5 min"] D --> SP[("Postgres spool
durable copy")] Q -->|"lands once"| W SP -->|"replay after 60 s,
if the worker died"| RL["Balance-ledger worker"] --> W
How a wallet outage is contained after round 11. The hold taken before the call stays until its settle lands, so an organization cannot overspend, and a settle that lands twice is a no-op, so nobody is charged twice.

Round 5: readiness, unknown keys, and settles that held the answer

What we saw on the round-4 build: in a cut, readiness turned "not ready" after 3.6 s; some served requests finished 12 to 15 s late; an unknown key's 401 took about 4.5 s.

Why. The readiness probe pinged MemoryDB through the wallet's client and paid its synchronous cluster rediscovery (3.6 s); a cut over the probe's 60 s failure window would have pulled every worker. The engine answers a non-streaming request only after its settle returns, and the settle retried for up to 15 s on the request's thread. The "minted in the last five minutes" check for unknown keys was not behind the breaker and used redis-py's default 10 retries.

What changed. Three things:

  • Readiness is now the catalog, the lane lifecycle and the key filter, nothing else.
  • One MemoryDB breaker is shared by the limiter, the wallet, the policy cache and the recent-mint check. The recent-mint check now makes no retries and gives an unknown key the retryable 503 at once (without MemoryDB a filter miss cannot tell a key minted a second ago from a random one).
  • A settle now holds its request at most 2 s. After that, a queue (one thread, bounded at 50,000) retries the same settle and receipt for up to 5 minutes.

Why a background settle is safe. The hold taken before dispatch stays until the settle lands, so the available balance is only ever lower in the meantime. The settle script is a no-op on a hold that is no longer held, so a retry never debits twice. A settle that never lands leaves its hold to the existing forfeit sweeper: nothing charged, a visible forfeit receipt.

Round 6: keeping the usage record complete

What we found. A failed attempt whose settle was deferred, followed by the request's failure terminal, put the terminal in the receipt stream first. The writeback finalizes a request's usage event once, so the event missed that attempt. Money was right; the record was not.

Designs compared. Re-finalizing in SQL when a late attempt row lands would mean reversing and rewriting the usage event, its rollups and its ClickHouse outbox payload inside a hot money function. Keeping the order at the source needs no SQL change. The second won: a request's terminal waits in the queue behind its own deferred attempts, never another request's.

The worst case of an in-memory queue. A deferred settle is lost only if the worker dies during the outage. Each worker admits at most 64 requests, so at most 64 pending settles per worker: about $0.32 to $3.20 at a mean charge of $0.005 to $0.05, and up to about $32 if all 64 were $0.50 long-context calls. The old design forfeited every in-flight settle of any outage over 15 s, with no worker death needed, so the new one never loses more.

Rounds 7 and 8: a durable spool for deferred settles

To make a worker's death cost nothing, each deferred settle now also gets a durable copy in Postgres (balance_ledger_spooled_settles):

  • It is written on the queue's thread, never the request's, under the request-path bounds (0.5 s checkout, 0.75 s statement).
  • If Postgres is also down, the settle stays in memory only, as before.
  • The balance-ledger worker replays rows older than 60 s, oldest first, 200 per pass, every 15 s. An alarm fires when the oldest row passes 600 s.
  • Round 8 spooled the request's own terminal record too, with a rule in SQL that a terminal is never replayed while any settle of its request is still spooled.

Tests. On a real Redis cluster a worker deferred and spooled three settles in a cut, then died; the replay landed all four (one had landed from the live queue), each charged exactly once, and replaying again changed nothing. pgTAP: 22 of 22 on pr-902980 in a rolled-back transaction. The two migrations were folded into one before either reached main. Cost: one insert and one delete per deferred settle, nothing while MemoryDB is healthy.

Round 9: no request is ever the test call

What we saw in a 90 s cut on the round-5 build: readiness held, no success was held and money was exact, but 18 of 20 unknown keys took 4.2 to 4.9 s, and 4 of 97 model listings took 4.8 to 7.8 s.

Why. After each 2 s open period, the breaker let one call through to test the store. At the low request rates of these paths, that call was nearly always a customer request, and it paid the dead store's read timeout plus a cluster rediscovery that dials every node; a security-group cut drops those connection attempts. That is 4 to 8 s.

What changed. A background prober pings MemoryDB every 1 s while the breaker is open, and only its success closes the breaker, so every request during an outage is refused at once. Request-facing reads (the unknown-key check, the listing's deny-set read) run on a separate small thread pool with a 0.5 s budget. One function builds every gateway MemoryDB client, and a structural test fails any code that builds one elsewhere.

Read during a stallRound 8bRound 9
Unknown-key check, preview 90 s cut4.2 to 4.9 sbounded at 0.5 s
Listing deny read, preview 90 s cutup to 7.8 sbounded at 0.5 s
Unknown-key check, local SIGSTOPmax 754 msmax 502 ms
Listing deny read, local SIGSTOPmax 3 ms (SIGSTOP accepts connects, so the rediscovery cost does not reproduce locally)max 506 ms

Rounds 10 and 11: booting during an outage, and the last slow calls

Round 10, a worker that starts during a wallet outage.

  • Problem. The limiter's boot check raised on any failure, and the wallet's client discovered the cluster in its constructor, so a worker could not start while MemoryDB was out.
  • What changed. Clients now connect on first use, inside the breaker. The boot check logs, leaves the breaker open and retries every 5 s. Readiness, which no longer asks MemoryDB, lets the pod serve everything that does not need the wallet.
  • Kept. A refusal from a reachable store (a permissions error) still stops the boot, because that is a configuration error.

Bring-your-own-key calls are not served in a wallet outage. Even a zero-cost call places a hold, which runs the ban and revoke check and carries the record that lands the request in Postgres. Serving them would need a second path; that is card 36.

Listings outside cuts. Measured on the preview from a laptop: an invalid-key 401 took 86 ms at p50, a listing 50 ms after another 80 ms, but a listing after 0.5 to 6 s idle 210 to 360 ms (max 1.1 s). Two refresher paths replaced the listing's memo inputs even when nothing changed, forcing a re-plan of about 820 routes; both now skip equal rows. That was not proven to be the whole cause, so two timing log lines were added to split a slow listing.

An unknown-key 503 with the wallet up. Three paths could answer it. A private 1 s backoff beside the breaker could refuse every unknown key for a second after one slow read; it is gone. The client was built inside the first unknown key's check; it is now built at boot. The remaining causes now log a reason. Two log fields from rounds 7 and 8 were not in the log schema and were renamed.

Round 11, the forced-kill run. On build b14d6afd6d the spool proof passed and a worker booted during the outage with 0 restarts.

Money was exact. The plan page records the forced-kill result: each attempt was charged exactly once. There were 3,766 attempts, 3,766 settle receipts and 135,576,000 nano-USD, and the wallet equalled Postgres, which equalled what callers were told. The spool emptied under 7 s after recovery.

Speed was not. Two spooled requests answered after 6.8 and 9.3 s despite the 2 s bound, a listing took 2.45 s, one got a 429, and an unknown key took 1.48 s.

Why. A hot wallet call that found the cut ran on the caller's own thread and paid the read timeout plus the rediscovery, seconds per call. The settle's 2 s bound was checked only between tries. And slow wallet calls held the engine's 4 bridge threads, which listings also need.

The fix. Every wallet, limiter and promotion-policy call runs on its own 32-thread lane with a 0.5 s budget, at a cost of about 11 microseconds per call. Two tests pin it: a reserve under a 5 s hang answers in under 0.7 s, and a settle gives up in under 2.3 s. Both fail on the old code.

CaseBefore round 11Expected now
A spooled (deferred) request's answer6.8 to 9.3 s2 s defer bound plus about 0.5 s at most
Listingup to 2.45 sits own work plus at most one 0.5 s bridge wait
Unknown keysup to 1.48 ssame as listings

A listing can still pass 0.6 s if every bridge thread is held at the moment of the cut. Cutting that further would mean serving GET /v1/models without a bridge permit, an engine change proposed only if the next measurement still misses.

The completeness check (22:00 to 22:30 UTC, preview build 16fa66ead2)

The last pass of the day asked a different question: is everything the plan promised for Observability actually built, wired into a page, documented in English and Japanese, and working on the preview? It matched 40 planned capabilities with a light API sweep of about 45 calls and a code reading.

Result. Almost everything is built, wired, documented and working. Measured on the preview:

  • the Requests list: 1.3 s cold and 0.4 s warm;
  • request detail 210 ms, body 1.0 s;
  • session list 774 ms, detail 505 ms, skeleton 884 ms, turns 1.9 s (slow for a 4-request session);
  • an OTLP span visible in its trace and session within 45 s;
  • dataset export 2.3 s for 10 items.

Search matched whole words, quoted phrases and joined terms such as INV-20391. It has no prefix match (Lisb finds nothing), now documented as "How search matches".

Gaps.

  • "Proxy traffic" on the Requests page is local capture (exp capture on a customer's machine), not the Helicone proxy hosts. It is platform-admin only, and its data, like trace uploads and Langfuse and Braintrust pulls, lands in the legacy trace_spans table, so it never reaches Requests, Sessions or Traces. (Fixed and verified in Round 12.)
  • No traces list page, no trace SQL screen, and no per-user totals page or tag-key picker (both needed before Helicone's /users and /properties links can redirect to ours).
  • Docs gaps: the own-use archive opt-in, and the Helicone SDK log endpoints.
  • Media and Decisions capture wait on an engine release.

These became card 37 in Part 7.

Round 12: page speed, new routes, and why uploads never arrived

Page speed. The conversation view now shows its first turn 40 to 77 ms after the click (target under 1 s; it was 1.3 to 1.7 s), with a layout shift of 0 on the demo org and 0.0078 on Atlas. The session page is back near its baseline: Atlas 1.0 s against 0.98 s, and the demo org's median about 1.0 s against 0.81 s. The slower back-to-back reloads on the demo org come from the preview's cap of 2 ClickHouse reads at a time per viewer; production plans 4. The tag filter and the Users view were verified live.

New routes. A per-upload DELETE route: it answers 404 for another organization's upload or a malformed id and 202 for the caller's own, and afterwards the receipt and the stored file are gone and erasure of the upload's spans is queued. And a new admin read, GET /api/admin/background-jobs, that shows the background jobs and the settings they run with.

The upload experiment.

  • Problem. Round 11 sent uploads, exp capture batches and the Langfuse and Braintrust pulls through the same span sink as OTLP. On the preview, uploads were accepted but never reached Observability.
  • How we looked. The new background-jobs read showed that the control pods did not have CLICKHOUSE_TRACE_PROJECTION_ENABLED. Main's deploy script gives that setting only to the Project worker; #2980 moves trace projection to the control plane, but its deploy-script change never reached the preview.
  • What changed. The gate is dropped. The projection loop starts wherever the observability store and the span sink exist, so it no longer depends on a setting the deploy may or may not give.
  • Production note. Segment capture is off in production, so there is no span sink there. Uploads and exp capture batches wait in their queue (they are not lost) until segments are switched on.
  • Verified on the preview (79479dfd80, 01:35 to 01:42 UTC). The background-jobs read showed trace projection "started" on the control pod. The 4 waiting uploads were processed when the pod started: the exp capture file on its first attempt, and two agent traces after 3 attempts each while the pod was starting (the cause is not yet read from the logs). The sessions and traces APIs answered 200. The demo agent trace shows the agent, then an LLM call (gpt-6-luna, 42 tokens in, 7 out), then the tool execute_tool lookup_refund, with the tree intact. The exp capture trace is one LLM span, and the Northwind copy landed in its own organization.
  • Storage controls hold. Northwind has capture off, and its stored batch has content_stripped true: no prompt and no tool arguments or result, while the model and token counts are kept. The demo org's batches keep their content.
  • Deleting a processed upload. The route answered 202. The trace answered 404 after 12 s, then the session did too. The receipt, the stored object and the deletion job were gone. The deletion worker takes one job per pass, so 3 deletions took about 2 minutes. All test data was deleted afterwards and every admin key minted for the test was revoked.
  • Still open, not blocking. The 3 retries at pod start deserve a look in the logs, and the name "Local capture" and who sees it are still an open UX decision (card 37).
  • What it led to. If one setting from the PR's deploy script was missing, others could be too. That question became the audit in the next section.

What the preview could and could not test

How the isolated preview works. A preview is put together from three sources:

  • The controller comes from main. The controller is the trusted program that creates the preview's cloud resources. It runs main's code, because only reviewed code may run with its credentials.
  • The images come from the PR. Python, the web app, the Rust engine, and the ClickHouse and Postgres migrations are all built from #2980's head.
  • The deploy layout comes from main. Which apps exist, how many instances each runs and which settings each gets is decided by main's scripts/porter/deploy_porter_apps.sh, main's helper scripts and main's preview provisioners. Two seed scripts are the exception: the Supabase seed and the observability fixture run from the PR's head.

So every preview round ran #2980's code on main's layout. Where #2980 changes the layout itself, in scripts/porter/ and scripts/preview/controller.py, the change never reached the preview.

How we found out. Uploads never reached Observability, and the admin background-jobs read showed the projection setting missing from the control pods (Round 12). An audit then compared main's deploy tooling with the PR's, line by line, and sorted every claim in the rounds, the decision logs and both reports.

What it means for earlier results. The audit sorted 172 claim rows into three classes. The same claim can appear in more than one source.

ClassRowsMeaningKey examples
A. Still valid103Depends only on image code, or on parts main already deploys: segment capture, the preview capture ETL, the MemoryDB ledger with its writeback service inside the control app, the two-worker gateway fleet, the tag and dataset workers, and Helicone host routing.Wallet cut behavior (errors only inside cuts, readiness held, workers booting during a cut). The restart rehearsals. Search, read and page speeds. The UX walk and the security retest. Capture to stored on the S3-notification path, p50 4.3 s and p95 5.8 s.
B. Not yet proven on the PR's layout46Depends on a deploy or controller change that only #2980 makes.The background units, the dashboard edge, the writeback app and queue-age autoscaling never ran; the settle drain and usage export ran inside the control servers, so "every queue drained", the exporter lag of 2 to 43 s and "searchable under 21 s" describe main's layout. Helicone webhook delivery ran nowhere, and the separate Helicone response cache was never provisioned. Direct announce never ran: p50 2.10 s and p95 3.82 s are a model, and the measured S3-notification path is p95 5.8 s. The 3,900 s startup budget never applied (main's check allows about 5 minutes). Upload projection on the control plane did not run before round 12; it has since been verified on the preview at 79479dfd80. Ingest speed and fairness were measured on main's shared /v1 edge.
C. Valid only because of a hand-applied step23The preview was changed by hand for the test.The control plane scaled to three servers with kubectl scale for the ingest step-up (13,146 spans/s). The stand-in model lane built with kubectl and aws, which every money-exact count on that lane depends on. Hand SQL: a dead-lane rung, orgs marked verified, onboarding stamps. 1.2 million request rows inserted by hand for the read tests. The node pool cap raised by hand. pgTAP run by hand in rolled-back transactions.

Deliberate fault injection (security-group cuts, pod kills, Postgres restarts) is the experiment itself, so it does not count as a hand step. Two corrections came out of reading the code: the control plane's database pool bound of 32 is the image's own default, so those claims are A; and turning off the control plane's queue workers moves only the settle drain and the usage export, not erasure or trace projection.

The options.

  • (a) Land the controller and deploy-script changes on main first, each opt-in and off by default, as AGENTS.md requires for a new deploy prerequisite. Then redeploy pr-902980 and re-run the B claims. This is the recommendation: it keeps the trust boundary and proves the layout before #2980 merges.
  • (b) A preview mode that deploys with the PR head's scripts. It proves the exact layout in one step, but unreviewed code would run with the controller's credentials, so it needs the owner's sign-off.
  • (c) Prove it on staging after merge, switching each unit on there. The proof comes later and costs a staging rehearsal round.

Whichever option is chosen, the C steps get replaced: the control instance count set in the deploy, the stand-in model lane provisioned through the controller, and test data loaded through the fixture. This is card 38 in Part 7.

November 23: can we move off Helicone?

The question. Does #2980 let us turn off Helicone's own infrastructure? Two read-only checks answered it: a code audit of main and the #2980 branch, and a live inventory of our AWS, Porter, Supabase, ClickHouse and DNS.

Answer: not yet. #2980 builds a Helicone-compatible layer on our platform. Helicone's own services (worker, jawn, US and EU databases, the S3 body bucket, the dashboard) must keep running after it lands, because unserved traffic is forwarded byte for byte to Helicone US, EU stays on Helicone, and prompts, webhook configurations, org members, stored provider keys, and scores and feedback have no importer.

Our side runs nothing Helicone-related today. All Helicone code is only on the #2980 branch; there is no app, AWS resource, table, DNS record or cost tag ($0 a month), and the Helicone cache cluster was never created (roughly $300 to $700 a month per shard pair if built). So moving off Helicone is a merge-and-cut-over decision on #2980, not a teardown of our own infrastructure.

Helicone's stack is in Helicone's accounts. api.helicone.ai points at Helicone's own jawn-prod-blue-green load balancer. Nobody here can read those accounts, so their size, traffic and cost are unknown.

Nothing can show it is safe to turn off. The edge counts neither forwarded requests nor 421s, and the worker's header counters are never emitted.

The path. Owner decisions, then read access to Helicone's accounts, then the missing importers and forwarded-traffic metrics, then deploy #2980 and move hosts one at a time, then turn off Helicone US once forwarded traffic is measured at zero (then EU), and delete Helicone data last. The plan page has the full account, under "Moving off Helicone: where it stands". docs/helicone-move.md points to a decision log, /tmp/obs-build/decisions/helicone.md, that does not exist.

Part 6

Where it stands now

The state at the end of 2026-11-22: what is built, what the numbers are, what is still open, and how big production needs to be.

Build state

One pull request. Everything is in GitHub #2980 (branch obs-data-plan). Its head is 79479dfd80 (round 12). At 16fa66ead2 it changed 1,453 files against main, added about 241,600 lines and added 72 Postgres migrations. It was built by 14 parallel workstreams, each in its own worktree with fixed file ownership and a decision log; the logs are in platform-build-decisions.html.

Merged nowhere yet. "Merged" on this page means merged into the PR branch. Nothing of #2980 is on main, and nothing runs in staging or production. It keeps do-not-merge until the owner approves it.

CI. At 05:40 UTC on 2026-11-22, with #2980 as one commit (2172de142f), 32 checks passed, 2 were running and none failed. Round 4's CI was fully green (all 34 checks). Every check passed on f7cd3b5bbe (31 checks). The later heads pass every check that has finished; on 79479dfd80 CI is still finishing, with the integration tests last. GitHub reports #2980 as mergeable with main.

Preview. pr-902980 runs 79479dfd80, with all twelve rounds. The wallet, ClickHouse and Postgres failure tests passed there with money exact every time.

Waiting outside the PR. The engine change for media and Decisions capture is engine PR experientiallabs/experiential#1412 (not merged, not released). It is opt-in: the pin bump alone changes nothing. Several small main PRs let the preview run the branch: #3133, #3145, #3175, #3176, #3243, #3248 and #3252 (#3238 was closed as a duplicate).

Results, before and after

The table collects the headline numbers from every phase. "Local" means a developer machine or test cluster; "preview" means pr-902980, whose 1-CPU ClickHouse makes its read numbers a lower bound for production.

Preview figures ran #2980's code on main's deploy layout. Some of them, such as the 3.3x ingest scale-out, the 21 s search time and the 3.82 s capture model, are not yet proven on the PR's layout or needed a hand-applied step; What the preview could and could not test lists which.

AreaBeforeAfterWhere
30-day search, 50M requests in one org2.8 s (phrase, 1.2M rows)100 to 210 ms on 1 thread; 46 to 93 ms on 4local
Search with filters, 50M rows3.4 s0.45 slocal
Search inside one trace549 ms71 mslocal
Requests list, key filter, 50M rows4.9 s0.75 s on 1 thread; 0.26 to 0.35 s on 4local
Traces list690 ms15 mslocal
Postgres calls per Requests page11 to 142local
Request drawer14 database calls, 403 ms4 calls, 293 mspreview
Capture pipeline, spans/s on 1 ClickHouse CPUabout 400about 4,800 (empty) / 2,100 (1.5M stored)local
Session summary per write2.8 to 3.1M rows, 21 to 64 sabout 37,000 rows, p50 330 mspreview
History import per production org73 to 195 rows/sabout 10,000 rows/s; 10M rows in about 20 min (was about 35 hours)preview, then local
Live prompt searchable, with a backlog25+ min3.4 s in the testpreview, then local
Live prompt searchable under 120 req/s35+ min (morning)under 21 s, 10 of 10 checkspreview
Capture to stored, idlep50 4.3 s, p95 5.8 smodeled p50 2.10 s, p95 3.82 s (not yet measured end to end)preview, model
Span ingest at 50 req/sp50 13.9 s, 2,871 refusalsp50 0.48 s, 101 refusalspreview
Span ingest at 4x overload24.3 req/s, 6,861 timeouts46.4 req/s (capacity), 0 timeoutspreview
Trace ingest, 1 vs 3 control servers4,029 spans/s13,146 spans/s (3.3x)preview
Quiet organization during another's floodp50 14.7 s, 34% got 503p50 0.61 s, no 503preview
New keys after a cold edge (120 keys x 4)8 of 480480 of 480local
Median gateway latency vs main20 ms (main)11 ms; a 5 MB prompt about 150 ms instead of 31 slocal
New org's first call16 of 30 failed8 of 8 succeeded through the real mint route (0.4 to 1.0 s)preview
Postgres down 10 minutes746 errors of 3,9560 of 3,956; money exactlocal
Postgres outage, 11 restarts, 459 of 615 s unreachablen/a0 errors on 3,060 requests; money exactpreview
Wallet store cut off4 server errors; 34 to 46% failing before any cut0 server errors; errors only inside cuts, all retryable, p95 0.34 s; money exactpreview
90 s wallet cuta cut over about 60 s would take every worker out of service0 not-ready in 184 samples, 0 restarts; slowest success 0.36 s; 1,868 calls = 1,868 recordspreview
Worker killed holding spooled chargesup to 64 charges per worker lost (about $0.30 to $32)3,766 attempts, 3,766 receipts, charged exactly once; spool empty under 7 s after recoverypreview
ClickHouse down 3 min 52 sn/a0 errors of 4,026 requests; every queue drainedpreview
Managed MemoryDB failover (real MemoryDB)n/aevery organization refused for 14.1 s (14 to 15.5 s in two runs); no money lostAWS
Data controls page, first data2.31 s1.30 slocal
Requests page JavaScript176 KB gzip83 KB gziplocal
Session, trace, API Keys pages (desktop, warm)1.57 s, 1.59 s, 1.25 s1.18 s, 0.70 s, 0.55 spreview
A failed request's reason on a phone1.8 to 3.9 s0.81 to 0.84 spreview
Finding why a request failed5 to 6 clicks2 clickspreview
Tag starvation guard (customers asking 100 judge calls/s)our review held 6.9/s24.0/slocal
Clef judge 503s0.55% (112 of 20,077 in 30 min)0 of 22,780production VM

Earlier, on 5 million requests in one org on a 16-core ClickHouse, the reads measured: first page 47 ms median, cost sort 681 ms, a 5,000-request session 124 ms, search 128 to 543 ms, session list 38 ms. In the browser a 5,000-request session draws in 186 to 228 ms (1.4 s at 4x slower CPU and 50 Mbit/s), and first rows show in 241 to 410 ms.

Remaining gaps

The Requests list at large scale. This is the biggest open performance item. At 1.2 million rows on the busy 1-vCPU preview it measured p95 2.8 to 9.1 s against a 2 s target (ClickHouse alone: p50 1.02 s, p95 5.39 s, plus 13 Postgres calls, about 0.8 s). It still reads the old usage events beside the new table until the history backfill stamps the environment. The follow-up run stopped on 2026-11-21 while waiting for the backfill and produced no result; the test has not been re-run since the round fixes. Helicone request/query is also over target (p95 6.64 s).

The PR's deploy layout. The background units, the dashboard edge, the writeback app and queue-age autoscaling, Helicone webhook delivery and the separate Helicone response cache, direct announce, and the 3,900 s startup budget have not run anywhere (What the preview could and could not test, card 38). Uploads and exp capture batches wait in their queue in production until segment capture is switched on there.

Ingest and the pipeline.

  • One ingest process saturates near 3,600 to 3,800 spans/s (about 200 microseconds a span). The fair cap refuses fast, but cannot stop queueing in front of admission; the fix is more processes.
  • A write that touches many traces of one huge session still reads most of that session; a per-session write lane would isolate it.
  • The tail of the text delay is the usage exporter's own lag (2 to 43 s); a notification from the exporter would remove the polling.
  • Hostile payloads (2.3 MB bodies, 40 random attribute keys, a 1,500-deep span chain) were accepted as designed, but their landing in ClickHouse was not observed during the load run.
  • The raw consumer was being taught to forward control messages that reach the wrong queue. Dead-letter replay and an alarm for the text step were next.
  • The 1 s seal and direct announcement are modeled, not yet measured end to end.

Restarts and outages.

  • Not yet run: a 10-minute cut on production-sized data, and the MemoryDB failover game day (its script is allowed only against staging, and the preview's ElastiCache Serverless cannot answer the failover question). Rehearsals so far: 41 to 70 s cuts, 11 restarts with 525 of 604 s down, all on a small preview database.
  • Protected chains were tested only locally (flow 12); the preview has none, and flow 12 is not in CI. One protected request in flight at the cut waited 30 s before its retryable 503.
  • No read replica exists in any environment, so replica routing is untested against one, and dashboard pages error during a restart.
  • Responses continuations: the shared spill needs the Helicone cache cluster, which previews lack (card 27); 45 continuations needed a resend in the preview outage test.
  • From failure injection: the segment directory is lost on pod restart; contract traffic is admitted during a long S3 outage; a pod with uncertain facts can over-grant promotions; the reconnect stampede.
  • From round 9: the first hot wallet call of a cut still pays one failing call before the breaker opens.
  • Both stores down at once plus a worker death: the old forfeit path still applies (accepted).
  • The money and chaos attacks have not been re-run against every fix.

Product. Local capture, trace uploads and connector pulls now reach Observability (verified in round 12), but the "Local capture" name and who sees it are still open (card 37); there is no traces list page and no trace SQL screen; session and tree previews are not built; media and Decisions content waits on the engine release; Helicone members cannot sign in yet, and full Helicone bodies are not copied (32 KB of text per request); session turns take 1.9 s and dataset export 2.3 s for small inputs. Two docs gaps remain (archive opt-in, Helicone SDK endpoints).

On main, outside the data plan. A sign-up refused because the mailbox already exists (plus-tag folding) shows a code step that never sends a code; the preview's admin seed leaves token columns NULL; Next.js 16.4.1 has 7 moderate advisories. Each gets its own small PR (card 32). The Clef pool's dead U.S. replica (18170) still needs an owner.

Sizing for production

Production today averages about 50 gateway requests a second, roughly 500 at peak. The load test sized each stage for ten times that: at an assumed 10 customer spans per gateway request, about 50,000 spans a second at peak, or about 700 ingest requests a second.

StageMeasured unit costNeed at 10x peakRecommendation
Span ingest (control plane)About 3,700 spans/s per Python process50,000 spans/sIts own deployment, 18 to 20 processes at peak, autoscaled on CPU. Recompute the per-organization limits as fleet-wide numbers, because they are per process.
Edge relayAbout 1 CPU at 200 requests a second with 50 KB bodiesAbout 700 requests a second4 or more edge pods for ingest, or route ingest from the ingress straight to the ingest deployment.
Capture ETL span writes480 spans/s per writer on short sessions; about 100 spans/s at 30,000-span sessions (before session parts)5,000 to 50,000 spans/sSession parts first (done), then more tasks, since each task has one writer: 10 to 100 tasks on a sized write group.
ClickHouse write group1 vCPU: about 480 spans/s with about 60% of the core in merges50,000 spans/sA separate write compute group of at least 16 vCPU.
QueuesOne queue for all sources (at the time of the test)Separate control queue (done 2026-11-21) and an alarm on the oldest message age per source.
ReadsRequests list p95 5.4 s at 1 million rows on a busy 1-vCPU ClickHouseAbout 50 million rows per large organizationRun the history backfill and stamp it (drops the union), use the read compute group, run totals beside the page, cut the 13 Postgres calls, and re-measure on production-size compute.

Customer reads get their own ClickHouse compute. On the preview, the capture pipeline catching up after the failure tests used 979 of 1,000 millicores, and every customer read slowed about 2x (the 30-day Requests page 552 to 995 ms). In production, customer reads go to their own read-only compute group, sized at least 4 vCPU per concurrent heavy reader, with max_threads 4 (8 threads adds nothing), and EXPLABS_CLICKHOUSE_READS_RUNNING_PER_ACTOR=4. A cost-sorted copy of the requests table was tested and rejected (13% more write time, 25% more disk, and the default view got 2x slower).

Gateway workers. One worker saturates at about 165 req/s (Python's single core plus the engine's 4 bridge threads), so the worker count follows peak request rate.

Wallet. One MemoryDB shard (one primary, two replicas) costs about $946 a month and holds all 64 slots. The receipt streams are budgeted at 4.8 GB (a 60-minute outage at 150 req/s with 4,460-byte receipts). Finished-charge records at 10x traffic would be about 52 of the wallet's 102 GB if kept 24 hours. Cards 9 and 10 decide shards and that window.

Cost of the new capture path. Batched segments cut the new S3 and SQS bill from about $3.5k a month to about $0.7k; the plan's target is about $1k a month for S3, SQS and Fargate at today's volume.

Steps that would touch staging or production, listed so nothing is lost; none run while the work stays in the preview: Terraform applies for trace storage, trace tags, the control-plane role, the audit archive and the Helicone cache cluster; alarm wiring; a read-only ClickHouse compute group and the per-environment backfills; checking the read replica's statement timeout; turning on EXPLABS_CAPTURE_DIRECT_ANNOUNCE with defer_s3_notifications after infra/traces is applied. Before each switch, confirm its alarms have an action.

Part 7

Decisions

Every decision still open, then the ones already made. The numbers and letters match the cards on the plan page.

Open decisions

Each card says what is being decided, what the code does today, the options and their trade-offs, and a recommendation. Cards marked Confirm are ones where the owner gave an answer that we read one way and need confirmed. Cards marked Your call need a decision. Decisions 3, 4, 5, 9, 10, 13 and 14 are built with a provisional default so the code could move forward; the owner asked for more information on them and has not decided them. #2980 stays do-not-merge until they are answered.

Nothing here runs in staging or production while the decisions are open.

Simplifications proposed by the November 20 plan review

Your call · A

One capture destination

Today. Capture can write three ways: inline into Postgres (production's default), segments (pod disk, then S3, then the ETL into ClickHouse), and a mirror state that writes both and gates reads. Every capture feature is tested three ways, and the read gate caused two bugs on the preview that week.

Proposal. Once segments run in an environment, make it the only mode there and delete inline and the mirror.

Trade-off. Segments depend on S3, SQS and the ETL being up (the pod disk buffers up to 2 GiB when they are not), while inline needs only Postgres; but inline keeps capture load on the Postgres the plan is moving off.

Recommendation: yes, after segments are proven in production.

Your call · B

Fold the new background apps into one

Today. The plan adds about five Porter apps (wallet writeback, trace-tag worker, dataset-run worker, Helicone webhooks, deploy units), each with its own spec, readiness check, alarms, CPU booking and place in the release order.

Proposal. One background app runs several worker processes.

Trade-off. Fewer things to deploy and watch, but you lose per-worker scaling on queue backlog and per-worker AWS roles (one role would hold the union of permissions), and a bad deploy of one worker restarts all.

Recommendation: partly. Fold the low-volume workers (tags, dataset runs, Helicone webhooks). Keep the wallet writeback (money) and the capture ETL (heavy, its own AWS role) separate.

Your call · C

Open the maintenance window automatically

Today. Before a planned Postgres restart, an operator opens the window, waits until every pod has seen it, then restarts. Forgetting it means protected chains (52% of traffic) get retryable 503s for the whole restart.

Proposal. The restart tool opens a window sized to the restart, waits for readiness, restarts, and reports.

Trade-off. A window freezes releases and catalog publishing for its length and cannot be ended early, so it must open only as part of an actual restart command, never on its own.

Recommendation: yes.

Your call · D

Table lifetimes without copying

Today (D3). Big tables (gateway_attempts is 238 to 311 GB) get a partitioned shadow copy kept in step by a change log and triggers on hot tables, then a cut-over. The copy is slow, the triggers sit on the busiest tables, and a column added later on main was already missed once in testing.

Proposal. Create the new partitioned table, send new writes to it at a cut-over, and read old plus new through a view for the 120-day retention window; drop the old table when the window passes. No copy, no dual-write triggers.

Trade-off. Reads through the view are a little slower while both tables exist, uniqueness across both needs care, and the old table lives 120 more days.

Recommendation: yes.

Retention, tags and access

Confirm · 3 · provisional default

Free plan: "we retain, not subject to any term"

Our reading. Free-plan organizations get no expiry of their captured data (we keep it), and this is not put into a terms change. So the built-in "free default expiry of 14 days, maximum 30" is removed rather than shipped switched off, and the free plan has no customer-set expiry control. Paid plans keep their expiry controls.

The code now. The switch is still there: free_default_enabled (off), free_default_days (14) and free_max_days in the retention settings, returned by explabs/api/routes/retention.py. With the switch off, free orgs get no forced expiry, which matches "we retain".

If confirmed, the switch and its three fields are removed from the settings, the API and the page. If you meant that free orgs can still set a shorter expiry themselves, the expiry controls open to the free plan instead, and the switch is still removed.

Your call · 4 · provisional default

Who pays for, and controls, the judge that scores a customer's tags

What this is. A customer defines a tag, such as "did the agent give up?". A judge model (Clef by default, or one they pick) reads each captured request and answers. That judge call is itself a model call: whose account makes it?

A (built). Through a key inside the customer's org, named "Trace tagging", system-managed, expiring every 15 minutes. Each judge call shows in their own usage. Their privacy settings (no-training, provider allowlist, ZDR, rate limits) apply automatically. Cost spreads across each customer's own balance.

B. Through our house account, then a fee. The customer sees one "tagging fee" line per period. Their privacy settings do not apply, so the judge needs a second copy of each org's policy logic. Every customer's judge traffic runs through one house organization: the hot-row problem behind the September and November incidents; on 2026-10-03 the house org ran out of credits and everything it funded stopped.

Recommendation: A. It is the only option where a customer's own privacy choices govern a model reading their data, and it keeps money spread out. The owner wrote "share more? not sure"; A has not been chosen.

Your call · 5 · provisional default

Revoking access to a private model takes up to 2 seconds

What changed. Every request used to check Postgres for whether the org may use a private model, one of the reads that turned database incidents into API outages. Now each worker keeps that list in memory, refreshed every 2 s from a change feed.

The cost. After a revoke, requests in flight and any in the next 2 seconds still go through. The same window already applies to revoking API keys. Money blocks (quarantine, ban, spend lock, revoked keys) are not affected: the wallet enforces them within about 1 second.

Recommendation: accept. If revocation must be instant, private-model requests go back to one Postgres read each and fail again during an outage. (The 15-minute outage bound on this list noted on November 20 is fixed: it uses the one 60-minute bound.)

Your call · 6 to 8 · the Helicone move

Legal, pricing and sign-in for moved Helicone customers

The plan (D12). Helicone customers change nothing. Our gateway answers Helicone's hostnames behind Helicone's own DNS; anything we do not serve yet is relayed unchanged to Helicone. History is copied; EU data stays on Helicone's EU stack. Everything is built and tested; the history copy and the DNS switch are off.

6. Legal sign-off first. Moving data from Helicone's stack to ours changes a sub-processor; DPAs usually require written notice (often 30 days) and a right to object. Recommendation: legal reviews the DPA and assignment clause, then we send notice. Until then the gateway can still serve Helicone traffic by relaying it.

7. Which plan and price. Options: keep their Helicone plan until next renewal, move to ours at once, or keep Helicone pricing forever. Recommendation: keep it until renewal; "change nothing" includes their bill.

8. How members sign in. Only orgs and keys are imported today. Options: import members by email with an emailed code on first sign-in, bridge Helicone's login, or ask everyone to sign up again. Recommendation: import by email; no passwords or shared session secrets move.

The wallet

Your call · 9 · provisional default

How many MemoryDB shards the wallet runs on

Today. One shard (one primary, two replicas), about $946 a month, holding all 64 slots. When AWS fails it over, every platform-funded request for every org gets a retryable 503 for about 14 to 15.5 s (measured twice on real MemoryDB). No money is lost.

Options. 1 shard: all orgs affected, about $946/month. 2 shards: half the orgs per failover, about $1,900/month. 4 larger shards (needed only at 10x traffic): a quarter, about $7,600/month.

Recommendation: 2 shards. It halves the blast radius of the most likely wallet outage for about $950 a month more. More shards do not make a failover shorter. The Terraform comment "Decided: 2 for production" is wrong; 1 ships until you choose.

Your call · 10 · provisional default

How long finished charges are kept in the wallet

What these are. A short record of each settled hold. It stops a late or repeated settle (a retry, a replayed receipt, a re-run writeback) from charging twice. Kept 24 hours today.

The trade. A few GB today; about 52 of the wallet's 102 GB at 10x traffic. One hour would shrink them 24 times, but the longest receipt delay seen in production was 55 minutes (November 11), so a late settle could charge twice.

Recommendation: keep 24 hours now; if traffic grows toward 10x, drop to 6 hours, never 1.

Your call · 36

Serve bring-your-own-key calls while the wallet store is down

Today. In a wallet outage, platform-funded calls get a fast retryable 503 (D6). BYOK calls get the same, because even a zero-cost call places a hold that runs the ban and revoke check and carries the record that lands the request in Postgres.

Option. Check bans and revoked keys from the gateway's in-memory copy (already used during a Postgres outage), and record the request through the Postgres spool built in round 7.

Trade-off. Customers on their own keys keep working through a wallet outage; the cost is a second, outage-only record path, and a ban or revoke made seconds before the outage could be missed until it ends.

Recommendation: build it.

Partial · 11

Rehearsals before any database restart

Done. Four preview rounds under load (41 to 70 s cuts), then 11 restarts; zero errors on known keys. Protected chains tested only locally (flow 12). The psycopg fix (#3046) is live in production.

Not yet run. The 10-minute cut on production-sized data, and the MemoryDB failover game day (its script runs only against staging, and the preview's ElastiCache Serverless cannot answer the failover question). A production restart that keeps protected chains serving needs the maintenance window, which ships with the request-path part of #2980.

Tools, traces and the Requests page

Your call · 13 · provisional default

How customers get the traces CLI and MCP server

What it is. A command line (list, get and search traces, sessions and requests; tree-first JSON; cursors) and an MCP server, so a customer's coding agent can debug their traces. The customer who left Helicone for Langfuse said "we give our agents the CLI".

Today. Both are commands of the private platform package (explabs-traces, explabs-traces-mcp); no customer can install them.

Options. (a) exp traces inside the public engine CLI customers already install: one tool, one login, ships with the next engine release. (b) A separate public package: its own schedule, but a second tool and login. (c) Keep it private: customers get nothing.

Recommendation: (a).

Your call · 14 · provisional default

Kion's offline tagging PRs (#2911, #2926, #2930, #2931)

What they are. Kion's offline tagging: background runs that score captured traffic against our own tag bank on rented GPU nodes running Clef, with results in ClickHouse and an erasure thread. One table (migration 0010) was applied by hand to the shared ClickHouse on 2026-10-15.

The overlap. #2980 builds customer tags scored online. Both store tag scores in ClickHouse, both must be erased with the capture, and their ClickHouse migration numbers conflict. Today there are two tag-score stores and two erasure paths; if both land separately, an erasure can miss one.

Recommendation: keep Kion's PRs and reconcile with Kion: one tag-score store and one erasure path, renumber whichever side is not applied. If the lanes stay separate, the erasure job (D19) must name Kion's tables before either merges.

Your call · 17

Requests sent without a session

Today. Such a request shows its trace id as a green session link, so every one looks like a one-request session. Helicone and OpenRouter show nothing there.

Trade-off. An empty cell matches the tools customers know and stops one-call "sessions" crowding the list; the link keeps one click to that call's trace.

UX recommendation: show "-" and keep the trace in the drawer.

Your call · 18

Listing refusals that happen before admission

Today. Requests refused before admission (an unknown model 403, a bad header 400) are not in the Requests list; only /admin/errors sees them. Helicone shows every call.

Trade-off. Listing them shows customers every call they made; they have no request row today, so the table would read a second source.

UX recommendation: list them, marked "Refused before a model"; these are the 400s customers debug first.

Your call · 19

Default sampling for a new tag: 10% or 100%

Today. The tag editor defaults to 10% of sessions; the API defaults to 100%. On low traffic a new tag at 10% can look broken for days.

Trade-off. 100% shows results at once on low traffic; 10% keeps the judge calls the customer pays for low on busy traffic. One default in both places removes the surprise either way.

UX recommendation: 100% under the existing budget cap.

Your call · 20

Requests table on a phone

Today. At 390 px only Time, Status and Model fit; Preview, Session and Cost sit behind a horizontal scroll.

Trade-off. Cards are readable on a phone but are a second layout to build and keep in step.

UX recommendation: cards with the preview first.

Your call · 21

Session and tree previews

Today. The sessions list shows no first-question preview, and the session tree no per-step text (UX gaps 25 and 27).

Trade-off. Previews make a session readable without opening it; they show only where capture runs in segments mode and the org stores prompts.

UX recommendation: build both before launch.

Your call · 22

When the old request-API parameter names stop working

Today. Main documents /usage/requests parameters (attribution_label, cache_hits_only, status=error, sort=oldest, conversation, cursor_ts / cursor_id / cursor_after) that #2980 had replaced, which would have broken customers' billing jobs. They now keep working with identical rows, proven per parameter, and answers carry a deprecation notice.

Recommendation. Remove them on 2027-05-21. From 2027-02-21, send a Sunset header and email the admins of orgs whose keys still use them. Billing jobs run monthly and are rarely touched; six months covers two quarterly reviews.

Your call · 23

One-click thumbs up or down in the request drawer

Today. Marking a bad answer takes 3 clicks plus creating a score type first. LangSmith and Helicone make it one click.

Recommendation: add it, backed by a built-in score type created on first use. Trade-off: one more control in the drawer and a built-in score type every org gets.

Your call · 24

Update session and trace summaries in the background

Today. Every span write recomputes the session and trace summaries before it returns. With long sessions stored, this limits the capture pipeline (about 2,100 spans/s on one ClickHouse CPU, against 4,800 on an empty table).

Recommendation. Recompute every 1 to 2 s in the background, so summaries may lag new spans by up to 2 s. It is the next large speedup, but it weakens today's guarantee that a summary is current when the write returns.

Your call · 37

Observability gaps from the completeness check

Local capture ("Proxy traffic"). Fixed and verified on the preview in round 12: all of it goes through the same span sink as OTLP. Your call: rename it "Local capture", and decide who sees it (recommendation: every org admin, as a self-serve way to get traffic in).

A Traces list page. The API exists; no page lists traces on their own. Recommendation: add it, since agent-framework users think in traces.

A trace SQL screen. API only today. Recommendation: hold until customers ask.

Users view and tag filters. Built and verified live on the preview in round 12: per-user totals and a tag-key picker, which also gives Helicone's /users and /properties links somewhere to land.

Operations and small calls

Confirm · 27

Give previews the Helicone cache cluster

Production has it; previews do not, so the shared outage spill for continuations (decision 25) cannot be tested on a preview. Recommendation: a preview-plumbing PR on main provisions it, sized small. Trade-off: one more resource per preview, in cost and setup time.

Your call · 28

Light-mode text contrast

In light mode the lighter grey (--muted-2, #8f8f8f) is 3.1:1 against the page, and the muted grey on the soft accent is 4.1:1; WCAG 2.2 AA needs 4.5:1. Dark mode passes. It affects every page. Recommendation: --muted to #6b6b6b and --muted-2 to #707070. Trade-off: grey text gets slightly darker and the third level of emphasis mostly goes away.

Confirm · 30

Membership-read audit records stay a background write

When a member reads an org page, the "who looked" record is written after the answer. A web pod killed hard can lose at most the last 1,024 records (typically the last second or two). Writing first would add about 27 ms to every org-gated request and fail reads whenever the audit database is down; a local disk spool would cost about 1 ms but web pods have no persistent disk. Recommendation: keep it.

Your call · 32

Found on main, outside the data plan

Sign-in bug (production): a sign-up refused because the mailbox already has an account (you+one@ then you+two@) shows a code step, but no code is sent; a small PR makes it say the account exists, waiting for approval. Preview seed bug: four login-token fields left empty break the auth user list. Onboarding suggestions: label the last button as finishing; one card-verification prompt instead of a banner plus a popup; name a new org from the email domain or person's name. Next.js 16.4.1 has 7 moderate advisories fixed after 16.4.4, and its build fails every other run; the upgrade belongs in its own PR.

Your call · 33

Raise preview pr-902980's real-model budget once

Each preview gets $5 of real model calls for its life. The relay holds the worst case per call ($0.0008 to $0.004) and never refunds, while a call really costs about $0.000018, so pr-902980 spent its $5 in about 1,400 calls and has refused every real-model call since 14:44 UTC on 2026-11-22. Recommendation: raise it once by $5 so you can try Playground and live chat (it bends the "never renews" rule for one preview). Separately, a small main PR to settle each hold to its actual cost would make $5 last about 277,000 calls.

Confirm · 35

Make a stored prompt searchable within 5 seconds (about $160 a month)

On a quiet preview a stored prompt becomes searchable in 4.3 s typically and 5.8 s for the slowest 1 in 20, mostly the 2 s upload interval plus about 1 s waiting for the storage notification. Built: upload every 1 s and have the uploader post the queue message itself (the notification stays as a backstop). Modeled slowest 1 in 20: about 3.8 s (typical 2.1 s); either change alone reaches only about 4.7 s. Cost: about $13 more per busy gateway server a month, about $160 for 12 servers. The direct message ships behind a switch, off by default. Recommendation: keep both. Not yet measured end to end.

Your call · 38

How to prove the deploy-layout changes

Today. The isolated preview deploys #2980's images with main's controller and deploy script, so the PR's layout changes have run nowhere: the background units, the dashboard edge, the writeback app and queue-age autoscaling; the Helicone webhook worker and response cache; direct announce; and the 3,900 s startup budget. 46 audited claims wait on this.

Options. (a) Land the controller and deploy-script changes on main first, opt-in and off by default, then redeploy the preview and re-run. (b) A preview mode that deploys with the PR head's scripts; it crosses the trust boundary, since unreviewed code would run with the controller's credentials, and needs your sign-off. (c) Prove it on staging after merge, at the cost of a staging rehearsal round and a later proof.

Recommendation: (a). It keeps the trust boundary, follows the rule for new deploy prerequisites, and proves the layout before #2980 merges.

Hand steps to replace either way. Set the control instance count in the deploy, provision the stand-in model lane through the controller, and load test data through the fixture.

Your call · 39

Moving off Helicone

Today. #2980 serves Helicone customers on our platform but keeps Helicone's own stack running behind it; nothing Helicone-related runs on our side yet.

Decisions before any shutdown. EU (an EU deployment, keep Helicone EU, or end EU service); read-only Helicone keys (build a read-only scope, or ask customers to mint full keys); plans, billing and ai-gateway credits for Helicone orgs; customer-owned gateway domains; the 11 unadapted vendors, Bedrock and prompt generation; legal for the history import; keep or delete the "switch from Helicone" marketing pages; and read-only access to Helicone's accounts to size and cost its stack.

Recommendation. Grant the read access first; every later step needs the numbers.

Decisions already made

The final plan's twenty decisions, D1 to D20, are in November 16 and 17, each with a one-line reason. These are the other decisions taken along the way, with their reasons.

DecisionReason
1. Rollout: ship to everyone. The new Requests table, Quality page, retention settings and per-key storage controls go live to every customer when #2980 deploys; no early-access gate.Owner decision. #3034 removed the early-access rule on 2026-11-19. The pipeline that fills the pages is off by default, so the availability endpoint hides a feature and says why instead of showing empty columns.
2. Uncensored models follow the published privacy policy. New requests follow the same capture and ZDR rules as every model; historical captures keep their original retention.The published policy is the promise in force.
12. Engine release for media and Decisions capture: yes.Opt-in: the pin bump alone changes nothing; each surface turns on after its writer, retention rules and media handling exist. In progress as experiential#1412.
15 and 16. Provider key and laptop Docker. 15: no action needed. 16: 51 stale containers from other sessions stopped (not removed).Housekeeping.
25. Responses conversations during a Postgres outage: each worker keeps recent state in memory, and during an outage only it spills to the Helicone cache cluster and copies into Postgres after.In a local 10-minute outage, 0 of 146 continued turns worked today; memory alone kept 58% locally (about 8% on 12 workers), the spill alone 95%, both 97% (142 of 146). Conditions: only content the request may store, never ZDR; purge on storage-off, ZDR, org deletion and erasure; at most 60 minutes; a per-org cap; never the wallet store; any miss falls back to the explicit resend error.
26. Smaller technical calls: every customer ClickHouse read carries the per-org quota key; grant and limit caches move from 2 s to 60 s with change-feed invalidation; ingest limits stay per pod; main's documented request-API parameters keep working.Fairness enforced by a test; edits still apply within about 2 s; the edge's per-org admission is the fleet-wide control; live callers must not break.
29. Failed requests open on the reason in the drawer, above Keep and Scores.Finding why a request failed is the most common task; now 2 clicks, down from 5.
31. Round-2 calls: a new org's first load gets 2 s and one retry, idle connections checked; fair admission worker-wide and by org at the edge, listings never take a slot; the outage check keeps a warm connection and logging writes use their own; an answer cut by its length limit is a warning, not an error; an unknown X-Explabs-Storage value is refused while Helicone omit headers stay lenient; wallet-outage refusals stay retryable; the text step runs 8 workers.Each follows a round-2 finding; an unclear storage value must store less, never more.
34. Failure behavior from the preview tests: money fails closed with a retryable error; wallet calls refused for 2 s after a failure with each request waiting at most about 2 s; quiet servers' closed connections are not an outage; the capture pipeline has its own read budget; customer reads get separate ClickHouse compute; at least 4 vCPU per heavy reader.Worst case dropped from 36 s to about 2.5 s locally; a busy pipeline slowed every page 2x; a cost-sorted table copy was rejected (13% more write time, 25% more disk, the default view 2x slower).
One pull request. The data plan lands as #2980; the 12 stacked PRs are closed.Owner decision, 2026-11-21.
Everything now, in one change.Owner decision, 2026-11-17.
Protected chains survive a planned restart through a maintenance window; the MemoryDB witness was dropped.The witness was large (nine migrations), and losing MemoryDB would freeze releases for 61 minutes; the owner's requirement was planned restarts.
MemoryDB stays the live wallet on 64 fixed slots.Hold p99 3.9 ms against 396 ms and 45 ms; correct on every backend.
The two-queue ETL; the in-memory park deleted.The park only moved the cliff: a capture waited over 3 minutes once it filled.
Settles defer after 2 s, with a Postgres spool.Never loses more than the old design, answers the caller, and a dead worker's charges still land exactly once.
Readiness never depends on Postgres or the wallet store.A store outage must not pull every worker out of service.
This page's first questions (November 9 and 10): search on new text only (D8), a capture fallback chain cut to memory, disk, then metadata (D2), media stored by kind (D14), customer Decisions captured and internal Clef callers storing outcomes only (decided November 10, D14), keys may only tighten storage (D14), customer expiry first (D13), provider keys on Helicone hosts used for one call and never stored (decided November 10, D12).See the first questions for each analysis.
Clef pool Fix A, applied 2026-11-19 with the owner's approval.Judge 503s went from 0.55% to 0.