8000 feat(automations): run a workflow, a pipeline or a routine by adeelahmad · Pull Request #441 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): run a workflow, a pipeline or a routine - #441

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mwk71t
Oct 15, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mwk71t

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Description

Before: automations could message people, use the model and call a web address, but they couldn't start Lens's own work.

After: the Run group of actions (workflow studio M7), all with effect lens:

  • run_workflow: runs a recording workflow on an asset as a job, using its published version or the one named. Output {job, workflow, version, asset}. A graph workflow is refused, since a routine runs those.
  • run_pipeline: processes an asset again with a pipeline, or the one its namespace uses, and keeps its outputs. Output {job, pipeline, asset}.
  • run_routine: asks the scheduler to run a routine now, as Run in Settings does, with propose_only if asked. Output {routine, requested, propose_only}. Routines belong to admins, so the person must be one. The routine must work only in the automation's namespaces, and a run over one of its budgets is refused. Its subject is never the event's object, so it always asks first.

asset takes an asset id or the activity's object id (lens:recording/<id>). It defaults to {{ event.object.id }}. On the asset the activity is about, inside the automation's namespaces, the action is routine; on any other asset, it asks first. Each one checks that the person can process assets in that namespace now. Jobs and runs show as by "automation: ".

actions.py gains shared asset helpers, which the next PR (asset changes and notes) uses too: asset_id, asset_subject, asset_param, on_asset, asset_for and allowed.

Motivation and Context

Workflow studio, module M7 (plan: /mnt/project-files/workflow-studio/plan.md §5 M7), PR 4 of 5. Earlier PRs: #433 (notify), #438 (AI), #439 (web). Set a field, move to a collection and write a note come next.

Choice taken (reversible): run_routine passes on requested rather than a run id. The scheduler starts the run within half a minute, and the run's id then shows in the routine's runs. Passing the id on is in refine later.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (ruff, ruff format, mypy clean locally).
  • I added or updated tests. tests/api/test_actions_run.py covers:
    • risk on the event's own asset versus another asset
    • jobs queued by the automation for a workflow and a pipeline, and dry runs
    • the person's permissions and the automation's namespaces
    • a routine run by an admin only, inside the automation's namespaces, and refused over budget
  • My change requires documentation updates, and I have updated docs/ accordingly (docs/automations.md "Running Lens work", the Actions rows, refine later).
  • Users need more than the title: n/a, people reach these actions once the engine (M6) runs automations.

Done questions (AGENTS.md)

  • Goal: the Run group of M7; merged on green CI.
  • Agents: in actions.catalog(), which M6 serves to the API, MCP and the assistant.
  • Zero setup: it uses the workflows, pipelines and routines already there.
  • Fewest clicks: asset defaults to the event's object; version defaults to the published one, and pipeline to the namespace's.
  • Configurable: n/a, no new setting.
  • Light: no new dependency; the work queues like any job.
  • Private and secure: the person's permissions apply now, only inside the automation's namespaces; another asset and every routine ask first. No new outside surface.
  • Cost: a routine run respects its budgets; jobs go through the usual ledger.
  • User decides: anything beyond the event's own asset waits for the person.
  • Upgrades: no change to stored data.
  • Honest: docs label it built.
  • Tests and docs updated; no API change, so no OpenAPI regeneration.
  • Open: n/a, internal actions.
  • Refine later is written in docs/automations.md:
    • passing on a routine run's id
    • waiting for the job's outputs
    • collection roles counting for process
    • a pipeline over every asset a join collected

🤖 Generated with Claude Code

https://claude.ai/code/session_01CyjR2zEfmTXBewKAx9Taw5


Generated by Claude Code

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CyjR2zEfmTXBewKAx9Taw5
@adeelahmad
adeelahmad merged commit f553fec into main Oct 15, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-mwk71t branch October 15, 2026 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0