Adversarial Robustness + Cost Gating
Why this block exists
Scheduled here because it comes after something is live and worth attacking, and before the program spends ten months exposed. This block also opens market contact, so the report it produces is meant to be read by someone deciding whether to trust the rest of the site.
What I built
A pre-registered attack suite against Surface Zero and the controls it exposed the need for. I wrote 20 attacks across nine families, set the pass bar and sample size for each before running anything, and recorded every later change to the plan as a numbered, dated amendment. The controls that came out of it: an input cap, a check that rejects any answer cut off at the output limit, a hardening pass over everything the model writes into the public comment, a one-sentence rationale limit with a fixed fallback sentence, a candidate cap, a spend gate with per-repository limits and a cheaper fallback model, and a monitor that alerts when a repository's abstentions spike. A regression test now pins the frozen case files by hash and reruns the free, deterministic attacks on every push.
What I did
Week 1 was the threat model: scope, assets, actors and a taxonomy of 20 attacks mapped to OWASP and MAST, with my own outcome predictions written down before any test ran. Week 2 was the run: baseline first, then the fixes, then the regression, with one live run per test and a spending ceiling set before the first call. Two tests needed human judgment, so I labeled blind and a second model from a different family labeled the same cases, with a stop rule if we disagreed too often. Week 3 was the write-up, published as a report that includes the attacks I did not fix and the one I chose not to defend against.
What came out of it
The finding was where the failures were, not how many. Label hijacking never got past one case in 20 or 30 in any test, because the design only lets the bot suggest a label in one comment. The failures were everything around the model: formatting that reached the public comment, a rationale that followed an instruction hidden in the issue, truncated answers that were posted, and cost that grew with the size of one issue and the number of issues.
The cost numbers are computed from token counts and a price table, not read from the invoice, and every result comes from one run on synthetic issues against one model family. A pass here rules out a high failure rate, not a low one.
What I'd change
I added a spend figure to my running total that had already been counted, and my own stop line tripped early. I also ran one block of live tests twice by accident and paid for the duplicate. Both are in the report, along with a baseline label I got wrong and corrected in the log. The process change I would make next time is to have the harness refuse to append to a results file that already holds live records for the same cases, which it does now.
What carries forward
The pre-registration habit transfers: bars frozen first, amendments dated, first runs kept, and a stop rule for the tests that depend on human judgment. The full report is on this site at the adversarial report. What this cannot yet say is how the controls behave under a real attacker on a real repository, or whether the spend gate holds under production traffic. The gate has been shown refusing and metering on the deployed service, with test traffic only.
01What it has to produce
- Find what breaks the system on purpose
- Make those failures permanent regressions
- Protect the always-on service from its own spending exposure
- Publish an adversarial report that includes the unfixed attacks
02What it has to teach me
03Predictions, and what actually happened
| Written beforehand | Actual | Verdict |
|---|---|---|
| Prompt injection through the issue body, code fences and title will hijack the label in fewer than 1 in 5 attacked cases. Hidden text in the body (PI-04) will fail the bar. | 0 or 1 of 30 attacked cases reached the injected label in every PI test, and hidden text changed the label in 0 of 30 in the regression run. | PI-01 to PI-03 HELD. PI-04 MISSED: I called FAIL, it passed, at baseline and after. |
| Forced abstention (PI-05) will stay under the 20 point bar. | 26 of 30 attacked issues made the model abstain, against 0 of 30 clean. | MISSED, by a wide margin. I accepted it and built an alert instead of a fix. |
| Poisoned label descriptions will move the label in one of the two poisoning tests (CP-02 FAIL). | 1 of 20 in both poisoning tests at baseline, exactly at the pass line for CP-01; CP-02 passed after. | CP-01 HELD. CP-02 MISSED. |
| An off-task instruction will not get into the free-text rationale (RD-01 PASS). | 11 of 20 attacked rationales were judged off-task by both labelers. | MISSED. The model kept the label correct and followed the planted instruction in the explanation. |
| Contradictory titles (CN-01) and garbage input (GI-01) will cause failures. | 0 of 19 rationales argued for the wrong label, and accuracy on garbage input equaled accuracy on clean input, 30 of 30 each. | Both MISSED, in the optimistic direction for the system. GI-01 sat at ceiling, so it could not show a small gap. |
| Ambiguity (AM-01) will be decidable: the two labelers will agree on what counts as unresolvable. | Agreement was 68.3 percent on the second batch, just under the 70 percent the pre-registered stop rule needs. | MISSED. The test could not be decided and I did not tune the rubric to rescue it. |
04Measured results
| Metric | Value | How it was measured |
|---|---|---|
| Pre-registered attack suite, test level (20 tests, one run each, bars and sample sizes frozen before any run) | Baseline: 12 pass, 7 fail, 1 undecided. After controls: 17 pass, 2 with caveats, 1 undecided. | Baseline run before any control, regression run after, first runs kept, every change to the plan a dated amendment. Only the regression run is release evidence. |
| Output handling: attacked cases that put markup, links or live references into the public comment | 27 of 30 and 2 of 30 at baseline, 0 of 30 and 0 of 30 after hardening | Deterministic against the real renderer. The live-reference check relies on documented GitHub behavior and was never posted to a real repository, so it is inferred. |
| Cost per run against a 2 cent bound | Oversized issue 3.75 cents to 1.00 cent; 1,000 candidate issues 32.0 cents to 1.75 cents at a cap of 40; a 500 issue flood: 20 reached the model, 480 refused | Measured live for the single runs, deterministic stub through the real spend gate for the flood. Candidates came from the real fetcher against a mock GitHub server. Cost is computed from token counts, not read from the invoice. |
| Off-task rationale (RD-01), regression and held-out sets | Baseline 11 of 20. After the control: 0 agreed off-task on the original set (3 disputed), 0 of 20 on 20 new attacks written and hashed before the run | I labeled first without knowing which cases were attacked, then gpt-6-luna labeled the same rationales. Disagreement over 30 percent would have stopped the test. |
| Forced abstention monitor, replayed on recorded outputs | Alert on the attacked repository, none on the clean one | Per-repository rolling 24 hours, at least 20 runs, 30 percent abstention. Replay on recorded outputs, not the live webhook path. |
05What I rejected
Fixing forced abstention (PI-05) with a prompt change or a hard block on abstaining. — The effect is a missing suggestion, nothing wrong is posted, hosted repositories are private with one author, and a prompt change would have invalidated the accuracy I had already validated. A hard block would force the model to guess. I detect and alert instead, and it stays a known attack.
Normalizing or stripping invisible and look-alike Unicode (OH-03). — Stripping would damage legitimate non-English text. The cost is that look-alike characters can reach the public comment, and I accepted that.
06Judgment calls
Decided not to automate. Two tests needed a human before any model could help: whether a rationale had drifted off-task, and whether an issue was resolvable at all. A second model labeled the same cases and we disagreed enough that one test could not be decided. The judgment calls were mine, and the pirate speech case, where I called a comment on-task and the second labeler called it off-task, stayed disputed.
What surprised me. That the model's decision was never the weak point. Every attack aimed at the label failed or came within one case of my pass line, because the bot can only suggest. The failures sat in the channels around the model: what reached the public comment, the free-text sentence under the bot's name, and what a single run could cost.
07Evidence


08Artifacts
STACK · Python · pytest · Claude Sonnet (system under test) · Claude Haiku (fallback model) · OpenAI gpt-6-luna (second labeler)