Skip to content

fix: Stop omits native descendant requester lifecycle - #181766

Merged
steipete merged 5 commits into
openclaw:mainfrom
enki:fix/exact-stop-requester-lifecycle
Oct 25, 2026
Merged

steipete merged 5 commits into
openclaw:mainfrom
enki:fix/exact-stop-requester-lifecycle

Conversation

@enki

@enki enki commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: stopping an exact Gateway run can stop its parent but leave native descendants running with a requester-generation error.

User Impact

User impact: exact Stop cancels the selected request's native descendants while preserving other requests, replacement sessions, and already accepted cancellation outcomes. No configuration or migration is required.

Why This Change Was Made

The reserved and indexed request paths omitted the selected physical session's lifecycle revision. Both now supply that revision only when the session ID matches, and retain the captured source identity across asynchronous metadata preparation. Native generation, custody, and live requester checks remain with their existing owners. Main's committed-cancellation callback is preserved.

Related: #181475 fixes retained-parent selection inside Codex; this fixes the earlier Gateway request producer. #174900 covers separate catalog and completion continuity.

Evidence

  • On unchanged main production, seven regressions fail: five exact-Stop routes omit the lifecycle revision and two metadata-preparation cases accept retargeted sources. The other 17 cases pass.
  • After integration: 67 Gateway tests passed in 308.98s and 12 native cancellation tests passed in 121.13s. These suites exercise real request/cancellation ownership with fixed external transport fixtures; their imports dominate wall time.
  • Added negative cases exercise foreign and revoked requesters through both reserved and indexed Gateway routes. The reserved route retains the parent cancellation accepted before revocation; native cancellation remains unconsumed. The native-owner regression explicitly checks zero turn/interrupt requests after revocation. Existing native tests cover authorized interruption/settlement and foreign custody.
  • Targeted core/extension oxlint, formatting of all four changed files, and diff whitespace checks pass. Two independent P0–P2 reviews found no actionable issues; the second includes the corrected accepted-parent assertion. Local native typecheck could not use the nested checkout’s shared compiler layout; exact-head PR CI supplies broad type proof.
  • CI found a test-only generic callback typing error: the observer mock erased the cancellation callback's return type. The observer is now separate from the real callback; behavior and authority checks are unchanged. Both affected reserved/indexed regressions passed again (540.19s total; 491.83s in the suite, dominated by cold compilation), and a fresh P0–P2 review of this correction found no actionable issue.
  • Final-head CI run 40157376307 is green, including all six test-type jobs; prior superseded checks do not apply to this head.
  • Production +57/-35 (net +22); tests +238/-34 (net +204). The production increase supplies the missing lifecycle on two distinct paths and shares the captured-identity assertion; further consolidation would mix different parent-settlement contracts.

A fresh Gateway-to-native live run was not performed: the existing tests do not expose that composition, and adding a new cross-boundary harness exceeds this bounded proof pass. The native tests exercise the real cancellation owner with a mocked app-server transport; they are not live-model evidence.

Original fix by @enki; contributor commits and authorship preserved.

@clawsweeper

clawsweeper Bot commented Oct 23, 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 size: M labels Oct 23, 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. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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 Oct 23, 2026
@clawsweeper

clawsweeper Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR carries the selected session’s lifecycle revision into exact-run descendant cancellation and preserves source identity during metadata preparation.

Example: Stop native-parent-run in physical session native-parent-session with lifecycle original-incarnation.

  • Before: The Gateway omits original-incarnation, so native selection can reject cancellation while descendants continue running.
  • After: Both exact-Stop paths pass the matching lifecycle revision while retaining requester and source checks.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused repair is source-supported and has no identified code defect, but required composed behavior and authority proof is still absent.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Exact Stop can leave native children running after stopping their parent.
Reason: Restores the documented cancellation contract with a bounded producer repair and no new user-facing policy or configuration.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open: it repairs a current-main cancellation defect using the existing owners, and source review found no actionable introduced bug.

Priority: P1
Reviewed head: 15844ea9f40dd605730a3d903ffcca00d3730bea

Before merge

  • Add real behavior proof - Authority-chain proof required: Gateway regressions substitute the cancellation harness, and the native regression substitutes the app-server client; neither composes the changed producer with real native interrupt I/O. The linked live evidence in fix(codex): Stop succeeds after parent thread reuse #181475 exercises the native monitor directly. For reserved and indexed exact Stop, provide redacted logs or terminal output showing authorized selected-child interruption and settlement, foreign-requester rejection, and revocation during preparation preventing interrupt I/O; redact credentials, IPs, phone numbers, and non-public endpoints. The prior review’s requested final-effect proof remains outstanding. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - Existing requester, generation, binding, and custody checks remain intact, with no concrete authorization bypass found.
  • Resolve merge risk - The PR owner must establish that the newly supplied generation cannot authorize native interruption for a foreign or revoked Gateway requester.

Findings

None.

Tests

  • Missing end-to-end proof: Supply a redacted Gateway-to-native trace for reserved and indexed exact Stop showing authorized interruption and settlement, foreign rejection, and revocation during preparation causing zero interrupt I/O.
Agent review details

How this fits together

Gateway chat.abort and sessions.abort select a captured run, prepare session metadata, and invoke the existing harness cancellation owner, which selects native children and interrupts their exact Codex turns.

flowchart TD
A[Stop request] --> B[Gateway requester authorization]
B --> C[Captured run and session metadata]
C --> D[Session Stop controller]
D --> E[Harness descendant cancellation]
E --> F[Codex native child selection]
F --> G[Interrupt and terminal settlement]
Loading

Technical review

Best possible solution:

Retain the focused producer fix and existing cancellation owners, then demonstrate authorized settlement and unauthorized rejection through Gateway exact Stop.

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

Current main omits lifecycleRevision at both exact-run producers, while native selection compares it against retained ownership; the PR reports matching red-on-base regressions, but this read-only review ran no target code.

Is this the best way to solve the issue?

The patch fixes metadata at its producer, reuses the session snapshot and cancellation owners, and retains distinct reserved/indexed settlement contracts without adding persistent state or a parallel cancellation path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9ff9d8837459.

Merge-risk options

Maintainer options:

  1. Verify the composed cancellation boundary (recommended)
    The PR owner supplies final-effect evidence through both exact-Stop routes before merge.

Provenance checked

  • Gateway exact-run Stop and captured identity keeps the original intent (36e277d: The session-controller cutover centralized turn, queue, and Stop ownership while retaining exact source custody through settlement.)
  • Native descendant cancellation generation and custody keeps the original intent (d4820c4: Carry cancellation authority and session generation through Gateway and native-child lifecycle while preserving unrelated children and confirmed outcomes.)
  • Retained-parent current-generation selection keeps the original intent (bdab17f: Accept exact current owner and request custody after native parent-thread reuse without weakening stale-generation fencing.)
  • Completed-run Stop outcome keeps the original intent (992724e: Return the successful no-active-run outcome when the captured run completes during asynchronous metadata preparation while protecting replacements.)

Testing

Proof path: in-process harness.

Security

Needs attention: Existing requester, generation, binding, and custody checks remain intact, with no concrete authorization bypass found.

Evidence

What I checked:

PR surface

Source +22, Tests +204. Total +226 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 57 35 +22
Tests 2 238 34 +204
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 295 69 +226

Review metrics

Metric Value Why it matters
Production versus test growth Production +57/-35; tests +238/-34 Production growth supplies lifecycle metadata on two paths and shares the identity assertion; tests cover distinct routing, retargeting, replacement, and requester-authority failures.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Exact Stop can cancel a parent while leaving its native descendants running, breaking an active agent-control workflow.
  • merge-risk: 🚨 security-boundary: The lifecycle revision participates in native cancellation selection across Gateway requester and Codex ownership boundaries.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof through Gateway exact Stop that authorized requesters settle their selected native children while foreign and revoked requesters cause zero interrupt I/O.

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 (2 earlier review cycles)
  • reviewed 2026-10-23T17:06:43.253Z sha dedf7ea :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-25T02:55:24.901Z sha 3059f9d :: needs real behavior proof before merge. :: none

Reviewed October 24, 2026, 11:18 PM ET / October 25, 2026, 03:18 UTC (Revision 3).

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 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. 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 Oct 25, 2026
@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 25, 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. 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 Oct 25, 2026
@steipete
steipete merged commit b92d4c9 into openclaw:main Oct 25, 2026
144 of 147 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
* fix(gateway): retain exact requester lifecycle during Stop

* test: verify exact Stop requester authority

* test: preserve generic callback in Stop authority proof

---------

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

Labels

extensions: codex gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants