docs(#6424): add Timeout() / context.DeadlineExceeded pitfall to Go guidelines - #6427
Conversation
…uidelines
Add a "Go pitfalls" section to docs/contributing/go-code.md documenting
that context.DeadlineExceeded implements interface{ Timeout() bool }
(returning true), so any timeout detection via interface assertion must
guard against context errors first. Without the guard, context deadline
errors are incorrectly classified as transient network timeouts and
retried.
The section includes WRONG/CORRECT code examples, explains why context
errors should never be retried, references forge.IsTransient as the
canonical correct pattern, and adds a review guideline for flagging
unguarded Timeout() checks.
This follows the existing pitfall documentation pattern established in
cel-triggers.md and shell-scripting.md.
Note: pre-commit could not run (sandbox network policy blocked git
fetch during hook initialization). The post-script runs pre-commit
authoritatively on the runner.
Closes #6424
|
🤖 Finished Review · ✅ Success · Started 6:02 PM UTC · Completed 6:10 PM UTC Commit: |
Site previewPreview: https://896f39bb-site.fullsend-ai.workers.dev Commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Looks good to me |
|
🤖 Finished Retro · ✅ Success · Started 12:18 PM UTC · Completed 12:26 PM UTC Commit: Runtime: claude · Model: opus → claude-opus-4-6 · Cost: $1.36 |
Retro: PR #6427 — Go Timeout pitfall documentationThis PR documents the Timeline
AssessmentThis workflow went well. The retro→triage→code→review pipeline completed in ~22 minutes with zero rework. The code agent produced technically accurate documentation on the first attempt, following existing pitfall patterns from Evidence for existing issues (no new proposals needed)
|
Summary
Adds a "Go pitfalls" section to
docs/contributing/go-code.mddocumenting thatcontext.DeadlineExceededimplementsinterface{ Timeout() bool }(returningtrue), so timeout detection via interface assertion must guard against context errors first. Without the guard, context deadline errors are incorrectly classified as transient and retried.Related Issue
Closes #6424
Changes
docs/contributing/go-code.mdTimeout() bool/context.DeadlineExceededinterface trap with WRONG and CORRECT code examplesforge.IsTransientas the canonical correct patternTimeout()checks as medium-severity findingscel-triggers.mdandshell-scripting.mdTesting
Closes #6424
Post-script verification
agent/6424-go-timeout-pitfall)b294e1eaab74f8174dda7c556cad7e0508f6d9eb..HEAD)