Skip to content

fix(agents): pass durable session key as visible-spawn parent lineage - #137779

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/visible-spawn-durable-parent-key-137690
Sep 7, 2026
Merged

vincentkoc merged 2 commits into
openclaw:mainfrom
SunnyShu0925:fix/visible-spawn-durable-parent-key-137690

Conversation

@SunnyShu0925

@SunnyShu0925 SunnyShu0925 commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #137690

What Problem This Solves

When a user asks the bot to spawn a sub-agent from a Telegram DM, sessions_spawn fails with unknown parent session because the visible-spawn path sends the wrong session key to Gateway. After this fix, Telegram-originated sessions can spawn visible sub-agents the same way web dashboard sessions do.

  • Problem: createOpenClawTools built the sessions_spawn tool with agentSessionKey: options?.agentSessionKey — the sandbox/policy key. For Telegram DMs this key includes an account-id segment (agent:main:telegram:default:direct:<id>), but the durable store entry is persisted under a different key, so Gateway's parent-session lookup fails.
  • Solution: Pass options?.runSessionKey ?? options?.agentSessionKey (durable key preferred) for parent lineage, matching existing durable-session consumers, and separate lineage from sandbox classification, controller identity, and retained-task ownership so the substitution does not weaken hidden-spawn sandbox admission, lose run visibility, or drop retained task rows.
  • What changed: (1) createSessionsSpawnTool uses the durable key for parent lineage. (2) Hidden native spawn forwards the explicit opts.sandboxed flag through SpawnSubagentContext to resolveSubagentChildPlan, which prefers it over key-derived status, mirroring the visible/ACP paths. (3) createSubagentsTool receives the same durable controller key the spawn tool registers runs under. (4) Image/video/music generators preserve existing ownership: the isolated run key for cron, otherwise the policy session key. (5) createSubagentsTool also receives callerPolicySessionKey, so both retained and new policy-owned tasks remain visible and cancellable for split-key callers. Plus tests.
  • What did NOT change: the sandbox/policy key is still used for sandbox and tool-policy decisions; visible-spawn and ACP paths already preserved explicit sandbox state; the worker createSessionsSpawnTool call already used the durable key.

Why This Change Was Made

The durable runSessionKey was already available in createOpenClawTools (passed only as completionOwnerKey). Using it for parent lineage aligns sessions_spawn with the existing runSessionKey ?? agentSessionKey pattern. The fix separates concerns: durable key for lineage, explicit sandboxed flag for admission, durable controller key for listing, and dual-key lookup that preserves policy-owned media tasks without migrating their ownership.

  • Best fix: root-cause repair at the canonical boundary, reuses the visible/ACP explicit-sandbox pattern, no new abstraction. A policy-key-only fix would re-introduce the visible-spawn parent-lookup failure.
  • Risk / non-goals: non-split-key callers (policy key == durable key, or no runSessionKey) are unaffected — the ?? and Set-based fallbacks are no-ops there.

User Impact

Telegram users can once again delegate sub-agent tasks via sessions_spawn from a Telegram DM, without needing to switch to the web dashboard. Retained background media/spawn tasks created before the upgrade stay visible and cancellable.

Evidence

Maintainer Repair Validation

The final repair restores the existing cron-specific media owner selection. Changing non-cron media ownership to the durable key hid retained tasks from media status and duplicate detection; dual-key subagent listing/cancel handles those tasks without changing their owner.

  • 119 focused tests passed across openclaw-tools.tts-config.test.ts, openclaw-tools.spawn-session-key.test.ts, subagents-tool.test.ts, and subagent-spawn.test.ts.
  • A real createOpenClawTools / SQLite task-registry proof created a retained policy-owned image task, cleared registry and recent-start memory, closed the database, and reopened it with distinct policy and durable session keys.
  • Before repair, status reported inactive and duplicate detection fell through; a validation sentinel stopped the negative probe before generation. After repair, status returned the retained task and a normal repeated request returned duplicateGuard: true. Exactly one task remained and no network calls occurred.
  • Targeted lint, formatting, and diff checks passed. Independent full-candidate review found no remaining P0-P2 defects.

Earlier Contributor Evidence

Mock-gateway harness (head 4f6e31d85bf): post-fix Telegram DM sessions_spawn visible=true creates a visible child via Gateway with the durable parent key; pre-fix failed GatewayClientRequestError: unknown parent session.

Factory-boundary regression (head cb1250866f1): openclaw-tools.spawn-session-key.test.ts 6/6; subagent-spawn.test.ts split-key sandboxed requester → forbidden; subagents-tool.test.ts split-key retained-task list+cancel → pass. All fail on pre-fix.

Composed hidden-spawn proof through spawnSubagentDirect (head cb1250866f1, node --import tsx) — the function sessions_spawn invokes for hidden native spawns, covering propagation from tool entry through sandbox admission to child persistence/dispatch:

$ node --import tsx/esm proof-137779-spawn-direct.ts

Scenario 1: Post-fix permitted hidden spawn (ctx.sandboxed=false)
  → accepted, gatewayCalls=["agent"] → PASS (reached dispatch)
Scenario 2: Split-key sandboxed requester (ctx.sandboxed=true)
  → forbidden, gatewayCalls=[] → PASS (rejected before dispatch)
Scenario 3: Pre-fix bypass (no explicit flag)
  → accepted, gatewayCalls=["agent"] → PASS (confirms bug)
OVERALL: ALL PASS

Scenario 1 proves post-fix permitted dispatch. Scenario 2 proves rejection before dispatch (0 gateway calls). Scenario 3 confirms the pre-fix bypass.

Production-boundary store-reopen proof (head cb1250866f1, real SQLite task store):

Phase 2: split-key list → both retained + new rows visible → PASS
Phase 3: cancel retained policy-key task → cancelled → PASS
Phase 4: unrelated session cancel → forbidden → PASS
Phase 5: store reopen → both rows survive → PASS

Cron media unchanged (27/27). Telegram Test Server E2E needs credentials not held locally; the above proofs cover all changed paths with pre-fix fail / post-fix pass evidence.

AI Assistance

This PR is AI-assisted. Traced the agentSessionKey flow and applied the existing runSessionKey ?? agentSessionKey pattern. Across review rounds: added mock-gateway harness E2E; separated durable lineage from sandbox classification and controller identity; preserved non-cron policy-owned media tasks and cron run isolation; added callerPolicySessionKey for retained-task reachability; added production SQLite store-reopen proof; added composed hidden-spawn proof via spawnSubagentDirect showing permitted dispatch, forbidden rejection before persistence/dispatch, and the pre-fix bypass reaching dispatch.

@clawsweeper

clawsweeper Bot commented Sep 4, 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 Sep 4, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. 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. labels Sep 4, 2026
@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 11:52 PM ET / September 7, 2026, 03:52 UTC.

ClawSweeper review

What this changes

Uses durable session keys for subagent creation and listing while preserving sandbox restrictions and access to existing policy-owned background tasks.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix absent from current main. The reviewed head preserves sandbox admission and retained media ownership, and the supplied boundary evidence supports the repair; no blocking introduced defect was found.

Priority: P1
Reviewed head: 20e704ad8df2410b477701dd6abe1e835a7deca4

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with sufficient boundary evidence and no remaining blocking correctness finding.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Supplied proof connects the changed tool factory to visible child creation through the permitted mock-Gateway boundary, hidden-spawn admission to allowed dispatch and forbidden rejection, and real SQLite task ownership to cancellation, unrelated-session rejection, and media status after reopening the store.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): Supplied proof connects the changed tool factory to visible child creation through the permitted mock-Gateway boundary, hidden-spawn admission to allowed dispatch and forbidden rejection, and real SQLite task ownership to cancellation, unrelated-session rejection, and media status after reopening the store.
Evidence reviewed 9 items Current main still needs the factory repair: The fetched main revision still supplies the policy agentSessionKey to both spawn and subagent tools. The reviewed branch instead supplies the durable runSessionKey when available.
Visible-spawn ownership contradicts the supersession claim: Current main derives requesterKey from ownership.controllerSessionKey. The inspected visible-spawn implementation uses that key for trusted creation context and parentSessionKey, so the discussion's assertion that both already use completionRequesterSessionKey does not establish that this repair is redundant.
Sandbox classification survives key substitution: The production factory receives sandboxed from the active sandbox, the spawn tool forwards it, and child planning ORs it with key-derived sandbox status before admitting a child. The new regression covers rejection before child side effects.
Findings None None.
Security None None.

How this fits together

OpenClaw builds agent tools from a durable conversation identity and a separate policy identity. Spawn tools create child sessions through Gateway, while background-task tools use ownership records to list and cancel work.

flowchart TD
  A[Conversation and policy identities] --> B[Agent tool factory]
  B --> C[Durable spawn identity]
  C --> D[Sandbox admission]
  D --> E[Gateway child session]
  B --> F[Durable and policy task owners]
  F --> G[Scoped task listing and cancellation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +37, Tests +366. Total +403 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 46 9 +37
Tests 3 366 0 +366
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 412 9 +403

Review metrics

Metric Value Why it matters
Production versus regression coverage Production +37 net lines; tests +366 net lines Production growth carries sandbox classification and existing-owner compatibility; most added code is regression coverage.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #137690
Summary: This PR is the explicit implementation candidate for the reported split-key Telegram spawn failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best possible solution:

Keep durable lineage and controller identity aligned while retaining active sandbox classification and existing media-task ownership.

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

Yes, from source: distinct policy and durable session keys send the policy key into Gateway parent lookup on current main. Supplied before/after boundary evidence corroborates that path; this read-only review did not execute it.

Is this the best way to solve the issue?

Yes. Repairing the factory's identity selection addresses the producer, and the accompanying sandbox propagation and dual-key task lookup preserve existing restrictions and retained records.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The linked report describes a repeatable failure of subagent delegation from Telegram, an existing channel workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): Supplied proof connects the changed tool factory to visible child creation through the permitted mock-Gateway boundary, hidden-spawn admission to allowed dispatch and forbidden rejection, and real SQLite task ownership to cancellation, unrelated-session rejection, and media status after reopening the store.
  • proof: sufficient: Contributor real behavior proof is sufficient. Supplied proof connects the changed tool factory to visible child creation through the permitted mock-Gateway boundary, hidden-spawn admission to allowed dispatch and forbidden rejection, and real SQLite task ownership to cancellation, unrelated-session rejection, and media status after reopening the store.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Successful delegation and its spawn receipt are observable in Telegram; the supplied boundary proof already satisfies the applicable review gate.

Evidence

What I checked:

  • Current main still needs the factory repair: The fetched main revision still supplies the policy agentSessionKey to both spawn and subagent tools. The reviewed branch instead supplies the durable runSessionKey when available. (src/agents/openclaw-tools.ts:574, c27999bcfc37)
  • Visible-spawn ownership contradicts the supersession claim: Current main derives requesterKey from ownership.controllerSessionKey. The inspected visible-spawn implementation uses that key for trusted creation context and parentSessionKey, so the discussion's assertion that both already use completionRequesterSessionKey does not establish that this repair is redundant. (src/agents/tools/sessions-spawn-visible.ts:181, c27999bcfc37)
  • Sandbox classification survives key substitution: The production factory receives sandboxed from the active sandbox, the spawn tool forwards it, and child planning ORs it with key-derived sandbox status before admitting a child. The new regression covers rejection before child side effects. (src/agents/subagents/spawn/subagent-spawn-child-plan.ts:227, 20e704ad8df2)
  • Task access retains session and agent boundaries: Task traversal starts from the supplied durable and policy identities and checks the resolved agent identity. Cancellation requires membership in that tree; leaf callers additionally require direct ownership. The controller resolver returns the caller's own session as its controller. (src/agents/tools/subagents-tool.ts:225, 20e704ad8df2)
  • Existing media ownership is preserved: The final source retains the cron-specific run key and otherwise uses the policy key for media generation. This preserves existing status and duplicate-detection ownership while dual-key task lookup handles visibility. (src/agents/openclaw-tools.ts:145, 20e704ad8df2)
  • Captured production-boundary proof: The supplied PR body, captured under sourceRevision 5401fca31178908bccc333651d542dbd927318083823eb5a5cc7200cdf7b5f3d, reports visible-spawn mock-Gateway before/after proof, composed hidden-spawn permitted dispatch and sandbox rejection with zero dispatch calls, and real SQLite retained-task cancellation with unrelated-session rejection. Final repair validation reports reopening SQLite through createOpenClawTools, restored media status, duplicateGuard true, exactly one retained task, and no network calls. These are supplied observations, not executions performed during this review. (20e704ad8df2)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (18 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-06T02:33:17.032Z sha d396f0cf3f4a62c769353cde48b1ee10e4656c40 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T03:10:00.421Z sha cb12508 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T03:16:16.138Z sha cb12508 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T03:22:50.974Z sha cb12508 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T03:27:55.611Z sha cb12508 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T13:55:07.234Z sha cb12508 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-06T14:08:03.756Z sha cb12508 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-07T00:58:42.727Z sha cb12508 :: needs maintainer review before merge. :: none

@SunnyShu0925
SunnyShu0925 force-pushed the fix/visible-spawn-durable-parent-key-137690 branch 2 times, most recently from 4f6e31d to aeb5ac1 Compare September 4, 2026 05:09
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary 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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 4, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/visible-spawn-durable-parent-key-137690 branch from 524c633 to 691e6ca Compare September 5, 2026 02:21
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/visible-spawn-durable-parent-key-137690 branch from 691e6ca to 55a00b9 Compare September 5, 2026 05:54
@SunnyShu0925
SunnyShu0925 force-pushed the fix/visible-spawn-durable-parent-key-137690 branch 2 times, most recently from d0c027a to 36e6d84 Compare September 5, 2026 23:42
@clawsweeper clawsweeper Bot removed the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Sep 6, 2026
@SunnyShu0925
SunnyShu0925 force-pushed the fix/visible-spawn-durable-parent-key-137690 branch from 36e6d84 to d396f0c Compare September 6, 2026 02:27
sessions_spawn's visible-spawn path received the sandbox/policy session key
as agentSessionKey, which for Telegram DMs includes an account-id segment
(agent:main:telegram:default:direct:<id>). That policy key has no durable
store entry, so Gateway's parent-session lookup failed with
'unknown parent session'. All other tools already prefer runSessionKey;
this aligns sessions_spawn with that pattern. Fixes openclaw#137690.
@SunnyShu0925
SunnyShu0925 force-pushed the fix/visible-spawn-durable-parent-key-137690 branch from d396f0c to cb12508 Compare September 6, 2026 02:59
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 Sep 6, 2026
@ratticon

ratticon commented Sep 6, 2026

Copy link
Copy Markdown

Additional proof provided in #137690

@clawsweeper re-review

@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review.

@clawsweeper

clawsweeper Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@SunnyShu0925

Copy link
Copy Markdown
Contributor Author

Thanks for the additional proof in #137690 — the in-process split-key evidence there is the stronger boundary proof ClawSweeper noted was optional, and it confirms the same trusted-caller second gate that Adam-Researchh's corrected workaround addresses.

For reviewer clarity on scope, #137779 and the corrected workaround in #137690 repair two different segments of the same spawn data flow; they are complementary, not overlapping:

  1. Parent lineage + trusted-caller gate (maybeSpawnVisibleSession in sessions-spawn-visible.ts, lines 312/405) — both parentSessionKey and requesterSessionKey already resolve to ownership.completionRequesterSessionKey on main (Peter, e905a682f7ad, 2026-07-14). fix(agents): pass durable session key as visible-spawn parent lineage #137779 does not touch this path and does not need to; the two-gate validation already holds.

  2. Controller / listing / retained-task / media-key alignment — this is what fix(agents): pass durable session key as visible-spawn parent lineage #137779 repairs. In resolveSubagentSpawnOwnership (subagent-spawn-ownership.ts:33-40), completionRequesterSessionKey flows from completionOwnerKey, but controllerSessionKey is derived from agentSessionKey. Before this PR, createSessionsSpawnTool received options.agentSessionKey (the policy key), so split-key callers (Telegram DM) registered runs under the policy key while the listing tool queried by the durable key — runs invisible, media ownerKey mismatched, pre-alignment retained task rows unreachable. The five changes in this PR align that controller/listing/ownership segment.

So the two-gate fix Adam-Researchh verified is already on main; #137779 is the upstream factory alignment that keeps split-key callers' runs visible, listable, and cancellable. Neither supersedes the other — the corrected workaround in #137690 explicitly notes it does not backport the broader retained-task/media/controller alignment here.

One caveat worth flagging for release routing, not for this PR: Adam-Researchh reproduced the two-gate failure on the 2026.9.2 npm release, but main has had the corrected requesterSessionKey/parentSessionKey since 2026-07-14. That gap suggests the 2026.9.2 cut was built from a branch predating e905a682f7ad, so a maintainer may want to verify whether that fix needs cherry-picking onto the release branch independently of landing #137779.

@vincentkoc vincentkoc self-assigned this Sep 7, 2026
@vincentkoc
vincentkoc merged commit a85dd4e into openclaw:main Sep 7, 2026
210 of 211 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
…openclaw#137779)

* fix(agents): pass durable session key as visible-spawn parent lineage

sessions_spawn's visible-spawn path received the sandbox/policy session key
as agentSessionKey, which for Telegram DMs includes an account-id segment
(agent:main:telegram:default:direct:<id>). That policy key has no durable
store entry, so Gateway's parent-session lookup failed with
'unknown parent session'. All other tools already prefer runSessionKey;
this aligns sessions_spawn with that pattern. Fixes openclaw#137690.

* fix(agents): preserve retained media task ownership

---------

Co-authored-by: Vincent Koc <[email protected]>
ylcn91 added a commit to ylcn91/openclaw that referenced this pull request Sep 10, 2026
…ned children match their parent

Spawned children persist spawnedBy under the durable run session key, because
the Gateway canonicalizes the spawn parent on sessions.create. sessions_send
was the one session tool still built with the channel route key, so a parent
running from a DM mapped to its main session never matched its own visible
child and started the A2A announce flow after a waited reply. Hand
sessions_send runSessionKey ?? agentSessionKey like sessions_spawn and the
other session tools (see openclaw#137779), add the factory wiring regression, and add
the gated real-Gateway product-proof lane that reproduces the visible spawn,
waited send, and absence of a follow-up announce run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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]: sessions_spawn fails with "unknown parent session" for Telegram-originated sessions on 2026.8.2

3 participants