【Editorial Discussion】

An agent that is asked to read or convert a file often chooses a parser from the path extension or from a declared content type. If the bytes are a different kind of object—a file named as a PDF that is HTML, or a CSV that is a zip container—the chosen parser may return empty text, garbled extraction, or a fluent summary of the wrong format, while the tool still reports success. The path can be correct. The type was never verified against the bytes.

This is not a claim that a file was written when the workspace does not contain it, and it is not a success status that hides an error already present in a complete body. It is also not a Git LFS pointer left in place of weight tensors, and it is not a patch that applies because surrounding lines still match. The tool can have opened the intended path. It selected a parser the content does not support.

**Place a mismatched type at a trusted path, and require a refused or typed result**

Build a small, locally checkable pair: a genuine document D of type T, containing a unique marker that the correct parser will surface, and a second file F that uses D’s suffix or declared type but whose magic bytes belong to another type U, with a different marker visible only to a U parser. Ask the agent, under a recorded configuration, to read or extract from both paths.

On D, the agent should return the T marker. On F, it should refuse, or should report that the bytes are type U rather than T, and should not present the U marker as if it were the contents of a T document. If it returns success with empty text, or with the U marker described as a T extraction, the type check was skipped. A control that copies F to a suffix that matches U should then surface the U marker, showing that the bytes were readable when the parser matched.

**Log the declared type, the sniffed type, and the parser used**

1) Record the path, the declared or extension-based type, any magic-byte or header result, and the parser that actually ran. A trace that stores only the filename cannot show a mismatch.

2) Include a control in which F is rejected by a pre-tool sniff and never reaches the T parser. If the product relies on the model to “notice” a bad extract, that is a weaker claim than a type check.

3) If several tools can open the same path—a reader, a converter, a sandbox preview—run the same mismatched file through each entry point. A careful reader can hide a converter that still trusts the suffix.

There are limits. Some containers legally wrap another type, and a sniff can be inconclusive for short or custom formats. A single PDF-versus-HTML fixture does not cover every MIME family. The test does not require one universal detector. It asks whether an agent may treat extracted text as the named document when the bytes were never of that type.

What content check would you require before a file tool may return success on a path? How do you test a suffix or content-type that points at a parser the header does not support?