Add read-only workspace file browser to Android app#100813
Conversation
|
Thanks for the review — CI should be green now. The iOS build and dead-code scan were both tripping on a SwiftFormat |
|
Thanks for the context here. I did a careful shell check against current Close: current main already implements the useful mobile read-only workspace browser through merged Gateway, Android, and iOS work, with a canonical Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the split current-main implementation from the merged Gateway, Android, and iOS PRs, and close this stale all-in-one branch instead of rebasing it into a second workspace API. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a feature PR. Source inspection shows current main now has the Gateway, Android, and iOS workspace browser paths that the branch intended to add. Is this the best way to solve the issue? Yes for cleanup closure: the current split implementation is the better solution because it landed the Gateway contract and mobile clients in focused PRs with hardened file-read handling. This branch should not be repaired into a second API shape. Security review: Security review needs attention: The stale branch changes a workspace file-read security boundary and is weaker than the current merged implementation.
AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 45d0970a7de3; fix evidence: commit 077e35f3b2a5, main fix timestamp 2026-07-06T17:47:52+01:00. |
|
ClawSweeper applied the proposed close for this PR.
|
Closes #100705
What Problem This Solves
Operators running agents remotely (containers, VPS, always-on gateways) have no way to inspect what an agent produced or changed in its workspace from the mobile apps. The existing gateway file APIs cover only allowlisted bootstrap files (
agents.files.*) or session-transcript-touched text files (sessions.files.*), so checking a generated report, a log, or an edited config from a phone requires SSH into the gateway host.Why This Change Was Made
Ships the read-only slice of the workspace browser end to end: one canonical agent-scoped gateway RPC pair —
agents.workspace.list(bounded, deterministically ordered directory listing withoffsetpagination) andagents.workspace.read(size-capped, type-gated file read: UTF-8 text ≤256 KB inline, images ≤5 MB base64, other binary rejected) — plus browse/preview/share UI on iOS (Agent tab Files section, reusing the chat code renderer andShareLink) and Android (Settings → Workspace Files, share intent via the existing FileProvider). Reads are confined to the agent workspace root by path pre-normalization (absolute paths and..rejected before any filesystem access) and the existing fs-safe root (realpath, symlink and hardlink rejection). Strictly read-only by design: write/delete/upload stay with the broader workspace API discussion (#61368 / #62417), and theagents.workspace.*namespace matches that direction so it can extend rather than conflict. Protocol schemas are additive; Swift models regenerated.User Impact
Mobile operators can now open Files on the agent surface (iOS) or Settings → Workspace Files (Android), drill through the agent's workspace, preview text with syntax highlighting and images inline, and export any previewed file through the platform share sheet — without SSH or a desktop. Both methods are
operator.readscope; nothing can modify the workspace.Evidence
test/agents-workspace.e2e.test.tsspawns a real gateway process and a real operator WebSocket client, then verifies dirs-first listing, drill-downparentPath, UTF-8 text read, byte-exact PNG base64 round-trip, and rejection of../and absolute-path escapes over the wire. Green vianode scripts/run-vitest.mjs test/agents-workspace.e2e.test.ts.src/gateway/server-methods/agents-workspace.test.ts(10 tests) covers listing/pagination, text/image reads, and negative cases: traversal, absolute paths, symlink escape, oversize files, binary gating, unknown agent id. Verified fail-before/pass-after by removing the handler module.:app:assemblePlayDebug), installed on an Android 16 ARM64 emulator, paired with a live local gateway through the app's own device/node approval flow, then exercised manually: workspace listing (directories first), live refresh picking up a file created on the host after pairing, drill-down, text preview (todo.md, 30 B · text/markdown, monospace), visible image preview (base64 → bitmap), and share-sheet export delivered to a target app.:app:testPlayDebugUnitTestgreen locally including the newWorkspaceFilesTest(5 parser/params tests).WorkspaceFileBrowserviews +WorkspaceFileBrowserTests(7 tests: params encoding, payload decoding through a stub requester, language-id mapping, UTF-8/base64 export byte fidelity) live inOpenClawKit; themacos-swiftCI job compiles them. SwiftFormat lint clean over the full iOS filelist (0/172 files require formatting).pnpm tsgo:prod(core + extensions) clean,pnpm lintshards clean,pnpm check:docsclean after regeneratingdocs/docs_map.md,pnpm native:i18n:checkclean after syncing the native i18n inventory, gateway-protocol package tests (250) and neighbor gateway suites (410 tests) green, fullnpm run buildexit 0.