Skip to content

feat(studio): L12 auto-disable after 5 failed triggered runs - #1076

Merged
LinuxDevil merged 1 commit into
mainfrom
fb-l12
Nov 12, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
fb-l12

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

Summary

  • RunManager.run() accepts RunOptions { source, triggerId, triggerEvent, pins }; source/triggerId ride the RunEntry and AgentRunStatusPayload, survive approve/resume of the same run, and are cleared by the next manual launch (sendMessage, run() without options, fork).
  • New Studio-global AlertStore (server/inbox/alertStore.ts) persists InboxAlert records at studioPaths().alerts — atomic writes, __inbox__ lock, newest-first, 500 cap, onChange for R02b.
  • New server/lifecycle/enabledState.ts enabledPatch is the single write path for meta.enabled; PATCH /agents/:id/meta now routes through it, so a manual disable of an auto-disabled agent keeps disabledReason: 'auto_failure_streak' and a manual enable clears streak/disable fields.
  • New attachFailureStreak (per workspace, wired in createWorkspaceContext + the legacy createApp seam) counts only running -> done|error transitions with source: 'trigger': triggered done resets, fifth error auto-disables and raises exactly one auto_disabled alert + agent.changed event; manual runs neither count nor reset.
  • AgentListItem.disabledReason is exposed; the enable switch and agent card show the Auto-off warning pill with the ticket tooltip.

Test plan

  • enabledState.test.ts — patch semantics incl. preserve-on-redisable / reset-on-enable
  • failureStreak.test.ts — 4 failures stay on, 5th disables + one alert, success resets, manual ignored, 6th adds no alert, approve/resume keeps source, unsubscribe works
  • alertStore.test.ts — add/list/dismiss/cap/onChange/atomic persistence
  • runSource.test.ts — trigger metadata on payloads, cleared by later manual run and by sendMessage
  • agentRoutes.meta.test.ts — PATCH keeps auto reason; AgentCard/EnabledControl tests for the Auto-off pill
  • Full server suite (1516) + client suite (3948), typechecks, lint, fallow all green

Generated with Devin

Triggered runs now carry source/triggerId on the status payload; a
per-workspace failure-streak listener counts running->error transitions
with source 'trigger', resets on triggered success, and ignores manual
runs. The fifth failure writes enabled:false +
disabledReason:'auto_failure_streak' through the new enabledPatch helper
(the single write path for meta.enabled, now also used by PATCH meta) and
raises one auto_disabled alert on the new Studio-global AlertStore at
studioPaths().alerts. Manual re-enable clears streak and disable fields;
manual disable of an auto-disabled agent keeps its reason. The enable
switch and agent card show an Auto-off pill with the ticket tooltip.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@LinuxDevil
LinuxDevil merged commit 13555b0 into main Nov 12, 2026
6 checks passed
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.

1 participant