Skip to content

fix: preserve requester recovery source for native subagents - #182046

Merged
steipete merged 2 commits into
openclaw:mainfrom
ericcaiwx-star:codex/rehearsal-native-recovery-20261024
Oct 24, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
ericcaiwx-star:codex/rehearsal-native-recovery-20261024

Conversation

@ericcaiwx-star

@ericcaiwx-star ericcaiwx-star commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #182042. Related: #182043, #182065.

What Problem This Solves

Native subagents started by a channel requester can lose their completion after a Gateway crash because command admission never saved their original requester source.

User Impact

Native children now retain the admitted requester facts needed by registry recovery. Recovery still checks the current child, requester incarnation, Gateway lifetime, and permissions before continuing. Existing runs with no saved source remain blocked; transcript text and delivery routes cannot recreate authority.

Why This Change Was Made

The exclusion at agent-command.ts:304 prevented native keys from reaching the existing claim producer. restoreChannelSubagentCompletionSource already consumes that private child claim and independently reauthorizes it. Removing the exclusion repairs that producer/consumer contract; main-session recovery still excludes delegated sessions.

Eric Cai's implementation and regression are unchanged. The maintainer integration only merges main d355f2fd148dd68486d863aba8b510adfa8005c2, preserving the original commit. Production: +3/-7 (net -4); tests: +16/-4 (net +12). No schema, configuration, or public API change; existing restart-recovery documentation already describes the intended behavior.

#182043 remains separate. Its missing source is on the parent settlement turn. Native launch capture omits the existing retainRequester opt-in, batch authority compares operator source/scopes rather than channel principals, and announce dispatch omits agentToolCaller. That is a capture/batch/settlement ownership question, not this child's claim producer. Selecting a requester for a mixed-principal batch is outside this fix. The contributor's combined crash reproduction also remains red for #182043. Cleanup settlement is separately owned by #182065. No unconditional resend or uncertain-send success is introduced here.

Evidence

Maintainer verification on integration head de0b7ffc0c98e9254add882052b879343d224b67:

  • Red on current main: the expanded regression with production agent-command.ts from d355f2fd148d produced 1 failed / 5 passed. The native-key case retained previous-child-command instead of next-child-command; this was an assertion failure at real command admission/SQLite claim persistence, not a fixture setup failure.
  • Green with the fix: pnpm test src/agents/agent-command.recovery-source.test.ts src/agents/subagents/registry/subagent-detached-recovery.restart-integration.test.ts --maxWorkers=1 passed 17/17 tests: 6 command regressions and 11 registry recovery cases. The native case proves main-recovery exclusion and terminal source cleanup; the registry suite covers restored channel sources, missing/mismatched sources, and requester reset. Per-file wall times were 59.85s and 164.15s on the loaded host, dominated by import/transform and existing worker-backed fixtures; cold worker preparation was separate. These tests exercise real admission, persistence and recovery owners with model/transport doubles.
  • pnpm tsgo:core and all 29 affected test type graphs passed. Targeted typed lint, two-file format check, and git diff --check passed.
  • Fresh committed-branch Codex autoreview: scoped-clean, no actionable P0–P2 findings. Personal source review covered admission, claim preparation, registry restoration, source lifetime and the sibling settlement path.
  • Exact-head CI: run 40053286039, attempt 1 completed with 39 successful jobs, 31 skipped, and one failing test job plus the downstream aggregate. security-fast passed. The two failures are the existing replaced-session metadata and off-page controller/collector assertions in sessions-list-persisted-worker.test.ts (job 120750780484); both also fail in original run 40046482472. The CI merge 47f3db8778b989d14460223bdff369559178d391 has main baseline 0d49ef7bd1c6fa024d76e962995a0f37aa93c74e and this exact PR head as parents. Its diff from baseline is only this PR’s two files; the failure fixture, list/read/projection owners and registry are byte-identical. Those seeded list/describe tests never execute changed command admission. The classifier had no comparable scheduled-main job and reported unknown; inspected source and original-run failures establish them as inherited. The maintainer then ran only these two cases with production command code from main d355f2fd148d: both failed with the same assertions (2 failed, 1 unselected/skipped); the fixed module was restored and the worktree is clean. Landing uses the authorized inherited-failure exception; CI is not relabeled green.

Audit context: the restart analysis covered 61 Gateway starts and recorded 985 interrupted subagent waits and 110 direct-announcement failures. Journal lines 254140–254141 and 254444 illustrate this recovery surface. Those counts are not an attribution of every event to this bug; the synthetic regression above establishes this defect. No live Gateway or Team state was touched.

The contributor's inspectable full-process, replacement-rejection and latest-stable upgrade evidence follows. Those runs retain their original SHAs and limitations; they are not represented as new maintainer executions.

Contributor runtime and upgrade evidence

Inspectable existing source-recovery behavior evidence

Scope and pinned inputs: the standalone source fix is e13f9030214a1654d1eb55dc2ad89d9dac2e4f65, based on 2fc557a9fb060befdb5443db5d3963fa2cd082bc. Combined integration commit 0a38fe2ad20e5c1b60051ee42159dffcc24abef5 contains that source fix plus the independent cleanup-settlement repair from #182065 (9aabdbf9fd73965afe18fdded712a93ae1289f6c on its own branch). Standalone source recovery, standalone downstream settlement failure, and combined settlement success are reported separately below.

This section contains actual archived driver/Gateway output and explicitly labeled selected audit fields. Newly executed final-effect and latest-stable upgrade evidence follows in the next section. No IPs, keys, phone numbers, non-public endpoints, or local usernames/checkout paths are published here. All retained IDs are synthetic fixtures.

Real entry path: the built openclaw.mjs gateway run --port <isolated-loopback-port> runs on Node 26.12.1 / macOS arm64 under an OS sandbox, with a fresh isolated HOME, state, workspace, and TMPDIR. Non-loopback outbound traffic and user-home reads/writes are denied. Only rehearsal-channel is loaded. rehearsal.ingress queues an inbound synthetic message; the channel lifecycle calls finalizeInboundContext → recordInboundSession → dispatchReplyWithBufferedBlockDispatcher. A controllable loopback HTTP openai-completions model supplies responses to the real host sessions_spawn, sessions_yield, and sessions_send tools. The test sendText implementation records its outbound effect and returns a synthetic platform message ID.

The driver invocation shape was python3 reproduce.py --source <source-or-integration-checkout> --scenario normal|active --label <fixture-label> --port <isolated-loopback-port>. This is redacted invocation documentation, not invented shell stdout. The archived driver logs do not separately store historical shell exit status. Their Gateway process termination records are reported explicitly; audits reopened SQLite read-only after the processes stopped. MODEL 3 logs a planned text response before the active-model hold barrier; repeated fixed text across a restarted physical run does not prove a duplicate business side effect.

Original baseline: native private requester source absent

Before the crash on baseline 2fc557a9fb060befdb5443db5d3963fa2cd082bc, the captured child entry has no source (selected exact fields from databases-before.json):

{
  "sessionKey": "agent:main:subagent:df6de26c-d1ed-402a-9543-20276121caba",
  "sessionId": "b6276a29-747b-4858-90f0-c4f124fc8f66",
  "lifecycleRevision": "ef79a73e-2f1b-4d1f-9273-563042702b40",
  "restartRecoveryRequesterSource": null,
  "restartRecoverySourceIngress": null,
  "restartRecoverySourceMessageChannel": null
}

Actual baseline Gateway log prefix; stack omitted to redact local checkout paths:

2026-10-24T08:18:06.334+08:00 [agents/subagents] subagent completion authority was not restored runId=44bdacd8-9e9e-409d-9912-02f4359d471b error={"name":"Error","message":"Subagent restart recovery lacks its original operator source" [stack omitted: private checkout paths]

The independent final audit records no parent receipt and no successful input completion; recovery-source failure occurs before the later settlement scenario can run.

{
  "label": "main-active-02",
  "sha": "2fc557a9fb060befdb5443db5d3963fa2cd082bc",
  "driverError": "same-child sessions_send recovery",
  "receipts": [],
  "inputCompletions": [],
  "allRegistryDeliverySettled": false
}

Standalone e13f903: ordinary completion passes

Actual archived driver stdout excerpt:

START before 34025
MODEL 1 parent {'name': 'tool_call', 'arguments': '{"id": "openclaw:core:sessions_spawn", "args": {"task": "CHILD_CASE=normal synthetic lifecycle only", "taskName": "native_normal_77232c42", "runtime": "subagent", "cleanup": "keep"}}'}
MODEL 2 parent {'name': 'sessions_yield', 'arguments': '{}'}
MODEL 3 child CHILD_RESULT_normal_77232c42
MODEL 4 parent PARENT_COMPLETION_normal_77232c42

Selected exact fields from the independent read-only SQLite audit (structured data, not raw Gateway stdout):

{
  "label": "final-normal-01",
  "sha": "e13f9030214a1654d1eb55dc2ad89d9dac2e4f65",
  "driverError": null,
  "quickCheck": {
    "global": "ok",
    "agent": "ok"
  },
  "registry": [
    {
      "runId": "8774e451-e178-4354-b199-7d53a2060c98",
      "childSessionKey": "agent:main:subagent:30118b5f-587c-40ff-8aca-db8aea316f91",
      "generation": 1,
      "requesterSessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-normal-77232c42",
      "execution": {
        "status": "terminal",
        "startedAt": 1792801662582,
        "lifecycleGeneration": "6bad0a52-22c4-49f5-a024-54858e26516d",
        "endedAt": 1792801663229,
        "outcome": {
          "status": "ok",
          "startedAt": 1792801662582,
          "endedAt": 1792801663229,
          "elapsedMs": 647
        }
      },
      "delivery": {
        "status": "delivered",
        "disposition": "delivered",
        "deliveredAt": 1792801663721,
        "announcedAt": 1792801663721
      },
      "wake": null
    }
  ],
  "deliveryQueue": [],
  "pendingInputs": [],
  "beforeTranscriptRows": null,
  "afterTranscriptRows": 27,
  "changedOrMissingBeforeTranscriptRows": [],
  "inputCompletions": [
    {
      "session_key": "agent:main:synthetic:synthetic:direct:syn-owner-normal-77232c42",
      "session_id": "be50851b-e3c8-4dcc-9bbf-069773834f1c",
      "idempotency_key": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-normal-77232c42:8774e451-e178-4354-b199-7d53a2060c98:yield-1:user",
      "run_id": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-normal-77232c42:8774e451-e178-4354-b199-7d53a2060c98:yield-1",
      "request_hash": "317babe1b717c37aa3b90fef7eac5c1dffb73ddc6de67049e41a6e2191e4325a",
      "outcome_json": {
        "reason": "completed",
        "status": "ok",
        "stopReason": "stop",
        "livenessState": "working"
      },
      "succeeded": 1,
      "completed_at": 1792801663719
    }
  ],
  "receipts": [
    {
      "time": 1792801663688,
      "type": "outbound",
      "to": "synthetic:SYN-OWNER-normal-77232c42",
      "accountId": "synthetic",
      "text": "PARENT_COMPLETION_normal_77232c42",
      "messageId": "SYN-OUT-a21c7a81-4536-401f-b677-5ab1908f866b"
    }
  ],
  "allRegistryDeliverySettled": true,
  "realChannelAcceptance": "NOT_RUN",
  "codexProviderAcceptance": "NOT_RUN"
}

Captured Gateway process record:

[
  {
    "label": "before",
    "pid": 34025,
    "termination": "SIGTERM",
    "exit": 0
  }
]

Standalone e13f903: source persists and same-child continuation passes; durable settlement still fails

Before process death, the same production admission path now writes the native child private claim. Selected exact persisted fields:

{
  "sessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
  "sessionId": "a3caf3b0-4249-4eaa-9b96-c44d03f2cc0d",
  "lifecycleRevision": "450e05b9-d482-4340-89c5-2c7c09f96a55",
  "restartRecoveryRequesterSource": {
    "agentId": "main",
    "sessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
    "sessionId": "a3caf3b0-4249-4eaa-9b96-c44d03f2cc0d",
    "lifecycleRevision": "450e05b9-d482-4340-89c5-2c7c09f96a55",
    "sourceRunId": "681c07e3-b540-44a6-bd78-f64ea3edcced",
    "requesterOrigin": {
      "sessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8",
      "messageProvider": "synthetic",
      "accountId": "synthetic",
      "chatType": "direct",
      "senderId": "SYN-OWNER-active-4c2421b8"
    }
  },
  "restartRecoverySourceIngress": "channel",
  "restartRecoverySourceMessageChannel": "synthetic"
}

Actual archived driver stdout excerpt:

START before 34127
MODEL 1 parent {'name': 'tool_call', 'arguments': '{"id": "openclaw:core:sessions_spawn", "args": {"task": "CHILD_CASE=active synthetic lifecycle only", "taskName": "native_active_4c2421b8", "runtime": "subagent", "cleanup": "keep"}}'}
MODEL 2 parent {'name': 'sessions_yield', 'arguments': '{}'}
MODEL 3 child CHILD_RESULT_active_4c2421b8
START after 34408
MODEL 4 parent {'name': 'tool_call', 'arguments': '{"id": "openclaw:core:sessions_send", "args": {"sessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3", "message": "CHILD_CASE=active continue synthetic text-only work after old process death", "timeoutSeconds": 30}}'}
MODEL 5 child CHILD_RESULT_active_4c2421b8
MODEL 6 parent PARENT_COMPLETION_active_4c2421b8
PROBE_ERROR durable delivery/settlement failed

Exact selected host tool-event fields demonstrate the allowed continuation reaches the same child session:

{
  "time": 1792801682707,
  "type": "after_tool_call",
  "toolName": "sessions_send",
  "params": {
    "sessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
    "message": "CHILD_CASE=active continue synthetic text-only work after old process death",
    "timeoutSeconds": 30
  },
  "requesterRunId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8:681c07e3-b540-44a6-bd78-f64ea3edcced:yield-1",
  "result": {
    "runId": "55b4becb-df81-4048-8c54-5ca6a6f7653f",
    "sessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
    "status": "ok",
    "delivery": {
      "status": "skipped"
    },
    "reply": "CHILD_RESULT_active_4c2421b8"
  }
}

Selected exact durable audit fields; this is not an overall restart pass:

{
  "label": "final-active-01",
  "sha": "e13f9030214a1654d1eb55dc2ad89d9dac2e4f65",
  "driverError": "durable delivery/settlement failed",
  "quickCheck": {
    "global": "ok",
    "agent": "ok"
  },
  "registry": [
    {
      "runId": "681c07e3-b540-44a6-bd78-f64ea3edcced",
      "childSessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
      "generation": 1,
      "requesterSessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8",
      "execution": {
        "status": "terminal",
        "startedAt": 1792801669509,
        "lifecycleGeneration": "dfc4e090-767e-46ad-8b4f-1de1fe11aa09",
        "endedAt": 1792801676398,
        "outcome": {
          "status": "error",
          "error": "Subagent execution was interrupted by a Gateway restart. Inspect retained session history and uncertain tool outcomes, then continue the child with a follow-up or assign replacement work.",
          "startedAt": 1792801669509,
          "endedAt": 1792801676398,
          "elapsedMs": 6889
        },
        "interruptionReason": "gateway-restart",
        "suppressSessionEffects": true
      },
      "delivery": {
        "status": "pending",
        "disposition": "intentional_non_delivery",
        "lastError": "completion_handoff_pending"
      },
      "wake": {
        "status": "dispatching",
        "attemptCount": 1,
        "batchRunIds": [
          "681c07e3-b540-44a6-bd78-f64ea3edcced"
        ],
        "requesterYieldBatch": true,
        "yieldedFinalDeliverable": true,
        "rearmGeneration": 1
      }
    },
    {
      "runId": "55b4becb-df81-4048-8c54-5ca6a6f7653f",
      "childSessionKey": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
      "generation": 2,
      "requesterSessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8",
      "requesterTurnRunId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8:681c07e3-b540-44a6-bd78-f64ea3edcced:yield-1",
      "execution": {
        "status": "terminal",
        "startedAt": 1792801682512,
        "lifecycleGeneration": "9a8857ca-823c-42ec-8348-b7e8f00aabad",
        "endedAt": 1792801682655,
        "outcome": {
          "status": "ok",
          "startedAt": 1792801682512,
          "endedAt": 1792801682655,
          "elapsedMs": 143
        }
      },
      "delivery": {
        "status": "delivered",
        "announcedAt": 1792801682696
      },
      "wake": null
    }
  ],
  "deliveryQueue": [],
  "pendingInputs": [],
  "beforeTranscriptRows": 21,
  "afterTranscriptRows": 33,
  "changedOrMissingBeforeTranscriptRows": [],
  "inputCompletions": [
    {
      "session_key": "agent:main:subagent:8e302113-812e-46b0-8171-02bac79f4ee3",
      "session_id": "a3caf3b0-4249-4eaa-9b96-c44d03f2cc0d",
      "idempotency_key": "55b4becb-df81-4048-8c54-5ca6a6f7653f:user",
      "run_id": "55b4becb-df81-4048-8c54-5ca6a6f7653f",
      "request_hash": "f8b7648370fd3bd8daab9a37a574ae85210c28be83d75368fc519df703a145e5",
      "outcome_json": {
        "reason": "completed",
        "status": "ok",
        "stopReason": "stop",
        "livenessState": "working"
      },
      "succeeded": 1,
      "completed_at": 1792801682688
    },
    {
      "session_key": "agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8",
      "session_id": "9b2f37d8-3ef0-4e23-96db-51721bdcc990",
      "idempotency_key": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8:681c07e3-b540-44a6-bd78-f64ea3edcced:yield-1:user",
      "run_id": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8:681c07e3-b540-44a6-bd78-f64ea3edcced:yield-1",
      "request_hash": "9c7b56e227573c767a264257d4851f8083fca51a773a7d9694f9990a5dd11425",
      "outcome_json": {
        "reason": "completed",
        "status": "ok",
        "stopReason": "stop",
        "livenessState": "working"
      },
      "succeeded": 1,
      "completed_at": 1792801682889
    }
  ],
  "receipts": [
    {
      "time": 1792801682846,
      "type": "outbound",
      "to": "synthetic:SYN-OWNER-active-4c2421b8",
      "accountId": "synthetic",
      "text": "PARENT_COMPLETION_active_4c2421b8",
      "messageId": "SYN-OUT-962bbb76-5c6f-4924-b30a-e070c5956849"
    }
  ],
  "allRegistryDeliverySettled": false,
  "realChannelAcceptance": "NOT_RUN",
  "codexProviderAcceptance": "NOT_RUN"
}

Actual Gateway error excerpt:

2026-10-24T08:28:02.894+08:00 [agents/subagent-registry] requester settle wake failed error={"name":"SubagentRegistryMutationRejectedError","message":"Subagent completion owner changed before mutation"} runId=681c07e3-b540-44a6-bd78-f64ea3edcced requesterSessionKey=agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8
2026-10-24T08:28:02.894+08:00 [agents/subagent-registry] failed to persist requester settle wake rejection error={"name":"SubagentRegistryMutationRejectedError","message":"Subagent completion owner changed before mutation"} runId=681c07e3-b540-44a6-bd78-f64ea3edcced
2026-10-24T08:28:02.896+08:00 [agents/subagent-registry] requester settle wake failed error={"name":"SubagentRegistryMutationRejectedError","message":"Subagent completion owner changed before mutation"} runId=681c07e3-b540-44a6-bd78-f64ea3edcced requesterSessionKey=agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8
2026-10-24T08:28:02.896+08:00 [agents/subagent-registry] failed to persist requester settle wake rejection error={"name":"SubagentRegistryMutationRejectedError","message":"Subagent completion owner changed before mutation"} runId=681c07e3-b540-44a6-bd78-f64ea3edcced
2026-10-24T08:29:01.187+08:00 [agents/subagent-registry] requester settle wake failed error={"name":"SubagentRegistryMutationRejectedError","message":"Subagent completion owner changed before mutation"} runId=681c07e3-b540-44a6-bd78-f64ea3edcced requesterSessionKey=agent:main:synthetic:synthetic:direct:syn-owner-active-4c2421b8
2026-10-24T08:29:01.187+08:00 [agents/subagent-registry] failed to persist requester settle wake rejection error={"name":"SubagentRegistryMutationRejectedError","message":"Subagent completion owner changed before mutation"} runId=681c07e3-b540-44a6-bd78-f64ea3edcced

The original interrupted run 681c07e3-b540-44a6-bd78-f64ea3edcced remains pending / dispatching, while the new physical run 55b4becb-df81-4048-8c54-5ca6a6f7653f in the same child is delivered and exactly one parent completion exists. Thus this PR's requester-source repair reaches the intended continuation, but the separate cleanup-owner defect still blocks full settlement on standalone e13f903. No transient marker snapshot is invented from this run.

Combined 0a38fe2: complete normal and active-restart settlement

The following previously executed full-process evidence combines both independent repairs. It demonstrates combined behavior, not standalone acceptance of either PR. Driver SHA-256 is 8264fac01c2a4559882d9e9c8cd5221257a9bfb133a2f6cef93667578cc14de6; both inputs record sourcePatchSha256: null.

Combined fixed normal run

Actual archived driver stdout excerpt:

START before 57781
MODEL 1 parent {'name': 'tool_call', 'arguments': '{"id": "openclaw:core:sessions_spawn", "args": {"task": "CHILD_CASE=normal synthetic lifecycle only", "taskName": "native_normal_ab932683", "runtime": "subagent", "cleanup": "keep"}}'}
MODEL 2 parent {'name': 'sessions_yield', 'arguments': '{}'}
MODEL 3 child CHILD_RESULT_normal_ab932683
MODEL 4 parent PARENT_COMPLETION_normal_ab932683

Selected exact SQLite audit fields; normal has no pre-crash snapshot because it does not restart:

{
  "label": "fn1",
  "sha": "0a38fe2ad20e5c1b60051ee42159dffcc24abef5",
  "processes": [
    {
      "label": "before",
      "pid": 57781,
      "termination": "SIGTERM",
      "exit": 0
    }
  ],
  "quickCheck": {
    "global": "ok",
    "agent": "ok"
  },
  "registry": [
    {
      "runId": "97ea3dec-e2fd-4b7e-8909-1276e5f6da57",
      "childSessionKey": "agent:main:subagent:98b79256-3676-4a73-848f-40c4c3260b15",
      "generation": 1,
      "requesterSessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-normal-ab932683",
      "requesterTurnRunId": null,
      "execution": {
        "status": "terminal",
        "startedAt": 1792803267904,
        "lifecycleGeneration": "d2bba5c0-fd89-4449-b598-1654102e5966",
        "endedAt": 1792803268922,
        "outcome": {
          "status": "ok",
          "startedAt": 1792803267904,
          "endedAt": 1792803268922,
          "elapsedMs": 1018
        }
      },
      "delivery": {
        "status": "delivered",
        "disposition": "delivered",
        "deliveredAt": 1792803269416,
        "announcedAt": 1792803269416
      },
      "requesterSettleWake": null,
      "cleanupHandled": true,
      "cleanupCompletedAt": 1792803269057
    }
  ],
  "deliveryQueueCount": 0,
  "pendingInputCount": 0,
  "inputCompletions": [
    {
      "run_id": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-normal-ab932683:97ea3dec-e2fd-4b7e-8909-1276e5f6da57:yield-1",
      "succeeded": 1,
      "outcome": {
        "reason": "completed",
        "status": "ok",
        "stopReason": "stop",
        "livenessState": "working"
      }
    }
  ],
  "beforeTranscriptRows": null,
  "afterTranscriptRows": 27,
  "receipts": [
    {
      "time": 1792803269385,
      "type": "outbound",
      "to": "synthetic:SYN-OWNER-normal-ab932683",
      "accountId": "synthetic",
      "text": "PARENT_COMPLETION_normal_ab932683",
      "messageId": "SYN-OUT-a4543ad6-ea59-4fcc-9ddc-ca2dcf6f65c2"
    }
  ],
  "allRegistryDeliverySettled": true
}

Combined fixed active crash/restart run

Actual archived driver stdout excerpt:

START before 57915
MODEL 1 parent {'name': 'tool_call', 'arguments': '{"id": "openclaw:core:sessions_spawn", "args": {"task": "CHILD_CASE=active synthetic lifecycle only", "taskName": "native_active_66c874be", "runtime": "subagent", "cleanup": "keep"}}'}
MODEL 2 parent {'name': 'sessions_yield', 'arguments': '{}'}
MODEL 3 child CHILD_RESULT_active_66c874be
START after 58177
MODEL 4 parent {'name': 'tool_call', 'arguments': '{"id": "openclaw:core:sessions_send", "args": {"sessionKey": "agent:main:subagent:ee4113c7-d784-40a8-bf65-304e46e65c59", "message": "CHILD_CASE=active continue synthetic text-only work after old process death", "timeoutSeconds": 30}}'}
MODEL 5 child CHILD_RESULT_active_66c874be
MODEL 6 parent PARENT_COMPLETION_active_66c874be

Actual post-restart Gateway log excerpt:

2026-10-24T08:54:36.959+08:00 [gateway] agent model: synthetic/mock (thinking=off, fast=off)
2026-10-24T08:54:36.959+08:00 [gateway] http server listening (1 plugin: rehearsal-channel; 2.8s)
2026-10-24T08:54:45.564+08:00 [agents/agent-command] [agent] run announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be:1a042739-45c8-4018-a8a7-373370047405:yield-1 ended with stopReason=stop
2026-10-24T08:54:46.140+08:00 [shutdown] completed cleanly in 204ms

The driver held the child model response, then killed the entire pre-restart Gateway process group (exit: -9). The new Gateway completed the native requester-settle wake and invoked sessions_send into the same child session. The resumed physical run is generation 2; the old generation remains an interrupted terminal error with suppressSessionEffects: true. Normal final shutdown exited 0. MODEL 3 above logs a planned synthetic response before the hold barrier; its repeated text is not evidence of a duplicated business action.

Exact read-only SQLite audit output for the active run (whole audit object, not raw Gateway stdout):

{
  "label": "fa1",
  "sha": "0a38fe2ad20e5c1b60051ee42159dffcc24abef5",
  "processes": [
    {
      "label": "before",
      "pid": 57915,
      "termination": "forced-kill-process-group",
      "exit": -9
    },
    {
      "label": "after",
      "pid": 58177,
      "termination": "SIGTERM",
      "exit": 0
    }
  ],
  "quickCheck": {
    "global": "ok",
    "agent": "ok"
  },
  "registry": [
    {
      "runId": "1a042739-45c8-4018-a8a7-373370047405",
      "childSessionKey": "agent:main:subagent:ee4113c7-d784-40a8-bf65-304e46e65c59",
      "generation": 1,
      "requesterSessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be",
      "requesterTurnRunId": null,
      "execution": {
        "status": "terminal",
        "startedAt": 1792803271316,
        "lifecycleGeneration": "94796b0f-5a92-4d0e-b96d-d592f6ac6d97",
        "endedAt": 1792803279002,
        "outcome": {
          "status": "error",
          "error": "Subagent execution was interrupted by a Gateway restart. Inspect retained session history and uncertain tool outcomes, then continue the child with a follow-up or assign replacement work.",
          "startedAt": 1792803271316,
          "endedAt": 1792803279002,
          "elapsedMs": 7686
        },
        "interruptionReason": "gateway-restart",
        "suppressSessionEffects": true
      },
      "delivery": {
        "status": "delivered",
        "disposition": "delivered",
        "deliveredAt": 1792803285576,
        "announcedAt": 1792803285576
      },
      "requesterSettleWake": null,
      "cleanupHandled": true,
      "cleanupCompletedAt": 1792803285354
    },
    {
      "runId": "49102e0e-e0c8-4a31-90ac-8019ff8a581d",
      "childSessionKey": "agent:main:subagent:ee4113c7-d784-40a8-bf65-304e46e65c59",
      "generation": 2,
      "requesterSessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be",
      "requesterTurnRunId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be:1a042739-45c8-4018-a8a7-373370047405:yield-1",
      "execution": {
        "status": "terminal",
        "startedAt": 1792803285158,
        "lifecycleGeneration": "df6b0d80-1087-4e45-91f6-c139f0752b56",
        "endedAt": 1792803285322,
        "outcome": {
          "status": "ok",
          "startedAt": 1792803285158,
          "endedAt": 1792803285322,
          "elapsedMs": 164
        }
      },
      "delivery": {
        "status": "delivered",
        "announcedAt": 1792803285387
      },
      "requesterSettleWake": null,
      "cleanupHandled": true,
      "cleanupCompletedAt": 1792803285392
    }
  ],
  "deliveryQueueCount": 0,
  "pendingInputCount": 0,
  "sessions": [
    {
      "sessionKey": "agent:main:subagent:ee4113c7-d784-40a8-bf65-304e46e65c59",
      "sessionId": "59006ac7-2861-4982-acbe-1910707de468",
      "pendingFinalDelivery": null,
      "terminalDeliveryEvidence": null
    },
    {
      "sessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be",
      "sessionId": "8ccbf21a-54b2-4990-bbf8-2342a62eae07",
      "pendingFinalDelivery": null,
      "terminalDeliveryEvidence": [
        {
          "runId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be:1a042739-45c8-4018-a8a7-373370047405:yield-1",
          "captured": true,
          "payloads": [
            {
              "visible": true
            }
          ],
          "deliveryStatus": {
            "status": "sent",
            "resultCount": 1
          },
          "deliveryContext": {
            "channel": "synthetic",
            "to": "synthetic:SYN-OWNER-active-66c874be",
            "accountId": "synthetic"
          },
          "durableFinalReceipt": {
            "intentId": "66cf1e3a-b815-4899-9cdb-77c5938bf12b",
            "deliveryId": "94c478d2-4a42-499d-a2aa-64157c491927",
            "platformMessageId": "SYN-OUT-66a4c4ef-d9cc-4d20-bd1c-6e58c726ef4a"
          }
        }
      ]
    }
  ],
  "inputCompletions": [
    {
      "run_id": "49102e0e-e0c8-4a31-90ac-8019ff8a581d",
      "succeeded": 1,
      "outcome": {
        "reason": "completed",
        "status": "ok",
        "stopReason": "stop",
        "livenessState": "working"
      }
    },
    {
      "run_id": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66c874be:1a042739-45c8-4018-a8a7-373370047405:yield-1",
      "succeeded": 1,
      "outcome": {
        "reason": "completed",
        "status": "ok",
        "stopReason": "stop",
        "livenessState": "working"
      }
    }
  ],
  "beforeTranscriptRows": 21,
  "afterTranscriptRows": 33,
  "changedOrMissingBeforeTranscriptRows": [],
  "receipts": [
    {
      "time": 1792803285532,
      "type": "outbound",
      "to": "synthetic:SYN-OWNER-active-66c874be",
      "accountId": "synthetic",
      "text": "PARENT_COMPLETION_active_66c874be",
      "messageId": "SYN-OUT-66a4c4ef-d9cc-4d20-bd1c-6e58c726ef4a"
    }
  ],
  "allRegistryDeliverySettled": true
}

The durable parent receipt's platformMessageId matches the single raw test-transport event. Both original and continuation rows are delivered with no wake. The two input completions succeeded, the outbound queue and pending input table are empty, and pendingFinalDelivery is absent for both sessions. The audit compares every captured column/byte of the 21 pre-crash transcript rows by (session_id, seq); all 21 are unchanged among 33 final rows. It does not assert that a new physical run or a second logical registration is forbidden.

Audit execution: python3 verify-existing-sqlite.py was executed read-only against these retained stopped databases after inspecting the driver, transport, raw logs, and prior independent audits. It exited 0. It checks both SQLite quick_check results, original-vs-fixed settlement state, the single transport receipt, empty queue/input tables, absent pending-final state, and unchanged pre-crash transcript records. Its structured JSON above is a new audit result, not a reconstruction of historical stdout.

The same combined evidence has now been accepted by #182065's completed re-review as inspectable shipped-entry proof for its own cleanup-settlement scope. That acceptance does not clear this PR's distinct requester/child final-effect or latest-stable compatibility requirements.

Existing producer regression output

The admission table was executed through node scripts/run-vitest.mjs src/agents/agent-command.recovery-source.test.ts --maxWorkers=1. Actual archived baseline excerpt (new test with unchanged baseline production code):

 FAIL  |infra| src/agents/agent-command.recovery-source.test.ts > keeps direct command steering bound to its admitted claim with predecessor custody settled in subagent
AssertionError: expected { …(16) } to match object { …(3) }
(23 matching properties omitted from actual)

- Expected
+ Received

  {
-   "restartRecoveryDeliveryRunId": "next-child-command",
-   "restartRecoveryDeliverySourceRunId": "next-child-command",
+   "restartRecoveryDeliveryRunId": "previous-child-command",
+   "restartRecoveryDeliverySourceRunId": "previous-child-command",
    "restartRecoveryTerminalRunIds": [
      "previous-child-command",
    ],
  }


      Tests  1 failed | 5 passed (6)
[test] FAILED (exit 1)

Actual archived candidate output:

 ✓ |infra| src/agents/agent-command.recovery-source.test.ts > keeps admitted final ownership across post-run cache publication (successor: false) 3054ms
 ✓ |infra| src/agents/agent-command.recovery-source.test.ts > keeps admitted final ownership across post-run cache publication (successor: true) 622ms
 ✓ |infra| src/agents/agent-command.recovery-source.test.ts > keeps direct command steering bound to its admitted claim with predecessor custody settled in dashboard 631ms
 ✓ |infra| src/agents/agent-command.recovery-source.test.ts > keeps direct command steering bound to its admitted claim with predecessor custody settled in subagent 630ms
 ✓ |infra| src/agents/agent-command.recovery-source.test.ts > keeps direct command steering bound to its admitted claim with predecessor custody unresolved in dashboard 603ms
 ✓ |infra| src/agents/agent-command.recovery-source.test.ts > keeps direct command steering bound to its admitted claim with predecessor custody terminal-pending in dashboard 574ms
      Tests  6 passed (6)
[test] passed 1 Vitest shard in 41.67s

These archived test logs do not independently encode a Git SHA header; their pinned baseline/candidate association is retained in the existing author evidence records. They are not promoted here into a new execution or an unrecorded exact-head rerun.

Limits of this existing-evidence section: real production state, real QQ/WeChat login or send/receive, live providers/Codex, and business-side-effect acceptance were not run. The active case permits same-child physical continuation and legitimate wake replay. The pending-parent case remains unresolved in #182043 even with both fixes. The fresh-state results and unit boundaries above are separate from the newly executed final-effect and latest-stable controls below.

Executed authority-chain and latest-stable proof — October 24, 2026

All new captures use the unchanged, already-built exact PR head or explicitly combined commit, fresh synthetic state, the real Gateway, the host synthetic-channel ingress, public sessions.reset, and a controllable HTTP provider. The OS policy denies user-directory access and external network access. There is no production data or real channel/provider account. No product code, authority contract, database row, check status, or published history was changed for this proof.

The native pre-provider barrier is the normal before_model_resolve plugin hook. The existing host reasserts admission immediately after that awaited hook (src/agents/embedded-agent-runner/run/setup.ts:124), including abort, prepared source, and lifecycle authority (run-entry.ts:115-120). Reset preempts and joins old work before publishing a new incarnation; this proof does not swap an identity beneath a live turn.

The blocks below are selected fields from a newly executed read-only auditor, not invented historical stdout. node verify-new-proof.mjs exited 0, reading the archived SQLite/JSON captures, checking integrity, matching admitted claims and inputs, and comparing old transcript values. Raw driver and Gateway excerpts are separately labeled.

Recovered requester replacement and profileless continuation revocation

Exact standalone head e13f9030214a1654d1eb55dc2ad89d9dac2e4f65. Actual command: python3 security.py --source <e13-checkout> --scenario active --negative requester-reset --label nr3 --port <isolated-port>; driver exit 0.

The initial native child was admitted with its private requester claim, then the task-owned Gateway was killed. After restart, the actual announce:requester-settle run reached the pre-provider hook. A public requester reset began, its lifecycle log confirmed the held owner was aborted, the hook was released, and reset successfully committed a new lifecycle revision. The durable input receipt records that exact recovered run as cancelled. Provider requests remained at the three made before the crash, no transport effect followed recovery, and another clean restart admitted no stale work.

This channel source is profileless: its real revocation is requester incarnation/lifetime invalidation. It has no device/profile grant to revoke. No synthetic device revocation is claimed.

{
  "label": "nr3",
  "sha": "e13f9030214a1654d1eb55dc2ad89d9dac2e4f65",
  "gatewayExits": [
    {
      "label": "before",
      "exit": -9
    },
    {
      "label": "after",
      "exit": 0
    },
    {
      "label": "replacement-restart",
      "exit": 0
    }
  ],
  "originalRunId": "759f044b-2a39-4f03-8b81-970871c2f857",
  "barrierRunId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66dbc258:759f044b-2a39-4f03-8b81-970871c2f857:yield-1",
  "retainedChildSource": [
    {
      "agentId": "main",
      "sessionKey": "agent:main:subagent:7cc661da-6f16-4b3c-8559-f749586eaf73",
      "sessionId": "5617945e-9ee9-4765-8c0a-57add5d69580",
      "lifecycleRevision": "379cd746-7272-44a9-8f72-0edfe90405e3",
      "sourceRunId": "759f044b-2a39-4f03-8b81-970871c2f857",
      "requesterOrigin": {
        "sessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-66dbc258",
        "messageProvider": "synthetic",
        "accountId": "synthetic",
        "chatType": "direct",
        "senderId": "SYN-OWNER-active-66dbc258"
      }
    }
  ],
  "resetPreemptedOldOwner": true,
  "oldRequesterRevision": null,
  "newRequesterRevision": "20e93549-c7c4-4af1-ba52-ae72fa91214c",
  "recoveredProviderRequests": 0,
  "recoveredTransportEvents": 0,
  "secondRestartRequests": 0,
  "durableCancellation": [
    {
      "session_key": "agent:main:synthetic:synthetic:direct:syn-owner-active-66dbc258",
      "session_id": "0090afc8-7957-4c4f-9bc1-edf202027c03",
      "idempotency_key": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66dbc258:759f044b-2a39-4f03-8b81-970871c2f857:yield-1:user",
      "run_id": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-66dbc258:759f044b-2a39-4f03-8b81-970871c2f857:yield-1",
      "request_hash": "51f40c5da16c05c0a3335db87bf7dceef03a1eec0145bd91d1a6e5ae384fac0d",
      "outcome_json": "{\"reason\":\"cancelled\",\"status\":\"error\",\"stopReason\":\"rpc\"}",
      "succeeded": 0,
      "completed_at": 1792806423918,
      "outcome": {
        "reason": "cancelled",
        "status": "error",
        "stopReason": "rpc"
      }
    }
  ],
  "activePendingInputs": 0,
  "outboundQueue": 0
}

Raw Gateway log excerpts, redacted:

2026-10-24T09:47:04.908+08:00 [sessions/lifecycle] session lifecycle queue waiting pid=85583 threadId=0 isMainThread=true diagnosticEpoch=4593e836f49393e0 omittedObservations=0 operationId=3 operation=mutation mutationKind=reset sessionScopeHash=ea20bb25ce63e947e51de2c26291b2378810ce21e763e025102280ff0db227bc identityCount=2 operationTraceId=d4a0bdc7718b01e99414999b9b0f60ed operationSpanId=67621b9505a20525 queueKind=lifecycle identityHash=ea20bb25ce63e947e51de2c26291b2378810ce21e763e025102280ff0db227bc waitMs=1000 holderObserved=true holderOperationId=1 holderOperation=lifecycle holderSessionScopeHash=ea20bb25ce63e947e51de2c26291b2378810ce21e763e025102280ff0db227bc holderPhase=run holderElapsedMs=2085 holderSignalAborted=true
2026-10-24T09:47:04.973+08:00 [agent/embedded] before_model_resolve hook failed: AbortError: agent run aborted
2026-10-24T09:47:05.289+08:00 [ws] ⇄ res ✓ sessions.reset 1399ms bytes=1219 conn=bdcbcf3c…e7c7 id=2:eccecabb-e…737e

Same-child recovered physical execution rejected before provider I/O

Explicit combined commit 0a38fe2ad20e5c1b60051ee42159dffcc24abef5 (this producer patch plus #182065); not a standalone full-settlement claim. Actual command: python3 recovered-child-boundary.py --source <combined-checkout> --scenario active --label rc2 --port <isolated-port>; driver exit 0.

After an actual crash, the restored parent invoked the host sessions_send on the same child. A new physical run reached the native pre-provider hook with a real queued input and registry generation. The original private claim correctly remained with its unsettled predecessor; it was not rewritten for every physical run. Public reset preempted that new execution and committed the new child incarnation. The normal post-hook host assertion rejected the cancelled execution before its provider request. There was one child provider request before the crash and zero recovered-child provider requests. A still-authorized parent sent one explicit cancellation notice; it did not deliver the cancelled child's result. After settlement and another restart, no model request was added.

An authorized parent cancellation notice is not a stale child effect. This control intentionally preserves that behavior instead of prohibiting all provider work, delivery, or legitimate wake replay.

{
  "label": "rc2",
  "sha": "0a38fe2ad20e5c1b60051ee42159dffcc24abef5",
  "gatewayExits": [
    {
      "label": "before",
      "exit": -9
    },
    {
      "label": "recovered",
      "exit": 0
    },
    {
      "label": "after",
      "exit": 0
    }
  ],
  "originalRunId": "c9d7bc99-d494-4cd1-b49f-3f0e8a71c5c8",
  "recoveredPhysicalRunId": "1a433d95-c953-491b-b0ab-998afd7363c6",
  "childSessionKey": "agent:main:subagent:b6916904-53de-466b-92f5-8fd28d9186d5",
  "originalClaimUnchangedThroughRecovery": true,
  "retainedPrivateSource": {
    "agentId": "main",
    "sessionKey": "agent:main:subagent:b6916904-53de-466b-92f5-8fd28d9186d5",
    "sessionId": "5c9c5659-7efc-4d32-a375-73c09fe1d5a6",
    "lifecycleRevision": "33f51a96-f455-483d-bc94-45bd51ac3e6f",
    "sourceRunId": "c9d7bc99-d494-4cd1-b49f-3f0e8a71c5c8",
    "requesterOrigin": {
      "sessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-active-0d827e8b",
      "messageProvider": "synthetic",
      "accountId": "synthetic",
      "chatType": "direct",
      "senderId": "SYN-OWNER-active-0d827e8b"
    }
  },
  "admittedNewPhysicalInput": {
    "runId": "1a433d95-c953-491b-b0ab-998afd7363c6",
    "sessionId": "5c9c5659-7efc-4d32-a375-73c09fe1d5a6",
    "state": "queued",
    "lifecycleGeneration": "38e2a1a1-08aa-4b4e-a959-aa8c207b965f"
  },
  "resetPreemptedOwner": true,
  "oldChildRevision": "33f51a96-f455-483d-bc94-45bd51ac3e6f",
  "newChildRevision": "753d76bc-98d1-43d4-84c3-ce33495ea37b",
  "originalChildProviderRequests": 1,
  "recoveredChildProviderRequests": 0,
  "authorizedParentCancellationNotices": 1,
  "secondRestartProviderRequests": 0,
  "registry": [
    {
      "runId": "c9d7bc99-d494-4cd1-b49f-3f0e8a71c5c8",
      "execution": {
        "status": "terminal",
        "startedAt": 1792807169916,
        "lifecycleGeneration": "4e1dd5b1-b02a-4a9e-98c0-f6cb4500bd75",
        "endedAt": 1792807176452,
        "outcome": {
          "status": "error",
          "error": "Subagent execution was interrupted by a Gateway restart. Inspect retained session history and uncertain tool outcomes, then continue the child with a follow-up or assign replacement work.",
          "startedAt": 1792807169916,
          "endedAt": 1792807176452,
          "elapsedMs": 6536
        },
        "interruptionReason": "gateway-restart",
        "suppressSessionEffects": true
      },
      "delivery": {
        "status": "delivered",
        "disposition": "delivered",
        "deliveredAt": 1792807184624,
        "announcedAt": 1792807184624
      },
      "wake": null
    }
  ],
  "sessionInputRows": 0,
  "cancelledInputRows": 0,
  "activePendingInputs": 0,
  "outboundQueue": 0,
  "notice": {
    "time": 1792807184572,
    "type": "outbound",
    "to": "synthetic:SYN-OWNER-active-0d827e8b",
    "accountId": "synthetic",
    "text": "EXPECTED_CHILD_CANCEL_NOTICE_0d827e8b",
    "messageId": "SYN-OUT-2a4612f1-b56f-4a6e-b6e4-cf2ef983ce45"
  }
}

Raw recovered-Gateway excerpts, redacted:

2026-10-24T09:59:44.282+08:00 [sessions/lifecycle] session lifecycle queue waiting pid=92273 threadId=0 isMainThread=true diagnosticEpoch=9e30ff78e270cd44 omittedObservations=0 operationId=5 operation=mutation mutationKind=reset sessionScopeHash=a7508c013137d568aa566016124b3e2e810adca37e03408522d51fb6ad009c69 identityCount=2 operationTraceId=4e2c1520b90bbb7ada818d0c4eb78651 operationSpanId=56dbcb3680ab2073 queueKind=lifecycle identityHash=a7508c013137d568aa566016124b3e2e810adca37e03408522d51fb6ad009c69 waitMs=1001 holderObserved=true holderOperationId=3 holderOperation=lifecycle holderSessionScopeHash=a7508c013137d568aa566016124b3e2e810adca37e03408522d51fb6ad009c69 holderPhase=run holderTraceId=dd6a8338ac6d23dd82279dc0efd949a8 holderSpanId=2ef739f0e1b18d77 holderElapsedMs=1847 holderSignalAborted=true
2026-10-24T09:59:44.359+08:00 [agent/embedded] before_model_resolve hook failed: AbortError: agent run aborted
2026-10-24T09:59:44.494+08:00 [ws] ⇄ res ✓ sessions.reset 1233ms bytes=1762 conn=5f7ef318…a647 id=2:4469feb0-5…ad8c

Actual captured host-tool result after reset:

{
  "type": "after_tool_call",
  "time": 1792807184412,
  "runId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-0d827e8b:c9d7bc99-d494-4cd1-b49f-3f0e8a71c5c8:yield-1",
  "sessionKey": "agent:main:subagent:b6916904-53de-466b-92f5-8fd28d9186d5",
  "result": {
    "content": [
      {
        "type": "text",
        "text": "Inline child result no longer belongs to its requester turn."
      }
    ],
    "details": {
      "status": "error",
      "error": "Inline child result no longer belongs to its requester turn."
    }
  },
  "error": "Inline child result no longer belongs to its requester turn."
}

Selected persisted input-completion rows after clean shutdown:

[
  {
    "runId": "1a433d95-c953-491b-b0ab-998afd7363c6",
    "succeeded": 0,
    "outcome": {
      "reason": "cancelled",
      "status": "error",
      "error": "agent run aborted | OPENCLAW_DIRECT_ABORT",
      "stopReason": "rpc"
    }
  },
  {
    "runId": "announce:requester-settle:main:agent:main:synthetic:synthetic:direct:syn-owner-active-0d827e8b:c9d7bc99-d494-4cd1-b49f-3f0e8a71c5c8:yield-1",
    "succeeded": 1,
    "outcome": {
      "reason": "completed",
      "status": "ok",
      "stopReason": "stop",
      "livenessState": "working"
    }
  }
]

The separate initial-admission control retains one cancelled input audit row and zero active input rows; this recovered-child control has zero remaining input rows. Cancelled input rows are audit facts, not executable queued work; none was deleted by the proof to obtain a pass. The existing pending-input reader selects queued/interrupted work and exact current ownership. A separate initial-admission child-reset control also passed, but is not substituted for this crash/recovered-child control.

Latest stable package → exact standalone head: existing data preservation

GitHub's current latest stable was v2026.10.6. A fresh official npm tarball was downloaded and its published SHA-512 integrity checked. The release's own bundled dependencies were retained; additional dependencies came read-only from the previously audited isolated release installation. No old state, credentials or installer was reused.

Actual command: python3 upgrade.py --stable <verified-2026.10.6-package> --source <e13-checkout> --label ug6 --port <isolated-port>; driver exit 0. The published package created a completed conversation and an additional live main turn with the actual legacy requester/recovery fields that stable writes. The old process was killed, synthetic state/config were backed up, and the candidate's documented doctor --fix --non-interactive was actually executed before Gateway admission. Doctor exit 0. Skipping it was not treated as successful migration.

The existing recovery fields were preserved through handoff and consumed by the candidate's normal recovery owner. The candidate delivered one UPGRADE_COMPLETION and then accepted a distinct new message ID in the same upgraded conversation, delivering one POST_UPGRADE_HEALTHY response. An informational recovery-admission notice is a separate expected message, not a duplicate completion.

All 26 old transcript rows retain every original column value, including the exact event JSON/compressed bytes; the final store has 36 rows. Doctor adds navigation projection columns. All original explicit configuration values and original list order survive. Configuration bytes are not identical: Doctor added the disclosed plugin metadata, wizard bookkeeping, message queue default and disabled optional-skill defaults. No original setting was silently discarded. This is published-package state plus candidate Doctor/binary activation proof, not a network updater, image deployment or all-plugin acceptance claim. The local test plugin's convergence warning is retained; actual channel loading and sends are independently evidenced.

Verified official package:

{
  "version": "2026.10.6",
  "tarball": "https://registry.npmjs.org/openclaw/-/openclaw-2026.10.6.tgz",
  "integrity": "sha512-jSpQPa2Jw5rG0J2GC07j9+qHtVYIuoHjgccU88JeS+p7188sBCnvIJeuaiNPHj1zsWkuHcBv443QiEUh7qrxwA==",
  "sha256": "b13fc9f1221e185451573a435ff31bdeb8c5875f569e6f41008198708ca2359f",
  "dependencyRuntime": "Package-bundled dependencies retained; fallback to audited isolated release installation read-only. No original state, credentials or installer reused."
}
{
  "label": "ug6",
  "sha": "e13f9030214a1654d1eb55dc2ad89d9dac2e4f65",
  "gatewayExits": [
    {
      "label": "stable",
      "exit": -9
    },
    {
      "label": "candidate",
      "exit": 0
    }
  ],
  "stableVersion": "2026.10.6",
  "stableRecoveryFields": [
    {
      "sessionKey": "agent:main:synthetic:synthetic:direct:syn-owner-upgrade-798e528b",
      "claim": {
        "restartRecoveryDeliveryContext": {
          "channel": "synthetic",
          "to": "synthetic:SYN-OWNER-upgrade-798e528b",
          "accountId": "synthetic"
        },
        "restartRecoveryDeliveryRunId": "SYN-IN-upgrade-798e528b",
        "restartRecoveryDeliverySourceRunId": "channel-user:v1:f4180aad015f5d29029eb7e1de91e9d5f4f7c9709785787df8f8550624e9efd3",
        "restartRecoveryRequesterAccountId": "synthetic",
        "restartRecoveryRequesterSenderId": "SYN-OWNER-upgrade-798e528b",
        "restartRecoverySourceIngress": "channel",
        "restartRecoverySourceReplyDeliveryMode": "automatic",
        "restartRecoveryRuns": [
          {
            "runId": "39259d79-1438-4637-853a-f2f019af9f5c",
            "lifecycleGeneration": "a46850ae-11c3-441e-851f-cb8189f89db5"
          }
        ]
      }
    }
  ],
  "preLoadRecoveryFieldsUnchanged": true,
  "doctorExit": 0,
  "allPreexistingExplicitSettingsPreserved": true,
  "configurationBytesIdentical": false,
  "configRootChanges": {
    "plugins": {
      "before": {
        "allow": [
          "rehearsal-channel"
        ],
        "load": {
          "paths": [
            "<isolated-proof>/core/ug6/plugins/rehearsal-channel"
          ]
        },
        "entries": {
          "rehearsal-channel": {
            "enabled": true,
            "hooks": {
              "allowConversationAccess": true
            }
          },
          "memory-core": {
            "enabled": false
          }
        },
        "slots": {
          "memory": "none"
        }
      },
      "after": {
        "allow": [
          "rehearsal-channel",
          "synthetic"
        ],
        "load": {
          "paths": [
            "<isolated-proof>/core/ug6/plugins/rehearsal-channel"
          ]
        },
        "entries": {
          "rehearsal-channel": {
            "enabled": true,
            "hooks": {
              "allowConversationAccess": true
            }
          },
          "memory-core": {
            "enabled": false
          },
          "synthetic": {
            "enabled": true
          }
        },
        "slots": {
          "memory": "none"
        }
      }
    },
    "messages": {
      "before": null,
      "after": {
        "queue": {
          "allowCollaborativeSteering": false
        }
      }
    },
    "skills": {
      "before": null,
      "after": {
        "entries": {
          "coding-agent": {
            "enabled": false
          },
          "openai-whisper-api": {
            "enabled": false
          },
          "sherpa-onnx-tts": {
            "enabled": false
          },
          "trello": {
            "enabled": false
          }
        }
      }
    },
    "wizard": {
      "before": null,
      "after": {
        "lastRunAt": "2026-10-24T01:54:51.516Z",
        "lastRunVersion": "2026.10.6",
        "lastRunCommand": "doctor",
        "lastRunMode": "local"
      }
    }
  },
  "beforeTranscriptRows": 26,
  "afterTranscriptRows": 36,
  "changedOrMissingOldTranscriptRows": [],
  "doctorAgentIntegrity": "ok",
  "recoveryReceipts": [
    {
      "time": 1792806902465,
      "type": "outbound",
      "to": "synthetic:SYN-OWNER-upgrade-798e528b",
      "accountId": "synthetic",
      "text": "UPGRADE_COMPLETION_798e528b",
      "messageId": "SYN-OUT-4691d721-ed5d-4dba-9230-adf1d8743bc2"
    }
  ],
  "postUpgradeSameConversationReceipts": [
    {
      "time": 1792806903465,
      "type": "ingress-reply",
      "caseId": "upgrade-798e528b",
      "payload": {
        "text": "POST_UPGRADE_HEALTHY_798e528b",
        "replyToTag": false,
        "replyToId": "SYN-POST-UPGRADE-798e528b",
        "audioAsVoice": false
      },
      "info": {
        "kind": "final",
        "assistantMessageIndex": 1
      },
      "messageId": "SYN-REPLY-baf9e236-d5cb-4940-9708-a9dc1e6272a9"
    }
  ],
  "activePendingInputs": 0,
  "outboundQueue": 0
}

Raw candidate Gateway recovery decision:

2026-10-24T09:55:01.897+08:00 [main-session-restart-recovery] main-session restart recovery candidate {"boot":"ae013186-faac-42bc-ac6b-70bc70726a22","pass":"71756208-e9b3-49b6-a957-f34b3aadbdc2","agentId":"main","storePath":"<isolated-proof>/core/ug6/state/agents/main/sessions/sessions.json","sessionKey":"agent:main:synthetic:synthetic:direct:syn-owner-upgrade-798e528b","sessionId":"a40643ac-66e3-4c83-b1c7-3c7dd177a3ee","sourceRunId":"channel-user:v1:f4180aad015f5d29029eb7e1de91e9d5f4f7c9709785787df8f8550624e9efd3","recoveryRunId":"SYN-IN-upgrade-798e528b","interruptedRunIds":["39259d79-1438-4637-853a-f2f019af9f5c"],"decision":"started","reason":"dispatch_started","nextOwner":"restart-recovery-lane"}
2026-10-24T09:55:01.902+08:00 [main-session-restart-recovery] main-session restart recovery startup complete: started=1 settled=0 failed=0 skipped=0 boot=ae013186-faac-42bc-ac6b-70bc70726a22 pass=717562…bdc2

Scope, failed fixtures and review disposition

The inspected captures address the four author requests: attach actual runtime proof; demonstrate final-effect replacement/revocation refusal; preserve the original authority boundary; and show latest-stable data compatibility. The author does not grant a maintainer security approval or alter a bot label. Please reassess these results on unchanged head e13f9030214a1654d1eb55dc2ad89d9dac2e4f65.

Earlier fixture failures are retained and excluded: reading a claim from the wrong table; recently closed port reuse; stable startup/health format differences; omitting required Doctor; expecting stable to contain the newer private object; reusing an inbound message ID; expecting an audit row to remain in an active registry; using NO_REPLY for a result-required notice; requiring every physical run to replace predecessor custody; and conflating a valid parent notice with stale child I/O. None was repaired by changing product code or weakening its authority checks. The final expectations follow inspected production contracts and actual independent audits.

Required CI remains FAILURE, with the classifier and independent inherited evidence recorded above. The pending-parent source/cohort question in #182043 is still unresolved, including the previously failed pre-outbound crash. No real channel, Codex/live-provider or business-side-effect acceptance, production operation, merge, or history rewrite is claimed.

@clawsweeper

clawsweeper Bot commented Oct 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 labels Oct 24, 2026
@ericcaiwx-star ericcaiwx-star changed the title fix: 原生子任务重启后缺失原始请求者恢复来源 fix: preserve requester recovery source for native subagents Oct 24, 2026
@ericcaiwx-star
ericcaiwx-star marked this pull request as ready for review October 24, 2026 00:44
@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. P2 Normal backlog priority with limited blast radius. 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 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR saves native subagents’ admitted requester source through the existing command recovery claim.

Example: A channel requester starts agent:main:subagent:reused-child, then the Gateway crashes.

  • Before: Command admission skips the native key, leaving registry recovery without the original requester source.
  • After: Admission retains the private source, allowing registry recovery to revalidate it and continue the same child.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal, useful repair with shipped-entry recovery, final-effect rejection, and latest-stable data-preservation evidence; inherited CI failures remain a landing matter.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): Inspectable isolated macOS Gateway runs exercise real channel ingress, host subagent tools, SQLite claims, process death, and a loopback HTTP provider: the standalone fix retains source and resumes the same child, requester reset prevents recovered I/O, and an explicitly combined settlement build rejects a reset child before provider I/O. Full settlement success belongs to the combined build; real-channel and live-provider acceptance are not claimed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A native child can lose its recoverable completion after a Gateway crash because its original requester source was never persisted.
Reason: Restores the existing native recovery contract without new configuration, API, schema, or competing ownership.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR repairs a verified current-main recovery defect with a minimal change and no introduced findings.

Priority: P2
Reviewed head: de0b7ffc0c98e9254add882052b879343d224b67

Before merge

None.

Findings

None.

Agent review details

How this fits together

Agent command admission persists requester facts in the existing session claim; after restart, the subagent registry consumes those facts and checks current child, requester, and Gateway ownership before continuation.

flowchart TD
  A[Channel requester] --> B[Native child command]
  B --> C[Existing session claim]
  C --> D[Registry restart recovery]
  D --> E[Current authority checks]
  E --> F[Same child continuation]
Loading

Technical review

Best possible solution:

Land this existing-owner producer fix while keeping downstream settlement and pending-parent source recovery in their separately tracked work.

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

Current main visibly skips the claim producer required by registry restoration, and supplied baseline Gateway logs and a failing admission regression demonstrate that exact failure; this read-only review executed no reproduction.

Is this the best way to solve the issue?

Removing the producer exclusion is the smallest complete repair: it reuses existing persistence, source validation, cleanup, and registry recovery while preserving the separate main-session exclusion.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 47ce38735155.

Provenance checked

  • Native exclusion in command recovery persistence changes intended behavior with a stated reason (4decdf6: Main-session restart delivery recovery captured direct-run routes while delegated recovery remained separate; later registry channel restoration requires the private child source.)
  • Admitted source and final receipt custody keeps the original intent (70ed04a: Keep an admitted completion bound to its original source and destination across recovery and compaction.)
  • Terminal predecessor claim replacement keeps the original intent (4686e4c: Retire conclusively settled predecessor custody while preserving unresolved claims and terminal sends.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 6df0fb8 adds src/agents/agent-command.ts:952 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6df0fb818d67; files: src/agents/agent-command.ts)
  • Jason (Json): Raw commit 70ed04a adds src/agents/agent-command.recovery-source.test.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 70ed04a2dc6b; files: src/agents/agent-command.recovery-source.test.ts)
  • Paul Bohm: Raw commit 4686e4c adds src/agents/agent-command.recovery-source.test.ts:98 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4686e4c03e59; files: src/agents/agent-command.recovery-source.test.ts)

PR surface

Source -4, Tests +12. Total +8 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 3 7 -4
Tests 1 16 4 +12
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 19 11 +8

Review metrics

Metric Value Why it matters
Production versus regression code Production +3/-7; tests +16/-4 Removes the producer exclusion and extends existing coverage for native-key admission, main-recovery exclusion, and terminal source cleanup.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Repairs interrupted native-subagent recovery after Gateway crashes, with a limited trigger and no demonstrated broader runtime outage.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • 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 (2 earlier review cycles)
  • reviewed 2026-10-24T01:31:41.702Z sha e13f903 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-24T02:09:25.112Z sha e13f903 :: needs maintainer review before merge. :: none

Reviewed October 23, 2026, 10:23 PM ET / October 24, 2026, 02:23 UTC (Revision 3).

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Head remains e13f9030214a1654d1eb55dc2ad89d9dac2e4f65; no code or history change. The PR body now contains inspectable raw Gateway/tool output and read-only SQLite audit results for the reported standalone/combined runs, plus newly executed controls:

  • Recovered requester reset: the exact requester-settle run is cancelled before provider I/O, the new incarnation commits, and another restart emits no stale provider or transport effect (standalone head).
  • Recovered same-child physical execution: real host sessions_send, retained predecessor custody, public child reset, zero recovered child HTTP requests, and an actual Inline child result no longer belongs to its requester turn rejection. The authorized parent cancellation notice occurs once, with durable settlement and no further I/O on restart (explicit combined commit with fix: settle interrupted subagent completions after cleanup #182065).
  • Official latest-stable 2026.10.6 state to standalone head through the required candidate Doctor: all 26 original transcript rows/column values retained, original explicit settings/list order preserved with exact Doctor additions disclosed, the original recovery facts consumed successfully, and a distinct new message in the same upgraded conversation completed.

Failed fixture assumptions, cancelled audit rows, profileless revocation scope, local plugin convergence warnings, and unrun real-channel/Codex acceptance remain explicit. Required CI is still red with the previously published inherited-failure evidence; no rerun/status override is claimed. #182043 remains unresolved. Please reassess the four proof/security/compatibility requests against the attached evidence.

@clawsweeper

clawsweeper Bot commented Oct 24, 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: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 24, 2026
@steipete
steipete merged commit b14d2bf into openclaw:main Oct 24, 2026
144 of 147 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 24, 2026
…claw#182046)

Persist the admitted requester recovery source for native child commands so registry restart recovery can restore the original channel requester. Main-session recovery still excludes delegated sessions, and existing source lifetime and terminal cleanup checks remain.

Preserves Eric Cai’s implementation and regression. The native-key regression fails on main; all 17 targeted command/registry tests, core and affected-test typechecks, lint, formatting, and independent review pass. CI run 40053286039 retains two independently attributed inherited session-list metadata failures; landed under the authorized inherited-failure exception. Production net -4 lines; tests net +12.

Fixes openclaw#182042. The parent completion-source issue openclaw#182043 remains separate.

Co-authored-by: Eric Cai <[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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Native subagent restart recovery loses the original requester source

2 participants