8000 fix: resolve `vmsan create --connect` failing with HTTP 500 by angelorc · Pull Request #32 · angelorc/vmsan · GitHub
[go: up one dir, main page]

Skip to content

fix: resolve vmsan create --connect failing with HTTP 500 - #32

Merged
angelorc merged 1 commit into
mainfrom
fix/connect-500-home-permissions
Mar 3, 2026
Merged

angelorc merged 1 commit into
mainfrom
fix/connect-500-home-permissions

Conversation

@angelorc
@angelorc angelorc commented Mar 3, 2026 •
Copy link
Copy Markdown
Owner

Summary

  • Fix /home/ubuntu ownership (root:root → 1000:1000) during rootfs injection in the jailer, preventing EACCES when the agent chdir's after setuid
  • Surface actual error messages from the shell handler instead of opaque {"error":"internal error"}
  • Handle WebSocket unexpected-response event in the shell client to show Shell connection failed (HTTP 500): ... instead of Unexpected server response: 500

Closes #31

Test plan

  • bun run typecheck — passes
  • bun run lint — passes
  • go build ./... — passes
  • go test ./... — passes
  • Tested on remote server: vmsan create --connect successfully opens a shell

Summary by CodeRabbit

  • Bug Fixes
    • Session creation failures now return detailed error messages in responses
    • Fixed directory permissions issue that prevented proper command execution
    • WebSocket connection failures now include diagnostic response details in error reporting

The rootfs ships /home/ubuntu owned by root:root (750), causing EACCES
when the agent tries to chdir after setuid to uid 1000. Fix ownership
during rootfs injection, surface actual error details in shell handler
and WebSocket client.

Closes #31
@vercel
vercel Bot commented Mar 3, 2026
Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vmsan Building Building Preview, Comment Mar 3, 2026 11:22pm

Request Review

@coderabbitai
coderabbitai Bot commented Mar 3, 2026 •
Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 249c87c and b7e48cc.

📒 Files selected for processing (3)
  • agent/shell/handler.go
  • src/lib/jailer.ts
  • src/lib/shell/client.ts

📝 Walkthrough

Walkthrough

These changes enhance error handling robustness and file system permissions across the shell infrastructure: the Go handler now sanitizes and JSON-encodes error messages in responses, the TypeScript jailer fixes ownership of the ubuntu home directory to prevent access errors, and the shell client properly handles unexpected HTTP responses during WebSocket connection setup.

Changes

Cohort / File(s) Summary
Error Handling Improvements
agent/shell/handler.go, src/lib/shell/client.ts
Added sanitized error responses with proper HTTP status codes and error detail capture. Handler returns 500 with JSON body for non-max-session errors; client captures up to 4KB of body data from unexpected HTTP responses.
Security & Permissions
src/lib/jailer.ts
Added post-injection step to fix ownership of /home/ubuntu directory using sudo chown 1000:1000 to prevent EACCES errors when the ubuntu user executes commands.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A rabbit hops through error logs,
Sanitizing secrets, fixing flogs,
Permissions mended, responses spry—
Now errors speak without a sigh! 🐇✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/connect-500-home-permissions

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.

@angelorc
angelorc merged commit 024d1ca into main Mar 3, 2026
3 checks passed
@angelorc
angelorc deleted the fix/connect-500-home-permissions branch March 3, 2026 23:29

This branch was successfully deployed

1 active deployment
Preview — b7e48cc8 Deployed Mar 3, 2026 by vercel[bot]
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.

vmsan-agent fails to run: ERROR Unexpected server response: 500

1 participant

0