Skip to content

feat: session permission modes with worktree-scoped defaults - #124909

Merged
steipete merged 37 commits into
mainfrom
steipete/session-permission-modes
Aug 17, 2026
Merged

steipete merged 37 commits into
mainfrom
steipete/session-permission-modes

Conversation

@steipete

@steipete steipete commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

OpenClaw's agent permission posture is config-only and process-global: Codex sessions run whatever plugins.entries.codex.config.appServer.* says (commonly YOLO/danger-full-access), the native harness's fs/exec policy is agent-global, and none of it is visible or switchable per session. Operators cannot see what an agent may touch, cannot scope a session to its worktree, and cannot change posture mid-session.

Why This Change Was Made

This PR introduces one session-scoped, harness-agnostic permission mode with four values — read-only, guarded, workspace, full — where the differentiating axis is who reviews escalations: a human (guarded), an LLM reviewer (workspace), or nobody (full). A canonical session root (worktree path → contained cwd → agent workspace, realpath-canonicalized) is recorded at sessions.create and interpreted by the mode.

  • Core: permissionMode on sessions.create/patch/row + event projection (additive, closed literal union; no SQLite DDL — entry_json only). SessionEntry.permissionMode/sessionRoot recorded at creation, preserved across reset, sourced from the entry at the run owner (attempt-execution), never from caller opts. full requires operator.admin on create and patch. Worktree sessions default to workspace (deliberate bounded default; called out below).
  • Native harness: prepared {root, mode} policy; fs tools split resolution-cwd from containment-root (nested worktree cwds work), read-only removes mutating tools, exec maps to deny/ask/auto/full with existing allowlist fast-path, LLM auto-review, human fallback, and approvals-file floors.
  • Codex plugin: the stored-binding permissions overlay generalizes to the full tuple (sandbox/approvalPolicy/approvalsReviewer/cwd) from the session mode, atomically clamped against requirements TOML; workspace uses auto_review (guardian subagent) with the existing model-trust downgrade; session modes outrank explicitly configured global exec posture (supervision lock preserved); tuple applies before hook-promotion and trust resolution; thread/resume now carries cwd. /codex permissions persists the canonical session fact.
  • UI: permission picker in the composer footer (model-picker idiom: keyboard 1–4, ARIA, admin-locked full, session root pinned in the menu footer), live sessions.patch + sessions.changed round-trip, and guardian transcript notices (muted for approvals, danger-toned for denials/warnings) consuming the existing codex_app_server.guardian stream.

Unset mode = exactly today's behavior; no shipped session changes posture.

User Impact

Sessions show their permission mode in the composer and can switch it mid-session (next turn applies it — Codex re-sends policy per turn). Worktree sessions are contained by default: file tools and the Codex seatbelt sandbox are rooted at the worktree, benign work inside flows freely, escalations get judged by the guardian (workspace), a human (guarded), or blocked (read-only).

Mode Sandbox/root Escalations reviewed by
read-only reads only, rooted —
guarded rooted writes human
workspace (worktree default) rooted writes LLM guardian (auto_review)
full (admin-only) unrestricted nobody

Screenshots (live gateway):

Composer chip at rest · mode menu with root footer · switched to Guarded:

chip
menu
guarded

Evidence

Live-proven on an isolated dev gateway (own OPENCLAW_STATE_DIR, port 19811, dist build), both harnesses with real model turns:

  • sessions.create {worktree:true} records permissionMode:"workspace" + canonical worktree sessionRoot.
  • Native harness (sonnet-5): in-root write tool succeeds; outside-root write denied (Path escapes sandbox root …, actionable next-step copy, no file created); exec in workspace mode forces the allowlist/on-miss lane despite global tools.exec.mode=full; interactive exec approval card → Allow once → command ran (EXEC_RAN Darwin); reviewer model invocation verified via pinned-tracer model fetch.
  • Codex harness (gpt-5.6-sol via app-server): in-root native write succeeds; outside write (outside root and tmp — upstream workspace-write intentionally keeps /tmp/TMPDIR writable) denied by seatbelt (Sandbox blocked the write: operation not permitted); explicit escalation request → guardian auto_review approved a benign outside write (GUARDIAN_ALLOWED, file verified then removed).
  • Mid-session switch: menu shortcut → sessions.patch (server row shows guarded) → chip live-updates via sessions.changed.
  • Live testing caught and fixed two bugs unit suites missed: public agent ingress dropped the facts (fixed entry-sourced at the owner, net −9 prod, boundary regression test that failed pre-fix), and explicitly configured global exec posture locked out the session tuple (fixed: supervision-only lock, tuple→promotion→trust ordering, mode-mapped dynamic exec; regression tests failed pre-fix 4/9).

Focused suites (all green): gateway/protocol/runtime 283; native tools/attempts 146; codex policy/conversation/guardian 77+24; UI unit 190; mocked-gateway e2e 11; boundary regressions failed pre-fix for the intended reasons. pnpm ui:i18n:baseline clean; tsgo:extensions lane green; multiple clean Codex autoreviews per commit plus a final full-branch autoreview.

Production LOC (honest ledger vs origin/main): +1276/−157 (net +1119) — UI picker/notices ~+520, codex tuple mapping ~+330, core facts/enforcement ~+270; tests +1022/−41; docs +36. Named follow-ups that recoup surface: retire global appServer.mode/approvalPolicy/sandbox/approvalsReviewer config via doctor migration; remove session-level execSecurity/execAsk patch fields; native auto-review transcript notices; New Session dialog mode select; requirements clamp for the legacy global path.

Config-surface note (ClawSweeper): adds one session field (permissionMode) to create/patch/row; no new config keys or env vars; legacy config paths unchanged when mode is unset.

Main fallout CI repairs

Current main concurrently landed the canonical provider-provisioning split before the first exact-head watch completed. The initial fallout head d00bbf633ff carried a pure replay/recovery move and proved the original 45 tests remained 45/45, but that split became duplicate and was the PR's only merge conflict. Follow-up bfd155bc26 removes the duplicate branch delta so the synthetic merge now uses main's canonical focused files: provider-provisioning.test.ts (607 lines), provider-provisioning-node-admission.test.ts (105), provider-provisioning-node.test.ts (105), and provider-provisioning.replay.test.ts (398). All are below the 1,000-line cap; there is no suppression or baseline change.

The untouched Synology loopback deadline test had a real isolation race rather than an external transport flake. Its module-global user-list cache is keyed by the full user_list URL, while consecutive loopback tests rely on OS-assigned ephemeral ports. Port reuse could therefore return the prior test's cached user before the dripping test contacted its server, producing undefined instead of user id 21. The dripping test now adds a UUID token to its URL, preserving the same timeout and stale-cache assertions without sleeps or weakened semantics.

Proof: provider suite 45/45 before and after the initial pure split; Synology loopback 9/9; targeted oxlint clean; formatting, core/extension test typechecks, max-lines ratchet, lint, and the complete changed gate green. Two scoped Codex autoreviews reported no accepted/actionable findings.

@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 16, 2026 23:31
@steipete
steipete requested a review from a team as a code owner August 16, 2026 23:31
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling extensions: codex size: XL maintainer Maintainer-authored PR labels Aug 16, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 7:02 AM ET / 11:02 UTC.

ClawSweeper review

What this changes

Adds session-scoped permission modes and worktree-root enforcement across Gateway sessions, native and Codex harnesses, and the Control UI.

Merge readiness

⚠️ Needs maintainer review before merge - 4 items remain

Keep open for maintainer review. The local checkout is behind the supplied base and cannot access the PR head or required sibling Codex source, so an exact-head merge verdict would not be evidence-backed.

Priority: P1
Reviewed head: 99dd13493ce50667187c9f8ed1b5a79187971317
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The PR has substantial live-proof and test claims, but exact-head and direct-Codex contract review remain unavailable here.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The PR body provides after-fix isolated Gateway evidence for both harnesses and screenshots of the Control UI; the inability to fetch media here does not make that contributor proof deficient.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR body provides after-fix isolated Gateway evidence for both harnesses and screenshots of the Control UI; the inability to fetch media here does not make that contributor proof deficient.
Evidence reviewed 4 items Checkout cannot resolve the PR head: The review checkout is on local main and is behind origin; the supplied PR head and base commits are promisor objects that could not be fetched because DNS resolution for github.com failed.
Codex protocol surface exists on local main: Generated protocol metadata describes runtimeWorkspaceRoots as thread-scoped roots, but this is not a substitute for the required direct sibling Codex runtime inspection.
Current affected owner history: The current thread request builder and session-row owner paths were recently authored by Peter Steinberger, indicating shared ownership of the surrounding Codex and session surfaces.
Findings None None.
Security Needs attention Verify Codex root enforcement at the exact head: This change sends runtime workspace roots into the Codex app-server and relies on them for a filesystem boundary; direct inspection of the required sibling Codex runtime and the exact PR head is unavailable.

How this fits together

Gateway stores a session’s mode and root, then passes those facts into native tools and the Codex app-server policy. The Control UI displays and updates the session setting for authorized operators.

flowchart LR
  UI[Control UI] --> Gateway[Gateway session API]
  Gateway --> Stored[Stored mode and session root]
  Stored --> Native[Native harness policy]
  Stored --> Codex[Codex app-server policy]
  Native --> Tools[File and command tools]
  Codex --> Sandbox[Codex sandbox and approvals]
  Gateway --> UIState[Session change events]
  UIState --> UI
Loading

Decision needed

Question Recommendation
Can the exact head be verified against the pinned sibling Codex runtime before this security-boundary feature merges? Run exact-head contract review: Review the PR head with the pinned Codex source available, including start, resume, turn, and sandbox enforcement behavior.

Why: Repository policy requires direct inspection of the sibling Codex implementation for this protocol-dependent change, but that checkout and the PR objects are unavailable here.

Before merge

  • Resolve security concern: Verify Codex root enforcement at the exact head - This change sends runtime workspace roots into the Codex app-server and relies on them for a filesystem boundary; direct inspection of the required sibling Codex runtime and the exact PR head is unavailable.
  • Resolve merge risk (P1) - The reviewed checkout cannot load the exact PR head/base, and the required sibling Codex source is absent; the filesystem and approval boundary cannot be independently verified before merge.
  • Complete next step (P2) - A maintainer must complete exact-head and direct-Codex contract verification; this is not a safe automated repair task.

Findings

  • [medium] Verify Codex root enforcement at the exact head — extensions/codex/src/app-server/thread-requests.ts:186
Agent review details

Security

Needs attention: No concrete vulnerability was established, but the required upstream Codex boundary review cannot be completed in this environment.

Review metrics

Metric Value Why it matters
Persisted session surface 1 added session field and 1 new worktree default permissionMode changes persisted session behavior and defaults new managed worktrees to workspace mode.
Production versus test delta production +1,119 net; tests +981 net; docs +36 (author-reported) The feature spans Gateway, two harnesses, and the UI, so its stated production growth needs exact-head review.

Stored data model

Persistent data-model change detected: durable storage schema: src/worker/embedded-agent.runtime.ts, serialized state: extensions/codex/src/app-server/session-permission-policy.test.ts, serialized state: extensions/codex/src/app-server/session-permission-policy.ts, serialized state: packages/gateway-protocol/src/schema/sessions-create.ts, serialized state: packages/gateway-protocol/src/schema/sessions-patch.ts, serialized state: packages/gateway-protocol/src/schema/sessions-row.ts, and 12 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the exact Codex contract before merge (recommended)
    Confirm the pinned Codex runtime accepts and enforces the roots on every lifecycle request at the exact PR head.

Technical review

Best possible solution:

Have a maintainer with the exact PR head and sibling Codex checkout verify the runtimeWorkspaceRoots enforcement contract and rerun the exact-head security review before merging.

Do we have a high-confidence way to reproduce the issue?

Not applicable as a bug reproduction: the PR body describes live after-fix exercises, but this reviewer could not access the exact head to independently rerun them.

Is this the best way to solve the issue?

Unclear: the session-owned policy design is coherent, but the exact Codex enforcement contract and final branch state could not be independently inspected.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against bbe22082b0d3.

Labels

Label justifications:

  • P1: The PR changes filesystem and command permission behavior for active worktree sessions.
  • merge-risk: 🚨 compatibility: Existing session and global policy behavior must remain unchanged when permissionMode is unset.
  • merge-risk: 🚨 session-state: The feature persists and projects a session mode and root through Gateway session state.
  • merge-risk: 🚨 security-boundary: The change controls sandbox roots, write access, command escalation, and full-access authorization.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): The PR body provides after-fix isolated Gateway evidence for both harnesses and screenshots of the Control UI; the inability to fetch media here does not make that contributor proof deficient.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides after-fix isolated Gateway evidence for both harnesses and screenshots of the Control UI; the inability to fetch media here does not make that contributor proof deficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body provides after-fix isolated Gateway evidence for both harnesses and screenshots of the Control UI; the inability to fetch media here does not make that contributor proof deficient.

Evidence

Security concerns:

  • [medium] Verify Codex root enforcement at the exact head — extensions/codex/src/app-server/thread-requests.ts:186
    This change sends runtime workspace roots into the Codex app-server and relies on them for a filesystem boundary; direct inspection of the required sibling Codex runtime and the exact PR head is unavailable.
    Confidence: 0.96

What I checked:

  • Checkout cannot resolve the PR head: The review checkout is on local main and is behind origin; the supplied PR head and base commits are promisor objects that could not be fetched because DNS resolution for github.com failed. (6d04fe5305c0)
  • Codex protocol surface exists on local main: Generated protocol metadata describes runtimeWorkspaceRoots as thread-scoped roots, but this is not a substitute for the required direct sibling Codex runtime inspection. (extensions/codex/src/app-server/protocol-generated/json/v2/ThreadStartResponse.json:63, 6d04fe5305c0)
  • Current affected owner history: The current thread request builder and session-row owner paths were recently authored by Peter Steinberger, indicating shared ownership of the surrounding Codex and session surfaces. (extensions/codex/src/app-server/thread-requests.ts:183, 23ea04a375c1)
  • Contributor proof and product decision: The PR body records isolated live Gateway runs for both harnesses and screenshots, while the discussion records an explicit maintainer decision for the managed-worktree workspace default. (99dd13493ce5)

Likely related people:

  • steipete: Peter Steinberger authored the recent current-main commits touching the surrounding Codex request and session-row paths, and the PR discussion records the product decision. (role: recent session and Codex area contributor; confidence: medium; commits: 23ea04a375c1, 55ce95fac803; files: extensions/codex/src/app-server/thread-requests.ts, src/gateway/session-utils-row.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Run the exact-head review with the sibling Codex source available.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (18 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-17T05:20:36.193Z sha 4a60b6a :: found issues before merge. :: [P1] Propagate the mode to cloud-worker policy | [P1] Clear worktree-derived policy when detaching | [P2] Generate a native permission-mode enum
  • reviewed 2026-08-17T06:14:27.969Z sha 6e68bb5216179540483ad45a368414ba76d45284 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T06:41:30.633Z sha 5299319060a81f4efb897bc14a3f4a233611695c :: found issues before merge. :: [P2] Restore Default mode from the permission picker
  • reviewed 2026-08-17T07:13:53.441Z sha 6bb310fb5e9b34f746c8cd49de10583d082cbae3 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T07:52:39.519Z sha f1c3de1 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T08:12:29.558Z sha 2ff5a02 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T09:47:21.705Z sha 49d53aa :: needs maintainer review before merge. :: none
  • reviewed 2026-08-17T10:15:31.545Z sha b7555d4 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/session-permission-modes branch from 3cec523 to 687f6f5 Compare August 17, 2026 01:58
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Review findings addressed on 838681cf8e5:

[P1] Require operator.admin before persisting full mode — FIXED. /codex permissions yolo now requires the authenticated operator.admin scope on the command context (gatewayClientScopes, the same fact the sessions.create/sessions.patch gates check); channel owners without it get an actionable rejection naming the admin-gated paths. default stays owner-allowed. Regression tests cover owner-without-admin (no persistence + rejection), admin-scoped persistence, and default — the owner-without-admin case failed pre-fix (extensions/codex/src/commands.test.ts:6048).

[P2] Verify the Codex workspace-root request field — refuted with direct upstream source + live proof. The pinned rust-v0.147.0 accepts runtime_workspace_roots on all three requests: codex-rs/app-server-protocol/src/protocol/v2/thread.rs:80 (thread/start, experimental thread/start.runtimeWorkspaceRoots), the ThreadResumeParams block at thread.rs:325ff (experimental thread/resume.runtimeWorkspaceRoots), and turn.rs:105 (turn/start). The 0.147 app-server gates experimental request fields on experimental_api_enabled (codex-rs/app-server/src/message_processor.rs:160,820-822) and our client initializes with experimentalApi: true (extensions/codex/src/app-server/client.ts:293). Live proof on a real 0.147 app-server (isolated dev gateway, gpt-5.6-sol): thread start/resume/turns carrying these exact fields were accepted, the seatbelt enforced the root (in-root write ok, outside write Sandbox blocked the write: operation not permitted), and a guardian auto_review escalation round-trip completed.

The security concern and both P1 merge risks are resolved by the fix above; the runtimeWorkspaceRoots merge risk is resolved by the contract evidence above.

@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 17, 2026
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels Aug 17, 2026
@steipete

Copy link
Copy Markdown
Contributor Author
  • Visibility concern fixed on 99dd13493ce: sessionRoot now projects only for sessions with an explicit permissionMode; ordinary sessions expose no new path data; covered by projection regression tests.
  • runtimeWorkspaceRoots disposition: maintainer-side direct inspection of pinned rust-v0.147.0 (thread.rs:59ff/325ff, turn.rs:71ff, message_processor.rs:160,820-822, shared.rs:170, permissions.rs:529) + our client's experimentalApi opt-in (client.ts:293) + live seatbelt denial proof; the reviewer environment lacks the sibling checkout, so this recurs mechanically and is dispositioned by the lead.

@steipete
steipete merged commit 4b0d573 into main Aug 17, 2026
224 checks passed
@steipete
steipete deleted the steipete/session-permission-modes branch August 17, 2026 11:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
…w#124909)

* feat(gateway): add session permission modes

* feat(agents): enforce session permission policies

* test: cover session permission modes

* docs: explain session permission modes

* fix(agents): preserve apply patch default root

* feat(codex): map session permission modes

* feat(ui): add session permission controls

* test: cover session permission surfaces

* fix(agents): enforce session permissions from entry

* fix(codex): pass params object to requirements reader

* fix(codex): honor session permission modes

* fix(codex): preserve exec approval floors

* chore: revert changelog edit (release-owned)

* test: align full-mode promotion with upstream semantics

* chore(protocol): regenerate session permission models

* docs: register session permission modes

* fix(ui): use shared permission dropdown

* fix(sessions): restore permission mode contracts

* fix(ci): record session permission startup JS growth in the budget baseline

* refactor(agents): prepare session exec mode at dispatch

Host dispatch owns permissionMode→exec override preparation; the codex
plugin consumes prepared facts and the SDK barrel export is removed,
keeping the plugin-sdk surface at its recorded budget.

* test: type exec mode fixtures as ExecMode

* fix(codex): require admin scope for yolo permissions

* test: isolate codex permission command state

* ci: refresh PR checks against current main

* ci: refresh checks after gateway test repair

* test: fix main-fallout CI suites

* chore: refresh CI merge ref

* fix(worker): fence permission-mode cloud placements

* fix(sessions): clear worktree policy on detach

* chore(protocol): generate session permission mode enum

* test(gateway): type dispatch fixtures from session entries

* fix(ui): allow clearing session permission mode

* chore: refresh CI merge ref

* fix(ci): record permission picker startup growth in the budget baseline

* fix(gateway): gate session root projections
Chinmayrawat15 added a commit to Chinmayrawat15/openclaw that referenced this pull request Aug 18, 2026
`sessions.create` now lstats the requested cwd and rejects one that is
absent (openclaw#124909, "session permission modes with worktree-scoped
defaults"), so the two cwdOnCreateOnly tests failed on the rebase with
`cwd is unavailable: ENOENT` -- they passed fabricated /tmp paths.

Switched to `tempDirs.make()`, the auto-cleanup helper the rest of this
file already uses for real cwd cases. Also merged a duplicate import of
`translator.test-helpers.js` that the rebase surfaced.

No production change; the assertions are the same, against paths that
exist.
steipete added a commit that referenced this pull request Aug 26, 2026
…e default root

Session permission modes hard-required a recorded sessionRoot, which only the
sessions.create RPC ever records. Channel sessions, pre-#124909 rows, and
exec-node sessions are rootless, so runs failed closed with 'session permission
mode requires a recorded session root' (rows poisoned before the #128149 guards
were permanently bricked) and operators could not set a mode on channel
sessions at all.

The mode semantics are root-free; every containment consumer already falls
back to the workspace, and the remote worker launcher already derives its
containment root from placement.remoteWorkspaceDir. Make that the canonical
rule: a recorded sessionRoot pins worktree/explicit-cwd boundaries, and a
rootless session's boundary is the agent's canonical workspace resolved where
the run is prepared.

- embedded runner + compaction: default policy root to realpath(workspace)
  instead of throwing/dropping the mode; bricked rows self-heal
- gateway: delete the patch/create/reset rejection guards and
  session-permission-policy.ts entirely
- codex plugin: helpers take a required defaultRoot (agent workspace fact,
  never a requested thread cwd); delete the four root throws; sandbox context
  for conversation bindings now derives from the agent workspace
- ui: drop the rootless-rejection surface from the permission picker
- docs: permission-modes boundary contract updated
steipete added a commit that referenced this pull request Aug 26, 2026
…e default root (#129994)

* fix(gateway): permission modes work on rootless sessions via workspace default root

Session permission modes hard-required a recorded sessionRoot, which only the
sessions.create RPC ever records. Channel sessions, pre-#124909 rows, and
exec-node sessions are rootless, so runs failed closed with 'session permission
mode requires a recorded session root' (rows poisoned before the #128149 guards
were permanently bricked) and operators could not set a mode on channel
sessions at all.

The mode semantics are root-free; every containment consumer already falls
back to the workspace, and the remote worker launcher already derives its
containment root from placement.remoteWorkspaceDir. Make that the canonical
rule: a recorded sessionRoot pins worktree/explicit-cwd boundaries, and a
rootless session's boundary is the agent's canonical workspace resolved where
the run is prepared.

- embedded runner + compaction: default policy root to realpath(workspace)
  instead of throwing/dropping the mode; bricked rows self-heal
- gateway: delete the patch/create/reset rejection guards and
  session-permission-policy.ts entirely
- codex plugin: helpers take a required defaultRoot (agent workspace fact,
  never a requested thread cwd); delete the four root throws; sandbox context
  for conversation bindings now derives from the agent workspace
- ui: drop the rootless-rejection surface from the permission picker
- docs: permission-modes boundary contract updated

* fix(agents): split workspace path identity out of the kysely state store

Heals main: #116650 made memory-host-sdk/dreaming.ts import
resolveWorkspaceStateIdentity from workspace-state-store, statically pulling
kysely into the memory-core doctor-contract closure and failing the
doctor-contract-closure-guard lane on origin/main. The identity helpers are
pure path/crypto code; move them to workspace-state-identity.ts and repoint
all importers (dreaming, event-store, onboarding recommendations, workspace
migrations, legacy state).

* fix(ui): drop the unused permission picker sessionRoot prop and dead i18n keys

check-prod-types caught the New Session dialog still passing the removed
sessionRoot picker prop; the prop and the permissionControls.rootLabel /
sessionRoot strings have had no consumers since #124301.

* fix(codex): resolve rootless permission boundaries from agent config, not bind cwd

ClawSweeper P1: /codex bind --cwd stores the requested path as the binding
workspaceDir, which the previous commit then trusted as defaultRoot — letting
a bound thread's requested cwd become (and widen) the rootless permission
boundary. resolveConversationAppServerRuntime now owns the fact: it resolves
the selected agent's canonical workspace from config (falling back to the
plugin's configured default workspace), and the caller-supplied
agentWorkspaceDir parameter chain is deleted so no call site can pass a
tainted value. Recovery of recorded roots is unchanged (pinned roots stay
pinned); the moved-history test now proves the bind-cwd clamp lands on the
agent workspace.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…e default root (openclaw#129994)

* fix(gateway): permission modes work on rootless sessions via workspace default root

Session permission modes hard-required a recorded sessionRoot, which only the
sessions.create RPC ever records. Channel sessions, pre-openclaw#124909 rows, and
exec-node sessions are rootless, so runs failed closed with 'session permission
mode requires a recorded session root' (rows poisoned before the openclaw#128149 guards
were permanently bricked) and operators could not set a mode on channel
sessions at all.

The mode semantics are root-free; every containment consumer already falls
back to the workspace, and the remote worker launcher already derives its
containment root from placement.remoteWorkspaceDir. Make that the canonical
rule: a recorded sessionRoot pins worktree/explicit-cwd boundaries, and a
rootless session's boundary is the agent's canonical workspace resolved where
the run is prepared.

- embedded runner + compaction: default policy root to realpath(workspace)
  instead of throwing/dropping the mode; bricked rows self-heal
- gateway: delete the patch/create/reset rejection guards and
  session-permission-policy.ts entirely
- codex plugin: helpers take a required defaultRoot (agent workspace fact,
  never a requested thread cwd); delete the four root throws; sandbox context
  for conversation bindings now derives from the agent workspace
- ui: drop the rootless-rejection surface from the permission picker
- docs: permission-modes boundary contract updated

* fix(agents): split workspace path identity out of the kysely state store

Heals main: openclaw#116650 made memory-host-sdk/dreaming.ts import
resolveWorkspaceStateIdentity from workspace-state-store, statically pulling
kysely into the memory-core doctor-contract closure and failing the
doctor-contract-closure-guard lane on origin/main. The identity helpers are
pure path/crypto code; move them to workspace-state-identity.ts and repoint
all importers (dreaming, event-store, onboarding recommendations, workspace
migrations, legacy state).

* fix(ui): drop the unused permission picker sessionRoot prop and dead i18n keys

check-prod-types caught the New Session dialog still passing the removed
sessionRoot picker prop; the prop and the permissionControls.rootLabel /
sessionRoot strings have had no consumers since openclaw#124301.

* fix(codex): resolve rootless permission boundaries from agent config, not bind cwd

ClawSweeper P1: /codex bind --cwd stores the requested path as the binding
workspaceDir, which the previous commit then trusted as defaultRoot — letting
a bound thread's requested cwd become (and widen) the rootless permission
boundary. resolveConversationAppServerRuntime now owns the fact: it resolves
the selected agent's canonical workspace from config (falling back to the
plugin's configured default workspace), and the caller-supplied
agentWorkspaceDir parameter chain is deleted so no call site can pass a
tainted value. Recovery of recorded roots is unchanged (pinned roots stay
pinned); the moved-history test now proves the bind-cwd clamp lands on the
agent workspace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: synology-chat commands Command implementations docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: codex gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant