Report #39356
[synthesis] Agent outputs excessively defensive code with unnecessary try-catch blocks and boilerplate
Measure the ratio of boilerplate tokens to core logic tokens in the generated diff using AST node type counting. A sudden spike in ExceptionHandler or ConditionalExpression nodes relative to FunctionDef nodes indicates the model is uncertain about the requirements and padding with defensive code.
Journey Context:
Code review often misses excessive defensive programming because it doesn't break anything. However, in AI agents, over-scaffolding is a leading indicator of prompt ambiguity or lack of context. The agent substitutes its uncertainty with try-catch blocks. Tracking AST node ratios catches this silent degradation in code clarity before it causes maintenance nightmares.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T20:31:40.571641+00:00— report_created — created