Repository navigation
fix(gateway): keep rootless sessions usable after permission changes - #128149
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs real behavior proof before merge. Reviewed August 26, 2026, 12:02 AM ET / 04:02 UTC. ClawSweeper reviewWhat this changesThe PR prevents rootless sessions from persisting non-default permission modes and surfaces the Gateway validation error in the Control UI. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked until stronger real behavior proof is added - 4 items remain The source repair covers the documented patch, create, and reset persistence owners, but the current head moved after the recorded proof and this checkout cannot read the exact current-main objects. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe Control UI sends permission selections to Gateway session persistence, and later agent runs consume that stored session state. The persistence boundary must reject permission modes that require a session root when no root exists. flowchart LR
A[Operator selects permission] --> B[Control UI request]
B --> C[Gateway patch or reset]
C --> D{Session root exists?}
D -->|No| E[Visible validation error]
D -->|Yes| F[Persist session mode]
F --> G[Agent run]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +54, Tests +197. Total +251 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one shared root/mode policy at the patch projector and reset lifecycle, then establish that the current head preserves the visible Default recovery path. Do we have a high-confidence way to reproduce the issue? Yes: the patch owner can persist the tuple, while agent setup rejects a stored permission mode without a root; focused tests cover patch, create, reset, and recovery. Is this the best way to solve the issue? Yes, provisionally: shared validation at the patch projector plus reset lifecycle covers the actual persistence owners without adding public configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 937c89675b04. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
b196a4c to
03628b7
Compare
03628b7 to
69498df
Compare
b728365 to
d5d72cd
Compare
|
Addressed the reviewed P1 and rebase/security concerns at
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Exact-head CI/review receipt for
The failing paths are byte-identical to canonical base |
d5d72cd to
23c4721
Compare
Co-authored-by: 张贵萍0668001030 <[email protected]>
23c4721 to
a8b71aa
Compare
|
Merged via squash.
|
* origin/main: (24 commits) fix(gateway): reject rootless session permission modes (#128149) docs(memory): document shipped turn-taint propagation for network tool output (#129837) fix(ui): pool reply-less wake activity into one chat rollup (#128442) fix(package): prevent installs from deleting validated runtime assets (#129724) fix(nodes): approve silent initial node surfaces and name the pending surface approval (#129795) fix(backup): preserve configured agent state roots (#129773) fix(ui): own chat history issuance with a closed state machine (#129776) fix(cron): preserve cancellation reason after late finalization (#129331) fix(cron): prevent run waits from failing after clock changes (#129805) fix(telegram): route commentary through one frozen progress owner (#128259) fix(release): start approved VCR mirror recovery jobs (#129829) test: complete current-plugin-metadata-snapshot mock factories (#129791) test(telegram): remove duplicate reaction case (#129848) fix(channels): honor supported account reply-threading policies (#129679) refactor(cli): deduplicate lazy subcommand registration (#129351) fix(ai): report interrupted local-model streams instead of empty success (#129794) refactor(cli): consolidate Gateway fallback and hook ownership (#129802) fix(qa): reject token confidence lanes without executed evidence (#129830) fix(tui): fence session state and delayed actions (#129810) fix(control-ui): keep task progress full width on hover (#129832) ...
…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
…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.
Co-authored-by: fuller-stack-dev <[email protected]>
…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.
Fixes #128039
Summary
mainauthorization checks, active-run behavior, and contributor credit.What Problem This Solves
The public
sessions.patchpath could storepermissionModewithoutsessionRoot. Later agent setup rejected that tuple before model execution. A fallback model/auth error could then obscure the primary session-state failure.The reset lifecycle is a second persistence owner, so fixing only the shared patch projector was incomplete. It could also preserve or request a rootless non-default mode, and the earlier PR revision validated after active work had already been interrupted.
Canonical behavior
full,guarded, orworkspacerequests returnINVALID_REQUESTwith:permission mode requires a session root; choose Default or a rooted session.permissionMode: nullremains the recovery path for a legacy invalid row and does not require transcript deletion.Review findings resolved
requested ?? persisted), preventing a legacy rootless override from being re-committed unchanged.main; authenticated missing-session creation checks remain intact.main.Evidence
Final head:
d5d72cd276f5a16bcc461be018ef5168fd3cdbcaCanonical base:
c841a9958abc8344b37ce5c6c5a06bec4cfa6b91permissionfilter.git diff --check: passed.Blacksmith Testbox
tbx_01m0xvmycd6p161xnqgpwyyb41(stopped after proof), using official Crabbox v0.46.0:pnpm check:changed: passed all selected core, core-test, and UI lanes, including full dead-export scans, core/core-test/UI typechecks, lint, i18n, policy, database, and runtime-cycle guards.The Testbox proof ran on the identical patch tree at
4bf8e72b9265ea93755630eb4a867aa01bc6816a. Canonicalmainthen added three commits. Only restart/session-lifecycle recovery was adjacent; it did not touch the permission persistence owners. After rebasing, the full focused Gateway permission suite, including the active-admission case, passed again at final headd5d72cd276f.Source-blind runtime contract
An isolated real Gateway and the public
openclaw gateway callCLI exercised the final patch tree:Anti-cheat probes repeated the rejection with both
fullandworkspace, reopened state throughsessions.list, and verified Default performed a real write without a permission override.Original contributor evidence
The contributor's earlier exact-head browser proof remains useful visual confirmation of the same user-facing contract:
Those recordings were captured at the superseded
b728365abab7head. Current-head correctness is established by the tests, builds, lifecycle regression, and black-box Gateway/CLI state proof above.Scope
No protocol, configuration, database schema/version, migration, provider, channel, dependency, or permission-default change.