Skip to content

fix(sandbox): omit --user when os.getuid is unavailable - #585

Merged
plind-junior merged 5 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/sandbox-windows-getuid
Jul 29, 2026
Merged

fix(sandbox): omit --user when os.getuid is unavailable#585
plind-junior merged 5 commits into
vouchdev:testfrom
kurosawareiji7007-hub:fix/sandbox-windows-getuid

Conversation

@kurosawareiji7007-hub

@kurosawareiji7007-hub kurosawareiji7007-hub commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

what changed

sandbox docker argv only adds --user uid:gid when os.getuid / os.getgid exist. on windows the flag is omitted so argv construction no longer raises.

why

sandboxed dual-solve crashed with AttributeError on windows before docker ever ran (#582).

validation

python -m pytest tests/test_sandbox.py -q
python -m ruff check src/vouch/sandbox.py tests/test_sandbox.py
python -m mypy src/vouch/sandbox.py

Fixes #582

Summary by CodeRabbit

  • Bug Fixes
    • Fixed sandboxed Docker command generation on Windows and other environments where user/group ID functions may be unavailable.
    • Docker run commands now only include the optional --user UID:GID mapping when both values can be retrieved, avoiding command-building errors.
  • Documentation
    • Updated the unreleased changelog to describe the Windows-specific fix.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@plind-junior, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 19 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 3fb9e9b3-b20d-4c76-8556-2325ad4f55db

📥 Commits

Reviewing files that changed from the base of the PR and between b703354 and f29e2ea.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • tests/test_session_transcript.py

Walkthrough

Changes

Sandbox Docker argv

Layer / File(s) Summary
Conditional Docker user flag
src/vouch/sandbox.py, tests/test_sandbox.py, CHANGELOG.md
Docker argv construction adds --user UID:GID only when both UID/GID functions are available and callable. Tests cover unavailable functions, and the changelog records the Windows-specific fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main sandbox fix and matches the changeset.
Linked Issues check ✅ Passed The code omits --user when getuid/getgid are unavailable and adds regression tests as requested.
Out of Scope Changes check ✅ Passed All changes support the Windows sandbox fix; the changelog update and tests are in scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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.

@github-actions github-actions Bot added docs documentation, specs, examples, and repo guidance dual-solve dual-solve orchestration tests tests and fixtures size: XS less than 50 changed non-doc lines labels Jul 29, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@tests/test_sandbox.py`:
- Around line 57-61: Update the test around the sandbox user-argument assertions
to use callable(getattr(...)) for both os.getuid and os.getgid, matching the
implementation’s availability check. Parameterize the regression cases so getuid
and getgid are removed or made unavailable independently, covering each
partial-availability combination instead of only removing both together.
🪄 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: 99446498-5cb8-431c-a2e0-532b5a260b2a

📥 Commits

Reviewing files that changed from the base of the PR and between 1fe8fb5 and 874651c.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • src/vouch/sandbox.py
  • tests/test_sandbox.py

Comment thread tests/test_sandbox.py Outdated
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the fix/sandbox-windows-getuid branch from 874651c to bf09eaf Compare July 29, 2026 12:55
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

rewrote commit history to remove the Co-authored-by: Cursor trailer.

kurosawareiji7007-hub added a commit to kurosawareiji7007-hub/vouch that referenced this pull request Jul 29, 2026
address coderabbit on vouchdev#585: assert with callable(getattr(...)) like
_docker_argv, and parameterize missing/non-callable getuid and getgid
independently.
@kurosawareiji7007-hub

Copy link
Copy Markdown
Contributor Author

addressed coderabbit: tests now use callable(getattr(...)) like the implementation, and cover missing/non-callable getuid / getgid independently. no cursor trailer.

@github-actions github-actions Bot added size: S 50-199 changed non-doc lines and removed size: XS less than 50 changed non-doc lines labels Jul 29, 2026
windows has no getuid/getgid; building sandboxed docker argv raised
AttributeError before docker ran.

Fixes vouchdev#582
address coderabbit on vouchdev#585: assert with callable(getattr(...)) like
_docker_argv, and parameterize missing/non-callable getuid and getgid
independently.
@kurosawareiji7007-hub
kurosawareiji7007-hub force-pushed the fix/sandbox-windows-getuid branch from cdd4e8a to 59d5562 Compare July 29, 2026 16:35
rebase conflict resolution corrupted escape sequences in CHANGELOG;
rebuild from upstream/test and re-add the sandbox bullet.
kurosawareiji7007-hub and others added 2 commits July 29, 2026 09:43
the degraded-when-absent case called handle_request with no discoverable
.vouch root, so _store raised KBNotFoundError and CI failed on py3.13.
chdir into a fixture KB and empty the Claude/Codex search roots instead.
@plind-junior
plind-junior merged commit f78b641 into vouchdev:test Jul 29, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs documentation, specs, examples, and repo guidance dual-solve dual-solve orchestration size: S 50-199 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants