Skip to content

fix(cron): run keeps owner-private memory after its requester loses owner status - #198697

Merged
hannesrudolph merged 2 commits into
openclaw:mainfrom
daniel-lxs:cron-recheck-requester-owner-at-run-start
Nov 14, 2026
Merged

hannesrudolph merged 2 commits into
openclaw:mainfrom
daniel-lxs:cron-recheck-requester-owner-at-run-start

Conversation

@daniel-lxs

@daniel-lxs daniel-lxs commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Closes #198695

What Problem This Solves

An automation run can receive owner-private memory after its requester loses owner status while a fired condition waits for a free cron slot.

User Impact

A run that starts after its requester is removed from the owner list receives only its parent conversation's memory audience. Runs whose requester remains an owner retain owner-private memory.

Why This Change Was Made

Admission can happen long before payload execution. Each run rechecks requester ownership against the live runtime config when minting its execution context. Existing owner-only tool checks and intentional legacy/trusted-policy behavior are preserved.

Evidence

Live Gateway proof on 99181aa exercised both runtimes in one disposable VM with the repo's scripted mock provider and a CLI stub:

  • Both owner-positive controls received owner-private and completed successfully.
  • Eight occupied cron slots held both fired conditions. The requester remained in the owner list during the checks, and both runs had durable slot-wait receipts.
  • The Gateway published a config removing the requester while the same wait receipts remained and neither payload had started.
  • After capacity release, both payloads received conversation for the exact parent session key and session ID. The CLI stub recorded that same host-minted audience and run ID. Both payloads completed successfully.

A temporary observer recorded the runtime's audience; the CLI adapter passed that observed value to its stub. The Gateway scheduler, config watcher, SQLite session infrastructure, and both memory resolvers were real. The requester provenance and model transports were synthetic. No production code was changed for the proof, and the admission/resolver source hashes matched the PR head.

Two focused regressions in src/cron/execution-context-memory-audience.test.ts revoke a channel requester's ownership through a published config, or revoke a profile requester's access, between admission and minting. Recorded regression results: both cases fail without the fix on both runtime resolvers; the fixed test file passes all 9 tests.

Validation Limits

The live run verifies audience assignment with synthetic model transports. It did not call a hosted model, send real Discord traffic, or read private-memory contents. The focused regression file and full suite were not rerun during the VM proof task.

A fired condition can wait a long time for a run slot after its
occurrence was admitted. Each run minted the owner bit captured at
admission, so a requester who lost owner status during the wait still
got an owner context, and with it owner-private memory. Each run now
reads the bit again from the requester's existing owner check against
the live config.

Refs openclaw#196859
@clawsweeper

clawsweeper Bot commented Nov 14, 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.

@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. labels Nov 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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:needs-repro Preliminary submission classification; full source review pending. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Recheck requester ownership when a scheduled run mints its execution context after waiting for capacity.

Example: Discord requester 100000000000000001 loses owner status while its automation waits behind eight occupied cron slots.

  • Before: The payload starts with owner-private memory using the ownership recorded at occurrence admission.
  • After: The payload starts with only its parent conversation's memory.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, minimal repair with production-entry-point evidence and distinct profile/config regressions; broad exact-head CI remains unexecuted pending workflow approval, and no persisted format or migration changes.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The new exact-head Gateway trace resolves the prior proof gap: real scheduling, config publication, SQLite sessions, and both audience resolvers exercised revocation while queued and produced conversation-only audiences after release; synthetic model transports do not decide the changed authority fact.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A revoked automation requester can retain owner-private memory when its payload starts after waiting for capacity.
Reason: The change restores the established next-run ownership contract using existing authority machinery and preserves approved legacy behavior.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR fixes a concrete authorization bug still present on current main, with a focused change and no actionable code findings.

Priority: P2
Reviewed head: 99181aaf296aa9e2b251897e4d9542cb826ef057

Before merge

Findings

None.

Agent review details

How this fits together

Cron admission prepares an occurrence from the stored job and requester identity; each payload mints execution facts that both embedded and CLI memory resolvers consume.

flowchart LR
  A[Stored automation] --> B[Occurrence admission]
  B --> C[Wait for run capacity]
  C --> D[Mint execution context]
  E[Current requester authority] --> D
  D --> F[Embedded and CLI resolvers]
  F --> G[Host minted memory audience]
Loading

Technical review

Best possible solution:

Use the existing requester-authority predicate at run minting while preserving intentional legacy and trusted-policy behavior.

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

The current-main minting path demonstrably reuses admission-time ownership across the reported wait; the contributor reports both added regressions failing without the fix and passing with it, but this review executed no target code.

Is this the best way to solve the issue?

This is the smallest complete repair: refresh the authority fact at the existing minting owner, allowing both memory runtimes to consume the corrected decision without new state or parallel policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7f22598f7828.

Provenance checked

  • Occurrence admission and per-run minting keeps the original intent (c730759: Admit each occurrence once, retain its parent facts, and mint execution contexts for its individual runs.)
  • Requester owner checks and intentional legacy authority keeps the original intent (2011274: Unify scheduled owner authority across runtimes while retaining trusted operator jobs and live requester checks.)
  • Scheduled memory audiences keeps the original intent (ddbf65c: Grant the parent's memory audience, capped by the scheduled requester's owner status for that run.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Lehman: Raw commit 2011274 adds src/cron/execution-context-admission.ts:65 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 201127429a03; files: src/cron/execution-context-admission.ts)
  • Ayaan Zaidi: Raw commit 8100c60 adds src/cron/execution-context-admission.ts:78 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 8100c6008860; files: src/cron/execution-context-admission.ts)

PR surface

Source +3, Tests +60. Total +63 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 1 64 4 +60
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 68 5 +63

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 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • remove rating: 🧂 unranked krab: 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: ⏳ waiting on maintainer.

Label justifications:

  • P2: A bounded authorization repair prevents private-memory access after requester revocation during a scheduled capacity wait.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • 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 (1 earlier review cycle)
  • reviewed 2026-11-14T06:33:21.927Z sha 99181aa :: needs real behavior proof before merge. :: none

Reviewed November 14, 2026, 2:19 AM ET / 07:19 UTC (Revision 2).

@daniel-lxs

Copy link
Copy Markdown
Member Author

Live Gateway proof passed on unchanged head 99181aaf296aa9e2b251897e4d9542cb826ef057 for both embedded and CLI runtimes.

One disposable macOS 26.6.2 VM, Node 24.21.0. The embedded runtime used the repo's scripts/e2e/mock-openai-server.mjs; the generic CLI runtime used a stub backend. memory-lancedb selected the native audience path. A temporary before_prompt_build observer recorded the host-minted memoryAudience; the CLI adapter passed that observed record to the stub through its environment, and the stub recorded the matching host run ID and audience. This diagnostic handoff did not choose the audience.

The synthetic Discord requester was 100000000000000001. Jobs carried that requester and a real direct-parent session through the cron service; the synthetic inference binding was captured through normal cron.add. The Gateway scheduler, admission, SQLite sessions, slot queue, config watcher, and both audience resolvers ran without mocks or production-code edits.

Check Embedded CLI
Owner-positive control owner-private, completed ok owner-private, stub received it, completed ok
Condition fired with requester still in owner list Yes Yes
Parked behind eight occupied cron slots Durable wait receipt present Durable wait receipt present
Requester removed in published config while waiting Same wait receipt retained; no payload start Same wait receipt retained; no payload start
Payload after capacity release conversation for exact parent session Same conversation audience; stub received it
Completion ok ok

Condensed, redacted terminal facts from the final scenario on 2026-11-14 (UTC; P is the same direct parent session and incarnation throughout):

07:11:16.009 embedded condition executes; requester still in ownerAllowFrom
07:11:16.011 CLI condition executes; requester still in ownerAllowFrom
07:11:16.118 both runSlotWaitReceiptId values present; payload starts=0
07:11:16.759 [reload] config source revision 1 accepted (file)
07:11:17.030 ownerAllowFrom excludes requester; same wait receipts; payload starts=0
07:11:17.030 provider hold released
07:11:17.487 CLI memoryAudience=conversation(P)
07:11:17.518 embedded memoryAudience=conversation(P)
07:11:17.592 CLI stub records conversation(P), same host runId
07:11:17.623 embedded completed ok
07:11:17.662 CLI completed ok

Both payload audiences matched the parent's actual session key and session ID, and neither was owner-private. The admission and memory-resolver source hashes matched the exact PR head. No hosted-model calls, real Discord traffic, private-memory content reads, or full-suite rerun were performed; this proves the scheduled audience assignment with synthetic model transports.

@daniel-lxs

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. label Nov 14, 2026
@hannesrudolph
hannesrudolph merged commit 7a4e9f1 into openclaw:main Nov 14, 2026
162 of 166 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 15, 2026
…wner status (openclaw#198697)

* fix(cron): recheck the requester's owner status when a run starts

A fired condition can wait a long time for a run slot after its
occurrence was admitted. Each run minted the owner bit captured at
admission, so a requester who lost owner status during the wait still
got an owner context, and with it owner-private memory. Each run now
reads the bit again from the requester's existing owner check against
the live config.

Refs openclaw#196859

* test(cron): cover owner removal through a published config on both memory runtimes
RomneyDa added a commit that referenced this pull request Nov 15, 2026
Clear settled rejected CLI cleanup, preserve detached paired-node Gateway
context, cancel MCP work before socket drain, and refresh queued requester
ownership before granting owner-private memory.

Selected ledger fixes: #198224, #145741, #197119, #198697.
The owner-check predicate prerequisite is a narrow adaptation, not the
unrelated failure-repair feature.

(cherry picked from commit 4f8df80)
(cherry picked from commit dbedd7b)
(cherry picked from commit 480389e)
(cherry picked from commit 7a4e9f1)
(cherry picked from commit 8100c60)

Proof: four affected files and targeted real HTTP cancellation regression
pass on the frozen fix. Isolated c2 baseline fails detached context, cleanup
retry, both queued-owner revocation cases and MCP shutdown cancellation.
The full MCP suite has a preexisting slow-body fixture hang on both Node
and Bun; this remains open and is not represented as a passing full suite.
Fresh independent review found no actionable P0/P1 findings. FRV pending.

Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: obviyus <[email protected]>
Co-authored-by: Edward Abrams <[email protected]>
Co-authored-by: Wynne668 <[email protected]>
Co-authored-by: Daniel <[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

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Automation run keeps owner-private memory after its requester loses owner status while it waits for a run slot

2 participants