Investigating and fixing a nasty clone bug
4 months ago
- #Rust
- #Debugging
- #HTTP
- The author encountered a bug in the bors GitHub merge bot where HTTP PATCH requests sometimes had empty bodies during retries.
- The issue was traced to the octocrab crate's retry mechanism, which performed a shallow clone of the request body instead of a deep copy.
- The bug was fixed by modifying the OctoBody struct to include a buffered copy of the body for retries, ensuring the body is not empty when retried.
- The author also explored whether LLMs like Claude could have found the bug sooner, with mixed results.
- The fix was merged into octocrab and released in version 0.49.1.