Skip to content

Subagent completion delivery can fail when requester run is inactive and session transcript is locked #92076

Description

@loyur

Summary

A subagent completion can fail to reach the user when the requester session has already been evicted/inactive and the completion fallback path tries to write through the requester-agent/session transcript path. In a Feishu direct-message session, this surfaced as the generic user-facing error:

Something went wrong while processing your request. Please try again, or use /new to start a fresh session.

Observed behavior

On [email protected], the relevant log sequence was:

per-chat task exceeded 300000ms cap ... evicting from queue
Active requester session could not be woken ... reason=no_active_run
SessionWriteLockTimeoutError: session file locked (timeout 60000ms)
Embedded agent failed before reply: session file locked

The child/subagent had completed, but the parent/requester completion delivery failed after the requester run was no longer active and the requester session file was locked.

Expected behavior

For top-level subagent completions with a usable direct-message delivery target:

  • if the requester run is inactive or active wake fails with no_active_run, completion delivery should still send a concise direct/background message to the user when possible;
  • long child result text should not be mirrored wholesale into the requester transcript on this fallback path;
  • the fallback should avoid depending on a fresh requester-agent turn when the requester session is already inactive/locked.

Environment

  • OpenClaw version: 2026.6.1 (2e08f0f)
  • Install kind: npm global package
  • OS: macOS arm64
  • Gateway mode: local LaunchAgent
  • Channel observed: Feishu direct message

Local hotfix tested

A local dist-only hotfix was tested against dist/subagent-announce-delivery-DhVEJzi6.js:

  1. Add a capped direct text fallback for subagent task completion results.
  2. If active requester wake fails or requester is inactive, try direct text completion delivery before the requester-agent handoff.
  3. Keep the existing announce-agent fallback if direct text delivery is unavailable.
  4. Cap direct text fallback output to a concise head/tail preview to reduce lock-amplifying transcript writes.

Syntax checks passed:

node --check dist/subagent-announce-delivery-DhVEJzi6.js
node --check dist/subagent-announce-HPJnGzNW.js
node --check dist/agent-harness-task-runtime-DiaBUagI.js

Suggested upstream fix

In the source equivalent of src/agents/subagent-announce-delivery.ts:

  • route top-level subagent_announce completions with direct-message targets to direct/background text delivery when the requester is inactive or resolveActiveWakeWithRetries returns no_active_run;
  • cap or artifact-link long child result text before any user-visible fallback or transcript mirror;
  • consider treating SessionWriteLockTimeoutError from the direct announce-agent path as eligible for direct text fallback, not only generated-media fallback.

This appears related to the documented completion-delivery path where OpenClaw tries active requester wake first, then requester-agent handoff. The failure mode is when both the active requester path and transcript write path are unavailable, even though an external direct-message route exists.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions