Skip to content

fix(cron): keep automations bound across message edits - #199510

Closed
obviyus wants to merge 2 commits into
mainfrom
openclaw/amber-shell
Closed

obviyus wants to merge 2 commits into
mainfrom
openclaw/amber-shell

Conversation

@obviyus

@obviyus obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

Editing a message or switching a branch in the Control UI gives the chat a new transcript ID (sessionId) and keeps its lifecycle revision. Automations stored the creating chat's sessionId and compared it every time they used it. After an edit:

  • In-session continuations were refused with "operator authority … refused (… definition changed); recreate it from an authenticated turn".
  • Isolated announce results were dropped with session rebound for sessionKey. The run still reported ok, and the Gateway logged no warning.
  • Cron child runs quietly lost the parent's workspace, memory and sandbox requirement.

Daily, idle and manual resets rotate the lifecycle revision, so pinning the revision instead would end automations at every auto-reset.

Fix

  • Automations link the creating chat by key. The stored sessionId and revision are ignored when read. In-session runs, isolated results and child-run parent bindings follow the chat's current transcript through edits, branch switches and resets. Archiving or deleting the chat still pauses the job, with the existing notice.
  • The session generation lease no longer compares sessionId by default. It follows the chat's current transcript, and compares the lifecycle revision only when the reference carries one. Live-writer fences opt into exactTranscript.
  • Background result commits write to the current transcript. A pinned revision still rejects a reset.
  • Operator sources no longer record conversation IDs. The in-session ID recheck in cron-operator-source.ts is removed.
  • A dropped conversation delivery logs a Gateway warning. The run records not-delivered, which the existing failure-alert owner handles.

There is no schema change and no migration. Existing jobs with old stored IDs work as they are.

Lease caller audit (14)

Mode Caller Why
follow chat (default) cron admission (execution-context-admission) stored automation link
follow chat cron delivery target (single + batch) stored automation link
follow chat outbound delivery queue (delivery-generation) queued send to a chat
follow chat memory-audience stored memory link
follow chat session-event-target, session-event-handoff delivers an event into a chat
exact transcript prepareCronRootSessionGeneration (cli-runner, run-orchestrator, attempt-transcript-lifecycle-prepare) live run writing the transcript
exact transcript session-restart-resume-custody resumes a run in that transcript
exact transcript commands-fork copies a specific transcript
exact transcript subagent-control-session, subagent-controller-read, subagent-control-kill controls a live child run

Evidence

  • Regression tests: 11 new tests fail on the merge base (7b81788) and pass here, covering delivery after an edit or reset, the warning when a chat is deleted, child bindings after a parent edit or reset, the in-session continuation, and the lease following an edit. About 650 tests pass across the touched suites and their siblings. Typecheck, oxlint and oxfmt are clean.
  • E2E on an isolated Gateway from source, with a real model: the agent created both automations through its own tool, and the message was edited through sessions.rewind, the RPC behind the Control UI edit button.
    • origin/main after an edit: the in-session job is refused, and the isolated result is ok/not-delivered with nothing in the chat and no warning.
    • This branch after an edit: both deliver into the current transcript.
    • This branch after a reset: both still deliver.
    • This branch after an archive: both pause, with the visible notice.
  • Build: build --dts and the packed-install smoke both pass.

Production code: +207 / −265.

Follow-ups

  • Owner-based operator authority, so admins can repair or retarget automations from any chat.
  • Other per-chat state keyed by sessionId still breaks after an edit: reactions, GitHub publication status, deep-research view state, the knowledge conversations/<sessionId> partition, and goal continuation.

obviyus and others added 2 commits November 15, 2026 12:19
Automations name their creating conversation by key. Message edits,
branch switches and resets rotate the transcript id or lifecycle
revision; in-session continuations, isolated announce results and
child-run parent bindings now follow the conversation to its current
transcript instead of refusing or silently dropping. Archive and
deletion still pause the job visibly.

The session generation lease no longer compares the transcript id for
stored references; live-writer fences opt into exactTranscript.
Dropped conversation deliveries now log a Gateway warning.

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 6ed44a92-02a0-871c-9b0c-7fb5ddc6a53f
@clawsweeper

clawsweeper Bot commented Nov 15, 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 docs Improvements or additions to documentation gateway Gateway runtime commands Command implementations agents Agent runtime and tooling size: L labels Nov 15, 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. labels Nov 15, 2026
@obviyus obviyus closed this Nov 15, 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime size: L

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant