Repository navigation
feat(studio): L12 auto-disable after 5 failed triggered runs - #1076
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RunManager.run()acceptsRunOptions { source, triggerId, triggerEvent, pins };source/triggerIdride theRunEntryandAgentRunStatusPayload, survive approve/resume of the same run, and are cleared by the next manual launch (sendMessage,run()without options, fork).AlertStore(server/inbox/alertStore.ts) persistsInboxAlertrecords atstudioPaths().alerts— atomic writes,__inbox__lock, newest-first, 500 cap,onChangefor R02b.server/lifecycle/enabledState.tsenabledPatchis the single write path formeta.enabled;PATCH /agents/:id/metanow routes through it, so a manual disable of an auto-disabled agent keepsdisabledReason: 'auto_failure_streak'and a manual enable clears streak/disable fields.attachFailureStreak(per workspace, wired increateWorkspaceContext+ the legacycreateAppseam) counts onlyrunning -> done|errortransitions withsource: 'trigger': triggereddoneresets, fiftherrorauto-disables and raises exactly oneauto_disabledalert +agent.changedevent; manual runs neither count nor reset.AgentListItem.disabledReasonis exposed; the enable switch and agent card show theAuto-offwarning pill with the ticket tooltip.Test plan
enabledState.test.ts— patch semantics incl. preserve-on-redisable / reset-on-enablefailureStreak.test.ts— 4 failures stay on, 5th disables + one alert, success resets, manual ignored, 6th adds no alert, approve/resume keeps source, unsubscribe worksalertStore.test.ts— add/list/dismiss/cap/onChange/atomic persistencerunSource.test.ts— trigger metadata on payloads, cleared by later manual run and bysendMessageagentRoutes.meta.test.ts— PATCH keeps auto reason;AgentCard/EnabledControltests for the Auto-off pillGenerated with Devin