[Bug]: owned sessions reach the shared memory plane through spawn_subagent and execute_pipeline
Affected component
memory
Severity
S0 - data loss / security risk
Current behavior
A principal-bound ("owned") session is meant to keep all memory reads and writes on its owner's private plane. Two tool paths still build or hold memory handles that were never scoped to the owner, so an owned session can reach the agent's shared plane through them. Both were named as out-of-scope residual gaps in #11225, which fixes the delegate path only.
spawn_subagent—child_run_overridessetsmemory: None(crates/zeroclaw-runtime/src/tools/spawn_subagent.rs:68-71). With no memory override,agent::runbuilds the child's memory with an unscopedzeroclaw_memory::create_memory_for_agent(&config, agent_alias, None)(crates/zeroclaw-runtime/src/agent/loop_.rs:1472). The SubAgent of an owned session therefore reads and writes the agent's shared plane. The tool is kept for administrators and principals with wildcard agent selectors, and a delegated child can reach it when its policy admits it.execute_pipeline(opt-in:[pipeline] enabledwith a memory tool inpipeline.allowed_tools; off by default) —PipelineToolstores its owntools: Vec<Arc<dyn Tool>>captured at construction (crates/zeroclaw-tools/src/pipeline.rs:69-80). Session owner routing replaces memory tools in the registry viarebind_memory_tools(crates/zeroclaw-runtime/src/tools/scoped.rs:97, called fromagent/agent.rs:1993), which does not reach handles the pipeline already holds.
Both contradict the session-pinning contract that owned sessions stay on their owner's private plane.
Expected behavior
Every memory handle reachable from an owned session — including a spawn_subagent child and any tool a pipeline invokes — is built from the owning principal's scope. Where the owner cannot be carried, the call is refused rather than falling back to the shared plane.
Steps to reproduce
# Source-traced from master 0a2dae1837; not executed.
# Path 1: spawn_subagent
# 1. Owned RPC session for principal P on agent A; A's risk profile allows spawn_subagent.
# 2. P's session calls spawn_subagent with a prompt that runs memory_store "P-MARKER".
# 3. child_run_overrides passes memory: None; agent::run builds unscoped agent memory.
# 4. Expected P-MARKER on P's private plane for A; it lands on A's shared plane.
# Path 2: execute_pipeline
# 1. [pipeline] enabled = true with memory_store in pipeline.allowed_tools.
# 2. Owned session for P runs execute_pipeline with a memory_store step.
# 3. PipelineTool invokes its captured pre-routing memory_store handle.
# 4. The write lands on the shared plane rather than P's private plane.Impact
Cross-principal memory isolation for owned sessions does not hold across the full tool surface: a principal's writes can land where other principals using the same agent can read them, and a child can read shared rows the owner's session is meant to be isolated from. The private-plane feature is on master only (not in a release; latest is v0.8.5), so there is no deployed exposure yet — this should be closed before v0.9.0 ships multi-user sessions.
Related: #11225 (fixes the delegate path; also has three open FATAL findings on skill aliases and background result retrieval), #11198, tracker #8290. Separately, the Permission inheritance section of docs/book/src/agents/delegation.md lists six inheritance axes and none of them is the principal; that doctrine change is being drafted on its own and is not this issue's scope.
Logs / stack traces
_No response_ZeroClaw version
master 0a2dae1837 (workspace version 0.8.5; the affected feature is unreleased)
Rust version
rustc 1.96.1 (31fca3adb 2026-06-26)
Operating system
Platform-independent (source trace on Darwin 25.5.0 arm64)
Regression?
Unknown
Pre-flight checks
- I reproduced this on the latest master branch or latest release.
- I redacted secrets, tokens, and personal data from all submitted content.
Source: zeroclaw-labs/zeroclaw