Commit Graph
18 Commits
Author SHA1 Message Date
33650832e4 fix: prevent relay fs.rename from clobbering an existing destination (#2926) (#2937)
* fix: prevent relay fs.rename from clobbering an existing destination

The remote file-explorer rename path (provider.rename -> relay
fs.rename) called fs.rename unconditionally, silently overwriting any
file/folder already at the destination. The local rename already
guards via assertFileExplorerRenameDestinationAvailable; apply the
same guard on the relay to restore local/remote parity (case-only
renames on case-insensitive filesystems still allowed).

Moved the collision helper from src/main to src/shared so both the
main process and the remotely-deployed relay share one implementation.

Closes #2926

* review: make SSH safe rename explicit

- keep relay fs.rename raw and add fs.renameNoClobber for user-facing renames
- route SSH file-explorer rename paths through renameNoClobber
- add relay/provider/runtime regression coverage and stale-relay fail-closed handling
- verified live SSH rename behavior on openclaw 2

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
Co-authored-by: Orca <help@stably.ai>
2026-05-28 16:14:57 -04:00
Brennan BensonandOrca 54c2ef89da Handle force delete for orphaned worktree directories (#2757)
Co-authored-by: Orca <help@stably.ai>
2026-05-26 20:28:51 -07:00
Jinjing cfe39bcd8e fix: address review findings (#2220) 2026-05-17 22:34:09 -07:00
Jinwoo HongandOrca 29b8e36c39 Fix mobile SSH worktrees (#2198)
Co-authored-by: Orca <help@stably.ai>
2026-05-17 20:55:30 -07:00
Jinwoo HongandOrca 6c4bcf7ea6 feat(ssh): make remote workspaces first-class (#1876)
Co-authored-by: Orca <help@stably.ai>
2026-05-15 12:32:07 -07:00
Neil 2d44ee83b4 Add Space manager V2 safeguards 2026-05-14 23:30:22 -07:00
Jinwoo HongandOrca a22717bb35 Refactor runtime app architecture (#1878)
Co-authored-by: Orca <help@stably.ai>
2026-05-14 23:13:37 -07:00
Jinwoo HongandOrca a54436a2ac fix(ssh): treat symlinked directories as folders (#1717)
Co-authored-by: Orca <help@stably.ai>
2026-05-12 11:04:41 -07:00
Jinwoo HongandOrca c45712cead feat(ssh): stream fs.readFile to lift 10MB SSH preview cap (#1095) (#1676)
* feat(ssh): stream fs.readFile to lift 10MB SSH preview cap (#1095)

Replaces the single-shot fs.readFile path on the SSH relay with a
push-style stream protocol modeled on VS Code's readFileStream.

Wire shape:
- fs.readFileStream request returns metadata (streamId, totalSize,
  isBinary, mimeType, chunkEncoding, resultEncoding, optional empty)
- Relay pumps fs.streamChunk notifications (256 KB base64 chunks) and
  ends with fs.streamEnd or fs.streamError
- Client cancels via fs.cancelStream notification

Invariants:
- Max 16 concurrent streams per FsHandler (TooManyStreams)
- Client clamps totalSize against caps before allocating
- Sequence-number defense against out-of-order/missing chunks
- Subscribe-before-await with frame queueing until streamId is known
- Pump cleans up registry+handle in finally; disposeAll aborts before
  release so in-flight reads exit cleanly instead of EBADF
- Empty files short-circuit (no streamId, no handle open)

Compat:
- New client tries fs.readFileStream first, falls back to legacy
  fs.readFile on JSON-RPC -32601 (with once-per-session warn log)
- Bumps MAX_PREVIEWABLE_BINARY_SIZE 10 MB to 50 MB to match local

Tests: 91 streaming tests across relay, client, mux, integration.

Co-authored-by: Orca <help@stably.ai>

* test(ssh): wait for streamEnd instead of fixed flush() in stream test

Why: the binary-streaming test relied on 5 setImmediate ticks to drain
the pump, which is racy on slower CI runners (each handle.read is async
I/O). Swap to a deadline-bounded waitFor(streamEnd) so the test is
deterministic regardless of scheduler latency.

Co-authored-by: Orca <help@stably.ai>

* fix(ssh): preserve small binary detection in streamed reads

Co-authored-by: Orca <help@stably.ai>

* fix(ssh): rebind file watcher when connection id hydrates

Co-authored-by: Orca <help@stably.ai>

* fix(ssh): refresh explorer for update-only file creates

Co-authored-by: Orca <help@stably.ai>

* fix(ssh): recompute file watches when repo connection changes

Co-authored-by: Orca <help@stably.ai>

* Revert "fix(ssh): refresh explorer for update-only file creates"

This reverts commit 7c3c683cd0.

* fix(ssh): install relay watcher dependency

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-05-11 15:29:15 -07:00
Jinwoo HongandOrca ea9a718e29 fix(ssh): remove relay FS path allowlist to support symlinks outside workspace (#1661) (#1672)
When a remote SSH workspace contains a symlink whose target lies outside
the registered repo/worktree roots, file reads failed with 'Path outside
authorized workspace'. This silently broke common workflows: HPC dataset
mounts, multi-checkout repos, dotfile editing, and any cross-mount
symlink.

Drop `RelayContext.authorizedRoots`, `validatePath`, and
`validatePathResolved` along with all ~33 call sites in fs-handler.ts
and git-handler.ts. The relay's threat model becomes 'the relay runs as
the SSH user and trusts the renderer.'

Why this is acceptable: `pty.spawn` and `git.exec` already concede the
same threat. A renderer that wants to reach `/etc/passwd` can spawn a
shell or run `git -C /etc cat-file`; the FS allowlist was friction, not
a security boundary. Intra-worktree path checks in `getDiff` and
`discard` are intentionally preserved.

Back-compat preserved: `session.registerRoot` (notification + request)
remains a valid RPC, retained as no-ops on new relays. Old main + new
relay and new main + old relay both keep working through the upgrade
window. `registerRelayRoots` is also kept for the same reason. A
narrowed error-translation block in `worktree-remote.ts` handles old
relays still surfacing the legacy error string to users.

Tests: removed two negative-allowlist tests; added a positive control
('reads files outside any registered root') and a direct regression
test for #1661 ('reads files via symlinks resolving outside the
workspace'). All 469 relay/SSH/IPC tests pass.

See docs/relay-fs-allowlist-removal.md for the full rationale,
back-compat matrix, alternatives considered, and follow-up cleanup
plan.

Closes #1661

Co-authored-by: Orca <help@stably.ai>
2026-05-10 15:59:54 -07:00
Neil b309f49ee3 Allow large text files to open in editor (#1367) 2026-05-02 18:12:08 -07:00
JinjingandOrca 0431dd51f5 feat: improve SSH file search with configurable limits and rg fallback (#1130)
* feat: improve SSH file search with configurable limits and rg fallback

- fix: address lint issues (string template, ternary, max-lines via extraction)

Co-authored-by: Orca <help@stably.ai>

* fix: typecheck and improve rg listing correctness

Co-authored-by: Orca <help@stably.ai>

---------

Co-authored-by: Orca <help@stably.ai>
2026-04-26 13:38:34 -07:00
Jinwoo Hong 6729825bc0 feat(ssh): persist and auto-restore SSH sessions across app restarts (#1026) 2026-04-25 20:15:02 -07:00
Jinjing 50ebd11003 feat(fs): raise preview size cap for PDFs and images (#1096)
Local IPC bumps to 50MB; SSH relay bumps to 10MB (bounded by the 16MB JSON-RPC frame cap). Text and search paths keep the 5MB cap.
2026-04-25 16:45:01 -07:00
Jinwoo Hong 9e21423a6e fix(ssh): support Cmd+P file search for non-git folders without ripgrep (#1065) 2026-04-24 16:09:57 -07:00
Jinwoo Hong 68e658e082 fix(ssh): use SSH target label for home directory remote repos (#1031) 2026-04-24 13:58:48 -07:00
Jinwoo Hong c2cf9b32a1 fix(ssh): register linked worktree paths with relay on connect (#994) 2026-04-23 11:11:53 -07:00
Jinwoo Hong cc66e120eb feat: Add SSH remote support (beta) (#590) 2026-04-13 19:23:09 -07:00