Skip to content

fix(devcontainer): install platformio as the vscode user - #11264

Open
b-anantha wants to merge 1 commit into
meshtastic:developfrom
b-anantha:fix/devcontainer-platformio-pipx-path
Open

fix(devcontainer): install platformio as the vscode user#11264
b-anantha wants to merge 1 commit into
meshtastic:developfrom
b-anantha:fix/devcontainer-platformio-pipx-path

Conversation

@b-anantha

@b-anantha b-anantha commented Jul 28, 2026

Copy link
Copy Markdown

Problem

The devcontainer comes up without pio on PATH:

vscode ➜ /workspaces/firmware $ pio
bash: pio: command not found

pipx install platformio runs in the Dockerfile as root, before the devcontainers python feature sets PIPX_HOME/PIPX_BIN_DIR. pipx therefore falls back to root's defaults and installs to /root/.local/bin/pio. A directory that is mode 700 and not on the vscode user's PATH. The binary is in the image, just unreachable from the user the container actually runs as.

Fix

Move the install to .devcontainer/setup.sh, which runs as postCreateCommand as vscode, after features are applied and already installs esptool the same way. It lands in /usr/local/py-utils/bin, which is on PATH.

Trade-off

platformio is now fetched on container create rather than baked into the image. The alternative is keeping the Dockerfile install and setting ENV PIPX_HOME=/usr/local/py-utils PIPX_BIN_DIR=/usr/local/py-utils/bin above it. Happy to switch if that is preferred.

Testing

Created a fresh container with the devcontainer CLI:

  • pio resolves to /usr/local/py-utils/bin/pio (PlatformIO Core 6.1.19)
  • /root/.local/bin/pio is no longer present, confirming the Dockerfile change took effect
  • pio run -e rak4631 succeeds in that container (SUCCESS, 2:26)

Before this change the same steps produced pio: command not found.

This PR touches only .devcontainer/; no firmware code changed, so the per-device regression list is not applicable.

🤝 Attestations

  • I have tested that my proposed changes behave as described.
  • I have tested that my proposed changes do not cause any obvious regressions on the following devices:
    • Heltec (Lora32) V3
    • LilyGo T-Deck
    • LilyGo T-Beam
    • RAK WisBlock 4631
    • Seeed Studio T-1000E tracker card
    • Other (please specify below)

N/A - no firmware code is changed by this PR. The rak4631 build above was run only to confirm the toolchain works inside the container.

Summary by CodeRabbit

  • Chores
    • Updated development container setup to install PlatformIO during environment initialization.
    • Preserved PlatformIO device access configuration and existing container health-check behavior.

pipx ran in the Dockerfile as root, before the python feature sets
PIPX_HOME/PIPX_BIN_DIR.
@CLAassistant

CLAassistant commented Jul 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions

Copy link
Copy Markdown
Contributor

@b-anantha, Welcome to Meshtastic!

Thanks for opening your first pull request. We really appreciate it.

We discuss work as a team in discord, please join us in the #firmware channel.
There's a big backlog of patches at the moment. If you have time,
please help us with some code review and testing of other PRs!

Welcome to the team 😄

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

PlatformIO installation was removed from the devcontainer image build and added to the container setup script before esptool installation.

Changes

Devcontainer tooling

Layer / File(s) Summary
Move PlatformIO installation to setup phase
.devcontainer/Dockerfile, .devcontainer/setup.sh
The Dockerfile removes pipx install platformio, while setup.sh installs PlatformIO before esptool.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: moving PlatformIO installation to the devcontainer setup for the vscode user.
Description check ✅ Passed The description replaces the template with clear Problem, Fix, Trade-off, Testing, and Attestations sections and includes needed details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.devcontainer/setup.sh:
- Around line 7-8: Update the installation commands in the setup script so a
failure from pipx install platformio immediately terminates the script and
prevents the esptool step from masking it; enable fail-fast behavior or
explicitly chain the commands with &&.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6edad5cd-d382-413e-992e-a337e39f3c27

📥 Commits

Reviewing files that changed from the base of the PR and between dafa583 and 735873a.

📒 Files selected for processing (2)
  • .devcontainer/Dockerfile
  • .devcontainer/setup.sh
💤 Files with no reviewable changes (1)
  • .devcontainer/Dockerfile

Comment thread .devcontainer/setup.sh
Comment on lines +7 to 8
pipx install platformio
pipx install esptool

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Do not mask PlatformIO installation failures.

If pipx install platformio fails, the script continues to pipx install esptool; when that succeeds, postCreateCommand returns success even though pio is missing. Make the script fail fast so container creation cannot silently complete without PlatformIO.

Proposed fix
 #!/usr/bin/env sh
+set -e

 git submodule update --init

Alternatively, explicitly chain the installation commands with &&.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.devcontainer/setup.sh around lines 7 - 8, Update the installation commands
in the setup script so a failure from pipx install platformio immediately
terminates the script and prevents the esptool step from masking it; enable
fail-fast behavior or explicitly chain the commands with &&.

@vidplace7 vidplace7 self-assigned this Jul 30, 2026
@vidplace7
vidplace7 self-requested a review July 30, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants