Skip to content

Conversation

Jason2866
Copy link

@Jason2866 Jason2866 commented Aug 31, 2025

Description:

fix install issues with slow internet and computers. Better prefer hang before Interrupt of install.
Let tool-esp_install handle the retry attempts.

Checklist:

  • The pull request is done against the latest develop branch
  • Only relevant files were touched
  • Only one feature/fix was added per PR, more changes are allowed when changing boards.json
  • I accept the CLA

Summary by CodeRabbit

  • Refactor

    • Simplified tool installation flow by removing automatic retries and timeouts.
    • Installs now fail fast with clearer error reporting.
    • Consistent behavior across all devices (no device-specific timeouts).
  • Documentation

    • Updated installation guidance to reflect the new behavior.

Copy link

coderabbitai bot commented Aug 31, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Removed timeout and retry mechanisms from tool installation in platform.py, simplified subprocess invocation for idf_tools install, and updated method signatures (_handle_existing_tool, install_tool). Error handling now returns False directly on failures. Associated docstrings were updated, and global constants for timeout and retry limits were deleted.

Changes

Cohort / File(s) Summary of Changes
Tool installation flow simplification
platform.py
Removed SUBPROCESS_TIMEOUT and RETRY_LIMIT. Dropped timeout logic and TimeoutExpired handling in _run_idf_tools_install. Eliminated retry_count from install_tool and _handle_existing_tool signatures and logic. Updated calls accordingly. Adjusted docstrings to reflect simplified behavior.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant C as Caller
    participant P as Espressif32Platform
    participant S as idf_tools (subprocess)

    C->>P: install_tool(tool_name)
    activate P
    P->>P: _handle_existing_tool(tool_name, paths)
    alt Tool not present or needs install
        P->>S: _run_idf_tools_install()
        activate S
        S-->>P: Exit code (success/failure)
        deactivate S
        alt Success
            P-->>C: True
        else Failure
            note right of P: No retries or timeouts<br/>Directly return False
            P-->>C: False
        end
    else Already OK
        P-->>C: True
    end
    deactivate P
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

A rabbit taps the terminal, quick and spry,
No clocks, no second tries hop by.
One clean leap, install or stall—
Simpler paths through burrows small.
If fail, we nod and turn around,
Next nibble finds more fertile ground. 🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch no_timeout_retry

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Jason2866
Copy link
Author

@coderabbitai full review

Copy link

coderabbitai bot commented Aug 31, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
platform.py (2)

398-428: Consider adding user feedback for long-running operations.

While removing the timeout allows installations to complete on slow networks, users might benefit from knowing that the installation is still in progress. Since stdout/stderr are suppressed, the process could appear frozen.

Consider adding a log message before the potentially long-running subprocess call:

 def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> bool:
     """Execute idf_tools.py install command."""
     cmd = [
         python_exe,
         idf_tools_path,
         "--quiet",
         "--non-interactive",
         "--tools-json",
         tools_json_path,
         "install"
     ]

     try:
+        logger.info(f"Installing tools via idf_tools.py (this may take several minutes)...")
         result = subprocess.run(
             cmd,
             stdout=subprocess.DEVNULL,
             stderr=subprocess.DEVNULL,
             check=False
         )

398-428: Document the rationale for removing timeouts.

Based on the retrieved learnings, there's a history of intentional timeout values in related files. It would be helpful to document why this specific case differs.

Update the docstring to explain the design decision:

 def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> bool:
-    """Execute idf_tools.py install command."""
+    """Execute idf_tools.py install command.
+    
+    Note: No timeout is set to allow installations to complete on slow networks.
+    The tool-esp_install handles its own retry logic internally.
+    """
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1970373 and 363ce2a.

📒 Files selected for processing (1)
  • platform.py (5 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#255
File: builder/penv_setup.py:141-161
Timestamp: 2025-08-10T20:18:20.698Z
Learning: In the pioarduino/platform-espressif32 repository's builder/penv_setup.py file, the subprocess timeouts (30s for pip install, 90s for listing, 600s for package installation) are intentionally kept at their current values. When timeouts occur, it's typically due to server-side connection aborts rather than slow networks, so increasing timeout values doesn't resolve the issue.
📚 Learning: 2025-08-10T20:18:20.698Z
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#255
File: builder/penv_setup.py:141-161
Timestamp: 2025-08-10T20:18:20.698Z
Learning: In the pioarduino/platform-espressif32 repository's builder/penv_setup.py file, the subprocess timeouts (30s for pip install, 90s for listing, 600s for package installation) are intentionally kept at their current values. When timeouts occur, it's typically due to server-side connection aborts rather than slow networks, so increasing timeout values doesn't resolve the issue.

Applied to files:

  • platform.py
📚 Learning: 2025-08-10T16:59:15.533Z
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#255
File: builder/penv_setup.py:265-275
Timestamp: 2025-08-10T16:59:15.533Z
Learning: In the ESP32 platform builder's penv_setup.py, the esptool_repo_path used in subprocess calls comes from PlatformIO's internal package management system (platform.get_package_dir()) which is a trusted source. Command injection concerns are not applicable here since this is build infrastructure code with controlled inputs, not user-facing code accepting arbitrary input.

Applied to files:

  • platform.py
📚 Learning: 2025-07-29T11:35:26.182Z
Learnt from: Jason2866
PR: pioarduino/platform-espressif32#237
File: platform.py:200-201
Timestamp: 2025-07-29T11:35:26.182Z
Learning: In platform.py, the `tool-esp_install` package intentionally transitions from mandatory to optional status after successful installation. Initially it's needed and mandatory for installation, but becomes optional once installed since it's no longer required for subsequent operations. Setting `self.packages[tl_install_name]["optional"] = True` after version verification is the intended design pattern.

Applied to files:

  • platform.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (15)
  • GitHub Check: build (macos-15, examples/arduino-matter-light)
  • GitHub Check: build (macos-15, examples/arduino-zigbee-switch)
  • GitHub Check: build (windows-latest, examples/espidf-peripherals-usb)
  • GitHub Check: build (windows-latest, examples/arduino-wifiscan)
  • GitHub Check: build (windows-latest, examples/arduino-blink)
  • GitHub Check: build (windows-latest, examples/arduino-zigbee-switch)
  • GitHub Check: build (windows-latest, examples/arduino-usb-keyboard)
  • GitHub Check: build (ubuntu-latest, examples/espidf-blink)
  • GitHub Check: build (ubuntu-latest, examples/arduino-NimBLE-ext_client)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-littlefs)
  • GitHub Check: build (ubuntu-latest, examples/tasmota)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/espidf-arduino-matter-light)
  • GitHub Check: build (ubuntu-latest, examples/arduino-blink)
  • GitHub Check: build (ubuntu-latest, examples/arduino-wifiscan)
🔇 Additional comments (3)
platform.py (3)

398-428: LGTM! Simplified subprocess invocation improves reliability.

The removal of timeout and retry mechanisms from _run_idf_tools_install aligns with the PR objective of preferring a hang over interrupted installs for slow connections. This allows the underlying tool-esp_install to handle its own retry logic, which is a cleaner separation of concerns.


464-481: Method signature simplified correctly.

The removal of the retry_count parameter from install_tool is consistent with the PR's goal of eliminating retry logic. The method now returns False directly on failures, making error handling more straightforward.


505-521: Consistent parameter removal in _handle_existing_tool.

The removal of retry_count from both the method signature and the recursive call to install_tool maintains consistency throughout the refactoring. The simplified flow makes the code more maintainable.

@Jason2866 Jason2866 merged commit 6f9391d into develop Aug 31, 2025
1 check passed
@Jason2866 Jason2866 deleted the no_timeout_retry branch August 31, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant