Do Inconsistent Documentation Mislead AI Coding Agents?

Documentation for products often becomes outdated as features change. This is particularly true for rapidly evolving products, such as those in the AI space, where updates may not be reflected across all documentation pages. Consequently, developers may encounter conflicting information, leading to confusion and errors.
When developers face discrepancies between documentation pages, they typically discover which page is correct through trial and error. This process often involves copying code from one page, executing it, and troubleshooting the resulting failures, which can be time-consuming.
To understand how AI coding agents handle such contradictions, researchers conducted tests to see if agents could recognize discrepancies between documentation pages. They examined whether agents would follow the incorrect page, how they would recover from errors, and whether they would inform users of any issues.
The study involved three known contradictions in the documentation of Dev Proxy, an API simulator used for mocking APIs and testing error handling in applications. The documentation had undergone significant changes, with many pages becoming inconsistent due to rapid updates. A review of the documentation identified 79 instances where conflicting information existed.
Testing the Impact of Contradictions
To evaluate the effect of documentation contradictions on AI agents, researchers compared agent performance using outdated documentation against performance using updated pages. Each agent received either the outdated or the corrected version of a documentation page, while all other variables remained constant.
The tests utilized VS Code with GitHub Copilot Chat, ensuring that agents did not have direct access to the documentation in their workspace, as developers typically do not include product documentation in their repositories. Instead, prompts linked directly to the relevant documentation pages.
Three specific contradictions were selected based on their potential impact on the agents’ performance. In one case, an outdated API endpoint caused an immediate failure, while the other two contradictions led to silent failures that only became apparent later in the continuous integration (CI) process.
Results of the Tests
The tests revealed that agents frequently followed outdated documentation, leading to increased token usage and additional steps in their processes. For instance, when agents used outdated API endpoints, they experienced a median increase of 38% in token usage compared to when they used the updated documentation.
In one scenario, Claude Sonnet 5.5, an AI model, wrote outdated endpoints in 10 out of 15 runs when referencing the old CI/CD page. Although all scripts ultimately worked, the detour resulted in significantly higher token consumption and additional steps required for recovery.
In contrast, when agents checked a second source before writing code, they were less likely to be misled by outdated information. For example, GPT-6.1 Terra consistently used the correct endpoints in all runs, demonstrating the importance of cross-referencing documentation.
Recommendations for Documentation Maintenance
Given the findings, it is crucial for organizations to address inconsistencies in their documentation. Even if AI agents can recover from errors caused by outdated information, the additional costs in terms of time and resources can be significant. Maintaining accurate and up-to-date documentation is essential for ensuring that both developers and AI coding agents can work efficiently.
Future testing could explore how the nature of tasks influences recovery from documentation contradictions and whether agents can identify outdated pages through search rather than direct links. Additionally, examining how different AI models interpret documentation could provide further insights into improving coding agent performance.
Related link: aka.ms
Source: Microsoft Developer Blogs