CI fails on SonarQube, not tests: a field report on Codex piling complexity into one file
An engineer's write-up shows SonarQube failing CI on cyclomatic complexity in a file Codex had been reliably iterating on.
In a post on Engineering Notes (October 27, 2026), shared by @bibryam, an engineer describes a CI failure that turned out not to be the tests. The cause was SonarQube, which flagged App.tsx for cyclomatic complexity. The file was about 30 lines, but 15 of them were entire components that Codex had written on single lines. Codex "had been happily and reliably iterating on that file through several features." Our read: tests don't measure maintainability, and an independent static-analysis gate surfaced structure the agent loop never questioned, even though the author judged the complexity warranted.
The author says the logic was correct and the complexity was warranted by the requirements. They told Codex to "make SonarQube happy," and it split the code into 10 files. The author's point is that this was code they had never seen before, and an owner needs to know enough to spot when something is wrong and dive in when needed.
The broader evidence is mixed. According to daily.dev's write-up of Sonar's pitch, Sonar cites a Carnegie Mellon study of Cursor adoption in which static-analysis warnings rose 30% and complexity rose 41%. Sonar proposes verification at three points: as the agent writes, in CI and after release. An empirical study of 50 open-source projects found quality "remained largely stable," with lower code-smell density in the agentic era.
One caution if you hand fixes back to the agent. A study of Codex and Claude Code found every model it tested kept editing when repeatedly asked to refactor, even after the code was already clean. Give the agent a clear stopping criterion, such as passing the quality gate.
Sources
- What Do You Still Need to Know When Agents Do the Work? · Engineering Notes
- Does AI-Assisted Development Homogenize Software? An Empirical Study of Code Similarity, Quality, and Evolution · arXiv.org
- Your Wish Is My Commit: Over-Compliant Refactoring in AI Coding Agents Thanks: *Equal contribution. · arxiv.org
- AI sped up coding. Sonar instills confidence with verification. | daily.dev · daily.dev
- @bibryam: Here Be Monsters: What Do You Still Need to Know When Agents Do the Work? · @bibryam