Skip to content

reference: child self-resume across Gateway restarts (parked; steering split to #202139) - #202111

Closed
obviyus wants to merge 22 commits into
mainfrom
openclaw/plaid-claw
Closed

obviyus wants to merge 22 commits into
mainfrom
openclaw/plaid-claw

Conversation

@obviyus

@obviyus obviyus commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Parked as reference. Do not merge.

The commits stay here for reference: child self-resume, restart-drain guard, shutdown settle of unmarked children, startup settle with fresh custody, fixes for the Fable findings, and the jd2 journey evidence from the previous description.

obviyus and others added 16 commits November 19, 2026 21:37
sessions_send steering into an active run waited for the receiver's next
transcript commit with no delivery deadline. A long tool call in the
receiving run held that past the 30 s admission deadline, and the timeout
result failed the tool output schema, so callers saw an opaque error and
retried while the input was still delivered later.

Steering now returns at acceptance; the receiving run owns the input until
its next model boundary. The durable fallback that only served the commit
wait is removed, and the admission-deadline result uses status "error",
which matches the output schema.

Co-authored-by: obviyus <[email protected]>
…ceiver after a refused commit

Co-authored-by: obviyus <[email protected]>
…esume

Shutdown aborts runs only after the one-way restart drain. A restart abort observed during that drain no longer ends the child row as killed; the child session resumes after restart. Reset and rollover aborts outside the drain stay cancellations.

Co-authored-by: obviyus <[email protected]>
Interrupted children stay unended at shutdown and resume their own task; the root gets one completion wake with the real result and never sees 'Gateway stopped'. The legacy case reproduces the old Gateway's persisted quiet-kill row explicitly.

Co-authored-by: obviyus <[email protected]>
Another local process probing the mock's port sent GET / with no body; JSON.parse of the empty body failed restart e2e tests on base and head. Model requests are POSTs; other methods now get 404 and a log line.

Co-authored-by: obviyus <[email protected]>
…esume

Shutdown again ends live subagent rows as base does, except a child whose session committed a restart marker: that child resumes its own task after the restart. A child that cannot resume (marker persistence incomplete or not markable) keeps base's settle-and-recover path.

Co-authored-by: obviyus <[email protected]>
After each agent's restart resume decisions, a pre-boot subagent row that this boot did not resume, park, or leave marked ends once with the restart error. Fresh requester custody binds first so the outcome is delivered; a requester from another restart scope is never woken and its child ends without delivery. An agent with nothing to resume is still visited.

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 203ae32d-1cb1-8109-a6a8-c9c60a404dd0
@clawsweeper

clawsweeper Bot commented Nov 19, 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 gateway Gateway runtime agents Agent runtime and tooling extensions: qa-lab size: XL labels Nov 19, 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 19, 2026
@clawsweeper

clawsweeper Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head 5279eb02c714c599c9eeb22bba088ab42f8abee6, but the PR head is now 11ab1419627cb3f35a0fce60d66b6919d0ce0e54. Its old verdict and PR readiness labels are no longer current.

Next step
Comment @clawsweeper re-review when the current head is ready; pushes after the first review are not reviewed automatically.

Review history (1 earlier review cycle)
  • reviewed 2026-11-19T23:09:53.557Z sha 5279eb0 :: blocked before merge. :: [P2] Defer sweep settlement while startup still owns the child's recovery | [P3] Update the documented child restart contract

obviyus and others added 3 commits November 20, 2026 05:02
…sume own marked children

A child settled at shutdown gets no fallback resume marker and restart resume skips it, so its parent is woken once. The sweeper leaves rows whose child session still carries a restart marker to restart resume. Reactivation continues only a running, unkilled row. Steering acceptance never waits for runtime persistence; the commit-time stamp runs detached. An archived requester takes the no-delivery path. Docs describe child self-resume and the steering receipt.

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 087b4773-b7db-8a0c-b017-ca403b030b7c
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Nov 19, 2026
obviyus and others added 3 commits November 20, 2026 05:18
… sweeps on marker read errors

Co-authored-by: obviyus <[email protected]>
OpenClaw-Publication: 730c77c0-e505-8949-89e8-c0a33deabc5f
@obviyus obviyus changed the title fix: let delegated child agents survive steering and Gateway restarts reference: child self-resume across Gateway restarts (parked; steering split to #202139) Nov 20, 2026
obviyus added a commit that referenced this pull request Nov 20, 2026
## What Problem This Solves

When a parent agent sends a message to its own child while the child is busy in a long tool call, `sessions_send` waits about 30 s and then reports an error. The message does reach the child, but the parent thinks the send failed and often retries or gives up.

## User Impact

User impact: a parent's message to a busy child now returns at once as `accepted` / `steered`, and the child still sees the message at its next steering boundary.

## Why This Change Was Made

- Steering returns at acceptance. Once the receiving run accepts a steered message, it owns that message until it commits it or the run ends. `sessions_send` no longer waits for the transcript commit. The durable-fallback and commit-wait path for `sessions_send` steering is removed.
- Admission-only contract: after acceptance, the receiving run owns the steered input until it commits or the run ends; a refused commit is never seen by the model, and custody is released exactly once when the run ends.
- The tool deadline result now uses the schema's `error` status instead of a `timeout` shape the schema did not allow. Models see this change.
- The `steerTargetRunId` stamp is written on the committed transcript row as part of the admission write, and confirmation no longer waits for runtime persistence. This also stamps plugin steering, which previously had no stamp.
- Commit-wait (`waitForTranscriptCommit: true`) and its `timeout` status remain for the other callers (announce, `chat.send`, steer adoption).

Known window: if the receiving run is cancelled or fails, or the Gateway restarts, between acceptance and the next steering boundary, the steered message is withdrawn although the sender holds `accepted`. Plugin steering on main already has this window. On main's restart model, a restart stops the child and wakes the parent, so the parent learns the child was interrupted and can resend. Making accepted steers survive a restart needs a replay-authority decision and is not part of this PR.

Split from #202111. The restart half of that PR is parked as reference, because main's own restart model now owns that class.

## Evidence

Real Gateway journey on a built Gateway (isolated state, real model), current main vs this branch. The parent spawns a child doing a 75 s exec, sends it a MARKER with `sessions_send`, then waits:

| | main (`416b357c`) | this branch |
|---|---|---|
| `sessions_send` call → result | 30,066 ms, `error` | 74 ms, `accepted` / `steered` |
| Steered MARKER row in the child, and the MARKER in the child's final reply | 1 row, stamped; in the final reply | 1 row, stamped; in the final reply |

Tests:
- Steering receipt at acceptance (red on main: the steering-provenance test hangs 120 s, and the admission test returns `status: "timeout"`).
- The commit stamp is written for uncommitted messages.
- Steering custody is released exactly once when the receiving run ends, including the source-revoked case (the refused commit never reaches the transcript).
- The plugin steering contract now expects the stamp.
- Suites: sessions_send 11/13/132, user-turn transcript 89, steering custody 5, all green. tsgo and lint are clean.

Production code: +32 / −48 (net −16). The stamp now joins the admission write without an extra run-id comparison (session-identity ratchet). One drive-by lint fix: `agent-step.ts` drops a default `callGateway` type argument that the changed-lint lane flagged.

**Merge danger:**
- Two-way door: no schema, config or stored-state change.
- Blast radius: agents that steer a busy session with `sessions_send`, and plugin steering stamps.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 20, 2026
## What Problem This Solves

When a parent agent sends a message to its own child while the child is busy in a long tool call, `sessions_send` waits about 30 s and then reports an error. The message does reach the child, but the parent thinks the send failed and often retries or gives up.

## User Impact

User impact: a parent's message to a busy child now returns at once as `accepted` / `steered`, and the child still sees the message at its next steering boundary.

## Why This Change Was Made

- Steering returns at acceptance. Once the receiving run accepts a steered message, it owns that message until it commits it or the run ends. `sessions_send` no longer waits for the transcript commit. The durable-fallback and commit-wait path for `sessions_send` steering is removed.
- Admission-only contract: after acceptance, the receiving run owns the steered input until it commits or the run ends; a refused commit is never seen by the model, and custody is released exactly once when the run ends.
- The tool deadline result now uses the schema's `error` status instead of a `timeout` shape the schema did not allow. Models see this change.
- The `steerTargetRunId` stamp is written on the committed transcript row as part of the admission write, and confirmation no longer waits for runtime persistence. This also stamps plugin steering, which previously had no stamp.
- Commit-wait (`waitForTranscriptCommit: true`) and its `timeout` status remain for the other callers (announce, `chat.send`, steer adoption).

Known window: if the receiving run is cancelled or fails, or the Gateway restarts, between acceptance and the next steering boundary, the steered message is withdrawn although the sender holds `accepted`. Plugin steering on main already has this window. On main's restart model, a restart stops the child and wakes the parent, so the parent learns the child was interrupted and can resend. Making accepted steers survive a restart needs a replay-authority decision and is not part of this PR.

Split from openclaw#202111. The restart half of that PR is parked as reference, because main's own restart model now owns that class.

## Evidence

Real Gateway journey on a built Gateway (isolated state, real model), current main vs this branch. The parent spawns a child doing a 75 s exec, sends it a MARKER with `sessions_send`, then waits:

| | main (`e9b9f42d`) | this branch |
|---|---|---|
| `sessions_send` call → result | 30,066 ms, `error` | 74 ms, `accepted` / `steered` |
| Steered MARKER row in the child, and the MARKER in the child's final reply | 1 row, stamped; in the final reply | 1 row, stamped; in the final reply |

Tests:
- Steering receipt at acceptance (red on main: the steering-provenance test hangs 120 s, and the admission test returns `status: "timeout"`).
- The commit stamp is written for uncommitted messages.
- Steering custody is released exactly once when the receiving run ends, including the source-revoked case (the refused commit never reaches the transcript).
- The plugin steering contract now expects the stamp.
- Suites: sessions_send 11/13/132, user-turn transcript 89, steering custody 5, all green. tsgo and lint are clean.

Production code: +32 / −48 (net −16). The stamp now joins the admission write without an extra run-id comparison (session-identity ratchet). One drive-by lint fix: `agent-step.ts` drops a default `callGateway` type argument that the changed-lint lane flagged.

**Merge danger:**
- Two-way door: no schema, config or stored-state change.
- Blast radius: agents that steer a busy session with `sessions_send`, and plugin steering stamps.

Co-authored-by: Ayaan Zaidi <[email protected]>
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 21, 2026
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Closing to free a slot under the 20-open-PR cap. This was a parked reference marked 'Do not merge'. The branch stays, so it is still available as a reference.

@obviyus obviyus closed this Nov 26, 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 docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime P2 Normal backlog priority with limited blast radius. size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant