Virtual Trial
Repo
Judge modeEach section shows the criterion it speaks to and a link to the evidence.Full evidence map

Research prototype on GitLab and Google Cloud

A clinical trial for every change to insulin dosing code.

Before a code change can reach an insulin pump, Virtual Trial runs the old and new code on the same virtual patients, through the same bad days, and blocks the change if dangerous blood sugar becomes more likely.

New here? Every button explains a word or a number in plain language. Hover, tap, or tab to it.

One day, two versions of the dosing codeGlucose for one virtual patient under the unchanged code and under Insulin-on-board safety cap raised 4x. The lowest point with the change is 57 mg/dL.701802505400:0004:0008:0012:0016:0020:0000:00With the change: 57 mg/dLTarget range 70 to 180
Unchanged oref0Insulin-on-board safety cap raised 4x
Real trial outputReal trial output: virtual patient child#003, scenario "Basal rate set 30% too high". Same meals, sensor noise, and seed; only the dosing code differs.Time below 70: 1.7% unchanged, 5.2% with the change.

Blocked In the full trial this change made low blood sugar risk rise in most matched runs. A person reads the explanation; the change does not ship.

Potential impact

Dosing software can hurt people

People with type 1 diabetes trust software to decide their insulin every few minutes. When that software changes, a small mistake can become a dangerous dose.

224
injuries reported after one pump app update
10 to 100x
the intended dose, from one dropped decimal point
97,648
US emergency visits a year for insulin-related low blood sugar
Innovation

Today's tests check outputs, not bodies

Open-source dosing code like OpenAPS oref0 is tested with open-loop tests: a fixed input, an expected output. That catches typos. It does not show what a change does to a body over a day, or what happens when real life gets messy. Its own tests already fail, and nothing stopped that.

Virtual Trial adds the missing check to every change: a closed loop with virtual patients and injected faults modeled on real bugs and recalls.

Both directions

A change is blocked if it raises low blood sugar risk or high blood sugar risk. Checking only one would reward the wrong behavior.

Same patients, same bad days

Old and new code face identical meals, sensor faults, pump records, and random seeds, so any difference comes from the code.

Small but consistent harm counts

The gate also blocks a change that makes things a little worse almost every time, using a paired statistical test.

Design

How it works

Full walkthrough
  1. A change is proposed

    A developer opens a merge request on the dosing code.

  2. An agent plans the trial

    A GitLab Duo flow reads the change, names its risks, and can make the trial bigger.

  3. The trial runs

    Old and new code dose the same virtual patients through eight realistic days, including sensor faults and missing pump records.

  4. The gate decides

    If low or high blood sugar risk rises past human-set limits, the change is blocked.

  5. An agent explains

    A second flow explains the verdict in plain words on the merge request, quoting the exact numbers.

  6. Ship and watch

    A safe engine goes out as a canary, then ten virtual patients live on it around the clock.

Technological implementation

The AI tests and explains. People decide.

Three GitLab Duo flows plan trials, explain verdicts, and respond to incidents. They can read and comment, the planner can make a trial bigger, and the incident agent can undo a shipped change with git revert. They can never write dosing code, the trial, or the gate limits, a pipeline job enforces that (the agent boundary), and a person approves every merge.

What Virtual Trial will never do
Live dosing engine

Checking...

dosing-engine-5al5er4q5a-uc.a.run.app

Live right now

Ten virtual patients live on the deployed engine. Every 10 minutes they move 2 simulated hours forward, and every insulin decision comes from the same engine the public can call.

Release safety, already proven

On Oct 13 a new engine build crashed at startup. The canary never gave it traffic; the public engine kept serving the previous version, and the fix shipped the same hour.

Nobody's night should be a test.