openhuman icon indicating copy to clipboard operation
openhuman copied to clipboard

Make action_dir editable in Settings UI (currently env/TOML only)

Open CodeGhost21 opened this issue 6 months ago • 0 comments

Summary

Expose Config.action_dir in the Settings UI as an editable path, so users can relocate the action sandbox without editing config.toml or restarting with OPENHUMAN_ACTION_DIR. PR #3074 introduced the field but left it configurable only via env var / TOML.

Problem

PR #3074's description implies the Action Sandbox is user-configurable, but AgentAccessPanel.tsx (and surrounding Settings panels) only display the action path — no input control, no RPC to update. The only ways to change it today:

  1. Set OPENHUMAN_ACTION_DIR=/custom/path before launching the desktop app.
  2. Edit ~/.openhuman/users/<id>/config.toml and restart.

Neither is discoverable from the UI. Users who keep their code on an external drive, want per-project sandboxes, or share a host machine cannot move the action sandbox through the supported product surface.

Related: this is also a prerequisite for the panel showing a meaningful path to the user (see #3237 — the audit follow-up that makes the panel read live values). Editability sits on top of that work.

Solution (optional)

  • Add an "Action sandbox path" row in AgentAccessPanel (app/src/components/settings/panels/AgentAccessPanel.tsx) with a text input + folder-picker (Tauri dialog::open with directory: true).
  • Add an RPC like config.set_action_dir(path) in src/openhuman/config/ that validates: directory exists or can be created, not under workspace_dir, not under forbidden_paths, agent has permission to write there.
  • On save: persist to config.toml, swap the live SecurityPolicy (the existing security::live_policy pattern), and broadcast a DomainEvent so other surfaces refresh.
  • Show validation errors inline (path collides with internal workspace, etc.).
  • Keep OPENHUMAN_ACTION_DIR as an env override that wins over the persisted value (consistent with the existing env-as-config pattern).

Acceptance criteria

  • [ ] config.set_action_dir RPC — validates path, writes config.toml, swaps live policy.
  • [ ] Settings input — AgentAccessPanel has an editable path field with folder picker.
  • [ ] Validation — rejects paths under workspace_dir, under forbidden_paths, or non-creatable; surfaces a clear error.
  • [ ] Hot apply — change takes effect in the running session without restart (new agent turns use the new path).
  • [ ] Env override precedence preserved — OPENHUMAN_ACTION_DIR still wins; UI shows it as "(overridden by env)" and disables editing.
  • [ ] Tests — Vitest component test for the input + validation feedback; Rust unit test for the RPC validating allow/deny cases; integration test that a tool run after set_action_dir writes to the new path.
  • [ ] Diff coverage ≥ 80% — the implementing PR meets the changed-lines coverage gate (Vitest + cargo-llvm-cov, enforced by .github/workflows/pr-ci.yml).

Related

  • Parent issue: #3051
  • Implementing PR: #3074
  • Depends on (or coordinates with): #3237 — live path display in AgentAccessPanel.
  • Audit: gap #6 — beyond the strict acceptance criteria of #3051 but called out in the PR description, so worth closing the loop.
  • Relevant code: app/src/components/settings/panels/AgentAccessPanel.tsx, src/openhuman/config/, src/openhuman/security/live_policy.

CodeGhost21 avatar Jun 02 '26 21:06 CodeGhost21