feat(telegram): bind spawned subagents to forum topics#82023
Conversation
|
Codex review: found issues before merge. Reviewed June 2, 2026, 1:19 AM ET / 05:19 UTC. Summary PR surface: Source +1134, Tests +854, Docs +13. Total +2001 across 33 files. Reproducibility: Do we have a high-confidence way to reproduce the issue? Yes from source: current main only advertises automatic thread-bound spawn when the channel default placement is Review metrics: 3 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Rebase onto current main, keep the explicit per-kind Telegram spawn capability, route Do we have a high-confidence way to reproduce the issue? Do we have a high-confidence way to reproduce the issue? Yes from source: current main only advertises automatic thread-bound spawn when the channel default placement is Is this the best way to solve the issue? Is this the best way to solve the issue? No: the capability idea is right, but the PR should use current main's core session-binding preparation path instead of adding new Telegram Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 93fd17447abd. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +1134, Tests +854, Docs +13. Total +2001 across 33 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
|
Follow-up after the gate review:
Remaining blocker: |
|
Follow-up live proof for commit Real behavior proof addendum
Evidence bundle path in the live proof environment: |
|
Follow-up streaming proof for latest branch head Real behavior proof addendum — topic transcript parity
Evidence bundle path in the live proof environment: |
Real CodeClaw follow-up proof: Telegram progress preview replacementI added and validated another maintainer-side follow-up for the CodeClaw Telegram topic behavior. What changedThe progress mirror now uses both:
Latest PR branch head:
Combined CodeClaw proof branch:
ValidationLocal validation on the PR branch:
Live CodeClaw validation:
Real Telegram topic proofReal setup:
Action:
Observed behavior:
This is the intended behavior for CodeClaw PR topics: one visible preview/status message for in-flight progress in a topic, with the current tool/read line replaced by newer tool/read progress, followed by a normal final answer. Cleanup:
|
|
This pull request has been automatically marked as stale due to inactivity. |
Summary
supportsAutomaticThreadBindingSpawnchannel capability so automatic thread-bound session spawn support is not overloaded ontodefaultTopLevelPlacement.subagent_spawning,subagent_delivery_target, andsubagent_endedhooks sosessions_spawn(thread:true)for subagents can create and bind a child forum topic while keeping Telegram's normal top-level binding placement ascurrent.subagentvsacp) so Telegram advertises subagent forum-topic spawn support without incorrectly exposing ACP child-topic spawn.Context
Telegram already had forum-topic primitives and session binding infrastructure, but it lacked the subagent lifecycle hook wiring and an explicit capability to say: "explicit subagent thread spawns can create child topics, while ordinary top-level binding should stay in the current conversation." Discord and Matrix naturally expose automatic thread spawns through
defaultTopLevelPlacement: "child"; Feishu keepscurrentplacement and does not advertise child-thread session spawn. Telegram now follows the narrower model: keep normal Telegram/focusand top-level binding behavior current, while allowing explicitsessions_spawn(thread:true)for subagents to create a child forum topic when the Telegram adapter can do so.Real behavior proof
Behavior or issue addressed: Telegram
sessions_spawn(thread:true, mode:"session")from a channel-bound CodeClaw triage session creates and binds a real Telegram forum topic for the spawned subagent session, so follow-up work routes to that topic instead of becoming invisible or falling back to the parent topic.Real environment tested: Live
codeclaw-triageDocker container after installing a custom OpenClaw package built from combined proof branchcodeclaw-proof-82023-82275(https://github.com/efpiva/openclaw/tree/codeclaw-proof-82023-82275) atOpenClaw 2026.5.17 (db1c53a). The container was connected to the real CodeClaw Telegram forum supergroup and used the real CodeClaw triage cron job.Exact steps or command run after this patch:
docker exec --user codeclaw codeclaw-triage HOME=/home/codeclaw openclaw cron run cc373f35-b483-4c7f-9253-2f6c9c94a595 --wait --wait-timeout 15m --timeout 30000Evidence after fix:
The triage transcript for run
1d6d77dd-c23b-4b02-9831-e990fb11a7fcshows the initial PR action for private CodeClaw PR [Bug]: Windows install script HOME variable error #1223 was spawned withthread:trueandmode:"session":{ "type": "toolCall", "name": "sessions_spawn", "arguments": { "agentId": "main", "label": "codeclaw-pr:external:microsoft.ghe.com:bic/lobster:1223", "mode": "session", "context": "isolated", "thread": true } }The tool result accepted the spawn and returned a thread-bound child session:
{ "toolName": "sessions_spawn", "isError": false, "details": { "status": "accepted", "childSessionKey": "agent:main:subagent:c89515e3-1a1e-4465-8fe9-8b25e85c7819", "runId": "23538111-3540-4645-a66b-cc0568f96de0", "mode": "session", "note": "thread-bound session stays active after this task; continue in-thread for follow-ups.", "modelApplied": true } }Live Telegram/OpenClaw logs show the forum topic was created and bound to that child session. The Telegram supergroup id is redacted, but the topic id and session key are unchanged:
The persisted Telegram binding file contains the same mapping:
{ "conversationId": "<telegram-supergroup-id>:topic:1167", "targetKind": "subagent", "targetSessionKey": "agent:main:subagent:c89515e3-1a1e-4465-8fe9-8b25e85c7819", "agentId": "main", "label": "codeclaw-pr:external:microsoft.ghe.com:bic/lobster:1223", "metadata": { "threadName": "🤖 codeclaw-pr:external:microsoft.ghe.com:bic/lobster:1223" } }The CodeClaw poller state also persisted the spawned native session key for that PR:
{ "source": "pr_reviews", "id": "microsoft.ghe.com|bic/lobster#1223", "lastKind": "initial", "nativeSessionKey": "agent:main:subagent:c89515e3-1a1e-4465-8fe9-8b25e85c7819" }Observed result after fix: The live Telegram Bot API created forum topic
1167, OpenClaw bound it to the spawnedmainsubagent session, the child session ran withmessageChannel=telegram, and all child/specialist session transcript files for the spawned review used thetopic-1167suffix. CodeClaw recordednativeSessionKeyfor future follow-ups.What was not tested: Telegram permission-denied and non-forum failure paths in the live container; those remain covered by local mocked tests. The live proof used one real forum supergroup and one real CodeClaw triage run.
Supplemental validation
Behavior addressed: Telegram subagent
sessions_spawn(thread:true)now has an explicit per-kind automatic-spawn capability and lifecycle hooks that bind spawned subagents to child forum topics without enabling Telegram ACP child-topic spawns.Real environment tested: Local OpenClaw source checkout with mocked Telegram forum topic creation and session binding adapters; no live Telegram Bot API/forum supergroup was used.
Exact steps or command run after this patch:
Evidence after fix: Targeted Vitest proof passed with 12 files and 245 tests; docs MDX check passed; whitespace check passed;
pnpm buildcompleted including plugin SDK export verification; final Codex CLI review reported no actionable correctness issues.Observed result after fix: Telegram advertises
threadfor subagent session spawn through the new explicit per-kind capability, returns a routable Telegram delivery origin for created forum topics, routes completion to the bound topic, cleans up Telegram subagent bindings, and does not advertise/recommend ACP thread-bound spawns when ACP support is disabled for Telegram.What was not tested: Live Telegram Bot API behavior in a real forum supergroup with
can_manage_topics; non-forum group and permission failure behavior were covered only through local unit paths/mocked failures.