Skip to content

fix: keep Telegram automations tied to their owner and account - #201008

Merged
vincentkoc merged 11 commits into
mainfrom
openclaw/scheduled-telegram-authority-20261118
Nov 18, 2026
Merged

vincentkoc merged 11 commits into
mainfrom
openclaw/scheduled-telegram-authority-20261118

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Related: #186008

What Problem This Solves

An automation scheduled from a Telegram private chat can fail every run with Scheduled account "<name>" is unavailable even though that bot account is configured and still chatting normally. The job was saved without the record that it came from Telegram, so the scheduler had no channel to check the account against. A later repair turn could also lose the identity of the owner who authorized the job.

User Impact

Automations created by a Telegram owner keep their Telegram account context and authenticated requester, so they run and can be repaired. An owner can reauthorize an existing job in its original Telegram conversation while keeping its current tool list.

Jobs saved before this change are not migrated. Each one needs a single reauthorization from its original conversation; until then it still reports the account as unavailable.

Why This Change Was Made

The creation grant passed through only local origins, so an authenticated channel owner's external origin was dropped, and the native requester was captured for Discord only. The grant now carries the origin for channel owners, and the Telegram requester comes from the identity that channel ingress already verified and bound to the current owner authority. A missing, mismatched, or revoked grant cannot establish ownership.

Not in this change: other channels keep their origin but still do not capture a native requester, and the scheduler's "account unavailable" wording for a job with no saved origin is unchanged. Both are follow-ups.

Evidence

Incident. On one deployment, 25 runs across 10 automations created from Telegram private-chat topics failed with this error over six days while the same account kept delivering chat. The affected jobs carried an account policy but no saved origin, and a private-chat session key names no channel.

Regression coverage. The Gateway integration test creates a job through the automation tool from a private-chat thread session, reloads it, and proves the saved origin and requester, the owner recheck on repair (including revocation and a non-owner), scheduled trigger evaluation, and rejection once the account is removed.

Exact-head CI. Run 44261389865 (attempt 1) tested 210fb959c8e5da0de4dc32c6d1502912dda78319 merged into main at ee3f5a72fb. The five test files this PR adds or changes passed with no failures, and security-fast passed. Nine jobs and the aggregate gate failed, none in code this PR touches:

Jobs Failure Attribution
check-prod-types, check-test-types, check-test-types-core-1 to -5, check-additional-extension-package-boundary Six compiler errors in src/plugin-sdk/plugin-entry.ts, which imports type names main no longer exported at that commit Identical on main: scheduled run 44252334221 on the same main commit reports the same six errors in the same eight jobs. Main has since landed #201044
checks-node-changed-compact-small-34 Three cases of src/cli/program/register.onboard.test.ts The test asserts on interactive-shell output and this runner prints a sudo hint into it; the same test passes on main run 44252334221. This PR changes no file under src/cli/

The files behind both failures are byte-identical between that main commit and the tested merge. This PR is being landed with those failures attributed rather than green.

An earlier dispatch on the same head (run 44251963365) failed on different inherited jobs (stale exports, two UI e2e tests, the same onboarding test, one timeout) that did not recur.

The current-head native and hosted test-line ratchets passed exactly: 463 net regression lines = 400 default + 63 allocated. The allocation-only commit retains independent origin, owner, revocation, and account-removal regression coverage.

Local review. Autoreview, branch mode, merge base f3707dafb9 to head 210fb959c8, priorities P0 through P2: scoped-clean, no findings. The reviewer had the diff only; it did not have unchanged implementation context and did not execute tests.

Live. Telegram creation and retrieval passed with exactly six allowed tools, the caller origin, and the authenticated requester preserved. Offline legacy-job repair also passed update, retrieval, and removal with the same tool capabilities. Live reauthorization of a job saved before this change has not been run.

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime agents Agent runtime and tooling size: L labels Nov 18, 2026
@vincentkoc vincentkoc self-assigned this Nov 18, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 18, 2026
@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Preserves a Telegram owner's authenticated requester and channel origin when creating or reauthorizing account-bound automations.

Example: A verified Telegram owner creates an automation from account work in a private-chat topic.

  • Before: The saved job can lack Telegram provenance and fail with Scheduled account "work" is unavailable.
  • After: The job retains its Telegram origin and authenticated requester while preserving its account restriction and allowed tools.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused repair with resolved prior findings and compatible persisted fields; direct runtime evidence is limited and required CI remains unresolved.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the contributor proof gate; its live Telegram report describes creation, readback, provenance loss, and explicit same-owner repair, while inspectable source coverage uses the in-process Gateway and scheduler.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Telegram owners can save automations that repeatedly reject a healthy account and lose the requester needed for owner repair.
Reason: The maintainer-authored direction repairs a concrete creation failure; Related wording correctly leaves the broader restart and persistence report open.

Merge readiness

✅ Ready for maintainer review

Keep this PR open: it repairs a current automation-creation defect, resolves the three earlier findings, and introduces no identified code or security defect.

Priority: P2
Reviewed head: 210fb959c8e5da0de4dc32c6d1502912dda78319

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The body reports live Telegram creation and legacy reauthorization, but supplies no inspectable trace of a subsequent scheduled run or red-on-base regression result.
Agent review details

How this fits together

Channel ingress authenticates the sender, reply execution carries that authority into automation grants, and the Gateway persists provenance that scheduled execution and repair consume.

flowchart LR
  A[Telegram owner message] --> B[Verified host ingress]
  B --> C[Reply requester capture]
  C --> D[Gateway automation grant]
  D --> E[Stored job provenance]
  E --> F[Scheduled execution]
  E --> G[Owner repair turn]
Loading

Technical review

Best possible solution:

Retain the existing grant and scheduler owners, capture verified Telegram provenance at creation, and reauthorize legacy jobs explicitly from their original conversation.

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

Current-main source shows the missing external creation origin and Discord-only requester capture; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The fix addresses the provenance producer, reuses existing normalization and grant validation, preserves Discord behavior, and adds no competing storage or authorization owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 74e5127c0c3d.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 9ee5c26 adds src/gateway/cron-creator-authority-grant.ts:117 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 9ee5c26f4080; files: src/gateway/cron-creator-authority-grant.ts)
  • johan-eilertsen: Raw commit 024d58f adds src/auto-reply/reply/get-reply-run-execute.ts:372 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 024d58f35437; files: src/auto-reply/reply/get-reply-run-execute.ts)
  • Josh Avant: Raw commit a345ede adds src/gateway/cron-creator-authority-grant.ts:44 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a345ede6851c; files: src/gateway/cron-creator-authority-grant.ts)

PR surface

Source +58, Tests +463, Other +2. Total +523 across 14 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 6 100 42 +58
Tests 7 505 42 +463
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 14 607 84 +523

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, 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:

  • P2: Repairs recurring failures for Telegram account-bound automations through a focused provenance change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

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

Workflow

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

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-18T05:36:22.158Z sha 4f76020 :: blocked before merge. :: [P2] Preserve the source channel in the creation regression fixture | [P2] Update the signed-requester consumer test for external origins | [P2] Bring the regression additions within the test-line budget

Reviewed November 18, 2026, 2:55 AM ET / 07:55 UTC (Revision 2).

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 210fb959c8e5da0de4dc32c6d1502912dda78319
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/cron-creator-authority-context.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • src/gateway/cron-creator-authority-grant.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@vincentkoc
vincentkoc enabled auto-merge (squash) November 18, 2026 07:48
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Nov 18, 2026
@vincentkoc
vincentkoc disabled auto-merge November 18, 2026 08:19
@vincentkoc
vincentkoc merged commit febe293 into main Nov 18, 2026
380 of 399 checks passed
@vincentkoc
vincentkoc deleted the openclaw/scheduled-telegram-authority-20261118 branch November 18, 2026 08:26
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

obviyus added a commit that referenced this pull request Nov 18, 2026
Problem: an automation created from a channel chat must remember who created it and on which account, so each run can check that owner. #201008 fixed this for Telegram with a Telegram-specific branch next to an older Discord-specific path; other channels (Slack, WhatsApp, ...) still saved no creator, and core code branched on channel names.

Fix: the creator comes from the owner identity that the shared channel ingress already verified (`channelPrincipal`, added in #201008), for every channel. The `discord`/`telegram` branches and the configured-owner fallback are removed. Missing, mismatched, revoked or unverified owner authority still cannot establish ownership.

User impact: automations created by a verified channel owner on any channel keep their creator and account, so their runs pass the account check. A sender recognized as owner only by config/alias matching, without a verified ingress identity, no longer creates automations as owner.

Proof: Slack host-ingress capture (default and work accounts) and persisted origin/requester integration fail on base and pass on head; existing Telegram and Discord cases pass. Builds on Vincent Koc's #201008.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…law#201008)

* fix: preserve account context for channel-owner automations

* fix: retain Telegram automation requester identity

* fix: require host-bound Telegram automation owner

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: 5ac54850-8838-4d25-8e37-f09f8d90e200

* fix: correct scheduled authority validation

* fix: limit scheduled origin capture to channel owners

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: a873b056-74de-4978-a40d-2926bbd40bee

* test: bind scheduled account reload to config source

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: 08149ece-55ef-4a22-a4e9-ea576d5316f5

* test: allocate scheduled owner regression coverage

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: aca5fd31-3be8-4bf9-b3c2-df98ef752425
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 19, 2026
…201159)

Problem: an automation created from a channel chat must remember who created it and on which account, so each run can check that owner. openclaw#201008 fixed this for Telegram with a Telegram-specific branch next to an older Discord-specific path; other channels (Slack, WhatsApp, ...) still saved no creator, and core code branched on channel names.

Fix: the creator comes from the owner identity that the shared channel ingress already verified (`channelPrincipal`, added in openclaw#201008), for every channel. The `discord`/`telegram` branches and the configured-owner fallback are removed. Missing, mismatched, revoked or unverified owner authority still cannot establish ownership.

User impact: automations created by a verified channel owner on any channel keep their creator and account, so their runs pass the account check. A sender recognized as owner only by config/alias matching, without a verified ingress identity, no longer creates automations as owner.

Proof: Slack host-ingress capture (default and work accounts) and persisted origin/requester integration fail on base and pass on head; existing Telegram and Discord cases pass. Builds on Vincent Koc's openclaw#201008.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
* fix: preserve account context for channel-owner automations

* fix: retain Telegram automation requester identity

* fix: require host-bound Telegram automation owner

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: 5ac54850-8838-4d25-8e37-f09f8d90e200

* fix: correct scheduled authority validation

* fix: limit scheduled origin capture to channel owners

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: a873b056-74de-4978-a40d-2926bbd40bee

* test: bind scheduled account reload to config source

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: 08149ece-55ef-4a22-a4e9-ea576d5316f5

* test: allocate scheduled owner regression coverage

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: aca5fd31-3be8-4bf9-b3c2-df98ef752425

(cherry picked from commit febe293)

Co-authored-by: RomneyDa <[email protected]>
RomneyDa added a commit that referenced this pull request Nov 19, 2026
Problem: an automation created from a channel chat must remember who created it and on which account, so each run can check that owner. #201008 fixed this for Telegram with a Telegram-specific branch next to an older Discord-specific path; other channels (Slack, WhatsApp, ...) still saved no creator, and core code branched on channel names.

Fix: the creator comes from the owner identity that the shared channel ingress already verified (`channelPrincipal`, added in #201008), for every channel. The `discord`/`telegram` branches and the configured-owner fallback are removed. Missing, mismatched, revoked or unverified owner authority still cannot establish ownership.

User impact: automations created by a verified channel owner on any channel keep their creator and account, so their runs pass the account check. A sender recognized as owner only by config/alias matching, without a verified ingress identity, no longer creates automations as owner.

Proof: Slack host-ingress capture (default and work accounts) and persisted origin/requester integration fail on base and pass on head; existing Telegram and Discord cases pass. Builds on Vincent Koc's #201008.

Co-authored-by: Ayaan Zaidi <[email protected]>

(cherry picked from commit 00be7d5)

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…law#201008)

* fix: preserve account context for channel-owner automations

* fix: retain Telegram automation requester identity

* fix: require host-bound Telegram automation owner

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: 5ac54850-8838-4d25-8e37-f09f8d90e200

* fix: correct scheduled authority validation

* fix: limit scheduled origin capture to channel owners

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: a873b056-74de-4978-a40d-2926bbd40bee

* test: bind scheduled account reload to config source

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: 08149ece-55ef-4a22-a4e9-ea576d5316f5

* test: allocate scheduled owner regression coverage

* fix: keep Telegram automations tied to their owner and account

OpenClaw-Publication: aca5fd31-3be8-4bf9-b3c2-df98ef752425

Release adaptation: Split coherent23/41 preparation: host-verified immutable principal producer and shared ingress fixture; row41 consumes it next. No broadened grants.

(cherry picked from commit febe293)

Co-authored-by: RomneyDa <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…201159)

Problem: an automation created from a channel chat must remember who created it and on which account, so each run can check that owner. openclaw#201008 fixed this for Telegram with a Telegram-specific branch next to an older Discord-specific path; other channels (Slack, WhatsApp, ...) still saved no creator, and core code branched on channel names.

Fix: the creator comes from the owner identity that the shared channel ingress already verified (`channelPrincipal`, added in openclaw#201008), for every channel. The `discord`/`telegram` branches and the configured-owner fallback are removed. Missing, mismatched, revoked or unverified owner authority still cannot establish ownership.

User impact: automations created by a verified channel owner on any channel keep their creator and account, so their runs pass the account check. A sender recognized as owner only by config/alias matching, without a verified ingress identity, no longer creates automations as owner.

Proof: Slack host-ingress capture (default and work accounts) and persisted origin/requester integration fail on base and pass on head; existing Telegram and Discord cases pass. Builds on Vincent Koc's openclaw#201008.

Co-authored-by: Ayaan Zaidi <[email protected]>

Release adaptation: Split coherent23/41 preparation: retained native-account factory, caller and real ingress/queue tests consume preceding principal producer.

(cherry picked from commit 00be7d5)

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

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-sensitive-changed size: L 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.

1 participant