← Back to PRs

#13951: Improve error logging for better debugging in gateway logs

by arpankanwer open 2026-02-11 08:02 View on GitHub →
agents size: XS
Fixes #13868 This pull request improves error logging for provider errors in the Pi Embedded Runner to ensure better visibility and debugging of issues in the gateway logs. The changes focus on capturing both general provider errors and specific HTTP errors with detailed context. **Enhanced error logging:** * Added logging for non-failover provider errors in `run.ts` to ensure they are captured in gateway logs before being propagated to the user. The log includes provider, model, session key, and a truncated error message. * Added immediate logging of provider HTTP errors in `run/attempt.ts` when an error with HTTP status 400 or above is detected. The log records provider, model, session ID, run ID, HTTP status, error message, and error type for improved debugging. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Added comprehensive error logging to capture provider errors that weren't being logged before, improving visibility into gateway issues. - Logs non-failover provider errors in `run.ts` before throwing, capturing provider, model, session key, and truncated error text - Logs HTTP errors with status >= 400 in `attempt.ts` at the source, including provider, model, session/run IDs, HTTP status, error message, and error type <h3>Confidence Score: 5/5</h3> - This PR is safe to merge with minimal risk - The changes only add logging statements without modifying any control flow or error handling logic. Both logging additions are defensive and follow existing patterns in the codebase. The truncation to 2000 characters prevents log spam, and the logs provide valuable debugging context. - No files require special attention <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs