Skip to content

fix(reply): preserve streamed partials on run failure - #117603

Merged
obviyus merged 6 commits into
openclaw:mainfrom
dineshsuthar123:fix/streamed-partial-error
Aug 3, 2026
Merged

obviyus merged 6 commits into
openclaw:mainfrom
dineshsuthar123:fix/streamed-partial-error

Conversation

@dineshsuthar123

@dineshsuthar123 dineshsuthar123 commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #108586.

Telegram's default answer-draft path disables block streaming, so visible partial text is delivered through onPartialReply. If the model run then failed unexpectedly, the canonical runner did not know that Telegram had already shown output and the draft was cleared during cleanup.

What Changed

  • Track a visible partial only after the channel's awaited onPartialReply callback succeeds.
  • Recover an unexpected non-heartbeat failure when either a terminal block or a visible partial was genuinely delivered.
  • Keep user aborts silent and retain the existing heartbeat, reasoning-only, commentary-only, and no-visible-output behavior.
  • Add a reply-owner backstop for custom resolvers that throw after an awaited visible partial.
  • Finalize Telegram's active answer draft in place by appending the existing sanitized terminal notice, without clearing it or sending a duplicate durable message.

Maintainer Follow-up

This head covers the exact default path called out in review:

  1. Telegram resolves disableBlockStreaming: true for the default answer draft.
  2. The partial reaches the draft through onPartialReply.
  3. Delivery is recorded only after the queued draft update resolves.
  4. A subsequent unexpected resolver failure produces the canonical terminal error payload.
  5. Telegram performs exactly two edits: the visible partial, then the in-place finalized partial plus notice.

The composed Telegram ingress regression invokes the real buffered dispatch runtime. It no longer injects a final error payload directly.

Evidence

  • Runner E2E changed cases: 3 passed, 127 skipped, including direct-chat and group-chat recovery.
  • Core failure/accounting focused suites: 24 passed.
  • Core and extension production/test typechecks: passed.
  • Exact-head lifecycle recovery regression on ab609f08e16: 2 passed; asserts run_failed while the terminal reply remains deliverable.\n- Telegram composed draft + lane-delivery suites rerun on ab609f08e16: 58 passed.\n- Focused oxfmt, oxlint, git diff --check, and full build: passed.

Real Telegram transport proof

Run on rebased head 6a67980be3a1cb4003bc76e21abe0e925801efeb with a real Telegram QA user through TDLib, the real SUT bot, a temporary Gateway, and a mock Responses provider. The provider streamed OPENCLAW_PARTIAL_117603, waited six seconds, and completed successfully. A proof-only, uncommitted fault hook then threw from the same post-run usage-accounting boundary used by the red regression.

The redacted TDLib recording completed with exactly one SUT message. Its final text retained the streamed partial and appended the terminal notice. It recorded no clear, deletion, or second SUT message.

{
  "scenario": "telegram-group-partial-then-post-run-failure",
  "head": "6a67980be3a1cb4003bc76e21abe0e925801efeb",
  "transport": "real Telegram Bot API + TDLib",
  "faultBoundary": "post-run usage accounting",
  "recordingComplete": true,
  "sutMessageCount": 1,
  "finalText": "OPENCLAW_PARTIAL_117603\n\n⚠️ Something went wrong while processing your request. Please try again, or use /new to start a fresh session.",
  "draftCleared": false,
  "duplicateMessage": false,
  "verdict": "pass"
}

Commands:

node node_modules/vitest/vitest.mjs run --config test/vitest/vitest.e2e.config.ts src/auto-reply/reply/agent-runner.runreplyagent.e2e.test.ts -t "terminal failure in a .* chat after a delivered partial with block streaming disabled"
node scripts/run-vitest.mjs extensions/telegram/src/bot-message-dispatch.draft-failures-progress.test.ts extensions/telegram/src/lane-delivery.test.ts
node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core.tsbuildinfo
node scripts/run-tsgo.mjs -p tsconfig.extensions.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions.tsbuildinfo
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.core.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-test.tsbuildinfo
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfo
pnpm build

@openclaw-barnacle openclaw-barnacle Bot added channel: telegram Channel integration: telegram size: S labels Aug 1, 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 Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 12:19 PM ET / 16:19 UTC.

ClawSweeper review

What this changes

The branch records successfully delivered partial replies, converts later non-heartbeat failures into a terminal error payload, and has Telegram append that notice to the existing streamed answer draft instead of clearing it or sending a duplicate message.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for normal merge review. The prior lifecycle-state finding is addressed: recovery now records run_failed before returning the terminal payload, while the core runner and Telegram delivery path preserve an already delivered partial and finalize the same draft in place. Current main does not contain this recovery, and the branch includes focused core, dispatch, and Telegram regressions plus supplied real Telegram transport proof.

Priority: P1
Reviewed head: ab609f08e16135b481ac30ed90d203258b48d0a8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-backed repair with real Telegram transport proof and regressions for the previously missed default path and lifecycle state.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (recording): The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (recording): The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
Evidence reviewed 7 items Current-main gap: Current main marks an unexpected run as failed and rethrows it after no known failure payload is available; it has no visible-partial recovery branch at this owner boundary.
Canonical recovery implementation: The PR flushes terminal blocks, accepts either a delivered terminal block or a delivered partial, records run_failed, and returns a terminal failure payload only for non-heartbeat, non-aborted runs.
Delivery is recorded only after callback completion: The existing progress wrapper awaits the channel callback and invokes onVisible only when it did not return false, so the new visible-partial marker does not claim a failed or suppressed callback as delivered.
Findings None None.
Security None None.

How this fits together

The reply runner feeds streamed partials to channel callbacks and then returns a final payload or throws. Telegram maps those callbacks to one editable answer-draft message, so the failure path must retain delivery state and finalize that same message when a later run step fails.

flowchart LR
  A[Telegram inbound message] --> B[Reply runner]
  B --> C[Awaited partial callback]
  C --> D[Telegram answer draft]
  B --> E{Run outcome}
  E -->|Success| F[Normal final reply]
  E -->|Failure after delivery| G[Terminal error payload]
  G --> D
  D --> H[One finalized visible message]
Loading

Before merge

  • Resolve merge risk (P1) - The recovery is deliberately in shared reply dispatch as well as Telegram finalization; required exact-head CI should complete before merge to protect non-Telegram channels and direct custom resolvers.
  • Resolve merge risk (P1) - The failure notice now remains visible in group conversations when an answer partial was already delivered, which is the intended anti-silent-failure behavior but changes terminal delivery semantics for that narrow path.
Agent review details

Security

None.

PR surface

Source +101, Tests +247. Total +348 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 6 115 14 +101
Tests 3 247 0 +247
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 9 362 14 +348

Review metrics

Metric Value Why it matters
Production versus regression delta production +101 net (115 added, 14 removed); tests +247 The production growth establishes a shared visibility/failure ownership boundary and Telegram’s one-message finalization, with larger focused regression coverage for runner, dispatch, and transport behavior.

Merge-risk options

Maintainer options:

  1. Wait for exact-head delivery and lifecycle checks (recommended)
    Let the in-progress required checks validate the shared runner and Telegram delivery behavior on ab609f08e16135b481ac30ed90d203258b48d0a8 before merging.
  2. Accept the focused behavioral change
    Merge with the documented risk that visible partial failures now produce one final in-place error notice rather than draft cleanup, relying on the new direct, group, and lifecycle regressions.

Technical review

Best possible solution:

Merge the canonical core recovery with the Telegram in-place finalizer once the exact-head checks complete successfully; retain the explicit heartbeat, abort, no-visible-output, and failure-operation guards as the permanent boundary.

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

Yes—source-reproducible with high confidence. Current main rethrows the unexpected failure after an already delivered partial, while the branch’s focused runner, dispatch, and composed Telegram regressions exercise the repaired default draft path; this read-only review did not execute them locally.

Is this the best way to solve the issue?

Yes. The repair records delivery at the awaited callback boundary, recovers at the canonical reply owner, and lets Telegram finalize its existing draft, avoiding a channel-specific core workaround or duplicate fallback path.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: A failed run can otherwise erase already visible Telegram output and leave users with only a generic fallback.
  • merge-risk: 🚨 message-delivery: The PR changes whether a delivered partial is retained and whether the terminal notice edits the existing Telegram message instead of creating another delivery.
  • merge-risk: 🚨 session-state: The recovery now explicitly records run_failed while returning a deliverable terminal payload, changing the relationship between run lifecycle state and reply delivery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (recording): The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. The PR body provides redacted real Telegram TDLib evidence showing one retained and finalized SUT message after the fault path; the latest head also adds the lifecycle-state regression requested in the prior review.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The change directly affects the visible Telegram answer-draft message after a streamed partial and subsequent failure.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame identifies Peter Steinberger’s commit f5cb0f2 on the central Telegram delivery flow surrounding the PR’s change. (role: recent area contributor; confidence: medium; commits: f5cb0f2f76; files: extensions/telegram/src/lane-delivery-text-deliverer.ts)
  • obviyus: Authored the two latest follow-up commits that address the reviewed default-path and reply-operation lifecycle requirements. (role: follow-up repair contributor; confidence: high; commits: 6a67980be3a1, ab609f08e161; files: src/auto-reply/reply/dispatch-from-config.execute.ts, src/auto-reply/reply/dispatch-from-config.terminal-recovery.test.ts)

Rank-up moves

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

  • Let the currently in-progress required checks finish on the exact head before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

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

History

Review history (10 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-01T20:23:38.952Z sha 9cf600f1676a2d7a90d6700c60f5ad57f698e508 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T13:06:33.660Z sha 2c534be74df19817cbef59b28c6b268727e025db :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T13:11:53.723Z sha 2c534be74df19817cbef59b28c6b268727e025db :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T13:30:44.803Z sha 027e420c6fc79756c38291dc9dc96e9e3762b8c2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T13:48:55.432Z sha 027e420c6fc79756c38291dc9dc96e9e3762b8c2 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T15:36:12.098Z sha 57c4cf35c23f2c393df25c5f367b7afc9ebd5cf3 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T15:56:06.330Z sha 6a67980 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-03T16:02:54.510Z sha 6a67980 :: needs changes before merge. :: [P2] Mark the dispatch operation failed before swallowing this error

@dineshsuthar123

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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 Aug 1, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Blocking P1: the current patch still misses the exact default Telegram streaming path reported in #108586.

  • Telegram draft previews explicitly disable block streaming when an answer draft can stream (extensions/telegram/src/bot-message-dispatch-draft.ts:462-470).
  • The visible partial is delivered through the separate onPartialReply callback (extensions/telegram/src/bot-message-dispatch-turn.ts:155-160).
  • With block streaming disabled, blockReplyPipeline is null (src/auto-reply/reply/agent-runner-run.ts:493-501).
  • The proposed failure recovery only runs when blockReplyPipeline?.didStreamTerminalReply() === true (src/auto-reply/reply/agent-runner-core.ts:445-453).

Therefore the ordinary reported scenario—visible Telegram draft, then an unexpected model failure—still follows the throw/cleanup path and loses the draft. The new runner test enables block streaming, while the Telegram test injects a final error payload directly; neither composes the actual reporter path.

Please account for genuinely delivered onPartialReply output at the canonical reply owner, preserve existing heartbeat/abort behavior, and add a composed Telegram ingress regression with default draft streaming, a visible partial, and a subsequent unexpected failure that finalizes the existing draft in place.

Copy link
Copy Markdown
Contributor Author

Addressed in 2c534be74df.

  • The runner now wraps onPartialReply and records visibility only after the awaited channel callback succeeds with sendable content.
  • Unexpected recovery accepts either the existing terminal block evidence or that genuinely delivered partial evidence.
  • Heartbeats still rethrow, user aborts remain silent, and reasoning/commentary-only block streams retain their existing behavior.
  • The runner regression now uses blockStreamingEnabled: false and onPartialReply.
  • The Telegram ingress regression asserts the default disableBlockStreaming: true path and invokes the real buffered dispatch runtime with a resolver that emits a visible partial and then throws. It verifies exactly two draft edits, no clear, and no duplicate durable send.

Validation on this head:

  • runner E2E: 6 passed
  • Telegram draft-failure suite: 20 passed
  • core, extension, core-test, and extension-test typechecks: passed
  • focused format, lint, and diff checks: passed

I also updated the PR body with the exact commands and explicitly kept composed runtime evidence separate from the still-unavailable live Telegram transport proof.

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@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 Aug 3, 2026
@obviyus obviyus self-assigned this Aug 3, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Aug 3, 2026
@obviyus
obviyus force-pushed the fix/streamed-partial-error branch from 57c4cf3 to 6a67980 Compare August 3, 2026 15:42
@obviyus

obviyus commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 3, 2026
@obviyus

obviyus commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@obviyus
obviyus force-pushed the fix/streamed-partial-error branch from ac48001 to ab609f0 Compare August 3, 2026 16:13
@clawsweeper clawsweeper Bot added proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 3, 2026
@obviyus
obviyus merged commit 430fca6 into openclaw:main Aug 3, 2026
196 of 210 checks passed
@obviyus

obviyus commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Landed via squash on main as 430fca67ffb.

  • Exact-head CI: 80 passed; required gate green
  • ClawSweeper: no findings; proof sufficient
  • Focused proof: lifecycle recovery 2/2, Telegram draft delivery 58/58, real TDLib transport recording passed
  • Changelog: no separate entry

Thanks @dineshsuthar123!

steipete added a commit that referenced this pull request Oct 14, 2026
…delta after a preview is visible (#171417)

* fix(reply): stop re-sanitizing streamed Telegram replies on every delta

#118349 made partial reply text a lazy getter so Telegram sanitizes it
only when its draft stream flushes a preview. The visible-partial checks
from #117603 read that text after every visible partial, which runs
sanitizeUserFacingText over the whole cumulative reply on every model
delta once a preview is visible (progress mode after any tool call, and
partial mode).

The checks only set a flag that never resets and that only failure
handling reads, so stop reading once it is set. Both checks need this:
the getter is memoized per payload, so either one reading it runs the
sanitizer.

On the Telegram dispatch path a 24k-character reply drops from about
1.0 s to 0.1 s of Gateway CPU, and from about 48 s to 1 s when a line
starts with a Markdown link; Telegram sends are unchanged.

* test(reply): bound lazy preview sanitization regressions

Extend the Telegram-style visibility regressions to hundreds of deltas,
including initially hidden or sanitizer-empty content and entity/markup
boundaries. Preserve canonical whole-snapshot sanitization at consumption
and the existing terminal failure recovery contract. Remove a duplicate
comment without expanding production code.

Original fix by @boeingchoco for #171416.
Co-authored-by: boeingchoco <[email protected]>

* test(reply): prepare session facts for recovery authorization

CI exposed a recovery fixture calling the synchronous authorization
consumer without preparing its session facts. Use the existing async
owner and release the retained authorization after the test. Preserve
the live authority assertion and every recovery assertion.

---------

Co-authored-by: boeingchoco <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 15, 2026
…delta after a preview is visible (openclaw#171417)

* fix(reply): stop re-sanitizing streamed Telegram replies on every delta

openclaw#118349 made partial reply text a lazy getter so Telegram sanitizes it
only when its draft stream flushes a preview. The visible-partial checks
from openclaw#117603 read that text after every visible partial, which runs
sanitizeUserFacingText over the whole cumulative reply on every model
delta once a preview is visible (progress mode after any tool call, and
partial mode).

The checks only set a flag that never resets and that only failure
handling reads, so stop reading once it is set. Both checks need this:
the getter is memoized per payload, so either one reading it runs the
sanitizer.

On the Telegram dispatch path a 24k-character reply drops from about
1.0 s to 0.1 s of Gateway CPU, and from about 48 s to 1 s when a line
starts with a Markdown link; Telegram sends are unchanged.

* test(reply): bound lazy preview sanitization regressions

Extend the Telegram-style visibility regressions to hundreds of deltas,
including initially hidden or sanitizer-empty content and entity/markup
boundaries. Preserve canonical whole-snapshot sanitization at consumption
and the existing terminal failure recovery contract. Remove a duplicate
comment without expanding production code.

Original fix by @boeingchoco for openclaw#171416.
Co-authored-by: boeingchoco <[email protected]>

* test(reply): prepare session facts for recovery authorization

CI exposed a recovery fixture calling the synchronous authorization
consumer without preparing its session facts. Use the existing async
owner and release the retained authorization after the test. Preserve
the live authority assertion and every recovery assertion.

---------

Co-authored-by: boeingchoco <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: telegram Channel integration: telegram 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. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown-error failure path deletes already-streamed partial replies and posts only the generic fallback

3 participants