When you paste an error into an AI agent, you're handing it your conclusion
说明与用途
仅将堆栈跟踪粘贴给 AI 代理会导致修复症状而非根本原因。提供完整的请求、代码上下文和可重现的触发方式,代理即可识别合同漂移并给出可靠修复。
问题
Relying solely on a stack trace when asking an AI agent to fix a bug leads the agent to patch the symptom rather than the root cause, causing incomplete fixes and repeated failures.
结果
Providing comprehensive evidence (exact input, surrounding code, reproducible trigger) enables AI agents to identify contract drift and root causes, leading to reliable fixes that prevent repeated production failures.
工作流
- 1. Capture the exact input that triggered the failure (request line, headers, body).
- 2. Provide the surrounding code path, not just the failing line, including the calling functions and branch conditions.
- 3. Offer a reproducible way to trigger the error locally (e.g., a test or script).
- 4. Paste the stack trace along with the above evidence into the AI agent.
- 5. Review the agent’s proposed patch and ask, "What input would still break this?" to uncover overlooked cases.
- 6. Apply the patch only after confirming it addresses the root cause and all relevant inputs.
证据
What you pasted wasn't the bug. It was your conclusion about which part of the bug mattered.
I used to paste just the trace. Now I paste three things, in order: the exact input that triggered the failure, the surrounding code path, and a reproducible way to trigger it locally.
After the agent proposes a patch, before I apply it, I ask one question back: "what input would still break this?"
- 记录日期: 2026-10-12T00:41:14.857Z