Skip to content

fix(cron): repair channel-owner tool reauthorization - #198707

Closed
vincentkoc wants to merge 1 commit into
mainfrom
fix/cron-telegram-origin-20261114
Closed

vincentkoc wants to merge 1 commit into
mainfrom
fix/cron-telegram-origin-20261114

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Account-scoped automations can remain unavailable after their owner resaves an unchanged tool cap from a Telegram turn.

User Impact

Fresh owner edits preserve the channel provenance needed to resolve the scheduled account. Affected automations need a fresh owner edit after this fix is installed.

Why This Change Was Made

Retain the normalized external origin from an already validated management grant. Grant admission, run and lifecycle checks, job ownership, and tool caps are unchanged; unknown origins remain omitted.

Evidence

  • Exact-head CI checked out 5a2fa540ff7986b67f225ab3504f24fd7580d0ce. Build artifacts, production/test type checks, and core lint passed.
  • The grant test file passed 30 cases on each of Node and Bun, including external/unknown origin, expiry, replay, and unqualified runtime-grant rejection.
  • The scheduled-policy integration file passed all 12 cases on each runtime, including the new unchanged-cap Telegram regression through the real cron tool, management grant, Gateway handler, and persisted store. Existing owner/account/cap boundaries also passed.
  • Scoped formatting and native commit hooks passed. Independent boundary review and Autoreview found no actionable issues across base 3256fe14aaee0e8865fb67f2bd1d236f40ea8139 to the PR head (P0–P2 scope).
  • The broad manual run is not fully green. Native locale, MCP legacy-owner, and model-picker failures also occur in the earlier main run; other broad failures remain separately unclassified. Normal ready-PR CI and required landing gates still apply.
  • The baseline-red probe and live Telegram execution remain unrun. This PR does not claim a deployed fix.

@vincentkoc vincentkoc self-assigned this Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 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 size: M labels Nov 14, 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. 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. 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 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR preserves authenticated external channel origin when an owner reauthorizes an automation through a management grant.

Example: A Telegram owner resaves toolsAllow=["read"] on an account-bound automation using account work.

  • Before: The management operation omits the authenticated Telegram origin, leaving the automation without the provenance needed for scheduled account resolution.
  • After: The saved provenance records external/telegram while preserving the owner, account policy, and tool cap.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The source change is focused and appears correct, but the recovery regression and shipped recovery behavior remain unverified.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An account-bound automation remains unavailable after its Telegram owner attempts to reauthorize it by resaving the existing tool cap.
Reason: The maintainer-authored direction restores a useful recovery path through existing owners and contracts, with no new setting or public API.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep this maintainer-authored draft open: it repairs a current cron failure, and no introduced code defect was found; the same production fix already appears in #186833.

Priority: P1
Reviewed head: 5a2fa540ff7986b67f225ab3504f24fd7580d0ce

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Provide redacted shipped-path evidence of a Telegram owner resaving an unchanged cap on an affected job and its next scheduled run succeeding after a v2026.11.3 upgrade with settings and data intact, plus the regression failing on base and passing on head; redact IPs, API keys, phone numbers, and non-public endpoints.
Agent review details

How this fits together

Authenticated owner turns mint management grants; Gateway cron handlers consume those grants and persist provenance that scheduled execution uses to resolve the creator's channel account.

flowchart LR
  A[Authenticated owner turn] --> B[Management grant]
  B --> C[Gateway cron update]
  C --> D[Persisted job provenance]
  D --> E[Scheduled account admission]
  E --> F[Agent execution]
Loading

Technical review

Best possible solution:

Consolidate the shared origin-propagation fix and this recovery regression with #186833, preserving its contributor credit.

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

Current-main source establishes the omitted-origin path, and #186833 independently records the corresponding Telegram failure; this review ran no target code.

Is this the best way to solve the issue?

Preserving normalized origin at the existing grant owner is the smallest complete repair: it enables the existing persistence path without inferring authority from delivery routes or widening creator-grant qualification.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 569bf22dba45.

Provenance checked

  • Management-grant caller origin keeps the original intent (4a35a21: Preserve authenticated local source for scheduled account reads while withholding local authority from remote management.)
  • Owner tool-cap integration fixture keeps the original intent (4513fcb: Fresh owner cap replacements may capture authority while non-owner management edits preserve their separate, restricted workflow.)

Testing

Proof path: none.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit 4a35a21 adds src/gateway/cron-creator-authority-grant.ts:350 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4a35a213beb7; files: src/gateway/cron-creator-authority-grant.ts)

PR surface

Source 0, Tests +106. Total +106 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 2 2 0
Tests 2 187 81 +106
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 189 83 +106

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.

Root-cause cluster

Relationship: duplicate
Canonical: #186833
Summary: The earlier PR contains the identical production repair; this PR adds a distinct unchanged-cap recovery regression.

Members:

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: Lost channel provenance can prevent subsequent named-account automation runs even while the configured Telegram account remains healthy.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.

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.

Reviewed November 14, 2026, 1:41 AM ET / 06:41 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 14, 2026 07:20
@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: 5a2fa540ff7986b67f225ab3504f24fd7580d0ce
  • Maintainer: @vincentkoc
  • Repository role: admin

These security sensitive changes were made:

  • 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

Copy link
Copy Markdown
Member Author

Superseded by #186833 from @fransqaas. The production fix matched; the additional regression coverage is now preserved there in commit 9ecc45bb4eb9ae010cff2c05c89ec9b8c5d95a38, with both original contributor commits intact. Closing this duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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. security-sensitive-changed size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant