mirror of
https://github.com/openclaw/openclaw.git
synced 2026-11-16 13:08:44 +00:00
## What Problem This Solves
Fixes: a yielded subagent's final reply sometimes never reaches its requester. The child's task stays at `waiting for external continuation; delivery=pending; requester_continuation=pending` after the child wrote its answer.
A paused subagent task continues under a new run id each time an exit wake resumes it (#199283). `adoptPausedSubagentRunForFollowUp` moves the task row, the completion custody and the settle batch to the new run. It did not move the background commands. Each command kept the run that started it as `originRunId`.
When such a command exited after a later run had yielded, the failure was:
1. Its wake carried the retired run as `inputProvenance.runId` (`bash-tools.exec-notify.ts`, `sourceRunId: session.originRunId`).
2. `prepareReplySubagentContinuation` passes that id as `pausedRunId` (`src/auto-reply/reply/agent-runner-subagent.ts:47`).
3. `reactivateCompletedSubagentSession` returns false because the paused row now carries the newer run id (`src/gateway/session-subagent-reactivation.ts:48-52`).
4. The turn runs as a separate follow-up. The task row stays paused (`pauseReason: "sessions_yield"`), and the child's final reply is not tied to the task. Nothing announces it.
The later run also could not yield on those commands: `listYieldAwaitableExecs(runId)` matches `originRunId === runId` (`bash-tools.exec-notify.ts:108-116`), so its `sessions_yield` returned `nothing_pending` or "its exit cannot resume this run", and the model started to poll.
It is intermittent because it needs a command that outlives the run that started it while another wake continues the task first. A child that waits on one command at a time, or that the parent resumes with `sessions_send`, does not hit it.
## Production evidence (read-only, copied state DB)
Child `land_cache_pair` (redacted to the shape):
- Registry row: `runId` = the second run, `generation: 3`, `pauseReason: "sessions_yield"`, `execution.endedAt` set at the second run's yield, `delivery.status: "pending"`, `requesterSettleWake.status: "pending"`.
- Transcript: the second run started a pack-smoke command and yielded. Later wakes carried the starting run ids of earlier runs (`exec` wakes named run 1 three times while run 3+ was current). Every later `sessions_yield` returned `nothing_pending` or the "cannot resume this run" error, the agent polled, and the final reply (`stopReason: stop`) went nowhere. No announce lines exist for the child.
## Why This Change Was Made
- `moveRunningSessionsToRun(previousRunId, nextRunId)` in `bash-process-registry.ts`, the owner of process sessions.
- `replaceSubagentRunAfterSteer` calls it when it replaces a `sessions_yield`-paused row, next to the existing settle-batch remap and controller-input retirement. Ordinary steers and completed-run follow-ups are unchanged.
- Docs: `docs/concepts/subagent-yield-handoff.md`, `docs/plugins/tool-plugins.md` and the `inputProvenance` doc comment now say the wake names the run that owns the command.
No new state, stored row, schema or protocol field. Production delta: +20/-2 lines in `src`, most of it comments.
## Evidence
**Real agent, isolated source Gateway** (`ocx src`, scratch state/port/HOME, `env -i`), Claude Opus through the shared Claude proxy. A UI parent spawns a hidden subagent and yields. The child starts commands A (15 s) and B (50 s) and yields. A's exit continues the task in run 2, which starts C (70 s) and yields. B (started by run 1) then exits while run 2 is the paused run. base = merge base `
|
||
|---|---|---|
| .. | ||
| architecture-internals | ||
| codex-harness | ||
| codex-harness-reference | ||
| codex-harness-runtime | ||
| google-meet | ||
| hooks | ||
| knowledge | ||
| manifest | ||
| reference | ||
| sdk-agent-harness | ||
| sdk-channel-plugins | ||
| sdk-entrypoints | ||
| sdk-migration | ||
| sdk-overview | ||
| sdk-provider-plugins | ||
| sdk-runtime | ||
| voice-call | ||
| adding-capabilities.md | ||
| admin-http-rpc.md | ||
| agent-guidance.md | ||
| agentsapi.md | ||
| apple-fm.md | ||
| architecture-internals.md | ||
| architecture.md | ||
| beam.md | ||
| building-plugins.md | ||
| bundles.md | ||
| cli-backend-plugins.md | ||
| cloudflare.md | ||
| codex-computer-use.md | ||
| codex-harness-reference.md | ||
| codex-harness-runtime.md | ||
| codex-harness.md | ||
| codex-native-plugins.md | ||
| codex-supervision.md | ||
| community.md | ||
| compatibility.md | ||
| copilot.md | ||
| dependency-resolution.md | ||
| facetime-recovery.md | ||
| facetime.md | ||
| feature-plugins.md | ||
| geolocation.md | ||
| github.md | ||
| google-meet.md | ||
| hooks.md | ||
| install-overrides.md | ||
| knowledge.md | ||
| llama-cpp.md | ||
| logbook.md | ||
| manage-plugins.md | ||
| manifest.md | ||
| mcp-relay.md | ||
| meeting-plugins.md | ||
| memory-lancedb.md | ||
| memory-wiki.md | ||
| message-presentation.md | ||
| muse.md | ||
| oc-path.md | ||
| onepassword.md | ||
| onnx.md | ||
| plugin-inventory.md | ||
| plugin-permission-requests.md | ||
| reference.md | ||
| research-adapters.md | ||
| runtime-compatibility.md | ||
| sdk-agent-harness.md | ||
| sdk-channel-inbound.md | ||
| sdk-channel-ingress.md | ||
| sdk-channel-outbound.md | ||
| sdk-channel-plugins.md | ||
| sdk-entrypoints.md | ||
| sdk-gateway-ingress.md | ||
| sdk-migration.md | ||
| sdk-overview.md | ||
| sdk-provider-plugins.md | ||
| sdk-runtime.md | ||
| sdk-setup.md | ||
| sdk-subpaths.md | ||
| sdk-testing.md | ||
| session-share.md | ||
| slack-huddles.md | ||
| subq.md | ||
| team-reports.md | ||
| teams-meetings.md | ||
| tool-plugins.md | ||
| typesafe.md | ||
| vault.md | ||
| voice-call.md | ||
| workboard.md | ||
| zalouser.md | ||
| zoom-meetings.md | ||