Skip to content

fix(memory): complete Phase 1C read isolation - #121945

Closed
galiniliev wants to merge 42 commits into
openclaw:mainfrom
galiniliev:memory-permissions-p1c-v2
Closed

galiniliev wants to merge 42 commits into
openclaw:mainfrom
galiniliev:memory-permissions-p1c-v2

Conversation

@galiniliev

@galiniliev galiniliev commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Memory read isolation requires a single trusted authorization boundary across selected memory plugins, automatic recall, transcript replay, operator surfaces, and model-facing tools. A partial conversion is unsafe: a legacy read, raw file path, transcript row, or worker invocation can widen access even when one read path is correctly gated.

Why This Change Was Made

This is a broad, in-progress integration draft exploring the Phase 1C read/policy boundary and adjacent enforcement work. The diff includes selected-runtime authorization, exposure and transcript-policy storage, plugin and channel paths, and tool/file controls. It also touches filesystem/tool paths associated with Phase 1D, transcript compaction/write paths associated with Phase 2B, and dreaming/backfill paths associated with Phase 2C.

It is therefore not a discrete, merge-ready Phase 1C slice. Those later-neighborhood touches do not represent completed Phase 1D, 2B, or 2C work. Likewise, checked Phase 1C boxes in this branch's copy of the implementation plan are not completion evidence; the plan requires current-head proof for every definition-of-done item.

User Impact

This draft ships nothing and changes no supported production boundary. It is available for architecture and security review only. Users and operators should continue to rely on the current documented trusted-operator model.

Stack and Review Scope

This branch currently targets main directly. It is not stacked on the Phase 0 sequence #121421 → #121422 → #121423, and its required Phase 1A/1B parents are not published as reviewable predecessors.

Use it to review the intended end-to-end ownership boundaries, not to approve a finished implementation. In particular, follow the selected-memory runtime, worker launch, transcript transaction, model tool, CLI/status, and supplemental-plugin paths together.

Evidence

  • Current draft head: b7f746a01d72142a7120f51259b9939ebd0ffa72.
  • Live diff: 234 files, +28696/-457 (net +28239), spanning docs, core, plugins, gateway, channels, UI, SDK, scripts, and tests.
  • GitHub currently shows only 2 routing/static checks successful and 10 checks skipped. It has no green exact-head changed-path, build, full integration, live-provider, or live-channel result.
  • Earlier local/remote results in prior descriptions are for different heads or unavailable remote attempts; they are not represented as current-head proof here.
  • The latest live ClawSweeper review identifies a P1 boundary defect: worker isolation is derived from the default agent instead of descriptor.assignment.agentId. GitHub also reports the branch DIRTY against main.

Remaining Gates

  • Repair the assigned-worker-agent isolation boundary and cover both cross-agent directions before any security claim.
  • Split or restack the branch into the plan's prerequisite sequence, beginning with reviewable Phase 1A and 1B parents; keep later Phase 1D/2B/2C work out of a claimed Phase 1C completion slice unless it is deliberately staged and proven.
  • Replace the unverified plan checkbox claims with evidence-backed phase status only after the relevant integrated head passes its full definition of done.
  • Obtain exact-head focused, SDK, schema/migration, changed-path, build, and relevant real-behavior proof. Codex-adapter work additionally needs direct upstream Codex contract inspection.
  • Resolve the existing dirty integration and request a fresh exact-head security review after the repair.

No full memory-permissions rollout, two-subject pilot, tenant isolation, durable-write cutover, process isolation, or live provider/channel proof is claimed.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: memory-wiki extensions: codex plugin: file-transfer extensions: active-memory size: XL maintainer Maintainer-authored PR labels Aug 11, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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. 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. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 20, 2026, 1:55 AM ET / 05:55 UTC.

ClawSweeper review

What this changes

This draft introduces identity-aware memory read isolation across selected memory tools, worker execution, persistent policy state, channels, operator commands, and the Control UI.

Merge readiness

⛔ Blocked by patch quality or review findings - 9 items remain

Keep open for human review: the prior P1 worker-isolation flaw remains at the current PR head, and this protected draft is not merge-ready. Current-main source could not be materialized from the partial checkout, so redundancy against main is not claimed.

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

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 7 items Worker assignment is the owner namespace: The launch descriptor defines assignment.agentId as the host placement namespace for worker-local policy, hooks, and audit attribution.
P1 boundary violation remains: The worker reads the isolation posture using DEFAULT_AGENT_ID instead of descriptor.assignment.agentId before replacing its state directory.
Regression test masks the two-agent case: The fixture assigns worker-agent but the isolation test persists and enables the marker for main, so neither cross-agent direction exercises the assigned worker's posture.
Findings 1 actionable finding [P1] Derive worker cutover from the assigned agent
Security Needs attention Worker isolation uses the wrong agent namespace: The worker tool surface is fenced according to the default agent instead of the descriptor’s assigned agent, so a cut-over worker can retain raw filesystem and process capability.

How this fits together

Memory reads normally flow from an agent session into a selected memory plugin and then into model tools or automatic recall. This branch adds a per-agent authorization posture intended to stop legacy memory, filesystem, transcript, and worker paths from bypassing that boundary.

flowchart LR
  A[Incoming session] --> B[Per-agent identity]
  B --> C[Memory isolation posture]
  C --> D[Authorized memory runtime]
  D --> E[Model tools and recall]
  C --> F[Worker tool surface]
  C --> G[Operator and transcript paths]
Loading

Decision needed

Question Recommendation
Should this direct-to-main integration draft be split and restacked behind the Phase 0 memory-authorization sequence before Phase 1C behavior is considered? Require staged prerequisites: Keep this draft unmerged and require repaired, independently reviewable prerequisite slices before a narrowly scoped Phase 1C PR.

Why: The branch changes the product’s trusted-operator memory model, Plugin SDK surface, persistent state, and operator controls; maintainers must choose the intended rollout and review boundary.

Before merge

  • Derive worker cutover from the assigned agent (P1) - assignment.agentId is the worker-local policy namespace, but this lookup uses DEFAULT_AGENT_ID. A cut-over worker-agent under legacy main keeps raw tools, while the inverse incorrectly suppresses a legacy worker. The test assigns worker-agent but enables main, so it masks both cases; use the assigned agent and cover both directions.
  • Resolve security concern: Worker isolation uses the wrong agent namespace - The worker tool surface is fenced according to the default agent instead of the descriptor’s assigned agent, so a cut-over worker can retain raw filesystem and process capability.
  • Resolve merge risk (P1) - A cut-over worker assigned to a non-default agent can retain raw filesystem and process tools, defeating the proposed memory boundary.
  • Resolve merge risk (P1) - The branch changes persistent identity and memory-policy surfaces plus operator controls, but lacks exact-head runtime and upgrade proof.
  • Resolve merge risk (P1) - The Codex startup override cannot be accepted as a security boundary without direct upstream contract inspection.
  • Complete next step (P2) - A protected, security-sensitive product rollout needs maintainer sequencing and ownership direction; the current P1 must be repaired before another full review.
  • Improve patch quality - Resolve the security review concern or explain why the changed path is safe.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P1] Derive worker cutover from the assigned agent — src/worker/worker.runtime.ts:58
  • [high] Worker isolation uses the wrong agent namespace — src/worker/worker.runtime.ts:58
Agent review details

Security

Needs attention: The worker’s default-agent lookup creates a concrete bypass of the proposed per-agent memory isolation boundary.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

Metric Value Why it matters
Memory-isolation operator surface 1 new Doctor mode with 3 documented posture commands The added status, shadow-read-only, and legacy controls change durable memory posture and require operator and upgrade proof.
Production vs test LOC Unavailable: partial checkout could not materialize base blobs for an auditable split The PR reports a very large aggregate diff, but the required production-versus-test calculation could not be completed without promised base objects.

Stored data model

Persistent data-model change detected: database schema: src/state/memory-identity-schema.ts, database schema: src/state/memory-identity.ts, database schema: src/state/openclaw-agent-schema.sql, database schema: src/state/openclaw-agent-session-memory-schema.ts, database schema: src/state/openclaw-state-schema-compatibility.ts, database schema: src/state/openclaw-state-schema.sql, and 88 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Repair and restack the isolation slice (recommended)
    Use descriptor.assignment.agentId for worker cutover, add both cross-agent tests, and rebase the resulting focused slice on its reviewed prerequisites.
  2. Pause the integration draft
    Keep the branch as architecture reference only until maintainers choose a supported staged rollout and the prerequisite stack is viable.

Technical review

Best possible solution:

Repair the worker lookup to use the assigned agent, prove both cross-agent directions, then restack narrowly on reviewed prerequisite phases before reevaluating the security rollout.

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

Yes, from source: mark worker-agent cut over while main remains legacy, then launch a descriptor assigned to worker-agent; the current default-agent lookup leaves raw worker tools enabled. The inverse direction is likewise masked by the existing test.

Is this the best way to solve the issue?

No: the branch is not yet the best delivery shape because it bypasses the declared prerequisite sequence and retains a wrong owner-boundary lookup; a repaired, staged per-agent slice is safer.

Full review comments:

  • [P1] Derive worker cutover from the assigned agent — src/worker/worker.runtime.ts:58
    assignment.agentId is the worker-local policy namespace, but this lookup uses DEFAULT_AGENT_ID. A cut-over worker-agent under legacy main keeps raw tools, while the inverse incorrectly suppresses a legacy worker. The test assigns worker-agent but enables main, so it masks both cases; use the assigned agent and cover both directions.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The current head can give a cut-over worker raw filesystem and process tools when its assigned agent differs from the default agent.
  • merge-risk: 🚨 compatibility: The draft adds persistent memory-policy state and an operator-controlled cutover that changes existing legacy-memory behavior.
  • merge-risk: 🚨 security-boundary: The worker isolation decision currently uses the wrong agent namespace, allowing a selected security posture to be bypassed.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Security concerns:

  • [high] Worker isolation uses the wrong agent namespace — src/worker/worker.runtime.ts:58
    The worker tool surface is fenced according to the default agent instead of the descriptor’s assigned agent, so a cut-over worker can retain raw filesystem and process capability.
    Confidence: 0.99

What I checked:

  • Worker assignment is the owner namespace: The launch descriptor defines assignment.agentId as the host placement namespace for worker-local policy, hooks, and audit attribution. (src/worker/launch-descriptor.ts:42, b7f746a01d72)
  • P1 boundary violation remains: The worker reads the isolation posture using DEFAULT_AGENT_ID instead of descriptor.assignment.agentId before replacing its state directory. (src/worker/worker.runtime.ts:58, b7f746a01d72)
  • Regression test masks the two-agent case: The fixture assigns worker-agent but the isolation test persists and enables the marker for main, so neither cross-agent direction exercises the assigned worker's posture. (src/worker/worker.runtime.test.ts:834, b7f746a01d72)
  • History confirms the prior blocker is unchanged: Blame attributes the affected worker lines to the current reviewed head; the prior ClawSweeper finding therefore still applies rather than being a newly late concern. (src/worker/worker.runtime.ts:58, b7f746a01d72)
  • Sibling paths are per-agent: The shared cutover helper explicitly resolves the durable posture for its supplied agent ID, matching the descriptor ownership contract rather than a process default. (src/plugins/memory-cutover.ts:372, b7f746a01d72)
  • Codex contract gate is affirmative but unavailable: The PR directly changes Codex app-server startup arguments and relies on an upstream configuration override; the required sibling ../codex checkout is absent, so that dependency claim was not validated. (extensions/codex/src/app-server/run-attempt-connection.ts:53, b7f746a01d72)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Erick Kinnee: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (6 earlier review cycles)
  • reviewed 2026-08-11T08:50:13.896Z sha 7a9623a :: found issues before merge. :: [P1] Use the assigned agent for worker cutover | [P1] Permit the intentional no-tool worker mode | [P1] Reject partial scoped-memory schema groups
  • reviewed 2026-08-14T02:11:16.454Z sha 83d87357a32b9bed4ca3c13c5afd28aad169e906 :: found issues before merge. :: [P1] Derive worker cutover from the assigned agent
  • reviewed 2026-08-14T02:19:04.694Z sha 75580e565c66f0694dd0852bf6f492d7706d797b :: found issues before merge. :: [P1] Derive worker cutover from the assigned agent
  • reviewed 2026-08-14T03:13:15.159Z sha 0a80a76cf35389ab193401cc4a5f2cc3504cc67e :: found issues before merge. :: [P1] Derive worker cutover from the assigned agent
  • reviewed 2026-08-14T05:32:03.340Z sha 1bc740cc32589c0704d53a16404be0f303517458 :: found issues before merge. :: [P1] Derive worker cutover from the assigned agent
  • reviewed 2026-08-19T09:22:30.551Z sha b7f746a :: found issues before merge. :: [P1] Derive worker cutover from the assigned agent

@galiniliev
galiniliev force-pushed the memory-permissions-p1c-v2 branch 4 times, most recently from 75580e5 to e256e9b Compare August 14, 2026 02:21
@galiniliev
galiniliev force-pushed the memory-permissions-p1c-v2 branch from e256e9b to 7349106 Compare August 14, 2026 02:39
@galiniliev
galiniliev force-pushed the memory-permissions-p1c-v2 branch from 1bc740c to b7f746a Compare August 19, 2026 09:13
@clawsweeper clawsweeper Bot added 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. labels Aug 19, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 20, 2026
@steipete

Copy link
Copy Markdown
Contributor

Thanks for the PR. We're closing older pull requests that have gone stale against current main.

This 28k-line draft has had no commits since August 19, is waiting on the author, and is far beyond the reviewable size limit. Memory read isolation would need to land as small, separately reviewable slices; please open fresh focused PRs if you continue.

If this change is still needed, please open a fresh PR against current main and we'll review it there.

@steipete steipete closed this Oct 24, 2026
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: telegram Channel integration: telegram cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: active-memory extensions: codex extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki 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. P1 High-priority user-facing bug, regression, or broken workflow. plugin: file-transfer rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts 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.

2 participants