Skip to content

Conversation

@lklimek
Copy link
Contributor

@lklimek lklimek commented Oct 31, 2025

Issue being fixed or feature implemented

Github Copilot and OpenAI Codex cannot build the platform due to lack of proper
dependencies (eg. wrong version of protoc compiler).

What was done?

Added a script to install dependencies on Ubuntu.

How Has This Been Tested?

TODO.

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have added "!" to the title and described breaking changes in the corresponding section if my code contains any
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Chores
    • Added a new environment setup script for Ubuntu 24.04 that automates installation and configuration of all project dependencies, including build tools, Node.js, Rust toolchain, WASM utilities, and protobuf compiler.
    • Updated project documentation to reference the new setup script as a development dependency.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 31, 2025

Walkthrough

A new Ubuntu 24.04 setup script is introduced that comprehensively configures build dependencies including system packages, Node.js, Rust, protobuf, and WASM tooling. Documentation in AGENTS.md references this script under the Dependencies section.

Changes

Cohort / File(s) Summary
Documentation and Setup Script
AGENTS.md, scripts/setup-ai-agent-environment.sh
Added documentation reference to new setup script in AGENTS.md. Introduced comprehensive setup script for Ubuntu 24.04 that validates OS version, installs system dependencies (build tools, libraries, Python, Node.js 20+), configures Corepack for Yarn, installs and updates Rust toolchain with wasm32 target, installs protobuf compiler, provisions WASM tooling (wasm-bindgen-cli, wasm-pack), configures Docker group membership, and outputs final guidance for shell restart and repository setup.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Script as setup-ai-agent-environment.sh
    participant System as System/OS
    participant APT as APT/Package Manager
    participant Tools as Build Tools<br/>(Node, Rust, etc.)

    User->>Script: Execute setup script
    Script->>System: Validate Ubuntu 24.04
    alt OS validation fails
        Script-->>User: Exit with error
    end
    
    Script->>Script: Determine sudo availability
    
    Script->>APT: Update APT metadata
    Script->>APT: Install system dependencies
    APT-->>Script: Installation complete
    
    rect rgb(200, 220, 255)
    Note over Script,Tools: Install Build Toolchains
    Script->>Tools: Ensure Node.js 20+
    Script->>Tools: Enable Corepack for Yarn
    Script->>Tools: Install/update Rust toolchain
    Script->>Tools: Install protobuf compiler
    Script->>Tools: Install WASM tooling
    end
    
    Script->>System: Configure Docker group (if needed)
    
    Script-->>User: Output completion guidance<br/>(restart shell, run setup)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Bash script complexity: Multiple conditional paths (sudo availability, architecture detection, tool version checking) and error handling patterns require careful verification
  • System interaction scope: Script touches package management, user group configuration, and multiple external toolchain installations—each with potential edge cases
  • Fallback logic verification: Ensure all conditional branches (missing tools, existing installations, non-sudo contexts) are properly handled
  • Cross-platform considerations: While targeting Ubuntu 24.04 specifically, verify version detection and architecture-specific installations (protoc, WASM tools)

Poem

🐰 A warren of tools, now organized and neat,
Ubuntu's noble heart beats with each shell so sweet,
Node and Rust and WASM dance in harmony,
One script to build them all—the setup's poetry! 🛠️✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "build: script to configure environments for ai coding agents" accurately and specifically describes the main change in the changeset. The pull request adds a new environment setup script (setup-ai-agent-environment.sh) designed to configure Ubuntu systems for AI coding agents to build the platform, and updates AGENTS.md to reference this new dependency script. The title is clear, concise, uses the appropriate "build:" prefix to indicate a tooling/development change, and provides enough specificity that a teammate scanning the git history would immediately understand the purpose of the addition without confusion or ambiguity.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/codex-environment

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 and usage tips.

@lklimek
Copy link
Contributor Author

lklimek commented Oct 31, 2025

@copilot please test this PR.

Copy link
Contributor

Copilot AI commented Oct 31, 2025

@lklimek I've opened a new pull request, #2846, to work on those changes. Once the pull request is ready, I'll request review from you.

@lklimek lklimek changed the title feat: script to configure environments for coding agents build: script to configure environments for ai coding agents Oct 31, 2025
Copy link
Contributor

@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: 1

🧹 Nitpick comments (2)
scripts/setup-ai-agent-environment.sh (2)

122-149: Rust toolchain installation is robust but could improve parsing.

The function reads the rust-toolchain.toml and correctly installs components and targets. However, the grep/awk parsing at line 124 is somewhat fragile—if the TOML format deviates slightly, it could fail silently. Consider adding a fallback or validation.

A more robust parsing approach for rust-toolchain.toml:

install_rust_toolchain() {
  local toolchain
  # More defensive TOML parsing
  toolchain=$(grep -m 1 '^\s*channel\s*=' "${REPO_ROOT}/rust-toolchain.toml" | sed 's/.*=\s*"\?\([^"]*\)\"\?.*/\1/' | tr -d ' ' || true)
  if [[ -z "${toolchain}" ]]; then
    warn "Unable to determine toolchain from rust-toolchain.toml; defaulting to stable."
    toolchain="stable"
  fi
  # ... rest of function

This adds support for optional spaces and different quote styles while remaining shell-portable.


201-219: Cargo tools installation should pin wasm-pack version.

The script correctly pins wasm-bindgen-cli to v0.2.103, which is good practice. However, wasm-pack at line 213 installs without an explicit version constraint, which reduces reproducibility and predictability.

Pin wasm-pack to a specific version for reproducibility:

install_cargo_tools() {
  local wasm_bindgen_version="0.2.103"
  local wasm_pack_version="1.3.4"  # Or appropriate version

  if ! command -v wasm-bindgen >/dev/null 2>&1 || [[ "$(wasm-bindgen --version | awk '{print $2}')" != "${wasm_bindgen_version}" ]]; then
    log "Installing wasm-bindgen-cli ${wasm_bindgen_version}"
    cargo install --locked "wasm-bindgen-cli@${wasm_bindgen_version}"
  else
    log "wasm-bindgen-cli ${wasm_bindgen_version} already installed."
  fi

  if ! command -v wasm-pack >/dev/null 2>&1 || [[ "$(wasm-pack --version | awk '{print $2}')" != "${wasm_pack_version}" ]]; then
    log "Installing wasm-pack ${wasm_pack_version}"
    cargo install --locked "wasm-pack@${wasm_pack_version}"
  else
    log "wasm-pack ${wasm_pack_version} already installed."
  fi
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c262818 and cd9e50e.

📒 Files selected for processing (2)
  • AGENTS.md (1 hunks)
  • scripts/setup-ai-agent-environment.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
scripts/**

📄 CodeRabbit inference engine (AGENTS.md)

Place automation and helper scripts in scripts/

Files:

  • scripts/setup-ai-agent-environment.sh
🧠 Learnings (1)
📓 Common learnings
Learnt from: shumkov
Repo: dashpay/platform PR: 2346
File: .github/workflows/release-docker-image.yml:0-0
Timestamp: 2024-11-22T12:53:36.084Z
Learning: As of November 2024, `ubuntu-24.04` and `macos-14` runners are available for use in GitHub Actions workflows.
⏰ 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). (1)
  • GitHub Check: Build JS packages / Build JS
🔇 Additional comments (7)
scripts/setup-ai-agent-environment.sh (6)

1-47: Header, utilities, and environment setup look good.

The script establishes a solid foundation with strict bash options (set -euo pipefail), proper logging utilities, and clean path derivation. OS version detection appropriately warns on mismatch, and sudo detection is well-structured.


49-78: Comprehensive system dependency installation.

The APT update and dependency list are thorough and appropriate for the build environment. No concerns here.


80-94: Node.js version detection and installation logic is sound.

The version parsing correctly extracts the major version, and the conditional installation logic handles both fresh installs and version upgrades properly. The NodeSource setup is a standard practice.


96-120: Corepack enablement handles user context thoughtfully.

The function defensively retrieves user home and handles both sudo and non-sudo scenarios. Warnings on failure are appropriate rather than hard errors.


221-239: Docker group configuration is defensive and well-handled.

The script checks Docker availability, verifies group membership, and provides appropriate guidance. The warning message is helpful.


240-243: Final guidance messages are clear and actionable.

The script provides concise next steps for the user, including shell restart and repository setup.

AGENTS.md (1)

10-10: Documentation reference is clear and well-placed.

The addition of the setup script reference under Dependencies is straightforward and helpful.

@shumkov
Copy link
Collaborator

shumkov commented Nov 1, 2025

Don't we have already dev container ?

@lklimek
Copy link
Contributor Author

lklimek commented Nov 3, 2025

Don't we have already dev container ?

We do; however, codex doesn't support using non-standard docker image at this point, it only allows using some script.

@lklimek lklimek merged commit 167e589 into v2.2-dev Nov 4, 2025
21 checks passed
@lklimek lklimek deleted the feat/codex-environment branch November 4, 2025 12:18
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.

4 participants