feat(gateway): read-only agents.workspace list/get browsing RPCs#100738
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9029e911ef
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs real behavior proof before merge. Reviewed July 6, 2026, 5:14 AM ET / 09:14 UTC. Summary PR surface: Source +450, Tests +346, Docs +1, Other +172. Total +969 across 13 files. Reproducibility: not applicable. as a bug reproduction: this is a feature PR. The security issue is source-reproducible from the new Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Land the read-only workspace API only after file-content reads are gated above ordinary Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this is a feature PR. The security issue is source-reproducible from the new Is this the best way to solve the issue? No. The shared fs-safe extraction and read-only split are plausible, but Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3dc00f46704d. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +450, Tests +346, Docs +1, Other +172. Total +969 across 13 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
fa54358 to
1a4711b
Compare
1a4711b to
ab567c9
Compare
|
Land-ready review complete on the exact PR head.
Known proof gap: the source-blind CLI probe was blocked before Gateway startup by a stale Testbox dependency state and a frozen-lockfile override mismatch. Focused behavior tests, the full changed gate, security workflows, and exact-head hosted CI cover the landed surface. |
|
Merged via squash.
|
…nclaw#100738) * feat(gateway): add read-only agents.workspace list/get browsing RPCs * fix(gateway): gate workspace image reads on sniffed magic bytes, not extension * fix(gateway): tighten workspace browsing boundary * docs(gateway): clarify workspace read trust scope * chore(gateway): leave release notes to release flow
…nclaw#100738) * feat(gateway): add read-only agents.workspace list/get browsing RPCs * fix(gateway): gate workspace image reads on sniffed magic bytes, not extension * fix(gateway): tighten workspace browsing boundary * docs(gateway): clarify workspace read trust scope * chore(gateway): leave release notes to release flow
Related: #100705
What Problem This Solves
Operator clients have no way to browse an agent's workspace or preview arbitrary files in it. The existing
agents.files.*API is deliberately limited to allowlisted bootstrap files, andsessions.files.*can list the workspace tree but only returns content for transcript-touched text files, keyed by session rather than agent. The mobile file browser (#100705) needs one canonical, agent-scoped, read-only surface.Why This Change Was Made
Adds a read-only RPC pair,
agents.workspace.listandagents.workspace.get(bothoperator.read), instead of per-client ad hoc paths. Listing is paginated (offset/limit, capped at 500 per page, deterministic directories-first ordering) and reads are bounded: 256 KiB for UTF-8 text, 5 MiB for images returned as base64. Content gating is enforced server-side — text must decode as UTF-8 with no NUL bytes, and image payloads are verified by magic-byte sniffing (@openclaw/media-coredetectMime, buffer-only, no filename hints), so a renamed binary cannot ride the image path. Path confinement goes through the existing fs-safe root infrastructure: realpathed root, lexical containment pre-check, symlink and hardlink escape rejection. The bounded browse helpers shared with the session file browser were extracted fromsessions-files.tsintoworkspace-fs.tsso both surfaces run on one policy;sessions.files.*behavior is unchanged. There are deliberately no write operations in this namespace — mutations stay with the allowlistedagents.files.*surface and the separately tracked workspace CRUD discussion (#61368).Method descriptors are appended at the end of the advertised block to keep existing method indices stable for older clients. Protocol schema changes are additive; Swift models regenerated.
User Impact
Gateway operators get a stable read-only API for workspace browsing; the mobile apps (stacked PRs) build their Files section on it. No behavior change for existing methods or clients.
Evidence
tbx_01kwvyh1rxs9e9jprrepjjtjff: 414 focused tests green, including 16 handler cases covering../and absolute-path rejection, symlinked file/directory escapes, hardlink rejection, invalid UTF-8, renamed-binary image bypass, both size caps, pagination determinism, and unknown-agent rejection, plus the session-browser regression suite and registry/protocol guards.tbx_01kwvzj0hc4evz1sb9fkkv0t4h: fullcheck:changedgreen across conflicts/changelog/dependency guards, core and core-testtsgo, all core lint shards, five macOS app CI Vitest shards, database/import-cycle guards, and generated checks.pnpm protocol:gen+pnpm protocol:gen:swiftoutput committed; regen on a clean box reproduces the committed bytes.Review request
This is a security-sensitive file-read surface (path confinement, read scope). Requesting an owner review from @openclaw/openclaw-secops before merge.