#14100: fix(linux): add gio and trash-put fallbacks for moveToTrash
commands
Cluster:
Cross-Platform Fixes
#### Summary
On minimal Linux installs, `trash-cli` is often not installed, causing `moveToTrash()` to silently fail. This leaves files in place with only a log message during `openclaw reset` and agent deletion.
Fixes #14081
#### Root Cause
Both trash implementations only try the `trash` command. If it fails:
- `onboard-helpers.ts:moveToTrash` — logs failure and continues (files left in place)
- `browser/trash.ts:movePathToTrash` — falls back to `~/.Trash` rename (better, but still only tries `trash`)
However, `gio trash` (from GLib, available on most desktop Linux) and `trash-put` (alternative trash-cli name) are commonly available alternatives.
#### Changes
**`src/commands/onboard-helpers.ts`**
- `moveToTrash()` now tries three commands in order: `trash` → `gio trash` → `trash-put`
- Returns on first success; only logs failure if all three fail
**`src/browser/trash.ts`**
- `movePathToTrash()` now tries the same three commands before falling back to `~/.Trash` rename
#### Tests
5 new tests in `onboard-helpers.test.ts`:
```
✓ src/commands/onboard-helpers.test.ts (14 tests) 10ms
```
- First command succeeds
- Fallback to `gio trash`
- Fallback to `trash-put`
- All commands fail → logs failure
- Skips non-existent paths
lobster-biscuit
**Sign-Off**
- Models used: Claude Opus 4
- Submitter effort: AI-assisted, verified both trash code paths
- Agent notes: Simple but impactful — fixes silent failures on minimal Linux installs
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Added fallback support for `gio trash` and `trash-put` commands when `trash` is unavailable on minimal Linux installations.
- Both `moveToTrash()` and `movePathToTrash()` now try three commands sequentially: `trash` → `gio trash` → `trash-put`
- Prevents silent failures during `openclaw reset` and agent deletion when trash-cli is not installed
- Comprehensive test coverage with 5 new tests covering all fallback scenarios
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The changes are well-implemented with proper fallback logic, comprehensive test coverage (5 new tests covering all code paths), and follow existing code patterns. The implementation is defensive, maintains backward compatibility, and solves a real issue on minimal Linux installations without introducing side effects
- No files require special attention
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11602: fix(config): skip stale legacy config files when openclaw.json exists
by akoscz · 2026-02-08
75.4%
#10367: CLI/Ops: resilient browser fill + failover hardening + operations t...
by cluster2600 · 2026-02-06
73.7%
#15852: fix: pass agentId when resolving IRC session paths
by MisterGuy420 · 2026-02-14
72.5%
#7085: test: skip flaky workspace-paths & safe-bins tests on non-Linux/CI ...
by ThinkIbrokeIt · 2026-02-02
72.0%
#15619: fix: clean up orphan LaunchAgent plist on bootstrap failure
by superlowburn · 2026-02-13
72.0%
#15306: fix: explicit exit after onboarding command completes
by jeroenbaas · 2026-02-13
71.5%
#13881: fix: Address Greptile feedback - test isolation and channel resolution
by trevorgordon981 · 2026-02-11
71.4%
#12308: fix(cli): redirect log output to stderr during completion script ge...
by mcaxtr · 2026-02-09
71.1%
#6577: fix: add null checks for stdout/stderr when using inherit-stdio fal...
by ncmalan · 2026-02-01
70.9%
#3561: fix: fail fast when both state dirs exist
by adityarao3 · 2026-01-28
70.8%