Skip to content

fix(tlon): chunk outbound text over the declared delivery limit - #117438

Merged
steipete merged 3 commits into
openclaw:mainfrom
chenyangjun-xy:fix/tlon-outbound-chunking
Aug 1, 2026
Merged

steipete merged 3 commits into
openclaw:mainfrom
chenyangjun-xy:fix/tlon-outbound-chunking

Conversation

@chenyangjun-xy

@chenyangjun-xy chenyangjun-xy commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where long Tlon (Urbit) outbound messages could be delivered as a single oversized poke. The channel adapter declared a textChunkLimit of 10000 but never implemented a chunker, so core's delivery planner (src/infra/outbound/message-plan.ts) treated the limit as dead config and sent the whole text in one unit. Messages above the practical platform delivery size are sent unbroken, matching the silent-delivery-failure class that the sibling synology-chat fix (#116645) addressed.

Why This Change Was Made

ChannelOutboundAdapter.chunker is optional. When it is absent, planOutboundTextMessageUnits returns the entire text as a single text unit regardless of textChunkLimit. Every other bundled channel that declares a limit either provides a chunker (zalo, matrix, msteams, signal, telegram, sms, irc, qqbot, feishu, googlechat, imessage, nextcloud-talk, discord, line, twitch, reef, nostr, buzz) or explicitly opts out with chunker: null plus internal truncation (slack). Tlon was the only adapter declaring a limit with neither. The textChunkLimit: 10000 has been present since the plugin's original introduction but never wired to an actual chunker.

The fix adds the same standard declaration used across sibling channels:

chunker: chunkTextForOutbound,
chunkerMode: "markdown",

chunkTextForOutbound splits on newline/space boundaries first and falls back to a hard character split, so bounded sends always succeed.

User Impact

Long Tlon messages are now split into bounded chunks at the declared 10000-character limit instead of being delivered as one oversized unit. The textChunkLimit config becomes effective rather than dead.

Evidence

  • Root cause: extensions/tlon/src/channel.ts and extensions/tlon/src/channel.runtime.ts declared textChunkLimit: 10000 without a chunker. src/infra/outbound/deliver-core.ts:130 reads sendHandler.chunker (typed as ChannelOutboundAdapter["chunker"] in src/infra/outbound/deliver-contracts.ts:62) and planOutboundTextMessageUnits returns the whole text as one unit when the chunker is absent (src/infra/outbound/message-plan.ts:144). Tlon was the only bundled channel declaring a limit with neither a chunker nor chunker: null.
  • Regression coverage: extensions/tlon/src/channel.outbound.test.ts verifies the gateway adapter declares bounded Markdown chunking (chunkerMode: "markdown", textChunkLimit: 10000) and that the chunker splits a 10001-character string into two bounded chunks.
  • Real behavior proof: extensions/tlon/src/outbound.loopback.test.ts starts a mock urbit ship over loopback HTTP (rejects pokes whose memo exceeds 10000 characters with HTTP 413) and sends a 10001-character text through the real adapter path — tlonPlugin.outbound.sendText authenticates against the mock ship and issues one poke per chunked unit. The test asserts every poke is accepted (no oversized rejection), each delivered memo stays at or below 10000 characters, the pokes rejoin to the original text, and the poke count equals the chunk count. Full command + result:
$ node scripts/run-vitest.mjs extensions/tlon/src/outbound.loopback.test.ts
 Test Files  1 passed (1)
      Tests  1 passed (1)
  • Static checks run locally: git diff --check, oxfmt --check on the changed files, and node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json shows no tlon errors.
  • Tlon suite: 256/257 passing; the single failure is a pre-existing setup-wizard Unexpected prompt: Ship 名称 baseline in extensions/tlon/src/core.test.ts unrelated to this change (that file is untouched by this PR).
  • No real Urbit ship is reachable in this environment; live-ship behavior remains a CI/reviewer follow-up rather than a claimed pass.

AI Assistance

This PR was prepared with AI-assisted tooling. The author reviewed and understands the changes and their verification limits.

@openclaw-barnacle openclaw-barnacle Bot added channel: tlon Channel integration: tlon size: XS labels Aug 1, 2026
@chenyangjun-xy
chenyangjun-xy marked this pull request as ready for review August 1, 2026 14:12
@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. P2 Normal backlog priority with limited blast radius. 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 1, 2026, 3:00 PM ET / 19:00 UTC.

ClawSweeper review

What this changes

The PR makes Tlon’s declared 10,000-character outbound text limit effective by registering the shared Markdown-aware chunker in both the plugin adapter and runtime delegate, with adapter and loopback HTTP-poke coverage.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

This PR remains necessary: current main still declares Tlon’s 10,000-character delivery limit without a chunker, so the shared outbound planner sends oversized replies as one unit. The branch supplies the existing Plugin SDK chunker at the correct plugin boundary, has credible loopback transport proof, and has no actionable correctness or security finding; it needs normal maintainer review of the exact merge result.

Likely related people: Peter Steinberger is the strongest current-source routing candidate (medium confidence); DaigoSoup is relevant for the analogous merged channel-delivery repair (medium confidence).

Priority: P2
Reviewed head: 566895fd5ea574e213bc03983c007f25a6a10001

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, contract-aligned repair with credible loopback transport proof and no identified patch defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR body provides a passing terminal transcript for a loopback Urbit HTTP-poke scenario that observes each bounded chunk being accepted and oversized memo content being rejected; source inspection independently establishes the delivery-core planner connection.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body provides a passing terminal transcript for a loopback Urbit HTTP-poke scenario that observes each bounded chunk being accepted and oversized memo content being rejected; source inspection independently establishes the delivery-core planner connection.
Evidence reviewed 6 items Current delivery contract: The planner returns one text unit whenever a channel has no chunker, while the delivery core passes each channel handler’s chunker, mode, and effective limit into that planner before it invokes the send function.
Current-main gap: The supplied current-main revision still has Tlon’s two outbound adapters declaring textChunkLimit: 10000 without chunker or chunkerMode, so the no-chunker planner branch remains reachable.
Proposed repair and regression coverage: The PR adds the existing Plugin SDK chunker and Markdown mode to both Tlon adapter declarations, tests the declared contract plus a 10,001-character split, and includes a loopback HTTP-poke scenario that accepts bounded memo content while rejecting oversized content.
Findings None None.
Security None None.

How this fits together

OpenClaw’s outbound delivery core converts agent replies into ordered channel send units. Channel plugins declare a delivery limit and chunker; Tlon then delivers each planned unit through its Urbit HTTP poke transport.

flowchart LR
  A[Agent reply] --> B[Outbound delivery core]
  B --> C[Channel adapter settings]
  C --> D{Chunker and limit present?}
  D -->|yes| E[Bounded Markdown units]
  D -->|no| F[One unbounded unit]
  E --> G[Tlon HTTP poke transport]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - The branch is behind current main. GitHub context reports it as cleanly mergeable and the visible checks are successful, but maintainers should let GitHub evaluate the exact merge result before landing.
  • Resolve merge risk (P1) - Long Tlon replies will become multiple ordered recipient-visible messages rather than one oversized request; this is the intended delivery behavior and is covered by the submitted bounded-poke proof.
  • Complete next step (P2) - No automated repair is needed; a maintainer should review the current merge result and land the focused patch if required checks remain green.
Agent review details

Security

None.

PR surface

Source +8, Tests +184. Total +192 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 9 1 +8
Tests 2 184 0 +184
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 193 1 +192

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Validate the exact merge result (recommended)
    Refresh the merge result if needed and land once the current head remains clean with required GitHub checks green.
  2. Request real-ship confirmation
    Pause only if maintainers require a live Urbit ship run beyond the submitted loopback HTTP-poke evidence.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Require the current merge head to remain clean and all required GitHub checks to pass.

Technical review

Best possible solution:

Merge this focused plugin-contract repair after GitHub confirms the exact merge result, retaining shared outbound planning as the sole chunking policy rather than adding Tlon-specific HTTP transport splitting.

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

Yes. Current main provides a high-confidence source reproduction: Tlon supplies a delivery limit but no chunker, and the shared planner therefore produces one unbounded unit. The PR’s loopback proof shows bounded accepted HTTP pokes after the adapter chunker is applied, although that test manually invokes the chunker rather than calling the delivery core.

Is this the best way to solve the issue?

Yes. Registering the shared SDK Markdown chunker is the narrowest maintainable fix because the outbound core already owns unit planning and Tlon only needs to declare its channel contract. Splitting inside Tlon’s HTTP sender would duplicate shared policy and risk divergence across delivery routes.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: The change repairs a bounded, channel-specific outbound delivery bug without evidence of wider runtime impact.
  • merge-risk: 🚨 message-delivery: The PR changes how long Tlon replies are split into ordered recipient-visible delivery units.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body provides a passing terminal transcript for a loopback Urbit HTTP-poke scenario that observes each bounded chunk being accepted and oversized memo content being rejected; source inspection independently establishes the delivery-core planner connection.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides a passing terminal transcript for a loopback Urbit HTTP-poke scenario that observes each bounded chunk being accepted and oversized memo content being rejected; source inspection independently establishes the delivery-core planner connection.

Evidence

What I checked:

  • Current delivery contract: The planner returns one text unit whenever a channel has no chunker, while the delivery core passes each channel handler’s chunker, mode, and effective limit into that planner before it invokes the send function. (src/infra/outbound/message-plan.ts:144, 1e9a1405206d)
  • Current-main gap: The supplied current-main revision still has Tlon’s two outbound adapters declaring textChunkLimit: 10000 without chunker or chunkerMode, so the no-chunker planner branch remains reachable. (extensions/tlon/src/channel.ts:65, 1e9a1405206d)
  • Proposed repair and regression coverage: The PR adds the existing Plugin SDK chunker and Markdown mode to both Tlon adapter declarations, tests the declared contract plus a 10,001-character split, and includes a loopback HTTP-poke scenario that accepts bounded memo content while rejecting oversized content. (extensions/tlon/src/outbound.loopback.test.ts:66, 566895fd5ea5)
  • Shared helper contract: The repair reuses the SDK helper whose documented behavior preserves newline/space boundaries and falls back to hard character splits, rather than introducing Tlon-local chunking policy. (src/plugin-sdk/text-chunking.ts:15, 1e9a1405206d)
  • Available feature provenance: Current-line history attributes the surrounding Tlon adapter implementation to a recent repository refactor by Peter Steinberger. The partial checkout could not retrieve deeper promisor history, so original-introduction attribution remains medium confidence. (extensions/tlon/src/channel.ts:65, 1e34c2d073eb)
  • Analogous completed repair: The related Synology Chat repair was merged and uses the same general channel-chunking pattern, but it fixes a distinct transport and does not supersede this Tlon PR. (extensions/synology-chat/src/channel.ts:1, 75830f027af8)

Likely related people:

  • Peter Steinberger: Current line provenance for the Tlon outbound adapter resolves to this recent repository refactor; deeper original-introduction history was unavailable in the partial clone. (role: recent area contributor; confidence: medium; commits: 1e34c2d073eb; files: extensions/tlon/src/channel.ts, extensions/tlon/src/channel.runtime.ts)
  • DaigoSoup: Authored the merged Synology Chat long-message delivery repair that uses the same shared chunking direction for a neighboring channel surface. (role: adjacent channel repair author; confidence: medium; commits: 75830f027af8; files: extensions/synology-chat/src/channel.ts)

Rank-up moves

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

  • Let GitHub evaluate the exact current merge result because the branch is behind main.

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 (3 earlier review cycles)
  • reviewed 2026-08-01T14:19:01.109Z sha bbd973f :: needs real behavior proof before merge. :: [P1] Protect gateway replies at the Tlon transport boundary
  • reviewed 2026-08-01T14:47:34.867Z sha 983ff81 :: needs real behavior proof before merge. :: [P1] Enforce the limit at Tlon’s send boundary
  • reviewed 2026-08-01T15:14:31.174Z sha 566895f :: needs maintainer review before merge. :: none

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

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Maintainer independently ran the identical actual registered Tlon outbound adapter + production outbound planner + real login + real localhost Urbit HTTP poke on freshly pulled current main and the exact untouched original contributor head 566895fd5ea574e213bc03983c007f25a6a10001:

Existing transport limit on both versions: 10,000 characters

BEFORE direct message: actual adapter chunker undefined; [10001] -> HTTP 413 -> 0 delivered messages
BEFORE group channel:  actual adapter chunker undefined; [10001] -> HTTP 413 -> 0 delivered messages

AFTER direct message: actual adapter and runtime chunkers registered; [10000, 1] -> HTTP [200, 200]
                      poke marks [chat-dm-action, chat-dm-action]; original text reconstructed exactly
AFTER group channel:  actual adapter and runtime chunkers registered; [10000, 1] -> HTTP [200, 200]
                      poke marks [channel-action-1, channel-action-1]; original text reconstructed exactly

Intentional recipient-visible behavior: one oversized outbound response becomes two ordered, separately visible recipient messages for both direct and group delivery; their concatenated text exactly equals the original response. This replaces the prior total delivery failure; the existing 10,000-character limit is unchanged.

Focused owner/transport proof: OPENCLAW_VITEST_FS_MODULE_CACHE_PATH=/private/tmp/openclaw-vitest-s02-117438-tlon node scripts/run-vitest.mjs extensions/tlon/src/channel.outbound.test.ts extensions/tlon/src/outbound.loopback.test.ts extensions/tlon/src/urbit/send.test.ts — 8 tests passed. Fresh full-branch gpt-5.6-sol xhigh structured review: clean (0.99). Exact-head full hosted CI: https://github.com/openclaw/openclaw/actions/runs/30705280495.

ClawSweeper rank-up addressed: native maintainer review refreshed current main and the exact current merge result; preserve the original already-green external contributor head without an unnecessary rebase.

@steipete
steipete merged commit b24881e into openclaw:main Aug 1, 2026
100 of 112 checks passed
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
…claw#117438)

* fix(tlon): chunk outbound text over the declared delivery limit

* fix(tlon): guard optional outbound adapter in chunking test

* test(tlon): prove chunked outbound over real urbit loopback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: tlon Channel integration: tlon merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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.

2 participants