Skip to content

Fall back to local settings when sudo is unavailable - #561

Merged
andy-xu-db merged 3 commits into
mainfrom
andy/fix-554-local-settings-fallback
Sep 11, 2026
Merged

Fall back to local settings when sudo is unavailable#561
andy-xu-db merged 3 commits into
mainfrom
andy/fix-554-local-settings-fallback

Conversation

@andy-xu-db

@andy-xu-db andy-xu-db commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • treat failed privileged managed-settings writes as recoverable
  • continue with the already-written local Claude Code or Codex settings when no OS-managed value conflicts
  • preserve the existing launch blocker when an OS-managed value would override local settings
  • add regression coverage for compatible and conflicting settings

Fixes #554

Testing

  • uv run ruff check .
  • uv run pytest tests/test_managed_files.py tests/test_agent_claude.py tests/test_agent_codex.py -q (218 passed)
  • uv run pytest -q (2205 passed, 42 skipped, 2 environment-dependent installed-client integration failures)

The two full-suite failures are TestClaudeUserAgent::test_user_agent_arrives_at_gateway and TestCodexUserAgent::test_user_agent_arrives_at_gateway; both reproduce on an untouched main checkout with the locally installed agent versions.

Docker test without sudo access

Tested both versions in the same container as a non-root ugtest user that was not present in sudoers:

  • This PR: the Claude path reported the sudo denial, fell back to ~/.claude/ucode-settings.json, left /etc/claude-code/managed-settings.json absent, and succeeded.
  • This PR: the Codex path behaved equivalently, using its local settings file and succeeding.
  • Unchanged origin/main: the Claude configuration path exited with status 1 and RuntimeError: Claude Code cannot start because ucode could not update /etc/claude-code/managed-settings.json.

These Docker checks directly exercised the configuration-writing paths under identical no-sudo conditions. They did not perform a fully authenticated end-to-end agent launch, which requires Databricks workspace credentials and installed Claude/Codex clients.

@andy-xu-db
andy-xu-db enabled auto-merge (squash) September 11, 2026 20:37
@andy-xu-db
andy-xu-db merged commit b1ff483 into main Sep 11, 2026
2 checks passed
@andy-xu-db
andy-xu-db deleted the andy/fix-554-local-settings-fallback branch September 11, 2026 20:44
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.

ug/ucode hard-fails on macOS when the user lacks admin rights (cannot write /Library/Application Support/ClaudeCode/managed-settings.json)

2 participants