Skip to content

feat(telegram): bind spawned subagents to forum topics#82023

Open
efpiva wants to merge 12 commits into
openclaw:mainfrom
efpiva:codeclaw-telegram-thread-binding
Open

feat(telegram): bind spawned subagents to forum topics#82023
efpiva wants to merge 12 commits into
openclaw:mainfrom
efpiva:codeclaw-telegram-thread-binding

Conversation

@efpiva

@efpiva efpiva commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an explicit supportsAutomaticThreadBindingSpawn channel capability so automatic thread-bound session spawn support is not overloaded onto defaultTopLevelPlacement.
  • Wires Telegram subagent_spawning, subagent_delivery_target, and subagent_ended hooks so sessions_spawn(thread:true) for subagents can create and bind a child forum topic while keeping Telegram's normal top-level binding placement as current.
  • Makes the spawn capability per-kind (subagent vs acp) so Telegram advertises subagent forum-topic spawn support without incorrectly exposing ACP child-topic spawn.
  • Documents the new capability seam and adds Telegram/core regression coverage for schema exposure, runtime capabilities, hook registration, binding, completion routing, cleanup, and boundary invariants.

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 keeps current placement and does not advertise child-thread session spawn. Telegram now follows the narrower model: keep normal Telegram /focus and top-level binding behavior current, while allowing explicit sessions_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-triage Docker container after installing a custom OpenClaw package built from combined proof branch codeclaw-proof-82023-82275 (https://github.com/efpiva/openclaw/tree/codeclaw-proof-82023-82275) at OpenClaw 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 30000
  • Evidence after fix:

    The triage transcript for run 1d6d77dd-c23b-4b02-9831-e990fb11a7fc shows the initial PR action for private CodeClaw PR [Bug]: Windows install script HOME variable error #1223 was spawned with thread:true and mode:"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:

    2026-05-17T15:07:57.282-07:00 telegram: bound conversation <telegram-supergroup-id>:topic:1167 -> agent:main:subagent:c89515e3-1a1e-4465-8fe9-8b25e85c7819 (idle=24h maxAge=disabled)
    2026-05-17T15:07:57.406-07:00 [telegram] update: {"message":{"message_id":1167,"chat":{"title":"CodeClaw Activity","is_forum":true,"type":"supergroup"},"message_thread_id":1167,"forum_topic_created":{"name":"🤖 codeclaw-pr:external:microsoft.ghe.com:bic/lobster:1223"},"is_topic_message":true}}
    2026-05-17T15:07:57.923-07:00 [agent/embedded] embedded run start: runId=23538111-3540-4645-a66b-cc0568f96de0 sessionId=ada5b4d0-65b5-48ff-8c81-76c2ab477ab8 provider=github-copilot model=gpt-5.5 thinking=medium messageChannel=telegram
    2026-05-17T15:07:58.444-07:00 [agent/embedded] [context-diag] pre-prompt: sessionKey=agent:main:subagent:c89515e3-1a1e-4465-8fe9-8b25e85c7819 ... sessionFile=/home/codeclaw/.openclaw/agents/main/sessions/ada5b4d0-65b5-48ff-8c81-76c2ab477ab8-topic-1167.jsonl
    

    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 spawned main subagent session, the child session ran with messageChannel=telegram, and all child/specialist session transcript files for the spawned review used the topic-1167 suffix. CodeClaw recorded nativeSessionKey for 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:

node scripts/run-vitest.mjs \
  extensions/telegram/src/subagent-hooks.test.ts \
  extensions/telegram/index.test.ts \
  extensions/telegram/src/thread-bindings.test.ts \
  src/channels/plugins/thread-binding-api.test.ts \
  src/channels/thread-bindings-policy.test.ts \
  src/agents/runtime-capabilities.test.ts \
  src/agents/tools/sessions-spawn-tool.test.ts \
  src/agents/acp-spawn.test.ts \
  src/plugins/contracts/boundary-invariants.test.ts
pnpm docs:check-mdx docs/plugins/sdk-channel-plugins.md
git diff --check
pnpm build
codex review --uncommitted

Evidence after fix: Targeted Vitest proof passed with 12 files and 245 tests; docs MDX check passed; whitespace check passed; pnpm build completed including plugin SDK export verification; final Codex CLI review reported no actionable correctness issues.

Observed result after fix: Telegram advertises thread for 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram agents Agent runtime and tooling size: L triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed June 2, 2026, 1:19 AM ET / 05:19 UTC.

Summary
Adds Telegram subagent forum-topic binding support, an explicit automatic thread-binding spawn capability, Telegram topic progress mirroring, docs, prompt snapshots, and regression coverage.

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 child, while Telegram keeps default placement current.

Review metrics: 3 noteworthy metrics.

  • Plugin capability surface: 1 added. supportsAutomaticThreadBindingSpawn expands the channel binding contract, so compatibility and docs/tests need to stay aligned.
  • Deprecated hook route: 1 added. The PR registers Telegram subagent_spawning routing even though current main documents core session-binding preparation as the replacement path.
  • Release-owned file: 1 changed. CHANGELOG.md is generated by release flow and should not be edited by this normal PR.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🦞 diamond lobster
Patch quality: 🧂 unranked krab
Result: blocked by patch quality or review findings.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Rebase on current main and resolve the dirty merge state.
  • Replace Telegram subagent_spawning routing with current core session-binding capability support.
  • Drop CHANGELOG.md from the PR and rerun targeted Telegram/core binding tests.

Risk before merge

  • [P1] The PR is currently reported dirty against main, so maintainers need a rebase/conflict-resolution pass before judging the final merge result.
  • [P1] Merging the hook-based implementation as-is would create a second routing source of truth beside current core session-binding preparation.
  • [P1] The new Telegram topic progress mirror changes where nested session progress/tool output is delivered, so the rebased fix needs owner review for wrong-topic, duplicate, or stale-session delivery behavior.

Maintainer options:

  1. Rework on the current core binding path (recommended)
    Expose Telegram's explicit subagent child-topic capability to the current core binder and remove the new subagent_spawning routing path before merge.
  2. Pause until the branch is rebased
    Because the branch is dirty against current main, maintainers can ask for a rebase first and then review the actual three-way merge result.
  3. Accept temporary hook compatibility debt
    Maintainers could intentionally accept the deprecated hook path for a short-lived urgent fix, but that would leave a duplicate routing contract to remove later.

Next step before merge

  • [P2] Maintainer review is needed to choose and supervise the rebase/rework onto the current core binding seam; this is not a safe one-shot automated repair on the stale branch.

Security
Cleared: No new dependency, workflow, permission, credential, or supply-chain surface was found; the main safety concern is delivery/session routing correctness rather than a concrete security regression.

Review findings

  • [P1] Route Telegram binds through core, not subagent_spawning — extensions/telegram/subagent-hooks-api.ts:13-15
  • [P3] Remove the release changelog edit — CHANGELOG.md:9
Review details

Best possible solution:

Rebase onto current main, keep the explicit per-kind Telegram spawn capability, route sessions_spawn(thread:true) through the existing core session-binding adapter path, drop deprecated hook routing and the changelog edit, then refresh targeted tests and live Telegram proof.

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 child, while Telegram keeps default placement current.

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 subagent_spawning routing.

Full review comments:

  • [P1] Route Telegram binds through core, not subagent_spawning — extensions/telegram/subagent-hooks-api.ts:13-15
    Current main documents subagent_spawning as deprecated compatibility, and src/agents/subagent-spawn.ts now prepares thread:true bindings through channel session-binding adapters before subagent_spawned. Registering a new Telegram subagent_spawning handler here creates a second routing source of truth that will drift from the core binder; keep the explicit capability/artifact, but let the existing core binder call the Telegram adapter instead.
    Confidence: 0.9
  • [P3] Remove the release changelog edit — CHANGELOG.md:9
    Repository policy marks CHANGELOG.md as release-owned and says normal PRs should not edit it. Please move any release-note context into the PR body or squash message and leave changelog generation to the release flow.
    Confidence: 0.96

Overall correctness: patch is incorrect
Overall confidence: 0.86

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 93fd17447abd.

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: The PR adds plugin/channel capability surface and deprecated hook routing that can affect plugin SDK and channel binding contracts.
  • add merge-risk: 🚨 message-delivery: The PR changes Telegram topic routing and progress/final delivery for spawned subagents, where wrong-topic or duplicate delivery is possible.
  • add merge-risk: 🚨 session-state: The PR changes child session bindings, delivery context persistence, and topic-scoped progress preview state.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body and follow-up comments include redacted live Telegram forum logs showing after-fix topic creation, binding, progress preview edits, and final delivery; proof should be refreshed after the required rework.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (logs): The PR body and follow-up comments include redacted live Telegram forum logs showing after-fix topic creation, binding, progress preview edits, and final delivery; proof should be refreshed after the required rework.
  • add mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram forum-topic creation, progress preview, and final delivery behavior that can be demonstrated in a short Telegram proof run.
  • remove impact:session-state: Current review selected no impact labels.
  • remove impact:security: Current review selected no impact labels.
  • remove impact:message-loss: Current review selected no impact labels.
  • remove rating: 🌊 off-meta tidepool: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority Telegram/session-routing improvement with real user-visible value but bounded blast radius.
  • merge-risk: 🚨 compatibility: The PR adds plugin/channel capability surface and deprecated hook routing that can affect plugin SDK and channel binding contracts.
  • merge-risk: 🚨 message-delivery: The PR changes Telegram topic routing and progress/final delivery for spawned subagents, where wrong-topic or duplicate delivery is possible.
  • merge-risk: 🚨 session-state: The PR changes child session bindings, delivery context persistence, and topic-scoped progress preview state.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🦞 diamond lobster and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (logs): The PR body and follow-up comments include redacted live Telegram forum logs showing after-fix topic creation, binding, progress preview edits, and final delivery; proof should be refreshed after the required rework.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body and follow-up comments include redacted live Telegram forum logs showing after-fix topic creation, binding, progress preview edits, and final delivery; proof should be refreshed after the required rework.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram forum-topic creation, progress preview, and final delivery behavior that can be demonstrated in a short Telegram proof run.
Evidence reviewed

PR surface:

Source +1134, Tests +854, Docs +13. Total +2001 across 33 files.

View PR surface stats
Area Files Added Removed Net
Source 17 1147 13 +1134
Tests 14 870 16 +854
Docs 2 13 0 +13
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 33 2030 29 +2001

What I checked:

  • Current main still gates automatic spawn on child default placement: Current main only advertises automatic thread-bound spawns when the channel default top-level placement is child, while Telegram keeps defaultTopLevelPlacement: "current"; this supports keeping the useful request open rather than closing as implemented. (src/channels/thread-bindings-policy.ts:51, 93fd17447abd)
  • Telegram current placement remains current: Telegram's current channel contract keeps normal top-level bindings in the current conversation, so the PR's per-kind explicit spawn capability addresses a real gap in the existing gate. (extensions/telegram/src/channel.ts:720, 93fd17447abd)
  • Current main owns thread binding in core: Current main already prepares requested subagent thread bindings in bindThreadForSubagentSpawn through the session-binding service, which makes a new Telegram subagent_spawning routing path the wrong layer. (src/agents/subagent-spawn.ts:948, 93fd17447abd)
  • Current Telegram adapter can create child forum topics: The current Telegram session-binding adapter already advertises child placement and calls createForumTopicTelegram for child binds, so the best remaining fix is to expose the capability to the core binder rather than reimplement binding in a hook. (extensions/telegram/src/thread-bindings.ts:711, 93fd17447abd)
  • PR registers deprecated spawning routing: The PR registers subagent_spawning and returns Telegram routing from that hook, conflicting with current docs and the current core-owned binding path. (extensions/telegram/subagent-hooks-api.ts:13, 987388309d68)
  • Docs mark subagent_spawning as compatibility only: Current plugin docs say subagent_spawning is deprecated compatibility and that core prepares thread: true subagent bindings through channel session-binding adapters before subagent_spawned. Public docs: docs/plugins/hooks.md. (docs/plugins/hooks.md:146, 93fd17447abd)

Likely related people:

  • Vincent Koc: Current main's core thread-binding preparation, Telegram child binding adapter, channel binding policy, and deprecation docs all blame to Vincent-authored commits, with additional recent Telegram binding maintenance by the same author. (role: recent area contributor; confidence: high; commits: 489efc8f5eb1, c441dcd47a05, f1e012e0fc41; files: src/agents/subagent-spawn.ts, extensions/telegram/src/thread-bindings.ts, src/channels/thread-bindings-policy.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • 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.

@clawsweeper clawsweeper Bot added the mantis: telegram-visible-proof Mantis should capture Telegram visible proof. label May 15, 2026
@efpiva

efpiva commented May 15, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up after the gate review:

  • Fixed the prompt:snapshots:check drift in a4498e8 by regenerating the Telegram prompt snapshots with pnpm prompt:snapshots:gen.
  • Verified locally after the commit:
    • pnpm prompt:snapshots:checkPrompt snapshots are current (7 files).
    • git diff --check → no output.
  • The rerun CI shards that were downstream of snapshot drift are now green, including check-additional-boundaries-a, check-additional, checks-node-core-support-boundary, and checks-node-core.

Remaining blocker: Real behavior proof is still red. I attempted to produce live Telegram proof via the project Telegram credential lease path, but this environment does not have OPENCLAW_QA_CONVEX_SITE_URL / the Convex credential env available. I also attempted to apply the documented proof: override label, but this fork author account lacks label permissions on openclaw/openclaw (AddLabelsToLabelable denied). A maintainer will need to either run/attach the live Telegram forum proof or apply proof: override if the mocked/unit proof is sufficient for this PR.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 17, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. P2 Normal backlog priority with limited blast radius. impact:message-loss Channel message delivery can be lost, duplicated, or misrouted. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. labels May 17, 2026
@efpiva

efpiva commented May 17, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up live proof for commit c807f9ea50 / proof build 487cbca:

Real behavior proof addendum

  • Behavior addressed: nested specialist completion announces into a thread-bound PR/subagent session now route visible assistant output to the bound Telegram topic automatically. CodeClaw should not need to use the native message tool explicitly for the PR-topic digest when the session is correctly thread-bound.
  • Real environment tested: live codeclaw-triage container rebuilt from the local OpenClaw tarball at OpenClaw 2026.5.17 (487cbca), connected to the real CodeClaw Telegram forum supergroup.
  • Exact steps or command run after this patch: created a real Telegram proof forum topic (thread_id=1187), then ran a Gateway agent turn for synthetic thread-bound requester session agent:main:subagent:proof-20260517t230715z; the parent called sessions_spawn for a generalist child, the child replied CHILD_COMPLETION_PROOF_proof-20260517T230715Z, and the nested completion announce resumed the parent session.
  • Evidence after fix: docker logs show the completion announce run announce:v1:agent:generalist:subagent:9cb8f0bb-909d-4940-88ad-1582d02f1148:8dd3a6d6-25df-4a16-8188-5b5cfe25660b started with messageChannel=telegram for the parent thread-bound session, then emitted PARENT_TOPIC_DELIVERY_PROOF_proof-20260517T230715Z, followed by [telegram] outbound send ok ... messageId=1188 ... threadId=1187.
  • Observed result after fix: the visible parent completion output was delivered to the real Telegram topic 1187 automatically through OpenClaw's thread-bound session delivery path.
  • What was not tested: a full new CodeClaw PR review tick was not run after this patch because CodeClaw cron was intentionally stopped for debugging. The live proof used a synthetic thread-bound subagent session to exercise the same nested completion delivery path that failed for CodeClaw PR topics.

Evidence bundle path in the live proof environment: /tmp/openclaw-pr-evidence/82023-followup/.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label May 18, 2026
@efpiva

efpiva commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up streaming proof for latest branch head 89bfbe3643 / proof build e807b53:

Real behavior proof addendum — topic transcript parity

  • Behavior addressed: PR-topic Telegram output was still not transcript-equivalent: the topic showed only the final summary, while the session JSONL contained assistant progress, tool calls, and tool results. The follow-up commits add a channel mirror for thread-bound sessions plus cron delivery-context/run-context plumbing so Telegram topics receive progress/tool-output events, not just final answers.
  • Runtime tested: live codeclaw-triage rebuilt with OpenClaw 2026.5.17 (e807b53).
  • Real topic tested: existing CodeClaw Telegram PR topic 1189 for bic/lobster#1231.
  • Scheduled proof run: one-shot OpenClaw cron job f89632b0-8d30-4d9f-8bbc-865aae54ffaa, status ok, duration 13984ms; this was a scheduled cron run, not a manual gateway call.
  • Session transcript evidence: /home/codeclaw/.openclaw/agents/main/sessions/0cba4728-2e4c-4e33-9de5-5677832c02ea.jsonl contains:
    • line 5: OPENCLAW_STREAM_MIRROR_PROOF_E807B53 prompt for topic 1189
    • line 6: assistant commentary STREAM_PROOF_ASSISTANT_PROGRESS_005419 plus exec tool call printf STREAM_PROOF_TOOL_OUTPUT_005419
    • line 7: tool result STREAM_PROOF_TOOL_OUTPUT_005419, exitCode: 0
    • line 8: final answer STREAM_PROOF_FINAL_005419
  • Telegram delivery evidence: docker outbound logs show ten real Telegram sends to chat -1003898998425 with threadId=1189 during/after that scheduled run: message IDs 1204 through 1213.
  • Observed result after fix: unlike the earlier bic/lobster#1231 run that delivered only the final summary, the same real topic now receives multiple progress/tool/final messages for the run, matching the session transcript markers rather than only the final assistant answer.
  • Cleanup: proof cron jobs were removed; CodeClaw triage and own-PR health crons remain disabled; the temporary forced pr-tracker signature for bic/lobster#1231 was restored to f0d57602da599dac92e48cf4ba1b65ede3e49a83.

Evidence bundle path in the live proof environment: /tmp/openclaw-pr-evidence/82023-stream/.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. impact:security Security boundary, credential, authz, sandbox, or sensitive-data risk. labels May 18, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 18, 2026
@clawsweeper clawsweeper Bot added rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels May 18, 2026
@efpiva

efpiva commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

Real CodeClaw follow-up proof: Telegram progress preview replacement

I added and validated another maintainer-side follow-up for the CodeClaw Telegram topic behavior.

What changed

The progress mirror now uses both:

  • route/topic-scoped preview state so sessions bound to the same Telegram PR topic share a preview; and
  • current-tool replacement semantics so repeated tool/read/progress events update the same current tool line instead of accumulating multiple Read:/tool lines in the visible topic.

Latest PR branch head:

  • codeclaw-telegram-thread-binding: 987388309d6897b9ae0a827a0a7934dc4b3cfda3
  • latest fix commit: 987388309d (fix: replace current telegram tool preview)

Combined CodeClaw proof branch:

  • https://github.com/efpiva/openclaw/tree/codeclaw-proof-82023-82275
  • latest proof commit: 5d05443b6a8f (fix: replace current telegram tool preview)

Validation

Local validation on the PR branch:

  • added regression coverage that three repeated read/tool progress events (gotchas, patterns, anti-patterns) leave only the latest current tool line in the preview;
  • pnpm vitest run src/gateway/agent-event-channel-mirror.test.ts src/gateway/server-chat.agent-events.test.ts passed: 4 files / 92 tests;
  • pnpm tsgo:test passed for core and extension test configs.

Live CodeClaw validation:

  • rebuilt the live codeclaw-triage container from the combined proof branch with OpenClaw 2026.5.17 (5d05443);
  • verified installed dist contains the new progress-preview symbols:
    • CURRENT_TOOL_PROGRESS_LINE_ID
    • previewsByRoute
    • plus the existing PR symbols supportsAutomaticThreadBindingSpawn and resolveProviderDefaultRequestHeaders.

Real Telegram topic proof

Real setup:

  • live codeclaw-triage container
  • OpenClaw 2026.5.17 (5d05443)
  • actual CodeClaw PR topic: codeclaw-pr:external:microsoft.ghe.com:bic/lobster:1254
  • Telegram thread id: 1849

Action:

  • ran a scheduled one-shot cron proof in the bound PR topic/session;
  • the session read three files in sequence: memory/gotchas.md, memory/patterns.md, and memory/anti-patterns.md.

Observed behavior:

  • Telegram created one progress preview in the PR topic:
    • messageId=1880, threadId=1849
  • later progress updates edited that same message instead of sending new progress messages:
    • repeated Edited message 1880 ...
  • the normal final assistant delivery remained separate:
    • messageId=1883, threadId=1849

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:

  • the one-shot proof job self-deleted;
  • codeclaw-triage and own-PR health crons were left disabled after proof until explicitly re-enabled by maintainer request;
  • the gateway was stable after the proof and active sessions drained to active=0 queued=0.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jun 2, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed rating: 🌊 off-meta tidepool PR readiness rating does not apply to this item. impact:session-state Session, memory, transcript, context, or agent state can drift or corrupt. impact:security Security boundary, credential, authz, sandbox, or sensitive-data risk. impact:message-loss Channel message delivery can be lost, duplicated, or misrouted. labels Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: telegram Channel integration: telegram docs Improvements or additions to documentation gateway Gateway runtime mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL stale Marked as stale due to inactivity status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant