Skip to content

fix(exec): keep owner memory trusted after background commands finish - #204785

Merged
RomneyDa merged 3 commits into
openclaw:mainfrom
EnesKartal:fix/exec-notify-owner-continuation
Nov 26, 2026
Merged

RomneyDa merged 3 commits into
openclaw:mainfrom
EnesKartal:fix/exec-notify-owner-continuation

Conversation

@EnesKartal

@EnesKartal EnesKartal commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #204767

What Problem This Solves

When a Gateway owner’s background command finishes and wakes their WebChat session, the wake can lose the owner decision. A tracked edit to MEMORY.md then becomes untrusted and drops out of automatic context.

User Impact

An untainted completion in the same owner session keeps ordinary agent provenance. Guest, tainted, and cross-session cases still produce untrusted provenance. Existing quarantined files are not reclassified.

Why This Change Was Made

Capture operator-owner continuation only when the caller, the process, and the wake target share the same agent session. Build the exec event context through the existing owner-binding path without authorizing the completion text as a command.

Evidence

  • On Linux, the regression launches a real background Node process, checks that its output reaches a normally admitted completion, passes the runtime owner bit to the real tracked write tool, and reads the saved MEMORY.md provenance. On pre-fix a298c5a19cb6 the owner and tainted-owner cases failed because runtime ownership was false; the clean owner write was untrusted. With the fix, the clean owner is owner/agent; tainted owner is owner/untrusted; guest and cross-session are non-owner/untrusted.
  • pnpm test src/agents/bash-tools.exec-notify.owner-continuation.test.ts --maxWorkers=1: 4 passed. The requester, storage-failure, background-followup, and session-event handoff suites also passed while validating the same production change. Focused lint, format, and agent-tool typecheck passed.
  • Model inference was stubbed at its boundary. A live model-driven Control UI run was not performed.

Real behavior proof

Real-model Gateway proof and redacted logs. Three disposable Gateway runs used Qwen3-1.7B via loopback llama.cpp with no provider API key. The model generated the native tool calls and arguments for background exec and the tracked MEMORY.md write on the automatic wake. The adapter required the one relevant offered tool on action steps; it did not supply or rewrite arguments or replies. The network-tainted wake called web_fetch first and got an HTTP 200 result marked untrusted.

Build and case Hash-matched MEMORY.md provenance Badge in actual outgoing system prompt after /new
Base c734b2de, clean untrusted No
Head f286bd3a, clean agent Yes
Head f286bd3a, network-tainted untrusted No

In all three runs, the persisted wake transcript remained internal_system with senderIsOwner=false (not human authorship). All three proof runs exited 0 and disposable processes and state were removed. Earlier scripted comparison.

@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XS triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Nov 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 24, 2026
@clawsweeper

clawsweeper Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserve the originating Gateway owner's authority when a background command resumes the same agent session.

Example: A Gateway owner starts a background command, then the automatic completion turn writes MEMORY.md.

  • Before: The completion runs as a non-owner and records the clean memory write as untrusted.
  • After: The same-session completion retains owner authority and records agent provenance; tainted writes remain untrusted.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, worthwhile repair with production-entry-point proof, distinct regression cases, and a passing exact-head CI gate.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): The exact-head collaborator logs exercise a real model and disposable Gateway through background exec, automatic wake, tracked MEMORY.md write, persisted provenance, and the next reset request; clean owner memory becomes eligible while network-tainted memory stays excluded, resolving the prior proof request. The patch changes no persisted format or schema and leaves existing quarantine records and their ratchet unchanged.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An owner's ordinary background-command completion can quarantine a clean memory edit and exclude it from later automatic context.
Reason: The bounded repair restores the established originating-requester continuation contract without changing memory trust policy or adding configuration.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current owner-continuation bug with a focused change, sufficient real-model proof, and no actionable findings.

Reviewed head: f286bd3a5b15c027aad4b1f10e9ca69a1de810f2

Before merge

None.

Findings

None.

Agent review details

How this fits together

Background exec captures its requester and destination, session-event admission resumes the conversation, and tracked file tools use runtime ownership and taint to classify memory writes.

flowchart TD
A[Owner conversation] --> B[Background exec]
B --> C[Captured requester and session]
C --> D[Session event admission]
D --> E[Tracked memory write]
E --> F[Memory provenance]
F --> G[Automatic memory context]
Loading

Technical review

Best possible solution:

Land the scoped continuation repair through the existing session-event authority owner while preserving memory taint and quarantine rules.

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

Current-main source establishes both missing handoff steps, and supplied base/head Gateway logs demonstrate the resulting memory exclusion; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch repairs the authority handoff at its existing producer and consumer rather than weakening memory provenance, with distinct negative cases protecting guest, tainted, and cross-session behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0f1bb35f4d3d.

Provenance checked

  • Background completion requester capture keeps the original intent (147df8d: Retain the original requester's supported capabilities and restrictions through background completion; later channel-owner handling extended that contract.)
  • Synthetic-event owner binding keeps the original intent (5be92b4: Revert session-principal authority inheritance after guest completions acquired the wrong authority and lost their original policy.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit aa8b35b adds src/agents/bash-tools.exec-notify.ts:314 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: aa8b35bb20fd; files: src/agents/bash-tools.exec-notify.ts)
  • Peter Steinberger: Raw commit 3d2f7ca adds src/auto-reply/reply/session-event-context.ts:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 3d2f7ca06b26; files: src/auto-reply/reply/session-event-context.ts)

PR surface

Source +8, Tests +193. Total +201 across 4 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 2 12 4 +8
Tests 2 193 0 +193
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 205 4 +201

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (3 earlier review cycles)
  • reviewed 2026-11-24T17:18:38.258Z sha 7076d33 :: needs real behavior proof before merge. :: [P1] [P1] Consume owner continuation for exec event contexts
  • reviewed 2026-11-26T01:48:04.725Z sha f286bd3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-26T02:50:12.376Z sha f286bd3 :: needs real behavior proof before merge. :: none

Reviewed November 25, 2026, 11:57 PM ET / November 26, 2026, 04:57 UTC (Revision 4).

@THE-NAVVV THE-NAVVV left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

​

@tideclaw-bot tideclaw-bot changed the title fix(exec): preserve ownerContinuation on exec-completion wake targets fix(exec): keep owner memory trusted after background commands finish Nov 26, 2026
@tideclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@tideclaw-bot

Copy link
Copy Markdown
Collaborator

Sanitized runtime receipts for f286bd3a (loopback scripted model, real disposable Gateway). Each run observed the background exec result, released the process after the first turn returned, and observed the wake-driven tracked write. badgeInSystem comes from the next reset turn's actual model request, not a model judgment.

case          MEMORY.md provenance  file hash match  wake senderIsOwner  badgeInSystem
base clean    untrusted             true             false               false
head clean    agent                 true             false               true
head tainted  untrusted             true             false               false

The wake transcript retained internal_system provenance in all cases. No live model inference: the local credential sentinel blocked that run.

@tideclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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 Nov 26, 2026
@tideclaw-bot

Copy link
Copy Markdown
Collaborator

Real-model proof for f286bd3a5b15c027aad4b1f10e9ca69a1de810f2: Qwen3-1.7B via loopback llama.cpp (no provider API key), using disposable Gateways and state. Qwen generated native calls for background exec and, after the command's automatic wake, tracked write. The tainted wake first called web_fetch (HTTP 200, explicitly untrusted). The adapter required the one relevant offered tool on action steps and validated scope; it did not supply or rewrite arguments or model replies.

Redacted log excerpts:

model.toolCall  exec {"background":true, "command":"[fixture]"}
model.request   write wake=true
model.toolCall  write {"path":"MEMORY.md", "content":"The proof badge is [badge]"}

case                    originClass  hashMatches  wake.senderIsOwner  badgeInSystem
base c734b2de           untrusted    true         false               false
head f286bd3a clean     agent        true         false               true
head f286bd3a tainted   untrusted    true         false               false

The wake remained an internal_system transcript turn in all three runs. badgeInSystem was read from the outgoing /new model request, not inferred from the model’s answer. All three proof runs exited 0; disposable processes and state were removed.

@tideclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 26, 2026
@RomneyDa
RomneyDa merged commit 21a85ac into openclaw:main Nov 26, 2026
169 of 174 checks passed
tideclaw-bot added a commit that referenced this pull request Nov 26, 2026
…#204785)

* fix(exec): preserve ownerContinuation on exec-completion wake targets

* fix(exec): retain owner authority on same-session completion

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: tideclaw-bot <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 21a85ac)
Co-authored-by: RomneyDa <[email protected]>
Co-authored-by: vincentkoc <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 26, 2026
…#204785)

Preserve live owner authority for completion of a command in the originating session without authorizing the internal event as a command or inheriting ownership across a route.

Release adaptation: require the release authority’s operator.admin scope for exec events (main uses grant.owner), and use the release’s existing authority constructor and tool-construction plan in the regression. Companion audit found no later same-path or PR/SHA follow-up on pinned main.

(cherry picked from commit 21a85ac)

Co-authored-by: vincentkoc <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…openclaw#204785)

* fix(exec): preserve ownerContinuation on exec-completion wake targets

* fix(exec): retain owner authority on same-session completion

Co-authored-by: RomneyDa <[email protected]>

---------

Co-authored-by: tideclaw-bot <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Exec-completion wake in a webchat gateway-owner session runs with runtime senderIsOwner=false, quarantining MEMORY.md on tracked edits

4 participants