Skip to content

fix(reply): keep configured ACP bindings from dropping the first turn - #97649

Closed
wyf027 wants to merge 4 commits into
openclaw:mainfrom
wyf027:wyf027/fix-97186-telegram-acp-first-turn
Closed

wyf027 wants to merge 4 commits into
openclaw:mainfrom
wyf027:wyf027/fix-97186-telegram-acp-first-turn

Conversation

@wyf027

@wyf027 wyf027 commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #97186.

Configured type: "acp" bindings could finish session initialization but still lose the first inbound turn when no reply_dispatch hook claimed the ACP session. The result matched the report: session created, backend process spawned, but no systemSent, no transcript, and no visible reply.

What Problem This Solves

Telegram-style ACP sessions can be routed to a configured ACP target session before any reply-dispatch hook claims the event. When that hook path declines the event, the first user turn is silently dropped instead of being dispatched to the ACP runtime, so the conversation never produces a visible reply.

What changed

  • Build the ACP reply_dispatch event once and reuse it.
  • If the hook path does not handle an ACP-bound session, fall back to calling the core ACP dispatch runtime directly before embedded-model fallback.
  • Add a regression test that uses a configured Telegram-style ACP session key and proves the first turn still reaches runTurn() even when the hook declines to claim it.

Why this fixes the bug

Configured ACP bindings already rewrite the inbound session key to the ACP target session. The missing piece was a core fallback for that target when hook wiring was absent or declined the event. With this change, ACP-bound sessions no longer depend on the hook path to process the first prompt.

Evidence

  • node scripts/run-vitest.mjs src/auto-reply/reply/dispatch-from-config.test.ts
  • node scripts/run-vitest.mjs src/auto-reply/reply/dispatch-from-config.reply-dispatch.test.ts
  • pnpm_config_verify_deps_before_run=false pnpm build

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 29, 2026
@clawsweeper

clawsweeper Bot commented Jun 29, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the contribution. This PR still needs the requested real-behavior proof, and the branch has been idle since that ask.

Close this stale PR: it still lacks real configured-ACP behavior proof and retains a P1 path that can dispatch a second ACP turn after a timed-out hook is reported as unhandled.

So I’m closing this for now to keep the review queue honest. Please reopen or open a fresh PR with real-behavior proof (a live run, logs, or a reproducible validation transcript) and it will be reviewed again.

Review details

Best possible solution:

If revived, reimplement the repair in current route selection with an explicit hook outcome that permits fallback only after a completed decline, then prove one inbound ACP turn yields exactly one runtime turn and reply.

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

No live current-main reproduction was run, but source establishes that an unhandled hook falls through and that a timeout is indistinguishable from a completed decline to this branch.

Is this the best way to solve the issue?

No. The fallback is plausible for completed declines but is unsafe after timeout; an outcome-aware current-main route handoff is the narrower safe repair.

Security review:

Security review cleared: The diff changes ACP routing and tests only; no new dependency, credential, permission, or supply-chain surface was found.

AGENTS.md: found and applied where relevant.

What I checked:

  • Fallback treats timeout as an unclaimed dispatch: The branch calls the direct ACP fallback whenever reply dispatch does not return handled, but claiming-hook timeouts are caught and the runner ultimately returns undefined while the timed-out work is not cancelled. (src/auto-reply/reply/dispatch-from-config.ts:1925, 23cd93e2ce32)
  • Current ACP hook owns normal ACP dispatch: Current main registers the ACPX reply-dispatch hook with its own timeout and sends the event to the ACP runtime; the fallback must distinguish a finished decline from a timed-out owner. (extensions/acpx/index.ts:60, 1011b4102fd1)
  • Timeout behavior is contractual and tested: The hook runner races claiming hooks against registration timeouts, catches failures, and continues; its focused test demonstrates timeout continuation rather than cancellation. (src/plugins/wired-hooks-reply-dispatch.test.ts:98, 1011b4102fd1)
  • Stalled proof window: The branch head is from 2026-07-21, the needs-proof label was applied on 2026-06-29, and the provided timeline shows no subsequent contributor commit or human maintainer engagement; the PR body supplies mock tests and a build, not real runtime proof. (23cd93e2ce32)

Likely related people:

  • Peter Steinberger: Recent history includes the ACP SDK/runtime refactor and plugin hook consolidation that own the relevant handoff contract. (role: recent ACP and hook-framework contributor; confidence: high; commits: 7af8e129d685, 1f3d45b76f51; files: src/plugin-sdk/acpx.ts, src/plugins/hooks.ts)
  • Ayaan Zaidi: Current-main blame attributes the ACP SDK dispatch bridge and bound-session resolution to the latest integration commit. (role: recent current-main integrator; confidence: medium; commits: 1425d944ca98; files: src/plugin-sdk/acpx.ts, src/auto-reply/reply/dispatch-from-config.context.ts)

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

@openclaw-barnacle openclaw-barnacle Bot removed the triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. label Jun 29, 2026
@clawsweeper clawsweeper Bot added 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. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. labels Jun 29, 2026
@wyf027
wyf027 force-pushed the wyf027/fix-97186-telegram-acp-first-turn branch from 0d8143f to 2950355 Compare July 12, 2026 10:05
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jul 12, 2026
@wyf027
wyf027 force-pushed the wyf027/fix-97186-telegram-acp-first-turn branch from 2950355 to 5548a27 Compare July 21, 2026 04:07
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 23, 2026
@clawsweeper clawsweeper Bot added 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. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

@clawsweeper clawsweeper Bot closed this Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mantis: telegram-visible-proof Mantis should capture Telegram visible proof. 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. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant