A model submits many times, and every accepted program is a new version of its racer. We want to keep each accepted version exactly as it was checked, and to know at any moment which one is the model’s current racer. A player who picks a rival must get that version complete, never one that is half saved.
The files are kept in Vercel Blob. Every program an agent compiles is saved there as a file, together with the results of its test runs. When the host accepts a submission, it reads that file from Blob once more and checks that the bytes are intact.
The host then copies the program into its registry, the list of accepted submissions, and makes it the model’s current version. Both happen in one step. The game does not run the accepted file as it is. It downloads a guarded copy, the same program with the host’s safety checks added. A small record called the guard pin ties the two files together.
Accepting a version is one step
The host writes three things together: the update to the registry, the completion of the submit job, and the job’s receipt, the saved record of its result. Nothing else runs in between. A retry can then never leave a current version that is ahead of its receipt.
The registry is kept in Redis, and the three writes are one Redis script. The script stores the version record, the results of its checks and a copy of the program’s bytes. The code calls this step completeJob.
Before that step, the host checks the results once more and runs the guard, the step that adds the safety checks, on the original program. Then it throws the guard’s output away. The registry stores the original program, never a guarded copy or a guard pin.
A counter orders versions, not the clock
We order accepted submissions with a counter that goes up each time. Timestamps are not enough, because two submissions can be accepted within the same millisecond. The code calls the counter the sequence.
An accepted submission never changes. Sending the same one again returns the existing record, with the same sequence number, and does not change which version is current. Repairing an older submission therefore cannot put it back in front of a newer one.
The same program bytes can belong to separate submissions. Each one gets another sequence number. A history read returns a model’s accepted submissions with the newest sequence number first, at most 200 records per read.
The game runs a guarded copy of the accepted file
A race runs the guarded copy, not the file the agent compiled. The two are different files with different hashes. A hash says which bytes a reader should expect. It does not say whether the instructions in them are allowed, so the host verifies each guarded copy it produces.
The guard pin ties the two files together. It holds the hash and size of the original and of the guarded copy. It also holds which processor made the copy and the policy it applied. The game checks the bytes it downloads against the guarded hash in the pin.
The added checks take space, so the two files have separate limits. An original can be at most 262,144 bytes, and a guarded copy at most 4,194,304 bytes. The pin has both sizes. The game can therefore reserve memory for the program it runs, not for the program that was submitted.
The guarded copy is made when a rival is picked
The list of rivals in the game is built from the registry, and loading it does not prepare any program. The host makes a guarded copy only when a rival is selected. The routes that do this are Vercel Functions, and each copy stays in the memory of the instance that made it.
We limit that work per instance. The cache holds 8 entries. An instance starts with 8 attempts to guard a program that is not cached, and 1 attempt comes back every 5 seconds. Requests for the same program share one piece of work while it is in progress.
Only the current version can start new guard work. A request for an older version can reuse a result that is still cached, but it cannot start new work. The older original can still be downloaded by its registered identity.
The current version can change, so responses for the list of rivals and for guard pins use no-store and are never reused. A download of a guarded copy must match the hash it asked for. Successful responses with the bytes of an original or of a guarded copy are cached as content that never changes, for 365 days. Errors use no-store too, so a temporary failure is not served as content that never changes.