Skip to content

fix: run Claude Code native installer as vscode user - #428

Merged
keito4 merged 1 commit into
mainfrom
fix/claude-code-native-installer-user
Feb 2, 2026
Merged

fix: run Claude Code native installer as vscode user#428
keito4 merged 1 commit into
mainfrom
fix/claude-code-native-installer-user

Conversation

@keito4

@keito4 keito4 commented Feb 2, 2026

Copy link
Copy Markdown
Owner

Summary

  • Claude Codeのネイティブインストーラーをvscodeユーザーとして実行するように修正
  • rootユーザーでインストールすると/root/.claude/local/binにインストールされ、vscodeユーザーからアクセスできない問題を解決

Test plan

  • DevContainerイメージをビルドしてclaudeコマンドが動作することを確認
  • /home/vscode/.claude/local/bin/claudeにインストールされていることを確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Improved development environment setup to ensure consistent configuration for contributors.

rootユーザーとしてインストールすると/root/.claude/local/binに
インストールされてしまい、vscodeユーザーからアクセスできない問題を修正

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Feb 2, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The .devcontainer/Dockerfile is modified to install Claude Code as the vscode user instead of as root. The installer now executes within the vscode user context, with PATH updates added to /home/vscode/.bashrc to ensure proper binary placement in /home/vscode/.claude/local/bin.

Changes

Cohort / File(s) Summary
Claude Installation User Context
.devcontainer/Dockerfile
Switch to vscode user before running Claude installer, update PATH in user bashrc, and restore root context. Ensures Claude binaries install to user-scoped directory rather than root.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • keito4/config#427: Modifies Claude Code installation and PATH handling in the same Dockerfile with similar user context changes.
  • keito4/config#328: Updates Dockerfile to ensure Claude installer runs as the vscode user so plugins are placed in user home directory.
  • keito4/config#174: Alters Claude installer user-context and installation steps within the DevContainer setup.

Suggested labels

size/XS

Poem

🐰 A rabbit hops with glee,
User context, now it's clear—
Claude installs where it should be,
Home sweet home, not root, my dear! 🎩✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: running the Claude Code native installer as the vscode user instead of root, which directly addresses the accessibility issue described in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/claude-code-native-installer-user

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.

@keito4

keito4 commented Feb 2, 2026

Copy link
Copy Markdown
Owner Author

🔍 AI Code Review (Local Hook)

Models: Codex (gpt-5.2-codex) / Gemini (gemini-2.5-pro)

🤖 Codex Review

指摘事項はありません。

全体判定: patch is correct
理由: 変更はClaude Codeのインストールをvscodeユーザーで実行するためのユーザー切替のみで、挙動改善に留まり既存フローへの悪影響が見当たりません。
信頼度: 0.62

✨ Gemini Review

この変更には、指摘すべき重要な問題は見つかりませんでした。

判定: patch is correct
理由: この変更は、claude CLIがrootユーザーではなくvscodeユーザーとして正しくインストールされるように修正するものです。これにより、ツールが意図されたユーザーのホームディレクトリ (/home/vscode) にインストールされ、PATHが適切に設定されるようになります。コメントに記載された変更理由とコードの変更内容が一致しており、コンテナの構成を改善する妥当な修正です。
信頼度スコア: 1.0


🤖 Generated by post_pr_ai_review.py hook

@claude

claude Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

コードレビュー

概要

Claude Codeのインストールをvscodeユーザーで実行するように修正した変更を確認しました。この修正は適切で、問題を正しく解決しています。

良い点

  1. 問題の特定と解決が適切 - rootユーザーでインストールすると/root/.claude/local/binにインストールされる問題を正しく特定し、vscodeユーザーに切り替えることで/home/vscode/.claude/local/binへの正しいインストールを実現

  2. 最小限の変更 - 必要最小限の3行の追加で問題を解決。既存の構造を維持し、USER切り替えのパターンを適切に踏襲

  3. コメントによる明確な説明 - Dockerfile:69行目でなぜvscodeユーザーで実行する必要があるのかコメントで説明

  4. 一貫性のある実装 - Dockerfile:48-62, 86-89行目の他の類似箇所でも同じパターンを使用

確認事項

1. PATHの整合性 ✅

  • $HOMEを使用しているため、vscodeユーザーで正しく展開される
  • 既存のPATH設定パターンと一貫性がある

2. 権限の確認 ✅

  • 後続の処理で.claudeディレクトリの所有者を適切に設定
  • インストール時にvscodeユーザーで実行するため、追加の権限設定は不要

3. エラーハンドリング ⚠️

現在のインストールコマンドは失敗時に即座にビルドが中断されます。

推奨事項(オプション): 他のインストール処理(Dockerfile:126-129, 138-143)と同様に、フォールバック処理を追加することを検討してください。

セキュリティ

  • ✅ 特権昇格の問題なし(必要最小限の権限で実行)
  • ✅ 外部スクリプトの実行時に適切なフラグ(-fsSL)を使用
  • ✅ ユーザー分離が適切に維持されている

結論

承認推奨(Approve)

この変更は問題を正確に特定し適切に解決しています。コードベースの既存パターンに従っており、セキュリティ上の問題もありません。テストが完了し、CIが緑になれば安全にマージ可能です。

マイナーな改善提案: エラーハンドリングの追加は任意ですが、他のインストール処理との一貫性のため検討する価値があります。


Review generated with Claude Code following CLAUDE.md guidelines

@keito4
keito4 merged commit 5e83962 into main Feb 2, 2026
7 checks passed
@github-actions

github-actions Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.63.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Feb 2, 2026
@keito4
keito4 deleted the fix/claude-code-native-installer-user branch March 1, 2026 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant