Skip to content

fix(acp): bound sessions lose replies and streamed text - #168989

Merged
roboclaw-bot merged 6 commits into
mainfrom
openclaw/young-prawn
Oct 11, 2026
Merged

roboclaw-bot merged 6 commits into
mainfrom
openclaw/young-prawn

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #146365

What Problem This Solves

Fixes ACP-bound conversations failing to select a configured reply runtime and Telegram previews replacing earlier answer chunks.

User Impact

New raw-harness ACP sessions remain owned by the requesting OpenClaw agent. Existing bound harness sessions retain their original storage and transcripts while dispatching through the inspected channel owner. Telegram keeps incremental answer text visible without concatenating separate final replies.

Why This Change Was Made

Keep configured ownership separate from the external harness namespace. Preserve participant recording instead of hiding foreign-key failures by disabling it. Mark disjoint ACP text chunks explicitly; ordinary snapshots and final replies remain replacements, including text rewritten in place by delivery hooks. Existing metadata migration/read behavior is unchanged.

Evidence

  • Focused regressions pass: 57 ACP dispatch/cancellation tests, 31 Telegram HTTP delivery tests, and 9 owner/reopen/prefix tests. The prefix regression failed in both partial and block modes before the repair; the old CI cancellation failure was the exact added delta field, now covered without weakening settlement/transcript assertions.
  • Live Telegram Test Server + real ACPX process: a native /acp spawn proof-harness --bind here creates a main-owned session; the next user message reaches a deterministic ACP protocol peer. The same Telegram message changes from the first chunk to both chunks with one configured [proof] prefix. The late session-status notice is a separate message rather than overwriting the answer. This exercises the changed paths, not a normal mock-provider reply; no paid model was used.
  • Legacy bound-owner tests preserve the original harness store and transcript, reopen the persisted session with a fresh manager, and reject bindings removed or reassigned after configured runtime selection before any harness prompt executes. No database schema, serializer, or metadata migration changes are introduced; this is not a claim of a full released-package upgrade test.
  • Live forbidden-sender control: after the allowed user spawned and bound the ACP session, removing that sender from the Telegram allowlist caused the next real Telegram message to be rejected with zero harness prompt calls. Both live runs released their leases, removed credential scratch, and left no test listeners. An earlier reply-matcher fixture error and restart-interrupted attempts are not counted as passing proof.
  • Independent P0–P2 review of the repair delta is clean. Full staged static validation passed (732.3s), including core/extension types, lint, SDK surface, declarations, and architecture/auth guards. The one generic preview helper is accounted for explicitly in the SDK display-surface budget; no permission or persistence capability is widened.
  • Current-main conflict refresh was required only by the additive SDK surface-budget edits. Preserved both sets of exports; no hand-resolved runtime changes. The refreshed composition passed all 97 focused tests (174.5s grouped wall), the SDK shipped-surface/removal guard, and formatting. Prior static/live evidence remains scoped to the unchanged repair contracts.
  • Timing: ACP dispatch/cancellation suite 8.34s; final Telegram HTTP suite 79.08s; owner/reopen suite 29.98s; prefix metadata suite 1.17s. The original failed CI cancellation file took 9.31s and is fixed, not waived. Current-head CI will run on publication.
Captured Telegram and harness-boundary output (sanitized)

Native message IDs are replaced with run-local labels. The ACP peer is deterministic; Telegram and ACPX transport are real.

message M1: [proof] ✅ Spawned ACP session agent:main:acp:<session-id> (persistent, backend acpx). Bound this conversation to agent:main:acp:<session-id>.
message M2: [proof] ACP_PREFIX_PROOF_FIRST: This is the initial verified ACP answer chunk with enough visible content for a Telegram draft.
edit M2: [proof] ACP_PREFIX_PROOF_FIRST: This is the initial verified ACP answer chunk with enough visible content for a Telegram draft. ACP_PREFIX_PROOF_SECOND: This is the distinct continuation of that same answer, without another configured response prefix.
message M3: [proof] ⚙️ Session ids resolved.
acpx session id: <session-id>
acpx record id: agent:main:acp:<session-id>

Forbidden-sender run:
send status=completed text=/acp spawn proof-harness --bind here
send status=completed text=DENIED_ACP_HARNESS_MUST_NOT_RECEIVE_THIS
control actions: [{"type":"command","status":"completed","exitCode":0},{"type":"restartGateway","status":"completed"},{"type":"patchConfig","status":"completed"},{"type":"command","status":"completed","exitCode":0}]
harness boundary checkpoint: {"harnessPromptCalls":0,"expected":0}
SUT replies after excluded-sender message: 0

Production dispatch fixture (not live Telegram):
 ✓  infra  src/auto-reply/reply/acp-spawn-owner.test.ts > dispatches spawned ACP sessions without confusing the configured owner and harness storage 16195ms
 ✓  infra  src/auto-reply/reply/acp-spawn-owner.test.ts > dispatches legacy ACP sessions without confusing the configured owner and harness storage 1755ms
 ✓  infra  src/auto-reply/reply/acp-spawn-owner.test.ts > dispatches configured ACP sessions without confusing the configured owner and harness storage 1824ms
 ✓  infra  src/auto-reply/reply/acp-spawn-owner.test.ts > dispatches removed ACP sessions without confusing the configured owner and harness storage 1431ms
 ✓  infra  src/auto-reply/reply/acp-spawn-owner.test.ts > dispatches reassigned ACP sessions without confusing the configured owner and harness storage 1423ms
 ✓  infra  src/auto-reply/reply/acp-spawn-owner.test.ts > dispatches reopened ACP sessions without confusing the configured owner and harness storage 1773ms

Compatibility scope: this PR changes neither the persisted ACP schema nor its serializers or migration readers. The legacy-key fixture reopens the stored session through a fresh manager and asserts unchanged owner/key, ACP metadata, participant history, and assistant transcript. Existing bindings are not rewritten. A full v2026.10.1 updater exercise is not claimed; it would test unrelated updater behavior rather than this unchanged storage contract.

Requested by @steipete, following review of the public jmar5439/openclaw:test/all-fixes-2026.9.8 experiments.

Work sessions

Worked on by


View the OpenClaw team session

roboclaw-bot and others added 2 commits October 11, 2026 07:48
Keep raw harness sessions owned by the requesting configured agent, preserve legacy storage during bound dispatch, and explicitly distinguish answer deltas from replacement snapshots.

Co-authored-by: steipete <[email protected]>
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 7d643889-8ed4-45db-a8ed-da7e708caeae
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review October 11, 2026 07:49
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram size: M labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR separates ACP harness identity from configured reply-runtime ownership and preserves incremental Telegram answer text.

Example: The main agent runs /acp spawn claude --bind here, and the harness emits First sentence. followed by Second sentence..

  • Before: Follow-up dispatch can request an unpublished claude runtime, and successive Telegram chunks can replace earlier text.
  • After: New sessions belong to main, legacy sessions retain their storage identity, and Telegram accumulates both sentences with one response prefix.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The code resolves the earlier findings and has meaningful regression coverage, but required authority and released-state compatibility evidence cannot yet be cleared.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Bound ACP conversations can produce no response, and Telegram streaming can discard earlier answer chunks.
Reason: The collaborator-authored direction repairs documented failures using existing ownership boundaries; the broader linked issue also covers native slash-command behavior that this patch does not establish for legacy sessions.

Merge readiness

⛔ Blocked before merge - 4 items remain

Keep this maintainer-authored PR open: it addresses a current ACP dispatch failure and Telegram answer loss, and both earlier code findings are resolved.

Priority: P1
Reviewed head: cac2132e04119093f2f00dca87cb9db08bbb55cb

Before merge

  • Add real behavior proof - Authority-chain proof required: the body reports native Telegram spawning, real ACPX chunk accumulation, a separate status notice, and forbidden-sender rejection, while production-path tests inject binding removal and reassignment; captured final-effect output was not supplied in the readable GitHub material, and the supporting session link could not be inspected. Attach redacted logs or a terminal recording showing these outcomes before harness I/O, excluding credentials, IPs, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve security review attention item - No concrete bypass was found, but the newly enabled legacy execution path still requires inspectable final-effect authorization evidence.
  • Resolve merge risk - Before merge, establish final-effect rejection on the newly reachable legacy ACP path for a forbidden sender and for removed or reassigned bindings.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Inspectably captured Telegram/ACPX authorization results and a v2026.10.1 upgrade with existing bindings, preferences, participant history, and transcripts intact remain unverified.
Agent review details

How this fits together

Channel routing supplies a bound session and configured-owner observations to reply dispatch; ACP executes the harness, and the reply projector sends chunks through channel delivery.

flowchart LR
  A[Channel message] --> B[Binding route observations]
  B --> C[Configured runtime admission]
  C --> D[ACP session manager]
  D --> E[Reply projector]
  E --> F[Reply normalization]
  F --> G[Telegram preview and final delivery]
Loading

Technical review

Best possible solution:

Keep the shared ownership repair and explicit chunk contract, with inspectable authorization evidence and a stable-release upgrade preserving existing sessions.

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

Source confirms that binding projection can replace both session and agent identity with an unconfigured harness before runtime lookup; the linked report records the resulting production failures.

Is this the best way to solve the issue?

The shared resolver reuses existing binding observations, preserves legacy storage ownership, and marks chunk semantics explicitly rather than inferring them from text prefixes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 86c2aae466c5.

Merge-risk options

Maintainer options:

  1. Supply final-effect authorization evidence (recommended)
    Attach redacted captured output for allowed ACP execution, forbidden-sender rejection, and removed or reassigned binding rejection before harness I/O.

Provenance checked

  • Bound ACP runtime ownership keeps the original intent (a3b4c0a: fix(acp): deliver bound follow-up turns to external harnesses #110261 separated the configured reply runtime from harness-owned policy, storage, transcripts, and execution.)
  • ACP spawn namespace changes intended behavior with a stated reason (a7d56e3: feat: ACP thread-bound agents #23580 introduced thread-bound ACP sessions keyed by the target agent; this PR explains why raw harness names must no longer create configured owners.)
  • ACP projector lifecycle and incremental output keeps the original intent (295c8df: refactor(acp): make reply projector single-dispatch #120560 made projection dispatch-scoped and retained outer settlement ownership; explicit delta metadata preserves that lifecycle.)
  • Telegram preview and durable delivery keeps the original intent (1c3a424: The shared delivery refactor preserved preview versus durable-send contracts; the new delta handling remains confined to preview accumulation.)
  • Response prefix normalization keeps the original intent (d0a4cce: Dynamic response-prefix templates decorate replies; recording the exact added prefix preserves durable text while avoiding repeated preview decoration.)
  • Before-delivery modifiers keeps the original intent (b474f42: Reply payload sending hooks permit replacement text; clearing delta mode after a rewrite keeps that replacement authoritative.)

Testing

Proof path: in-process harness.

Security

Needs attention: No concrete bypass was found, but the newly enabled legacy execution path still requires inspectable final-effect authorization evidence.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit a3b4c0a adds src/auto-reply/reply/dispatch-from-config.gather.ts:329 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a3b4c0aa7196; files: src/auto-reply/reply/dispatch-from-config.gather.ts)
  • Onur Solmaz: Raw commit a7d56e3 adds src/auto-reply/reply/acp-projector.ts:76 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a7d56e3554d0; files: src/auto-reply/reply/acp-projector.ts)
  • Ayaan Zaidi: Raw commit e31a6e2 adds extensions/telegram/src/bot-message-dispatch-reply.ts:379 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e31a6e29fff7; files: extensions/telegram/src/bot-message-dispatch-reply.ts)

PR surface

Source +100, Tests +412, Docs +15, Other +2. Total +529 across 21 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 10 114 14 +100
Tests 8 423 11 +412
Docs 2 16 1 +15
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 2 +2
Total 21 557 28 +529

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #146365
Summary: The dispatch-owner portion addresses the established bound-ACP ownership defect; other open candidates overlap, while Telegram chunk accumulation is additional work.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The central defect prevents bound ACP follow-ups from executing and can dead-letter user messages.
  • merge-risk: 🚨 compatibility: The patch adds a public optional reply-payload contract and changes the owner namespace of newly created raw-harness sessions while retaining legacy storage.
  • merge-risk: 🚨 security-boundary: Configured-owner selection enables previously rejected legacy harness execution, requiring final-effect authorization evidence.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The changed behavior includes native ACP spawn replies, accumulated answer chunks, response-prefix handling, and separate final status notices on Telegram.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof for a disallowed channel sender and show that removed or reassigned legacy bindings prevent ACP harness I/O.
  • Upgrade existing harness-owned sessions from v2026.10.1 and verify bindings, settings, participant history, and transcripts remain intact.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-11T07:57:10.545Z sha b468ed3 :: needs real behavior proof before merge. :: [P2] Apply reply decoration once to the accumulated preview | [P2] Update the cancellation regression for explicit delta payloads

Reviewed October 11, 2026, 2:35 PM ET / 18:35 UTC (Revision 2).

roboclaw-bot and others added 2 commits October 11, 2026 18:20
Keep normalization-owned response prefixes distinct from authored chunk text. Preserve accumulated answer previews before final status notices and cover legacy binding revocation and reopening.

Co-authored-by: steipete <[email protected]>
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 89924c70-65be-4edc-8fe6-a40386857aa4
@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: M labels Oct 11, 2026
roboclaw-bot and others added 2 commits October 11, 2026 18:27
Integrate current main only to resolve the conflicting additive surface budget. Preserve the independent preview helper and main additions. Focused composition tests and SDK surface verification pass.

Co-authored-by: steipete <[email protected]>
Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: deac41a4-806a-47b9-9e76-172f8293cdd8
@roboclaw-bot
roboclaw-bot merged commit 2c543af into main Oct 11, 2026
158 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/young-prawn branch October 11, 2026 18:40
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 12, 2026
)

* fix(acp): bound sessions lose replies and streamed text

Keep raw harness sessions owned by the requesting configured agent, preserve legacy storage during bound dispatch, and explicitly distinguish answer deltas from replacement snapshots.

Co-authored-by: steipete <[email protected]>

* fix(acp): bound sessions lose replies and streamed text

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 7d643889-8ed4-45db-a8ed-da7e708caeae

* fix(telegram): preserve decorated ACP previews and notices

Keep normalization-owned response prefixes distinct from authored chunk text. Preserve accumulated answer previews before final status notices and cover legacy binding revocation and reopening.

Co-authored-by: steipete <[email protected]>

* fix(acp): bound sessions lose replies and streamed text

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: 89924c70-65be-4edc-8fe6-a40386857aa4

* fix(acp): bound sessions lose replies and streamed text

Worked on by:
- @steipete

Co-authored-by: steipete <[email protected]>
OpenClaw-Publication: deac41a4-806a-47b9-9e76-172f8293cdd8

---------

Co-authored-by: steipete <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 20, 2026
First-parent upstream 0bc7491..408a1f3 (53 commits, including
openclaw#169164 cold session/memory SQL off the Gateway main thread, openclaw#169173
per-turn SQLite bookkeeping, openclaw#169207 coalesced tool-result actor
admissions, openclaw#169238 inter-session envelope bytes, openclaw#168989 ACP replies).

Conflict:
- plugin-sdk-surface-report.mts: upstream budgets 3673/2134; ours stays
  +11/+4 on top (3684/2138).

Drag removed against upstream:
- plugin-sdk-surface-report.mts: dropped the "+1: createSessionHeaderLink"
  budget comments; upstream added them in openclaw#158742 and retired them in
  openclaw#165334, and no such export exists any more.
- normalize-reply.ts: restored upstream's blank line before
  bindNormalizeReplyTransformOwner (formatting-only overlay noise).

Auto-merged files that carry continuation overlay (normalize-reply,
sqlite-entry-store, user-turn-transcript, baselines, vitest paths) keep
the overlay byte-for-byte. Worker access inventory regenerated.

Refs #1475

Co-Authored-By: Claude Opus 5.5 <[email protected]>
steipete pushed a commit that referenced this pull request Oct 24, 2026
…2005)

#168989 keeps /acp spawn sessions for raw harness ids (claude, codex)
owned by the requesting configured agent, but the live ACP bind test
still asserted agent:<harness>:acp:, so the lane failed at the bind step
on every run. Assert the owner the spawn contract defines instead.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…nclaw#182005)

openclaw#168989 keeps /acp spawn sessions for raw harness ids (claude, codex)
owned by the requesting configured agent, but the live ACP bind test
still asserted agent:<harness>:acp:, so the lane failed at the bind step
on every run. Assert the owner the spawn contract defines instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: L 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.

1 participant