Skip to content

Let only an automation's creator change or run it, and only a bot's creator change its setup - #362

Merged
abhishekgahlot2 merged 1 commit into
mainfrom
fix/automation-creator-rule
Oct 18, 2026
Merged

abhishekgahlot2 merged 1 commit into
mainfrom
fix/automation-creator-rule

Conversation

@abhishekgahlot2

@abhishekgahlot2 abhishekgahlot2 commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Every firing of an automation runs as the member who created it: their keys, spend allowance, sandbox minutes and personal connections. So the schedules service now decides who may act on an automation, for every door (the automations API, a bot's routines and an agent's automation tools):

  • The creator edits it, enables it and runs it now.
  • An org owner or admin may also pause it (PATCH {"enabled": false}) or delete it, authorized in the organization's turn (asOrgAdmin), so a demotion that lands meanwhile is seen.
  • An automation with no creator stays open to members.
  • Anyone else gets 403 automation_creator_only with a message that names the creator; the Automations page shows that message.

A bot's standing rules steer every turn it takes, its routines' unattended ones included, so a bot's setup (rules, preset, routines) is its creator's too (botEditableBy):

  • Anyone else gets 403 bot_owner_only naming the creator, and the details drawer shows them the rules read-only.
  • An org owner or admin may still archive or restore the bot; everyone may still message it.
  • A routine someone else added earlier no longer fires, before or after the bot is archived (403 routine_not_bot_owner on run now).

Manual firing now goes only through runScheduleNow, which checks the actor; fireScheduleForOrg is left to the scheduler's cron firings. orgAdminScope and the new checks share one isOrgAdmin.

Tests: backend/test/automation-creator.test.ts covers the API, a bot's routines, approved agent tool calls, an admin's pause, delete and archive, a bot's setup, routines added by someone else, and a demotion while a delete waits for the organization's turn. On the frontend, the Automations API client passes the backend's words through (components/automations/schedules-api.test.ts).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

…reator change its setup

Every firing runs as the member who created the automation: their keys, spend allowance, sandbox minutes and personal connections. The schedules service now decides who may act on one, for every door: the automations API, a bot's routines and an agent's automation tools. The creator edits, enables and runs it now; an org owner or admin may also pause or delete it, authorized in the organisation's turn so a demotion that lands meanwhile is seen; an automation with no creator stays open to members. Anyone else gets 403 automation_creator_only with a message naming the creator, and the Automations page shows that message.

A bot's standing rules steer every turn it takes, its routines' unattended ones included, so a bot's setup (rules, preset, routines) is now its creator's too (botEditableBy): others get 403 bot_owner_only naming the creator and see the rules read-only, an org owner or admin may still archive or restore it, everyone may still message it, and a routine someone else added earlier no longer fires.
@abhishekgahlot2
abhishekgahlot2 merged commit dfd014a into main Oct 18, 2026
23 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants