8000 feat(automations): routine runs, budget warnings, backups and releases as activities by adeelahmad · Pull Request #449 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

feat(automations): routine runs, budget warnings, backups and releases as activities - #449

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-cyhjct
Oct 16, 2026
Merged

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

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Description

Before: automations could not react to what Lens itself does.

After: four new activity kinds. routine.ran is a routine run that ended (done, failed or skipped as over budget), with its status, trigger, action count and cost. budget.warned is a budget crossing its warning share or its cap. backup.finished is a backup taken by hand or on the schedule, with its size, whether it was copied to storage, or why it failed. lens.release is a newer Lens release. Each is for admins unless it is about one namespace, and each is logged once however often the thing behind it runs (several processes, sweeps, retries).

How: a routine_runs source reads runs that ended by finished_at over a new index. The other three are logged with a key where they already happen: budgets.sweep, backups.take/run_due, updates.announce, each wrapped so a logging problem never breaks the sweep, backup or announcement. The name lookup cache now keys on the fields asked for, which fixes routine names missing their namespaces when another lookup filled the cache first.

Motivation and Context

Workflow Studio M3 (plan section 3): Lens's own happenings as triggers.

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 (make hooks checks it on commit).
  • I added or updated tests. (tests/api/test_system_activities.py, embedded and SurrealDB server)
  • My change requires documentation updates, and I have updated docs/ accordingly. (docs/automations.md, docs/budgets.md, docs/updates.md, docs/database.md; mkdocs build --strict clean)
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. n/a: the title says it.

Done questions (AGENTS.md)

  • Goal: completes Studio M3's trigger sources; merged on green CI.
  • Agents: read through the events API and MCP like every other kind.
  • Zero setup: nothing to install or configure.
  • Fewest clicks and keystrokes: n/a, no new UI.
  • Configurable: n/a, no new settings.
  • Light: one index read and three keyed log writes; no new service.
  • Private and secure: admins only unless the thing is about one namespace; no new outside input, so no threat model change.
  • Cost: no model calls.
  • User decides: activities only; nothing acts on them until a person builds an automation. Defaults unchanged.
  • Upgrades: one new index defined at start-up with IF NOT EXISTS (docs/database.md); safe to run twice.
  • Honest: docs label the kinds built and list what to refine later.
  • Tests, docs and generated files updated (no API shape change, so no OpenAPI change).
  • Open standards: W3C Activity Streams 2.0; no new dependencies.
  • Result reported with evidence; "refine later" items in docs/automations.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QewNs6jxSB2vRoag2EvdyX


Generated by Claude Code

…s as activities

routine.ran reads routine_run rows that ended by finished_at (new index);
budget.warned, backup.finished and lens.release are emitted with keys where
budgets.sweep alerts, where a manual or scheduled backup ends and where
updates.announce tells people, so each is logged once. They are for admins
unless about one namespace. The name cache now keys on the fields asked for.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QewNs6jxSB2vRoag2EvdyX
@adeelahmad
adeelahmad merged commit be13bf8 into main Oct 16, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-cyhjct branch October 16, 2026 00:33
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