OpenAI Turns GPT-6 Astra Loose on Legacy Code: 800 Thousand Lines Deleted in Two Weeks

OpenAI's Core Experimentation team, which runs the experimentation system across the whole company, put GPT-6 Astra on dead-code cleanup. The prompt was vague and full of typos: find what's unused, and check Slack and Statsig. Over two weeks, five engineers merged more than 1,400 PRs almost as a side task and deleted over 800 thousand lines. The key economics come from comparing models on a single audit (1 million lines, 6,000 files). GPT-6.1 Sol Ultra found 131 issues for $15.12, while Astra Ultra found 142 for $109.06. That is 92% of the findings for 14% of the price, and the gap can be closed by refining the prompt. • The image of one service shrank from 3.31 to 1.72 GB • The model flagged a feature flag marked "Permanent" for human review instead of deleting it on its own • Median CI time dropped from ~10 to 4.5 minutes

AI-processed from TG: @ai_product (AI Product / Igor Akimov); edited by Hamidun News
OpenAI Turns GPT-6 Astra Loose on Legacy Code: 800 Thousand Lines Deleted in Two Weeks
Source: TG: @ai_product (AI Product / Igor Akimov). Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceTG: @ai_product (AI Product / Igor Akimov) ↗
Editor-in-Chief
Key metric #1The image of one service shrank from 3.31 to 1.72 GB
Key metric #2The model flagged a feature flag marked "Permanent" for human review instead of deleting it on its own
Key metric #3Median CI time dropped from ~10 to 4.5 minutes

OpenAI's Core Experimentation team is responsible for the experimentation system across the whole company. It has shown how GPT-6 Astra cleans up old code rather than writing new code. In two weeks, five engineers merged more than 1,400 PRs and deleted over 800 thousand lines. The image of one service shrank from 3.31 to 1.72 GB, and CI time nearly halved. The story was published on the OpenAI developer blog, and it is one of the most down-to-earth cases of agents working in a large codebase.

A prompt with typos instead of static analysis

Dead code used to be found with static analysis and runtime logs. Incidents from mistaken deletions still happened. This time the engineers sent the model one sloppy request, typos included, and left it in the blog post as is: "Can you help identify and clean up dead code in the repo please, feel free to check slack, statsig [a feature flag and experimentation platform we use], or any other source you need to confirm that things are indeed no longer being used and can be cleaned up or simplified".

The model did not stop at the repository. On its own, it went through old PRs, Slack threads, issue trackers, and production profiling, and it attached to every deletion an explanation of why the code counted as dead. Reviewers got arguments and sources, not a bare diff. About 400 visual snapshot variants were removed from the tests.

The "Permanent" flag that ate CPU for years

Stale experiments and feature flags are harder: that code may still run in production. The engineers had the model itself write the prompt for the full audit. It also calculated the CPU cost of each flag.

It found a flag that had quietly multiplied checks across all features at once for years. The model did not delete it on its own because the flag was marked "Permanent", and it raised the question with a human reviewer. After the flag was removed, the service saved about 0.42% of CPU. At OpenAI's scale that is real money, and the limit on the model's autonomy looks sensible.

Audit arithmetic: Astra, Sol, and the cost per finding

The most practical part of the case is the comparison of models on one audit: 6,000 files and 1 million lines of Python, TypeScript, Go, and Rust.

  • GPT-6 Astra Ultra: $109.06, 142 findings, $0.77 per finding
  • GPT-6.1 Sol Ultra: $15.12, 131 findings, $0.12 per finding
  • GPT-6.1 Sol Medium: $5.27, 86 findings, $0.06 per finding

Sol Ultra delivers 92% of the findings for 14% of the price. A review of the difference showed that Sol missed flags on which other flags depend. A prompt fix compensated for this. The practical takeaway: a mid-tier model with careful instructions catches up with the top model on tasks of this type.

The team sped up CI the same way. They asked the model to suggest optimizations and rank them by expected CI minutes saved per day, based on the repository's run history. The request read: "What ideas do you have to relieve CI load in this repository? List your ideas in a table and rank all of them by estimated CI minutes saved per day based on this repo's CI run history". The results:

  • about 30 PRs merged
  • median CI time dropped from ~10 to 4.5 minutes
  • p90 fell from 12.5 to 6 minutes
  • a set of 63 tests sped up from 592.6 to 29.8 seconds, roughly 20x

The authors say candidly that some of the suggestions added more complexity than value. The model surfaces so many optimizations that without prioritization and metrics you drown in them.

If you have legacy code, the recipe is simple. Pick one small task: dead code, a stale flag, or a flaky test. Run it on several models and effort levels and compare the cost per finding. Add review comments to the next prompt so the model learns your rules, for example about flags with dependencies. Once the result is stable, scale up to large chunks of the codebase. Mark critical places, as was done with "Permanent", so the decision stays with a human. For companies with accumulated tech debt, this is probably the fastest ROI from agents: the result is measured in lines, gigabytes of image size, and minutes of CI.

Story

Key Questions Answered

What are the key details on A prompt with typos instead of static analysis?

Dead code used to be found with static analysis and runtime logs. Incidents from mistaken deletions still happened. This time the engineers sent the model one sloppy request, typos included, and left it in the blog post as is: "Can you help identify and clean up dead code in the repo please, feel free to check slack, statsig [a feature flag and experimentation platform we use], or any other source you need to confirm that things are indeed no longer being used and can be cleaned up or simplified". The model did not stop at the repository. On its own, it went through old PRs

What are the key details on The "Permanent" flag that ate CPU for years?

Stale experiments and feature flags are harder: that code may still run in production. The engineers had the model itself write the prompt for the full audit. It also calculated the CPU cost of each flag. It found a flag that had quietly multiplied checks across all features at once for years. The model did not delete it on its own because the flag was marked "Permanent", and it raised the question with a human reviewer. After the flag was removed, the service saved about 0.42% of CPU. At OpenAI's scale that is real money, and the limit on the model's autonomy looks sensibl

What are the key details on Audit arithmetic: Astra, Sol, and the cost per finding?

The most practical part of the case is the comparison of models on one audit: 6,000 files and 1 million lines of Python, TypeScript, Go, and Rust. GPT-6 Astra Ultra: $109.06, 142 findings, $0.77 per finding GPT-6.1 Sol Ultra: $15.12, 131 findings, $0.12 per finding GPT-6.1 Sol Medium: $5.27, 86 findings, $0.06 per finding Sol Ultra delivers 92% of the findings for 14% of the price. A review of the difference showed that Sol missed flags on which other flags depend. A prompt fix compensated for this. The practical takeaway: a mid-tier model with careful instructions catches

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Hands-On AI Engineering · Hamidun Academy

Build & Ship Production AI Agents Without Boilerplate Code

Start your free 72-hour trial at Hamidun Academy (academy.hamidun.com) — interactive lessons on Claude Code & Cursor, live Tech Radar, and production agent templates.

Start 72h Free Trial →Vibe-Coding Intensive
What do you think?
Loading comments…