🎨 Palette: Interactive Wait States for CLI#77
🎨 Palette: Interactive Wait States for CLI#77google-labs-jules[bot] wants to merge 2 commits intomainfrom
Conversation
- Replace static sleep with visual countdown timer for retries and folder propagation - Improve feedback during long waits (>2s) - Ensure graceful fallback for non-interactive environments - Update Palette journal with UX learnings
|
👋 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 replacing static sleep calls with interactive countdown timers during retry delays and folder propagation waits. The implementation leverages the existing countdown_timer function and respects the USE_COLORS flag to provide visual feedback in interactive terminals while maintaining clean logs in non-interactive environments.
Key changes:
- Added countdown timers for retry delays >= 2 seconds in the
_retry_requestfunction - Added countdown timers for folder creation polling delays in the
create_folderfunction - Updated project journal documentation to reflect learnings about interactive wait states
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| main.py | Replaced static time.sleep() calls with countdown_timer() in retry logic (lines 271-274) and folder creation polling (lines 457-461) to provide visual feedback during waits |
| .jules/palette.md | Updated journal entries to document learnings about interactive wait states and active waiting feedback in CLI tools |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| time.sleep(wait_time) | ||
|
|
||
| if wait_time >= 2: | ||
| countdown_timer(wait_time, "Retrying") |
There was a problem hiding this comment.
The countdown_timer function expects an int parameter, but wait_time could potentially be a float if the delay parameter is passed as a float. Consider explicitly converting wait_time to an integer with int(wait_time) before passing it to countdown_timer to ensure type safety and prevent potential TypeErrors from the range() function.
| countdown_timer(wait_time, "Retrying") | |
| countdown_timer(int(wait_time), "Retrying") |
| @@ -450,8 +454,11 @@ def create_folder(client: httpx.Client, profile_id: str, name: str, do: int, sta | |||
|
|
|||
| if attempt < MAX_RETRIES: | |||
| wait_time = FOLDER_CREATION_DELAY * (attempt + 1) | |||
There was a problem hiding this comment.
The countdown_timer function expects an int parameter, but wait_time is calculated as FOLDER_CREATION_DELAY * (attempt + 1). While FOLDER_CREATION_DELAY is currently an int (5), consider explicitly converting wait_time to an integer with int(wait_time) before passing it to countdown_timer to ensure type safety and prevent potential TypeErrors from the range() function if the constant is ever changed to a float.
| wait_time = FOLDER_CREATION_DELAY * (attempt + 1) | |
| wait_time = int(FOLDER_CREATION_DELAY * (attempt + 1)) |
| if USE_COLORS: | ||
| countdown_timer(wait_time, f"Waiting for folder '{name}'") | ||
| else: | ||
| log.info(f"Folder '{name}' not found yet. Retrying in {wait_time}s...") | ||
| time.sleep(wait_time) |
There was a problem hiding this comment.
This conditional logic is redundant because countdown_timer already checks USE_COLORS internally. Consider simplifying to the pattern used at lines 664-666: log the message when not USE_COLORS, then always call countdown_timer. This would make the code more maintainable and consistent with other wait patterns in the codebase.
| if USE_COLORS: | |
| countdown_timer(wait_time, f"Waiting for folder '{name}'") | |
| else: | |
| log.info(f"Folder '{name}' not found yet. Retrying in {wait_time}s...") | |
| time.sleep(wait_time) | |
| if not USE_COLORS: | |
| log.info(f"Folder '{name}' not found yet. Retrying in {wait_time}s...") | |
| countdown_timer(wait_time, f"Waiting for folder '{name}'") |
|
Superseded: Interactive wait states already in main. |
Understood. Acknowledging that this work is now obsolete as the feature is already in main, and stopping work on this task. |
Improved CLI UX by replacing static sleeps with interactive countdown timers. This gives users visual feedback during retries and folder propagation delays, reducing "is it hung?" anxiety. The implementation respects the
USE_COLORSflag to ensure cleaner logs in non-interactive environments.PR created automatically by Jules for task 4696153334722923638 started by @abhimehro