Skip to content

[Bug]: Binding type: acp sessions silently fail — session created, process spawned, but systemSent never delivered #97186

Closed as not planned

Description

@allen0304

[Bug]: Binding type: "acp" sessions silently fail — session created, process spawned, but systemSent never delivered

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Binding type: "acp" + opencode agent on Telegram group topic creates session and spawns opencode acp process, but systemSent is never delivered, no transcript produced, and no error is logged. User never receives a response.

Steps to reproduce

  1. Configure an ACP agent with runtime type: "acp", mode: "persistent", backend acpx:
{
  "agents": {
    "list": [{
      "id": "opencode",
      "runtime": { "type": "acp", "acp": { "agent": "opencode", "backend": "acpx", "mode": "persistent" } }
    }]
  }
}
  1. Bind a Telegram group topic to it via type: "acp":
{
  "type": "acp",
  "agentId": "opencode",
  "match": {
    "channel": "telegram",
    "accountId": "default",
    "peer": { "kind": "group", "id": "-100XXXXXXXXXX:topic:2" }
  },
  "acp": { "label": "opencode", "mode": "persistent" }
}
  1. Send a message in the bound topic.
  2. Check sessions.json → session created, but systemSent absent, totalTokens: 0, no .jsonl transcript.
  3. ps aux | grep "opencode acp" → process is running but idle.

Expected behavior

Session receives systemSent, the ACP agent processes the message, and a response is delivered back to the Telegram topic. This works correctly when the binding is changed to type: "route", and also works via sessions_spawn(runtime="acp", agentId="opencode") and direct acpx opencode exec "hello".

Actual behavior

Session JSON created, opencode acp process spawned, but systemSent never becomes true. No .jsonl transcript file is generated. Process sits idle indefinitely. Gateway logs show no errors — the message is silently lost.

From sessions.json (redacted):

sessionId: a1ba2f33-...
systemSent: (field absent)
totalTokens: 0
status: (absent)
error: (absent)
sessionFile: (none)

OpenClaw version

2026.6.10

Operating system

macOS 25.5.0 (arm64)

Model

opencode-go/qwen3.7-plus (via OpenCode CLI)

Provider / routing chain

openclaw → acpx plugin (0.8.0) → opencode acp (v1.17.11, gpt-5.5) → opencode-go/qwen3.7-plus

Logs, screenshots, and evidence

Failing session (type: "acp"):

sessionId: a1ba2f33-d2d2-4eeb-9af7-7bd37b639767
systemSent: (absent)
totalTokens: 0
started: 13:09:36

Process: aiii 10807 ... ~/.opencode/bin/opencode acp

Working session (same config, only changed to type: "route"):

sessionId: 8c6787a7-2326-471e-8998-b4b6c18a24e6
systemSent: True ✅
totalTokens: 35,714
status: done
sessionFile: 8c6787a7-...-topic-2.jsonl (4KB)

Impact and severity

  • Affected: Any Telegram group topic bound via type: "acp" to an ACP agent
  • Severity: High — messages are silently dropped with no error, user never receives a response
  • Frequency: 5/5 observed attempts with type: "acp" binding; 0 failures with type: "route" workaround
  • Consequence: ACP agent bindings are unusable; users must switch to type: "route" binding

Additional information

Activity

  1. clawsweeper commented on Jun 27, 2026

    @clawsweeper
    Contributor

    Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 27, 2026, 2:09 AM ET / 06:09 UTC.

    Summary
    Keep open: Telegram forum-topic type:"acp" bindings are documented and wired as supported behavior, the report is against latest release v2026.6.10, and current main does not show a matching fix for first-prompt delivery into acpx/opencode.

    Reproducibility: no. live Telegram/acpx reproduction was run, but docs and current source show this is a supported path and the observed idle ACP session matches the gap between configured binding initialization and first-turn dispatch.

    Ways to help us reproduce this

    • Add a screenshot or short recording showing the behavior.
    • Add expected vs actual behavior.

    Next step
    Queue a focused bug-fix PR because the contract is documented and source-reproducible, but require live or strongly instrumented proof for the exact Telegram/acpx first-turn path.

    Review details

    Best possible solution:

    Repair the existing Telegram configured ACP binding dispatch so a matched topic both initializes the ACP session and sends the inbound prompt through reply_dispatch/acpManager.runTurn, surfacing a visible error if dispatch cannot start.

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

    No live Telegram/acpx reproduction was run, but docs and current source show this is a supported path and the observed idle ACP session matches the gap between configured binding initialization and first-turn dispatch.

    Is this the best way to solve the issue?

    Yes: the best fix is to preserve the existing type:"acp" binding contract and repair first-prompt dispatch, not add a new binding type or make type:"route" the workaround.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • The exact break point between Telegram configured-binding readiness and ACP runTurn was not live-reproduced with Telegram/acpx/opencode in this read-only review, so the fix needs targeted regression coverage plus real transport/runtime proof.

    Codex review notes: model internal, reasoning high; reviewed against fbfadbd806e1.

    Label changes

    Label changes:

    • add P1: A documented Telegram ACP binding workflow can silently drop live user messages with no response in the latest release.
    • add impact:message-loss: The reported bound-topic message is accepted far enough to create a session but never reaches the user-visible ACP reply path.
    • add impact:session-state: The affected session is left with missing systemSent, zero tokens, and no transcript, so agent session state never advances.
    • add issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.
    • add clawsweeper:needs-live-repro: Current issue advisory state selects this label.

    Label justifications:

    • P1: A documented Telegram ACP binding workflow can silently drop live user messages with no response in the latest release.
    • impact:message-loss: The reported bound-topic message is accepted far enough to create a session but never reaches the user-visible ACP reply path.
    • impact:session-state: The affected session is left with missing systemSent, zero tokens, and no transcript, so agent session state never advances.
    Evidence reviewed

    Acceptance criteria:

    • node scripts/run-vitest.mjs extensions/telegram/src/bot-message-context.acp-bindings.test.ts
    • node scripts/run-vitest.mjs src/auto-reply/reply/dispatch-from-config.test.ts
    • node scripts/run-vitest.mjs src/acp/persistent-bindings.lifecycle.test.ts

    What I checked:

    • Reporter reproduction: this issue reports v2026.6.10 creates a configured Telegram ACP session and spawns opencode acp, but systemSent remains absent, no transcript is written, and switching only the binding to type:"route" works.
    • Documented ACP binding contract: ACP docs define bindings[].type as "acp", include Telegram forum topic identity syntax, and state OpenClaw ensures the configured ACP session before use and routes messages in that channel/topic/chat to it. Public docs: docs/tools/acp-agents.md. (docs/tools/acp-agents.md:330, fbfadbd806e1)
    • Telegram docs explicitly support forum-topic ACP bindings: Telegram channel docs say forum topics can pin ACP harness sessions through top-level typed ACP bindings with match.channel:"telegram" and topic-qualified peer ids. Public docs: docs/channels/telegram.md. (docs/channels/telegram.md:688, fbfadbd806e1)
    • Config docs define exact ACP conversation identity: Gateway config docs list type:"acp" as a persistent ACP conversation binding and say those entries resolve by exact conversation identity rather than normal route tier order. Public docs: docs/gateway/config-agents.md. (docs/gateway/config-agents.md:1135, fbfadbd806e1)
    • Telegram route rewrite exists on current main: Telegram conversation routing calls resolveConfiguredBindingRoute, rewrites the route, and records configured binding mode with the bound ACP session key. (extensions/telegram/src/conversation-route.ts:112, fbfadbd806e1)
    • Configured binding readiness only initializes the ACP session: Telegram waits for configured binding readiness before building inbound context, and the ACP lifecycle creates or reuses the configured session with initializeSession; this matches the reporter's observed session/process creation before prompt delivery stalls. (src/acp/persistent-bindings.lifecycle.ts:56, fbfadbd806e1)

    Likely related people:

    • dutifulbob: Authored PR ACP: add persistent Discord channel and Telegram topic bindings #34873 adding persistent Discord and Telegram ACP bindings and PR ACP: harden startup and move configured routing behind plugin seams #48197 moving configured routing behind channel/plugin seams. (role: configured-binding feature owner; confidence: high; commits: 6a705a37f2cf, ea15819ecf2b; files: docs/tools/acp-agents.md, docs/channels/telegram.md, src/channels/plugins/acp-configured-binding-consumer.ts)
    • osolmaz: Merged the PRs that introduced persistent ACP bindings and the configured-routing plugin seams. (role: merger for configured-binding feature work; confidence: medium; commits: 6a705a37f2cf, ea15819ecf2b; files: docs/tools/acp-agents.md, src/channels/plugins/acp-configured-binding-consumer.ts)
    • steipete: Recent history includes Telegram socket failure work and ACP reset/bound-session test work near the affected channel/runtime surfaces. (role: recent Telegram and ACP-adjacent contributor; confidence: medium; commits: 072d3ed7b5e4, 29df67c49149; files: extensions/telegram/src, src/acp)
    • joshavant: Recent post-release commits touched active session rollover and acpx-adjacent agent cron behavior, useful routing context even though they do not appear to fix this issue. (role: recent reply/session area contributor; confidence: low; commits: 6f1076351cbe, cee2aca40912; files: src/auto-reply/reply, extensions/acpx)
    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.
  2. added
    P1High-priority user-facing bug, regression, or broken workflow.
    impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.
    impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.
    issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.
    clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.
    on Jun 27, 2026
  3. openclaw-barnacle commented on Jul 12, 2026

    @openclaw-barnacle

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

  4. openclaw-barnacle commented on Jul 19, 2026

    @openclaw-barnacle

    Closing due to inactivity.
    If this is still an issue, please retry on the latest OpenClaw release and share updated details.
    If you are absolutely sure it still happens on the latest release, open a new issue with fresh steps to reproduce.

  5. allen0304 commented on Jul 25, 2026

    @allen0304
    Author

    Re-test results (2026-07-25, OpenClaw 2026.7.1-2)

    Confirmed: both bugs still present in the current release. Additionally, the investigation surfaced a second, related bug in the type: "route" subagent delivery path for the same Telegram group topic scenario.


    Environment

    • OpenClaw 2026.7.1-2, macOS 26.5 (arm64)
    • Telegram group -1003697845241, forum topic 2
    • ACP backend: acpx, target: opencode
    • messages.groupChat.visibleReplies: "message_tool"

    Bug 1 (original): type: "acp" binding — stdin never reaches CLI

    Same silent-fail pattern as reported in June:

    Topic 2 message → Gateway → ACPX backend ready → CLI spawned → ❌ stdin never delivered
    

    Gateway log evidence:

    11:05:27 [plugins] embedded acpx runtime backend registered (cwd: /Users/aiii/.openclaw/workspace)
    11:05:27 [plugins] embedded acpx runtime backend ready
    11:05:27 [telegram] Inbound message telegram:group:-1003697845241:topic:2 -> @AiiiAgentBot (group, 5 chars)
    # ... no further ACP activity — no outbound, no stdin log, CLI idles forever
    

    Process spawned but idle:

    $ ps aux | grep opencode
    aiii  51682  opencode acp      # spawned, running, but no stdin received
    aiii  51655  npm exec opencode-ai acp
    

    ✅ Gateway receives message
    ✅ CLI process spawned
    ❌ Message content never written to CLI stdin — CLI idles indefinitely, no response ever sent to topic

    Suspected code path: dist/dispatch-acp-session.runtime-DN_0YgLN.js — the message relay to stdin appears to fail for group topic routing metadata (threadId handling).


    Bug 2 (new discovery): type: "route" — subagent completion announce fails to deliver

    When topic 2 binding uses type: "route" → opencode agent (which internally spawns ACP subagent), the CLI does receive input and produce output, but the results can't be delivered back to the Telegram topic.

    Gateway log evidence:

    11:22:18 [telegram] outbound send ok ... threadId=2 replyToMessageId=167  # status msg sent OK
    11:22:48 I detect evaluation intent — ... assess code quality/a11y/performance/design
    11:23:06 OpenCode 已完成檢查,以下是針對 hello.html 的改善建議整理:
    11:23:06 [agents/agent-command] run announce ... ended with stopReason=stop
    11:23:06 [warn] Subagent completion direct announce failed: completion agent did not use the message tool for message-tool-only delivery
    11:23:08 [warn] Subagent completion direct announce failed (retry 2)
    11:23:10 [warn] Subagent completion direct announce failed (retry 3)
    11:23:11 [warn] Subagent announce give up (retry-limit) retries=3 deliveryError="completion agent did not use the message tool for message-tool-only delivery"
    

    ✅ Route binding routes message to opencode agent
    ✅ Agent spawns ACP subagent (sessions_spawn(runtime="acp"))
    ✅ OpenCode CLI receives input, processes file, produces complete output
    ❌ Subagent completion announce retries 3 times, all fail — results never delivered to Telegram


    Source code trace for Bug 2

    Four key files in the delivery chain:

    File Lines Role
    subagent-announce-BH7YpLmx.js 305–328 Orchestrates announce flow, calls deliverSubagentAnnouncement
    source-reply-delivery-mode-Cl9ZnCi6.js 69 chatType === "group" → checks messages.groupChat.visibleReplies → returns "message_tool_only"
    completion-delivery-policy-MroGvjFb.js 14–23 completionRequiresMessageToolDelivery() → true for group topics
    subagent-announce-origin-DPSebzOW.js 1166–1187 Fallthrough: requiresMessageToolDelivery is true, but announce agent didn't call message(action=send) → returns error

    Root cause: Group chat visibleReplies: "message_tool" forces message_tool_only delivery for subagent completions. The announce agent (parent session) receives the delivery trigger, starts a turn, but the completion routing with message_tool_only mode fails because the agent doesn't produce a message-tool-mediated visible reply within the announce turn.


    Reproduction steps

    Bug 1 (type: "acp"):

    1. Configure a Telegram group forum topic with type: "acp" binding targeting an ACP harness
    2. Send any message to that topic
    3. Observe: CLI process spawns but message never reaches stdin, no response ever sent

    Bug 2 (type: "route" → ACP subagent):

    1. Configure topic with type: "route" binding to an agent with runtime.type: "acp"
    2. Ensure messages.groupChat.visibleReplies is "message_tool"
    3. Send a coding task that triggers ACP subagent spawn (e.g., "檢查這個檔案列出改善建議")
    4. Observe: CLI processes the task, but completion results never delivered to topic — "completion agent did not use the message tool" warning repeats 3 times, then silences

    Summary

    type: "acp" type: "route" (ACP subagent)
    CLI spawns ✅ ✅
    CLI receives input ❌ (stdin fail) ✅
    CLI produces output N/A ✅
    Result delivered to topic ❌ ❌
    Breakpoint Input routing Output delivery

    Both bugs are specific to Telegram group topics — direct chat ACP bindings work fine. The common theme is that group topic routing metadata (threadId, delivery context) isn't handled correctly in the ACP input/output pipelines.

  6. allen0304 commented on Jul 25, 2026

    @allen0304
    Author

    Update: second type: "acp" test + confirmed workaround (2026-07-25)

    Ran a second type: "acp" test (after the earlier route-mode subagent fix) — same result, confirming the bug is stable and reproducible.

    type: "acp" test #2

    13:44:24 [telegram] Inbound message topic:2 → "test acp" (8 chars)
    13:44    opencode acp PID 76865 spawned
             ❌ no outbound — same pattern as test #1 (11:05)
    

    Confirmed workaround

    The following combination works end-to-end (tested twice with ACP-spawned OpenCode CLI tasks):

    bindings.type: "route"
    messages.groupChat.visibleReplies: "automatic"
    
    • type: "route" avoids the stdin delivery bug
    • visibleReplies: "automatic" avoids the subagent-"did not use the message tool" bug

    Both bugs are specific to Telegram group topic routing metadata (threadId, delivery context) not being handled correctly in the ACP input/output pipelines.

  7. locked as resolved and limited conversation to collaborators on Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority user-facing bug, regression, or broken workflow.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.impact:message-lossChannel message delivery can be lost, duplicated, or misrouted.impact:session-stateSession, memory, transcript, context, or agent state can drift or corrupt.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.staleMarked as stale due to inactivity

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions