openclaw - 💡(How to fix) Fix [Bug]: Subagent deliveryContext inheritance broken - responses never reach parent session [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#53674Fetched 2026-04-08 01:24:59
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0

Root Cause

Subagents spawned via sessions_spawn complete successfully but their responses never reach the parent session or user. The root cause is missing deliveryContext.to and deliveryContext.accountId inheritance from parent to child session.

Fix Action

Workaround

Do NOT delegate via sessions_spawn when response delivery is required.

Use direct execution instead:

cd /root/.openclaw/workspace-sihteeri && wilma schedule list --when today --student xxxx --json

This bypasses subagent spawning and returns results directly to parent session.

Code Example

{
  "deliveryContext": {
    "channel": "signal",
    "to": "+358504369XXX",
    "accountId": "default"
  }
}

---

sessions_spawn({
  label: "sihteeri",
  task: "Check Wilma schedule for student XXX today",
  runtime: "subagent",
  mode: "run"
})

---

{
  "deliveryContext": {
    "channel": "signal"
    // ← Missing: "to" and "accountId"
  }
}

---

{
  "deliveryContext": {
    "channel": "signal",
    "to": "+35850436XXXX",
    "accountId": "default"
  }
}

---

{
  "deliveryContext": {
    "channel": "signal"
  }
}

---

{
  "key": "agent:main:subagent:4752bc8d-05fa-4c45-a81c-43f29de8b81b",
  "label": "sihteeri",
  "deliveryContext": {
    "channel": "signal"
  },
  "status": "done",
  "startedAt": 1774350621641,
  "endedAt": 1774350634991,
  "runtimeMs": 11962
}

---

{
  "key": "agent:main:subagent:fa7c237e-b7e7-4a1f-b0bf-28cdc0246c9f",
  "label": "sihteeri-check",
  "deliveryContext": {
    "channel": "signal"
  },
  "status": "done",
  "startedAt": 1774354122433,
  "endedAt": 1774354131753,
  "runtimeMs": 8337
}

---

cd /root/.openclaw/workspace-sihteeri && wilma schedule list --when today --student xxxx --json

---

// In main agent session with Signal channel
sessions_spawn({
  label: "test-subagent",
  task: "Echo back: test message",
  runtime: "subagent",
  mode: "run"
})

// Then check:
sessions_list({ activeMinutes: 5 })
// Subagent will show deliveryContext: { channel: "signal" } with missing "to" field
RAW_BUFFERClick to expand / collapse

Bug Description

Subagents spawned via sessions_spawn complete successfully but their responses never reach the parent session or user. The root cause is missing deliveryContext.to and deliveryContext.accountId inheritance from parent to child session.

Steps to Reproduce

  1. Create parent session with valid delivery context:
{
  "deliveryContext": {
    "channel": "signal",
    "to": "+358504369XXX",
    "accountId": "default"
  }
}
  1. Spawn subagent:
sessions_spawn({
  label: "sihteeri",
  task: "Check Wilma schedule for student XXX today",
  runtime: "subagent",
  mode: "run"
})
  1. Subagent completes successfully:

    • Runs Wilma CLI
    • Gets correct result
    • Status: done
    • Runtime: ~9 seconds
  2. Check subagent deliveryContext:

{
  "deliveryContext": {
    "channel": "signal"
    // ← Missing: "to" and "accountId"
  }
}
  1. Result: Parent session never receives subagent response. User waits indefinitely.

Expected Behavior

Subagent should inherit full deliveryContext from parent:

{
  "deliveryContext": {
    "channel": "signal",
    "to": "+35850436XXXX",
    "accountId": "default"
  }
}

Response should be delivered to parent session and user via the specified channel.

Actual Behavior

Subagent only inherits channel, missing to and accountId:

{
  "deliveryContext": {
    "channel": "signal"
  }
}

Result:

  • Subagent completes successfully
  • Attempts to announce result
  • Has no delivery target
  • Response goes nowhere
  • Parent session yields indefinitely
  • User receives no response

Environment

  • OpenClaw version: 2026.3.23-2 (7ffe7e4)
  • OS: Linux 6.17.4-2-pve (x64)
  • Runtime: Proxmox CT (Debian-based)
  • Node: v22.22.1
  • Channel: Signal (signal-cli HTTP daemon)
  • Parent model: openrouter/anthropic/claude-sonnet-4-5
  • Subagent model: anthropic/claude-haiku-4.5

Evidence

From sessions_list output (2026-03-24 12:08 UTC):

First subagent spawn (11:10 UTC):

{
  "key": "agent:main:subagent:4752bc8d-05fa-4c45-a81c-43f29de8b81b",
  "label": "sihteeri",
  "deliveryContext": {
    "channel": "signal"
  },
  "status": "done",
  "startedAt": 1774350621641,
  "endedAt": 1774350634991,
  "runtimeMs": 11962
}

Second subagent spawn (12:08 UTC):

{
  "key": "agent:main:subagent:fa7c237e-b7e7-4a1f-b0bf-28cdc0246c9f",
  "label": "sihteeri-check",
  "deliveryContext": {
    "channel": "signal"
  },
  "status": "done",
  "startedAt": 1774354122433,
  "endedAt": 1774354131753,
  "runtimeMs": 8337
}

Both subagents:

  • ✅ Completed successfully
  • ✅ Generated correct response
  • ❌ Could not deliver response (missing to field)

User Impact

Severity: High

User waited 57 minutes before reporting frustration.

What happened from user perspective:

  1. Asked simple question: "Moneltako XXX alkoi tänään koulu"
  2. No response
  3. Waited ~60 minutes
  4. Frustration: "This is unacceptable"

What happened from system perspective:

  1. Subagent spawned successfully
  2. Completed in 9 seconds with correct answer
  3. Response never reached user
  4. Parent session yielded indefinitely

Workaround

Do NOT delegate via sessions_spawn when response delivery is required.

Use direct execution instead:

cd /root/.openclaw/workspace-sihteeri && wilma schedule list --when today --student xxxx --json

This bypasses subagent spawning and returns results directly to parent session.

Additional Context

  • Related to multi-agent setups (Main → Talkkari/Sihteeri delegation pattern)
  • May be related to #15640 (Multi-agent: resolveSessionFilePath called without agentId)
  • May be related to #15601 (resolveSessionFilePath falls back to DEFAULT_AGENT_ID when callers omit opts.agentId)

Possible fix location:

  • Subagent spawn initialization code
  • deliveryContext inheritance logic
  • Session metadata copy/clone function

Expected fix: Deep copy entire deliveryContext from parent to child session during sessions_spawn.

Reproduction Script

// In main agent session with Signal channel
sessions_spawn({
  label: "test-subagent",
  task: "Echo back: test message",
  runtime: "subagent",
  mode: "run"
})

// Then check:
sessions_list({ activeMinutes: 5 })
// Subagent will show deliveryContext: { channel: "signal" } with missing "to" field

Note: This blocks all delegation workflows where parent expects subagent response. Critical for multi-agent architectures.

extent analysis

Fix Plan

To resolve the issue of subagents not inheriting the full deliveryContext from their parent sessions, we need to modify the sessions_spawn function to perform a deep copy of the deliveryContext object. Here are the steps:

  • Modify the sessions_spawn function to include the deliveryContext inheritance logic.
  • Perform a deep copy of the deliveryContext object from the parent session to the child session.

Example code:

// Modified sessions_spawn function
function sessions_spawn(options) {
  // ...
  const parentSession = getCurrentSession();
  const childSession = createNewSession(options);
  
  // Deep copy deliveryContext from parent to child
  childSession.deliveryContext = JSON.parse(JSON.stringify(parentSession.deliveryContext));
  
  // ...
}

// Alternatively, using a library like Lodash for deep cloning
const _ = require('lodash');
// ...
childSession.deliveryContext = _.cloneDeep(parentSession.deliveryContext);

Verification

To verify that the fix worked, you can:

  • Spawn a new subagent using the modified sessions_spawn function.
  • Check the deliveryContext of the subagent using sessions_list.
  • Verify that the deliveryContext contains the expected to and accountId fields.

Example verification code:

sessions_spawn({
  label: "test-subagent",
  task: "Echo back: test message",
  runtime: "subagent",
  mode: "run"
})

const subagentSession = sessions_list({ activeMinutes: 5 }).find(session => session.label === "test-subagent");
console.log(subagentSession.deliveryContext);
// Expected output: { channel: "signal", to: "+35850436XXXX", accountId: "default" }

Extra Tips

  • Make sure to test the modified sessions_spawn function thoroughly to ensure that it works correctly in all scenarios.
  • Consider adding logging or debugging statements to verify that the deliveryContext is being copied correctly.
  • If you're using a library like Lodash for deep cloning, make sure to check the documentation for any specific requirements or limitations.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix [Bug]: Subagent deliveryContext inheritance broken - responses never reach parent session [1 participants]