Who is liable when an AI writes the code that fails?

Ask an engineering team who is responsible for a defect in AI-generated code and you get a pause. The model vendor's terms disclaim fitness for purpose in the first paragraph. The developer did not write the line and may not have read it closely. The reviewer approved a pull request, not an authorship claim. Somewhere in that pause is a liability nobody has explicitly accepted.

The answer is already settled, and it is you

Legally this is less ambiguous than it feels. If your organisation ships software, your organisation is accountable for what the software does. No regulator or claimant is going to be redirected to a model vendor because a coding assistant suggested the function. Product liability, financial services conduct rules, medical device regulation and consumer protection all attach to the entity that placed the product on the market.

What is genuinely new is not the liability. It is that you can no longer describe how the thing you are liable for was made.

Three questions you will be asked

Was there human oversight? Almost every framework that touches AI expects meaningful human review. Answering yes requires distinguishing between a person who approved a change and a person who read it. A record that shows what the agent produced and what the human then altered supports that distinction. An approval timestamp on its own does not.

How much of the system is AI-generated? Most teams answer with a feeling. The honest answer is a measurement, and it needs a definition attached: code a model produced that survived review is a very different number from code a model ever emitted.

Can you show us? This is the one that ends conversations. Screenshots of a chat window are not evidence. A dated report drawn from a record that can be verified is.

Why the gap keeps widening

Adoption is running well ahead of governance. Agents are being used on production code in organisations whose software development policies have not been revised since they were introduced, and that will only stay comfortable while nothing goes wrong.

The mismatch is not a failure of intent. It is that the controls assume an author who can be asked afterwards, and the new author cannot be asked. The prompt that explains a decision exists for as long as somebody keeps that terminal window open.

What closing it looks like

Practically: record prompts, responses and diffs as they happen, locally, on every machine that writes production code. Attribute lines to the interactions that produced them and report what cannot be attributed. Keep the record append-only and verifiable so it means something when it is challenged. Write down which tools are allowed and where AI-authored code needs a named human sign-off.

None of that makes AI-written code safer on its own. It makes the question answerable, which is the part you are currently missing.

Make the liability question answerable.

We will show you what the record looks like on a repository you already worry about.