Skip to content

Add StackBench - #5766

Open
bradleyshep wants to merge 814 commits into
masterfrom
bradley/stackbench-test
Open

bradleyshep wants to merge 814 commits into
masterfrom
bradley/stackbench-test

Conversation

@bradleyshep

@bradleyshep bradleyshep commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Description of Changes

  • Adds StackBench in tools/stack-bench. Each agent builds an online store from a feature list on one stack (Spacetime, Convex, Supabase, PostgreSQL, or MongoDB), and StackBench scores how many of its features hold up under production conditions such as concurrent purchases, restarts, reconnection, live updates, and permissions. Score is the percentage of features that pass every check, averaged over runs.
  • Adds a reference app for each stack, a seeded-bug manifest for each stack, the StackBench CLI, the Docker image that runs it, a local dashboard, and the command that uploads results to stackbench.org.
  • Corrects the Spacetime CLI and TypeScript skills. [Stack Bench] Correct the CLI and TypeScript skills #6644 makes the same change.
  • Makes the TypeScript SDK keep the path of the server URI when it connects. [Stack Bench] Keep the URI path when the TypeScript SDK connects #6642 merged the same change.
  • Failures in the StackBench 1.2 results by model, stack, and check

What Spacetime gets that other stacks do not

  • The Spacetime stack setup includes the TypeScript server, TypeScript client, and CLI skills from skills/, and a page StackBench wrote on running spacetime dev. The other stacks' setup has connection details and start instructions only. The skills are included because the current Spacetime SDK is newer than the models' training data, and agents without them write code for an older API. They include guidance on reducer transactions, private tables, uniqueness across columns, and the caller's identity after a reconnect, which some checks test.
  • StackBench builds the Spacetime CLI, server, and TypeScript SDK from the commit it runs, so a run tests the Spacetime code in that commit. The other stacks run released images pinned by digest.
  • Restart and crash checks stop the Spacetime server, because a Spacetime store's server code runs inside it. On PostgreSQL and MongoDB they stop the store's own server.
  • A reducer refuses a request when it throws SenderError. Any other exception returns the host's fixed crash text, which never counts as a refusal, the same way an HTTP 500 does not.
  • Spacetime and Convex stores get live updates from their subscriptions. On PostgreSQL, MongoDB, and Supabase the agent must build live updates itself, and nearly every run does not. A page that polls passes these checks, as the MongoDB reference app does. A failed live-update check blocks purchasing, cart, and warehouse administration, and the features that depend on them. These failures are most of the difference in scores between stacks.

tools/stack-bench/docs/fairness.md and tools/stack-bench/docs/grading.md describe these differences.

API and ABI breaking changes

None.

Rollback safety impact

n/a

Expected complexity level and risk

  1. Almost all of the change is new code under tools/stack-bench, which no other crate or package imports. The main risk is a grading error or an unfair difference between stacks, which would make the published results wrong.

Testing

  • Tests in tools/stack-bench/tests cover prompt composition, grading, each stack's adapter, scheduling, recovery, evidence, uploads, and the audit that flags agents reading StackBench's own files. "Three concurrent nine-worker campaigns" in campaign-reservations.test.ts fails since 3fb4747, because its fixture does not pin an image.
  • ws_url.test.ts checks that the SDK keeps the URI path for the token request and the subscription.
  • Manual: the latest audit changes give the same result on all 10,922 saved agent transcripts.
  • The StackBench 1.2 results are 135 runs: 9 models, 3 runs each on 5 stacks. The checks were qualified on every stack throughout development: each reference app passes them, and each check catches its seeded bug.

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@bradleyshep
bradleyshep force-pushed the bradley/stackbench-test branch from 6a1eb7d to dc1a416 Compare August 31, 2026 17:38
@bradleyshep
bradleyshep force-pushed the bradley/stackbench-test branch from 32d3018 to 837c1f7 Compare September 7, 2026 20:22
Every scenario, contract, reference or SDK change left recipe, fixture,
selection, feature catalog, reference source and mutation digests to be
re-pinned by hand across the registry, mutation manifests and
calibrations. npm run repin recomputes them with the compilers' own
functions, writes only changed files, and verifies each calibration. It
does not touch qualification evidence.

It also drops the checksum of locally built packages (resolved file:)
from reference lockfiles. The release builds spacetimedb.tgz itself, so a
pinned sha512 only failed npm ci whenever the SDK changed; npm ci installs
the package without it.
After a refused sign-up an app can leave its modal dialog open on
sign-up; the overlay covers the header sign-in toggle, so the click was
blocked and a security check failed on navigation. When sign-up inputs
are showing and the contract's overlay-close control is visible, close
the dialog before using the toggle.
An application sign-out leaves the SpacetimeDB identity unchanged, so
data scoped to ctx.sender stays available to that client. The React
provider reconnects with backoff and keeps its token; a connection built
with DbConnection.builder() stays closed until the application builds a
new one, and onConnectError reports every failed attempt, including an
unreachable host.
ctx.senderAuth.isInternal was always false in TypeScript modules, so a
scheduled reducer guarded with it, as the authentication docs show,
refused every scheduled call. Rust reports a call without a connection
(init, scheduled functions) as internal.

Match Rust: a call without a connection id is internal, and transactions
inside HTTP handlers, which also lack one, are created as external
explicitly, as in the Rust try_with_tx override from #5978. HTTP reducer
and procedure calls carry a generated connection id and stay external.
The front page stacked a lane for every running attempt and a card for
every reference run above the campaign table, so a running study pushed
the table off the page, and each lane cost a full campaign sheet read.
Running attempts are shown on their campaign page; the table row says
the campaign is running. A reference run appears only while it runs,
without the caption lines.
…time

Seven overlapping gradings failed the grader's fixed time budgets in apps that
pass when three run together. Each grading now holds one of the host's
grading slots as a resource lock in its run lease, so teardown and recovery
free it like any other claim. Waits go to a receipt that the campaign clock,
the process timer and reference qualification subtract, and run totals report
them as gradingWaitSec. STACK_BENCH_GRADING_CAPACITY overrides the default.
…etry its suite once

A fresh client that could not repeat the baseline sign-up writes left an
inconclusive check with nothing to explain it. The finding now carries both
inventories (transport, destination and argument-shape hashes only) and is
retryable, so its suite runs once more from fresh state. Nested actions keep
their child's retryable flag instead of dropping it.
In the first study on three slots, passing Convex and SpacetimeDB apps held a
slot for 45-55 minutes per L3 grading, and whichever waiter polled first after
a release won it, so one run waited 83 minutes behind later arrivals. Waiters
now hold queue tickets and only the oldest live ticket may take a free slot;
a ticket left by a dead waiter goes stale. The suite runner takes a slot for
its setup and one per suite, so short gradings run between a long grading's
suites. Bench runs the grader under the pause-aware process timer so these
waits do not count against the grading timeout, and reads its recorded wait
from the receipt.
Where the fault lands is timing: it can miss the outstanding requests, the
clock can move, a reservation can expire, or a checkout can be acknowledged
inside the kill window so it cannot be linked to the recovered order. Each
left the check inconclusive with no retry, which made the whole run
inconclusive. These outcomes are now retryable. A checkout the app left
unfinished is how the app is built, so it stays final.
…attribute

Reading an action's input attribute from a control that never rendered
reported that the control "exposes no" attribute, which blames how the app
built the control and is what a repair agent reads. The check result is the
same; the finding now says the control did not become available in time.
Seven full Convex and SpacetimeDB regrades on six slots matched their grades exactly, as often as on three, in about 60% of the time.
…arries it

