Skip to content

fix(agents): ask the channel for its parent-relay stream mode - #116293

Closed
obviyus wants to merge 2 commits into
mainfrom
fix/acp-channel-default-stream-mode
Closed

obviyus wants to merge 2 commits into
mainfrom
fix/acp-channel-default-stream-mode

Conversation

@obviyus

@obviyus obviyus commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

What Problem This Solves

An ACP sub-agent relays its commentary into the parent session. Whether that relay runs depends on the parent channel's effective preview stream mode — and the relay resolved that itself, with a hardcoded channel id:

if (channelId !== "discord" || hasConfiguredPreviewStreamMode(entry)) {
  return entry;
}
// ...stamp mode: "progress" into the config entry

src/agents/acp-spawn-parent-stream.ts:127-133 before this change.

Telegram's default preview mode is now progress as well. On a Telegram parent session the entry carries no mode, so the resolver fell back to partial, and resolveChannelStreamingProgressCommentary returned false: the sub-agent's commentary was never relayed, with nothing in the session explaining why. Every future progress-default channel would have inherited the same silent no-op.

Why This Change Was Made

The default belongs to the channel — Discord and Telegram already own that decision in resolveDiscordPreviewStreamMode / resolveTelegramPreviewStreamMode — so core should ask rather than guess. ChannelStreamingAdapter gains resolvePreviewStreamMode, alongside the blockStreamingCoalesceDefaults it already carries, and the relay reads it the same way block streaming reads that sibling field (src/auto-reply/reply/block-streaming.ts:209).

Discord and Telegram declare the helper each already had, so there is one rule per channel rather than a core copy that drifts. Channels that accept the core partial default declare nothing and are unaffected.

This also removes a core→plugin-identity dependency: no core file names a channel to decide channel behavior. Stamping a synthetic mode into a config entry to smuggle a resolved value is gone with it — the relay now passes the resolved mode as the argument the resolver already accepts.

User Impact

Sub-agent commentary now reaches the parent session on Telegram, matching Discord. No config surface added, changed, or retired; streaming.mode and streaming.progress.commentary behave as documented, and an explicitly configured mode still wins on every channel.

Behavior is unchanged for Discord (same rule, now sourced from the channel) and for channels with no declared rule (still partial).

The relay resolves the mode through getChannelPlugin, which falls back to the bundled plugin for built-in channels; if no plugin resolves, it degrades to today's partial default rather than failing.

Evidence

src/agents/acp-spawn-parent-stream.test.ts, 36 passing. New case asserts a parent relay on both discord and telegram with channels.<id>: {} — no configured mode — relays commentary; on main the Telegram half of that loop fails. Existing cases still pass unchanged: explicit streaming.mode: "off" on Discord suppresses the relay, account-level overrides keep their explicit off, and generic channels keep the partial default.

The test declares the same rule the shipped channels declare, resolved through the real resolveChannelPreviewStreamMode, so an explicit mode still wins in the stub exactly as in production.

Typecheck clean (tsgo:core, tsgo:extensions); oxlint clean; check-import-cycles reports 0 runtime cycles. Non-test source is net −22 lines, and dropping the stamping helper puts acp-spawn-parent-stream.ts under the max-lines limit, so its grandfathered suppression and baseline entry are retired (check-max-lines-ratchet --prune).

Related

Surfaced while landing #116272, which fixed the same silent-no-op class on the direct channel path: the commentary gate guessing a mode instead of taking the caller's resolved one.

🤖 Generated with Claude Code

The ACP parent relay resolved the effective preview stream mode itself, by
stamping mode: "progress" into the config entry when the channel id was
literally "discord". Telegram's default became progress too, so on a Telegram
parent session the entry kept no mode, resolved to partial, and the commentary
relay stayed off with nothing explaining why.

Channels own that default, so ChannelStreamingAdapter now carries the channel's
own rule and the relay asks for it instead of guessing. Discord and Telegram
declare the helpers they already had; every other channel keeps the core partial
default. The config-stamping helper and its hardcoded id are gone, which drops
the file under max-lines and retires its grandfathered suppression.
@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: telegram Channel integration: telegram agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 30, 2026
@obviyus
obviyus marked this pull request as ready for review July 30, 2026 07:44
@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. labels Jul 30, 2026
@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 6, 2026, 4:49 AM ET / 08:49 UTC.

ClawSweeper review

What this changes

The PR makes ACP parent-commentary relay obtain the effective preview-stream mode from the active channel rather than applying a Discord-specific default in core.

Merge readiness

⛔ Blocked by patch quality or review findings - 7 items remain

Keep open: current main still suppresses bare Telegram ACP parent commentary, but this head has a test-type failure, retains the prior hot-path loading defect, and lacks real behavior proof. Likely related people: Peter Steinberger (high), obviyus/Ayaan Zaidi (high), and Vito Cappello (medium).

Priority: P1
Reviewed head: 4da7e333b3787fb7fc310e0e5bcb0aabe13ba425
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🧂 unranked krab (1/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 5 items Current-main defect: Current main stamps progress mode only for Discord, so an unset Telegram entry reaches the commentary gate without Telegram's progress default.
Telegram default and gate: Telegram's preview resolver defaults to progress, while the shared commentary resolver falls back to partial unless its caller supplies the effective mode.
PR hot-path regression: The proposed relay reads a static default through getChannelPlugin; the registry falls back to bundled-plugin materialization rather than a lightweight public artifact.
Findings 2 actionable findings [P1] Expose streaming in the Telegram base return type
[P2] Avoid loading a full channel plugin in the ACP relay
Security None None.

How this fits together

ACP sub-agents emit commentary that the parent-session relay filters using the parent channel’s stream policy before forwarding it as a session event. Channel plugins own preview-mode defaults, while the core relay consumes the resolved mode.

flowchart LR
  A[ACP sub-agent commentary] --> B[Parent-session relay]
  C[Parent channel configuration] --> D[Channel preview-mode policy]
  D --> B
  B --> E[Commentary eligibility decision]
  E --> F[Parent session event]
Loading

Decision needed

Question Recommendation
Should preview-mode resolution become a public ChannelStreamingAdapter contract, or should ACP use a lightweight bundled channel artifact for this static policy? Use an artifact-first policy seam: Keep channel ownership of the default while adding a narrow lightweight artifact for ACP and retaining partial only when no channel supplies a resolver.

Why: The submitted fix introduces an exported plugin contract while the repository's channel and agent policies require a lightweight path instead of full plugin loading.

Before merge

  • Expose streaming in the Telegram base return type (P1) - Late observation: the new streaming field is omitted from both declared Pick return types, so telegramPluginBase.streaming in the added test is a type error and check-test-types fails. Include streaming in both declarations or preserve the inferred return type.
  • Avoid loading a full channel plugin in the ACP relay (P2) - getChannelPlugin falls back to bundled-plugin materialization, yet this relay only needs a static default. Use the existing lightweight public-artifact pattern so ACP startup does not load the full Discord or Telegram runtime; this remains unresolved from the prior review.
  • Resolve merge risk (P1) - Until the Telegram return type is corrected, the added adapter is erased from its declared public base shape and test typechecking fails.
  • Resolve merge risk (P1) - The ACP relay would materialize a full bundled channel runtime solely to read static policy, increasing import cost and failure exposure on an agent hot path.
  • Resolve merge risk (P1) - The optional exported ChannelStreamingAdapter method is a compatibility-sensitive plugin contract that needs an explicit maintainer decision on its permanent shape.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P1] Expose streaming in the Telegram base return type — extensions/telegram/src/shared.ts:190
  • [P2] Avoid loading a full channel plugin in the ACP relay — src/agents/acp-spawn-parent-stream.ts:151
Agent review details

Security

None.

PR surface

Source -10, Tests +69, Other -1. Total +58 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 26 36 -10
Tests 3 69 0 +69
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 8 95 37 +58

Review metrics

Metric Value Why it matters
Production versus test delta production -10, tests +69, baseline -1 The patch removes core-specific defaulting and adds regression coverage, but introduces a new exported plugin contract and a hot-path lookup that need review.

Root-cause cluster

Relationship: canonical
Canonical: #116293
Summary: This PR owns the remaining ACP parent-relay mode-resolution path; the related merged commentary work repaired a neighboring caller/callee boundary only.

Members:

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

Mantis proof suggestion

A Telegram transcript can directly demonstrate that default-mode ACP commentary reaches the parent session. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram live proof: verify that an ACP sub-agent's commentary reaches a Telegram parent session with the channel's default streaming configuration.

Merge-risk options

Maintainer options:

  1. Repair the type and use a lightweight policy artifact (recommended)
    Add streaming to Telegram's declared base type and replace the full-plugin fallback with an artifact-first resolver before merge.
  2. Approve the new public adapter intentionally
    Maintain the proposed exported adapter only after an owner accepts its external plugin contract and its hot-path loading behavior.

Technical review

Best possible solution:

Use a lightweight channel-owned preview-mode artifact, preserve the generic partial fallback only when no channel declares a policy, correct Telegram’s exported base type, and prove the default Telegram ACP relay through a redacted live or qualifying mock-gateway run.

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

Yes—source-reproducible on current main: start an ACP relay with a Telegram parent configuration of channels.telegram: {} and enabled commentary; the relay supplies partial instead of Telegram's progress default.

Is this the best way to solve the issue?

No. Channel-owned mode resolution is the right direction, but obtaining it by loading a full channel plugin on the ACP path and exposing an unresolved public API is not the narrowest maintainable repair.

Full review comments:

  • [P1] Expose streaming in the Telegram base return type — extensions/telegram/src/shared.ts:190
    Late observation: the new streaming field is omitted from both declared Pick return types, so telegramPluginBase.streaming in the added test is a type error and check-test-types fails. Include streaming in both declarations or preserve the inferred return type.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.
  • [P2] Avoid loading a full channel plugin in the ACP relay — src/agents/acp-spawn-parent-stream.ts:151
    getChannelPlugin falls back to bundled-plugin materialization, yet this relay only needs a static default. Use the existing lightweight public-artifact pattern so ACP startup does not load the full Discord or Telegram runtime; this remains unresolved from the prior review.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: A default Telegram ACP session can silently omit sub-agent commentary, and the submitted patch currently cannot pass its test type check.
  • merge-risk: 🚨 compatibility: The patch adds an optional resolver to the exported channel plugin streaming contract.
  • merge-risk: 🚨 availability: The ACP relay can trigger full bundled plugin materialization merely to obtain static stream policy.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The claimed repair changes whether Telegram users visibly receive ACP parent-session commentary.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Recent channel-contract and lifecycle history makes this the strongest routing contact for a new lightweight channel-policy seam. (role: channel-contract architecture contributor; confidence: high; commits: 9e4381eb, aa2a5c96; files: src/channels/plugins/types.core.ts, src/channels/plugins/thread-binding-api.ts)
  • obviyus: Authored this PR and the merged related commentary-mode work, connecting them to the shared resolver and ACP call path. (role: commentary-streaming contributor; confidence: high; commits: e191df5ea2c6, 7c47e4ad0e53; files: src/agents/acp-spawn-parent-stream.ts, src/channels/streaming.ts)
  • Vito Cappello: Current-main blame for the ACP defaulting and shared commentary-gate area traces to this history, though shallow history limits origin certainty. (role: recent current-file contributor; confidence: medium; commits: 2a835768; files: src/agents/acp-spawn-parent-stream.ts, src/channels/streaming.ts)

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 (7 earlier review cycles)
  • reviewed 2026-07-30T07:49:40.332Z sha e191df5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-30T08:01:08.552Z sha 4da7e33 :: needs real behavior proof before merge. :: [P1] Carry the effective mode into the ACP relay
  • reviewed 2026-08-02T07:51:24.719Z sha 4da7e33 :: needs real behavior proof before merge. :: [P2] Avoid loading the full channel plugin for a static mode default
  • reviewed 2026-08-02T14:24:20.488Z sha 4da7e33 :: needs real behavior proof before merge. :: [P2] Avoid full plugin loading for a static channel default
  • reviewed 2026-08-03T09:17:36.360Z sha 4da7e33 :: needs real behavior proof before merge. :: [P2] Avoid full plugin loading for a static channel default
  • reviewed 2026-08-03T22:26:02.517Z sha 4da7e33 :: needs real behavior proof before merge. :: [P2] Avoid loading a full channel plugin in the ACP relay
  • reviewed 2026-08-05T06:17:23.153Z sha 4da7e33 :: needs real behavior proof before merge. :: [P2] Avoid loading a full channel plugin in the ACP relay

… rule

The relay test stubs the plugin registry, so a missing declaration on the
shipped channels would still pass. These assert the plugin bases themselves
carry the rule and that an explicit mode still wins.
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label Jul 30, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 3, 2026
@obviyus obviyus closed this Aug 12, 2026
@RomneyDa
RomneyDa deleted the fix/acp-channel-default-stream-mode branch October 22, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: discord Channel integration: discord channel: telegram Channel integration: telegram maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant