🎨 Palette: Add retry feedback to CLI commands#286
Conversation
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR improves CLI user experience by adding visible retry feedback for API requests. Previously, when API requests failed and were being retried, the CLI would hang silently. Now it writes informative messages to stderr showing the error and countdown to the next retry attempt.
Changes:
- Modified
fetchWithRetryto output retry feedback messages to stderr - Changed delay calculation from
Math.random()toMath.ceil(Math.random())for cleaner display
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // retry with delay | ||
| // console.error("retrying"); | ||
| const delay = 5000 * Math.random(); | ||
| const delay = Math.ceil(5000 * Math.random()); |
There was a problem hiding this comment.
The delay calculation using Math.ceil(5000 * Math.random()) produces delays from 1-5000ms rather than the documented 0-5 seconds. Consider using Math.floor(5000 * Math.random()) to maintain the original 0-5000ms range, or update the JSDoc comment on line 219 to reflect the new 1-5000ms range.
| const delay = Math.ceil(5000 * Math.random()); | |
| const delay = Math.floor(5000 * Math.random()); |
| // console.error("retrying"); | ||
| const delay = 5000 * Math.random(); | ||
| const delay = Math.ceil(5000 * Math.random()); | ||
| process.stderr.write(`> Request failed: ${error}. Retrying in ${(delay / 1000).toFixed(1)}s...\n`); |
There was a problem hiding this comment.
The new stderr output for retry feedback should be covered by tests. Consider adding test cases in tests/commands/unipept/retry_logic.test.ts to verify that the retry message is written to stderr with the correct format when retries occur.
Improved the CLI user experience by adding visible feedback when API requests fail and are being retried. Previously, the CLI would hang silently for up to several seconds during retries. Now, it writes a message to
stderrindicating the error and the time until the next retry attempt, ensuring users know the process is still active. This change affects all subcommands inheriting fromUnipeptSubcommand.PR created automatically by Jules for task 12170354350089645752 started by @bmesuere