feat(telegram): bind spawned subagents to forum topics#82023
Conversation
|
Codex review: found issues before merge. Reviewed June 30, 2026, 8:23 PM ET / July 1, 2026, 00:23 UTC. Summary PR surface: Source +1134, Tests +854, Docs +13. Total +2001 across 33 files. Reproducibility: yes. source-level. Current main keeps Telegram as current placement while sessions_spawn only exposes thread/session fields when automatic child-thread spawn is supported, so the requested Telegram child-topic subagent path remains unavailable. Review metrics: 3 noteworthy metrics.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Land a rebased, narrower version that exposes Telegram subagent child-topic spawning through an accepted core session-binding adapter capability, keeps Telegram transport behavior plugin-owned or behind a generic channel seam, preserves commentary visibility policy, and refreshes live Telegram proof on the final head. Do we have a high-confidence way to reproduce the issue? Yes, source-level. Current main keeps Telegram as current placement while sessions_spawn only exposes thread/session fields when automatic child-thread spawn is supported, so the requested Telegram child-topic subagent path remains unavailable. Is this the best way to solve the issue? No, not as submitted. The product goal is valid, but the maintainable path is a rebased core session-binding adapter capability plus plugin-owned or generic mirroring and an explicit commentary visibility gate. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5e572dcf781a. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1134, Tests +854, Docs +13. Total +2001 across 33 files. View PR surface stats
Security concerns:
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: |
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.