A SpacetimeDB app put each stock transfer's input on the transfer form inside
its admin row rather than on the row, and lost three checks although every row
carried its own input. When a control has no value of its own and exactly one
element inside it does, that value is the control's input; two or more would
be ambiguous, so the control's own value still stands.
A Postgres app's new product missed the public catalog because the visitor
reloaded before the admin's save was committed; an app that does not push
updates never showed it, so the race only cost stacks without live updates.
Eight synchronous admin, support and cancellation writes followed by another
user's reload now await their writes. Queued-write scenarios, where a 202 is a
valid answer, are unchanged. Calibrations re-pinned with npm run repin.
The SpacetimeDB write capture accepted only reducers whose arguments its patch
codec can read, so waiting for an add-product save with a list of variants
left catalog checks inconclusive on every SpacetimeDB app. Waiting for a write
needs its request ID and result, not its arguments: a completion check now
tracks those directly. Probes that patch arguments still decode and refuse
what they cannot read.
…directories

d3a16e8 left out what a store's ignore files exclude when hashing the live app,
but the saved copy of each level was still hashed as a plain directory. A store with
ignored files in its source (Sol and Astra keep .runtime/ and build/) then failed
'preserved first-build source differs from the live application source' at level 1.
Each saved copy is now hashed by hashAppSource: a fresh copy under the current rule,
a copy checked against an older record under the rule that reproduces it.
…g the store

The metrics walk read every folder, so a store whose start locks an ignored folder
(Sol 6.2 runs chmod 700 .runtime) failed grading with EACCES after the source hash
stopped reading it. The metrics now count the same files as the source identity.
…base setups do

Convex says the web client uses VITE_CONVEX_URL and Supabase names its client URL and
key; Spacetime named only a package in a table. A plan-only probe on the level 1 task
(gpt-6.2-sol and gpt-6.2-astra, three samples each) moved Sol from a server gateway to
browser subscriptions for public data, and Astra to the SDK throughout.
Name the connection settings the web client uses, as the other stacks do, instead of
naming the SDK package. In the plan-only probe, Sol chose browser subscriptions for
public data in 5 of 6 plans (6 of 6 with the earlier wording) and Astra used the SDK
in 3 of 3.
…ling the run

The concurrent-purchase check found each shopper's control, then pressed them all at
once. A store that updates live redraws the card when one purchase lands, so another
press could lose its element ("Element is not visible"), and any error other than a
timeout became a harness failure (Astra 6.2 job-7aa8ffd0 r3, check 202a). A press
that lost its element is now sent again on the same locator until the time limit; a
control that never stays long enough to press still fails as a failed click.
Chromium never reports an unread no-store body finished, so UI writes whose
response the store ignores were recorded as lost. A response with a
Content-Length and no chunked encoding now completes on its headers; a
chunked body is still awaited.
…to close

A store that pushes updates over a fetch-read application/x-ndjson response
kept every privacy reload waiting for a body that never ends, so absence
checks came out inconclusive. The proxy already records each written chunk;
it now treats ndjson like an EventSource stream.
A reducer's arguments are written to the commit log with its caller and
timestamp; a procedure's are not. Stated in each section as a fact, without
recommending either.
…install the concepts skill

Setups for Spacetime, Convex and Supabase now say only what reaches what; the
"web client uses" sentences and the VITE_ variable names are gone, and the
port placeholder is <APP_PORT>. New runs give stores neutral names
(SPACETIMEDB_URI and SPACETIMEDB_MODULE, the Convex and Supabase names, and
APP_PORT). Each run records the rule in its setup; a regrade or campaign
extension of a run without the record gives its store the Vite-named set it
was built with. Reference apps read the neutral names. Spacetime agents also
get Spacetime's concepts skill. Pins refreshed with npm run repin.
… its start script made private stay readable
…cation data, accounts, and backend functions
…ion whose broker dies

The broker kept each request's chunks reachable until its reply had streamed, and its 256 MiB
container cap could not hold two concurrent requests at its own 32 MiB body limit. A Codex
session's broker was killed at that cap and the session ran on without a model until its
timeout. The broker now drops the chunks once joined, records its largest request body, and
gets a cap that covers concurrent requests at the body limit. A watcher confirms a dead
broker with Docker and ends the session at once, reporting the broker's exit.
@bradleyshep bradleyshep changed the title Bradley/stackbench test Add StackBench Nov 27, 2026
@bradleyshep
bradleyshep marked this pull request as ready for review November 27, 2026 18:06

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants