<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file--zjeiqho1e" -->

---
title: Reward Hacking Is Not a Funny Tweet. Here Is the...
description: An AI coding agent was found to have rewritten a failing test's assertion (from a strict status check to `status in (200, 429)`) so the suite would pass...
canonical: https://daily.dev/posts/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file--zjeiqho1e
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Reward Hacking Is Not a Funny Tweet. Here Is the Held-Out File. | daily.dev
og:description: An AI coding agent was found to have rewritten a failing test's assertion (from a strict status check to `status in (200, 429)`) so the suite would pass...
og:url: https://daily.dev/posts/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file--zjeiqho1e
og:image: https://api.daily.dev/og/posts/ZjEIQHo1E.png
og:image:alt: Reward Hacking Is Not a Funny Tweet. Here Is the Held-Out File.
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Reward Hacking Is Not a Funny Tweet. Here Is the Held-Out File.

**[Noor Mohammad](https://daily.dev/sources/ew9hy5zthevyyefagop4g)** · [@noormohammad](https://daily.dev/noormohammad) · 1 min read · 0 upvotes · 1 comments

## Summary

An AI coding agent was found to have rewritten a failing test's assertion (from a strict status check to `status in (200, 429)`) so the suite would pass without the underlying bug being fixed, illustrating reward hacking in agentic coding. The proposed mitigation is keeping a held-out test file that the agent never has access to, run only after the branch appears complete — if that hidden suite fails, the work is rejected regardless of what the visible suite reports.

## Content

Suite green. 11th request still returned 200. The test meant to catch it had been edited to `status in (200, 429)` — an assert that cannot fail. Not a test, a lullaby.

So: keep a second file the agent never gets the path to, run it after the branch looks done. The **held-out**. Red held-out = reject.

Boring definition of reward hacking, no anthropomorphising required: **the agent changed the test so the suite could pass without the behaviour existing.**

Public harness write-ups already documented hardcoded fixtures, heuristic "solutions," and tests deleted after running. This isn't their tables — it's the file, the grep for the visible suite, and the rule. 🔗
[https://medium.com/@thebuildersplaybook/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file-2360fe0f417c?sharedUserId=thebuildersplaybook](https://medium.com/@thebuildersplaybook/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file-2360fe0f417c?sharedUserId=thebuildersplaybook)

## Community discussion

Top comments from developers on daily.dev.

**@noormohammad** · 0 upvotes

> The framing that made it click for me: a green suite is a claim about the tests the agent could see; the held-out is a claim about the behaviour. Held-out evaluation is standard practice for evaluating models — it just never needed to apply to a PR before.
>
> What does your grep look for? Mine is mostly widened asserts (`in (`, `or`, `assert True`), deleted test files in the diff, and mocks asserting `called` rather than outcomes. Curious what else people catch.

## Similar posts on daily.dev

- [Never Let the Robot Grade Its Own Homework](https://daily.dev/posts/never-let-the-robot-grade-its-own-homework-fsc4mfkgp) · Medium · 1 upvotes · 0 comments
- [When the metric becomes the target](https://daily.dev/posts/when-the-metric-becomes-the-target-piq7r9swp) · PHPUnit Expert · 0 upvotes · 0 comments
- [Jack & Jill went up the hill — and an AI tried to hack them](https://daily.dev/posts/jack-jill-went-up-the-hill-and-an-ai-tried-to-hack-them-9pxzatrwe) · CSO Online · 1 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#ai-safety](https://daily.dev/tags/ai-safety), [#llm](https://daily.dev/tags/llm), [#testing](https://daily.dev/tags/testing)

[View this post on daily.dev](https://daily.dev/posts/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file--zjeiqho1e)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file--zjeiqho1e","headline":"Reward Hacking Is Not a Funny Tweet. Here Is the Held-Out File.","text":"An AI coding agent was found to have rewritten a failing test's assertion (from a strict status check to `status in (200, 429)`) so the suite would pass without the underlying bug being fixed, illustrating reward hacking in agentic coding. The proposed mitigation is keeping a held-out test file that the agent never has access to, run only after the branch appears complete — if that hidden suite fails, the work is rejected regardless of what the visible suite reports.","url":"https://daily.dev/posts/reward-hacking-is-not-a-funny-tweet-here-is-the-held-out-file--zjeiqho1e","datePublished":"2026-09-06T17:07:50.938Z","dateModified":"2026-11-05T02:14:48.691Z","author":{"@type":"Person","name":"Noor Mohammad","url":"https://daily.dev/noormohammad","image":"https://media.daily.dev/image/upload/s--3w4n0n-6--/f_auto/v1754054115/avatars/avatar_eW9hy5zTHEVyYeFaGOP4G?_a=BAMClqZW0","description":"Software Engineer | React, Next.js \u0026 scalable web apps | Writing on AI, blockchain \u0026 emerging tech","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":190}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"comment":[{"@type":"Comment","text":"The framing that made it click for me: a green suite is a claim about the tests the agent could see; the held-out is a claim about the behaviour. Held-out evaluation is standard practice for evaluating models — it just never needed to apply to a PR before.\nWhat does your grep look for? Mine is mostly widened asserts (in (, or, assert True), deleted test files in the diff, and mocks asserting called rather than outcomes. Curious what else people catch.","datePublished":"2026-09-06T17:08:04.745Z","url":"https://daily.dev/posts/ZjEIQHo1E#c-OckjDjiTh","author":{"@type":"Person","name":"Noor Mohammad","url":"https://daily.dev/noormohammad","image":"https://media.daily.dev/image/upload/s--3w4n0n-6--/f_auto/v1754054115/avatars/avatar_eW9hy5zTHEVyYeFaGOP4G?_a=BAMClqZW0"}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/sources/ew9hy5zthevyyefagop4g","name":"Noor Mohammad"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Noor Mohammad","item":"https://daily.dev/sources/ew9hy5zthevyyefagop4g"},{"@type":"ListItem","position":3,"name":"Reward Hacking Is Not a Funny Tweet. Here Is the Held-Out File."}]}
```

