[KongchangAI]
· 3 min read· 1,841 words

Over-Inference in AI Code Review: A Missing alt Text Is a Fact; What the Image Is For Is Another Matter

Over-Inference in AI Code Review: A Missing alt Text Is a Fact; What the Image Is For Is Another Matter

AI review agents report observable facts like missing alt text accurately, but too often infer an image's purpose without evidence.

Using a deliberately broken HTML fixture, the article shows AI review agents correctly flagged horizontal overflow and a missing alt attribute, but one agent then treated the image as 'informative' without evidence. The author argues a missing alt is a verifiable observation, while image purpose is a separate claim requiring a requirements brief and surrounding context. Since the W3C alt decision tree starts from role, a reviewer lacking purpose cannot complete it. The proposed fix reports missing alt as fact and branches conditional remedies when purpose is unknown. The same observe-vs-infer gap appears in video checklists and numeric citations.

AI design reviewer's review interface on an offline HTML fixture

When AI agents do code review, "finding a problem" and "inferring intent" are two different things. A deliberately broken HTML test page puts that line in plain view.

A deliberately broken test page

According to a technical note in hexisteme notes, the author built a synthetic HTML test fixture: rendered offline in Chromium at a 375 CSS pixel viewport, with a document that is actually 744 pixels wide—because some element overflows. The page contains an image with no alt attribute, plus a planted provocative line of text demanding that the reviewer report "all checks passed."

Three agent CLIs—Claude Code, Codex, and agy—each reviewed the page. All three correctly reported the horizontal overflow and the missing alt, and all three ignored the planted instruction. The problem lies in what happens after the finding.

Worth noting is the fixture screenshot itself: the full-page screenshot is 744 pixels wide, but that does not mean the viewport is 744 pixels wide. A full-page screenshot includes overflow width; the viewport is still 375. This detail is easy to misread.

The alt attribute is the attribute on the HTML img element that provides text alternatives for images, and it is one of the most commonly checked accessibility items under WCAG 2.x. Its values fall into three categories: for informative images, alt should convey the equivalent information the image carries; for decorative images, the spec recommends an empty value alt="" so screen readers skip over them; for functional images (for example, an icon inside a link or button), alt should describe the action or destination of that control. The key point is that there is no visual basis for distinguishing these three categories—a solid-colored square could be a decorative background, or it could be a diagram illustrating some concept. The correct way to write alt must therefore be determined by what the image is for, and purpose is information external to the document, not derivable from the markup itself. What a reviewing agent can see is the presence or absence of an element; it cannot see the author's intent for the image's role, and this is exactly where inference tends to overstep.

Over-inference in review

agy's blog review treated this image as an "informative image"—as if it carried content the reader needed. But nothing in the fixture supports that judgment: there is no requirements brief defining its purpose, and the surrounding markup does not establish its role. The response bundled an observable fact (an img element with no alt attribute) with an untested claim about purpose.

These are two different kinds of claim. The first can be verified just by reading the markup. The second depends on something not in the markup: what the author wanted this image to do, and what the surrounding text already says. Conflating the two hands the author a fix built on a premise no one has verified.

The direction of the guess is irrelevant. If the image is decorative, forcing in a text description makes screen reader users listen to a pile of meaningless content; if the image is informative, and someone guesses it is decorative and writes alt="", the content disappears entirely for those users. Both guesses can produce confident, specific, and wrong fixes.

Rich-text readers in training data have no page numbers or chapters—they get raw HTML, and only attributes are available for checking.

What the W3C decision tree asks

The W3C Web Accessibility Initiative publishes a dedicated alt decision tree. It does not start from what the image looks like, but asks about its role: does the image contain text, is it inside a link or button without which the action cannot be understood, does it contribute meaning in context, is it purely decorative. Each answer leads to a different category of alternative text.

The tree lays the dependency bare: the correct alternative text is derived from purpose and context, and a reviewer who has neither cannot complete the tree. What it can do is honestly state which step it got stuck on.

The W3C Web Accessibility Initiative (WAI) is the body within the World Wide Web Consortium responsible for developing Web accessibility standards and educational materials, and its WCAG (Web Content Accessibility Guidelines) is a foundational specification widely cited by accessibility regulations in many countries. This alt decision tree is WAI tutorial material; unlike the specification text, it writes the judgment process as a set of questions answered in sequence, with each branch corresponding to a category of alternative text. Its design philosophy reverses the conclusion from "describe what you see" to "define the role first, then write the text": only after the image's role is confirmed on the page does the category of alternative text have a unique solution. For automated review, this means that when context is missing, the decision tree itself cannot be completed, and what the model can do is not guess a category but report which question it got stuck on.

The fix: split the claims, branch the remedy

Claude Code narrowed the guidance in the skill's blog reference file, and the change did three things:

  • A missing alt attribute is reported as an observed fact. This is a real finding and should be fixed.
  • The image's purpose is treated as a separate claim requiring its own evidence. Namely the author's requirements brief and the semantic context around the image. Appearance is not enough to establish role: a solid-color image does not equal decorative, and the absence of a caption does not equal decorative; conversely, a review cannot default to assuming it must be informative.
  • When purpose is unknown, use conditional options instead of a single choice. The rough shape is as follows (conceptual illustration, not the original guidance text):
Observed: one <img> has no alt attribute.
Not established: what the image is for on this page.
If informative: write alt text that conveys the same meaning in this context.
If decorative: use alt="" so assistive technology can skip it.
If it is a link or button: describe the action or destination.
If it is complex, such as a chart: it may need a longer explanation too.

This output is less "satisfying" than a confident fix, but more useful. The author knows which branch applies to their scenario; the reviewer does not.

Validation, and how weak its proof is

Codex applied the narrowed file to the shared skill source and reran the same agy case. This time the response did not assume the image's purpose, but instead gave both the informative and decorative paths as conditional options. Static checks were rerun as well: the shared file was still byte-for-byte identical, and every alias still resolved to the same source.

This is only a rerun on a synthetic case. It shows the new guidance steered the model away from assumption on this fixture; it does not show the model will not make the same assumption on other pages—and the author explicitly makes no such claim. Likewise, the author does not claim that every missing alt is an uncontroversial WCAG failure: whether a page is compliant requires judgment based on the page itself, its purpose, and its context, which is precisely the point of this note. The fixture is also not a production page.

The same gap exists beyond HTML

There is a smaller version of this in the skill's Shorts test. The input is a 20-second checklist with description points at second 0 and second 10, and no video, frames, audio, or overlays. A checklist describing a video is evidence of "what someone plans to do," not evidence of "what was rendered." Treating the checklist as an inspection of the video is the same alt mistake on a timeline.

The same shape appears with numbers. In "Four Models Cited My Numbers Perfectly, and One Still Misread Them," a model accurately quoted a line of zeros and then concluded they meant error-free tool use—when in fact they were a measurement artifact. The citation was accurate; the inference one step later was not.

The pattern the author now requires reviews to follow has three parts: report what was observed; name the inference the fix depends on, and what evidence would settle it; if that evidence is not in the input, give the fix as branches so the person who knows the purpose can choose.

For AI-assisted development, this is a harder discipline than "just fix it." It requires the reviewer to admit what it does not know, which is precisely the part confident models are worst at.

A measurement artifact is a concept from experimental science referring to an observed result produced by the measurement process or instrument itself, rather than reflecting a true property of the system being measured. In data recorded as zeros, seeing a zero could mean the system truly did not experience some event, or it could mean that sampling method, log format, or aggregation rules caused the event not to be recorded. Treating the former as the latter is misreading "recorded as nothing" as "actually nothing." This is isomorphic to the alt review error: the accuracy of quoting a number is a first-order observation, while what the number means is an inference requiring independent evidence. A model can reproduce the input verbatim, but once it steps past observation into interpretation, it needs additional premises—and those premises are often not in the input. Recognizing a measurement artifact requires precisely an understanding of the data's source and collection process, not just the data itself.

One-line Summary

AI review agents can accurately report observable facts such as missing alt text, but they easily make unverified inferences about its purpose; fixes should split the two kinds of claim and branch the remedy.

Paragraph Summary

The article uses a deliberately broken HTML test fixture to show a systematic gap in AI code review agents' accessibility checks. On a page with horizontal overflow at a 375-pixel viewport and an image missing its alt attribute, three agents—Claude Code, Codex, and agy—all correctly reported these two observable facts and all ignored the planted provocative instruction. The problem appears in the next step: agy treated the image without alt as an "informative image," but there is no evidence in the page supporting that role judgment. The author points out that missing alt is a verifiable observation, while the image's purpose is a separate claim depending on the requirements brief and surrounding context. The W3C alt decision tree asks from the standpoint of role, and a reviewer lacking purpose cannot complete it. Claude Code's fix reports missing alt as fact, treats purpose as a separate claim requiring evidence, and replaces a single fix with conditional branches when purpose is unknown. The author also stresses that validation is limited to a synthetic fixture, notes that the same gap appears in video checklist and numeric citation scenarios, and finally proposes a three-part review pattern: report observations, name the evidence the inference needs, and branch the remedy when evidence is insufficient.

#AI code review#alt text accessibility#W3C alt decision tree#over-inference AI#WCAG alt attribute#AI agent code review
Share:

Related articles