Skip to content

fix(cron): route topic targets through channel plugins#85701

Merged
steipete merged 4 commits into
mainfrom
fix/cron-plugin-owned-topic-targets
May 23, 2026
Merged

fix(cron): route topic targets through channel plugins#85701
steipete merged 4 commits into
mainfrom
fix/cron-plugin-owned-topic-targets

Conversation

@steipete

@steipete steipete commented May 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Moves cron announce target parsing for thread/topic ids behind the generic channel plugin parser instead of hard-coding Telegram forum syntax in cron core.
  • Keeps Telegram-owned chatId:topicId and chatId:topic:topicId parsing in the Telegram plugin, with cron consuming only the generic channel parser contract.
  • Updates cron delivery docs, changelog, and focused regression coverage for plugin-owned topic parsing.

Thanks @etticat for the original report and PR #49704.

Verification

  • pnpm test src/infra/outbound/targets.test.ts src/cron/isolated-agent/delivery-target.test.ts extensions/telegram/src/targets.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts
  • git diff --check
  • pnpm format:docs:check
  • .agents/skills/autoreview/scripts/autoreview --mode local --prompt "Review the refactor that moves cron delivery target topic parsing behind generic channel plugin target parsing. Focus on ownership boundary, Telegram forum topic target correctness, stale thread carry, and delivery regression risk. Do not complain about missing live Telegram proof; this is a local replacement PR prep."
  • pnpm check:changed via Blacksmith Testbox tbx_01ksa97e0fgg7z3m6sq5h6bc99, GitHub Actions run 26331385142

Real behavior proof

Behavior addressed: cron announce delivery resolves Telegram/forum topic ids through the owning channel plugin parser instead of cron core before direct delivery.
Real environment tested: local unit/integration tests plus Blacksmith Testbox tbx_01ksa97e0fgg7z3m6sq5h6bc99 changed gate.
Exact steps or command run after this patch: pnpm test src/infra/outbound/targets.test.ts src/cron/isolated-agent/delivery-target.test.ts extensions/telegram/src/targets.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts; pnpm check:changed.
Evidence after fix: focused tests passed 3 Vitest shards in 19.69s after rebase; Testbox changed gate exited 0 in run 26331385142.
Observed result after fix: Telegram :topic: and :topicId targets resolve to base chat id plus threadId; cron core no longer contains Telegram-specific topic stripping.
What was not tested: live Telegram Bot API/forum topic delivery with a real chat was not run in this replacement PR.

Replaces #49704.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram size: S labels May 23, 2026
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label May 23, 2026
@steipete steipete force-pushed the fix/cron-plugin-owned-topic-targets branch from 1cab374 to 645b9c0 Compare May 23, 2026 11:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cab374288

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

Latest ClawSweeper review: 2026-05-23 11:34 UTC / May 23, 2026, 7:34 AM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • 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.

Summary
The branch routes cron announce explicit target parsing through channel plugins, adds Telegram legacy slash topic target support, and updates docs, changelog, and regression tests.

Reproducibility: yes. source-level: PR head calls plugin parseExplicitTarget directly before the outbound wrapper, and current channel parsers such as ClickClack and QA throw on malformed syntax. I did not run tests because this review is read-only.

PR rating
Overall: 🧂 unranked krab
Proof: 🌊 off-meta tidepool
Patch quality: 🧂 unranked krab
Summary: Useful refactor direction, but a P1 parser-exception regression makes the patch not merge-ready.

Rank-up moves:

  • Guard parser exceptions and add a focused malformed-target regression test.
  • Rebase the conflicting branch and rerun the changed gate.
  • Capture live Telegram forum-topic delivery proof if maintainers want transport confidence before landing.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

Real behavior proof
Not applicable: This is a maintainer-labeled replacement PR, so the contributor real-behavior-proof gate is not applied; the body reports focused tests and Testbox proof but no live Telegram run.

Mantis proof suggestion
A live Telegram lane would prove that cron announce delivery reaches the configured forum topic rather than the base chat after the parser/routing change. A maintainer can ask Mantis to capture proof by posting a new PR comment that starts with the OpenClaw Mantis account mention, followed by:

telegram live proof: verify a cron announce job delivers the final reply to the configured Telegram forum topic without leaking to the base chat.

Risk before merge

  • Merging as-is can turn malformed cron delivery.to values for throwing channel parsers into an uncaught target-resolution abort instead of the expected structured Invalid delivery target result.
  • The live PR metadata reports mergeable=CONFLICTING and one failed CI shard, so the effective patch still needs rebase/check repair before merge.
  • The PR body has Testbox and focused test proof but no live Telegram topic delivery proof; the maintainer-labeled PR can choose that tradeoff, but real transport proof would reduce message-delivery risk.

Maintainer options:

  1. Guard plugin parser exceptions (recommended)
    Wrap the cron delivery parser seam so parseExplicitTarget failures fall through to normal target resolution or a structured invalid-target result, with a regression test for a throwing parser.
  2. Accept fail-fast parsing
    Maintainers could intentionally accept parser exceptions as hard failures, but that would be a user-visible behavior change for malformed cron delivery targets and should be documented and tested.
  3. Pause until rebase proof
    If the conflicting branch makes the effective diff unclear, pause this PR until it is rebased and the changed gate plus Telegram proof plan are refreshed.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Wrap channel plugin parseExplicitTarget calls used by cron delivery target resolution so parser exceptions cannot escape; add a focused regression test with a throwing parser that proves resolveDeliveryTarget returns a structured invalid delivery target result rather than rejecting.

Next step before merge
A narrow automated repair can guard the new parser seam and add regression coverage; merge still needs rebase and maintainer handling afterward.

Security
Cleared: No dependency, workflow, secret, permission, package-resolution, or new code-execution surface was added; the blocker is functional availability and delivery correctness.

Review findings

  • [P1] Catch plugin target parser exceptions — src/cron/isolated-agent/delivery-target.runtime.ts:18
Review details

Best possible solution:

Keep the plugin-owned parsing architecture, guard parser exceptions at the cron delivery seam, add a regression test for a throwing channel parser, then rebase and capture Telegram topic delivery proof if maintainers want transport confidence.

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

Yes, source-level: PR head calls plugin parseExplicitTarget directly before the outbound wrapper, and current channel parsers such as ClickClack and QA throw on malformed syntax. I did not run tests because this review is read-only.

Is this the best way to solve the issue?

No, not as written. The maintainable shape is still plugin-owned parsing, but the parser seam must catch exceptions and preserve structured cron delivery errors before merge.

Label changes:

  • add P2: This is a focused Telegram cron delivery bug-fix PR with limited blast radius, but it still needs a correctness repair before merge.
  • add merge-risk: 🚨 message-delivery: The PR changes cron target parsing for channel delivery and can mis-handle or abort deliveries for malformed plugin-owned targets if merged as-is.
  • add merge-risk: 🚨 availability: An uncaught parser exception can stop cron target resolution instead of returning a controlled invalid-target result.
  • add status: 🛠️ actively grinding: The PR author has acted after the latest ClawSweeper review and work remains. Not applicable: This is a maintainer-labeled replacement PR, so the contributor real-behavior-proof gate is not applied; the body reports focused tests and Testbox proof but no live Telegram run.
  • remove status: ⏳ waiting on author: Current PR status label is status: 🛠️ actively grinding.

Label justifications:

  • P2: This is a focused Telegram cron delivery bug-fix PR with limited blast radius, but it still needs a correctness repair before merge.
  • merge-risk: 🚨 message-delivery: The PR changes cron target parsing for channel delivery and can mis-handle or abort deliveries for malformed plugin-owned targets if merged as-is.
  • merge-risk: 🚨 availability: An uncaught parser exception can stop cron target resolution instead of returning a controlled invalid-target result.
  • rating: 🧂 unranked krab: Current PR rating is 🧂 unranked krab because proof is 🌊 off-meta tidepool, patch quality is 🧂 unranked krab, and Useful refactor direction, but a P1 parser-exception regression makes the patch not merge-ready.
  • status: 🛠️ actively grinding: The PR author has acted after the latest ClawSweeper review and work remains. Not applicable: This is a maintainer-labeled replacement PR, so the contributor real-behavior-proof gate is not applied; the body reports focused tests and Testbox proof but no live Telegram run.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible Telegram cron announce delivery to forum topics, which can be shown in a short real Telegram proof run.

Full review comments:

  • [P1] Catch plugin target parser exceptions — src/cron/isolated-agent/delivery-target.runtime.ts:18
    parseExplicitTargetForDelivery now calls each plugin parser directly, and resolveSessionDeliveryTarget uses that path before resolveOutboundTargetWithRuntime can wrap failures. Parsers like ClickClack and QA throw for malformed syntax, so an invalid cron delivery.to can reject target resolution instead of returning the normal structured invalid-target result; catch parser exceptions here and add a regression test.
    Confidence: 0.92

Overall correctness: patch is incorrect
Overall confidence: 0.9

Acceptance criteria:

  • node scripts/run-vitest.mjs src/cron/isolated-agent/delivery-target.test.ts
  • node scripts/run-vitest.mjs src/infra/outbound/targets.test.ts extensions/telegram/src/targets.test.ts
  • git diff --check
  • After rebase, run the changed gate in Testbox or the repository-approved changed check path.

What I checked:

Likely related people:

  • roytong9: Authored the merged Telegram topic target-normalization work that added current :topic: delivery-target behavior and regression tests in the cron resolver path. (role: introduced related behavior; confidence: high; commits: a3fd97570f8e; files: src/cron/isolated-agent/delivery-target.ts, src/cron/isolated-agent/delivery-target.test.ts)
  • giodl73-repo: Authored the recent merged cron bootstrap work for external channel delivery targets, which overlaps this PR's plugin bootstrap and delivery-target resolution boundary. (role: recent adjacent contributor; confidence: medium; commits: d7d85d1eb661; files: src/cron/isolated-agent/delivery-target.ts, src/infra/outbound/targets.ts)
  • steipete: Recently refactored cron delivery context resolution in the same resolver and test files, and this PR builds on that surface. (role: recent area contributor; confidence: medium; commits: fc9798a788ff, 645b9c018362; files: src/cron/isolated-agent/delivery-target.ts, src/cron/isolated-agent/delivery-target.test.ts)
  • vincentkoc: Split the loaded channel target parsing seam that resolveSessionDeliveryTarget uses for plugin-owned explicit target parsing. (role: adjacent route parsing contributor; confidence: medium; commits: eed595bba9ac; files: src/channels/plugins/target-parsing-loaded.ts, src/infra/outbound/targets-session.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 353dfeb108d7.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 645b9c0183

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot added 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. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. labels May 23, 2026
@clawsweeper

clawsweeper Bot commented May 23, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress.

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.
What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@clawsweeper clawsweeper Bot added status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 23, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the channel: telegram Channel integration: telegram label May 23, 2026
@steipete steipete force-pushed the fix/cron-plugin-owned-topic-targets branch from 899e5bc to 6695522 Compare May 23, 2026 12:27

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f4cc6d4e99

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@clawsweeper clawsweeper Bot added status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels May 23, 2026
@openclaw openclaw deleted a comment from chatgpt-codex-connector Bot May 23, 2026
@openclaw openclaw deleted a comment from chatgpt-codex-connector Bot May 23, 2026
@openclaw openclaw deleted a comment from chatgpt-codex-connector Bot May 23, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Verification before merge:

Behavior addressed: Cron announce delivery now routes Telegram forum-topic target parsing through the channel plugin parser instead of cron/core Telegram-specific parsing. Supported :topic: and numeric :topicId targets resolve to base chat target plus threadId; slash topic syntax is not accepted or documented.
Real environment tested: local macOS checkout plus GitHub Actions on PR head e664f65ac653b1d4288ec55718198136cb496ceb.
Exact steps or command run after this patch:

  • pnpm test src/infra/outbound/targets.test.ts src/cron/isolated-agent/delivery-target.test.ts extensions/telegram/src/targets.test.ts src/cron/isolated-agent.direct-delivery-core-channels.test.ts src/cron/service.jobs.test.ts
  • pnpm test src/cron/service.jobs.test.ts
  • pnpm format:docs:check
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode local --prompt "Review the current diff on branch fix/cron-plugin-owned-topic-targets. Focus on the cleanup in src/infra/outbound/targets-session.ts and src/cron/isolated-agent/delivery-target.ts: parser injection, plugin/core boundary, type correctness, and regressions in Telegram/forum topic delivery. Report only actionable findings."
  • gh pr diff 85701 | rg "slash|/[0-9]+|chatId/topicId|legacy" (no hits)
    Evidence after fix: Local focused tests passed; docs format and diff check passed; autoreview reported no accepted/actionable findings.
    Observed result after fix: PR checks passed on GitHub Actions run 26332996228; the failed checks-node-core-fast job was a checkout failure before code ran and passed on rerun as job 77522290209.
    What was not tested: No live Telegram send was run; coverage is plugin-parser/unit/integration-path focused.

@steipete steipete merged commit 9175491 into main May 23, 2026
164 of 166 checks passed
@steipete steipete deleted the fix/cron-plugin-owned-topic-targets branch May 23, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR mantis: telegram-visible-proof Mantis should capture Telegram visible proof. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 🛠️ actively grinding The PR author has acted after the latest ClawSweeper review and work remains.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant