feat: let the workspace error handler skip jobs started from the UI (#12624)

* feat: let the workspace error handler skip jobs started from the UI

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: address review of the ui-run error handler mute

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-11-24 11:44:59 +01:00
committed by GitHub
co-authored by Claude Opus 5.5
parent e810cbb93a
commit ade2a55e86
20 changed files with 284 additions and 77 deletions
@@ -0,0 +1,22 @@
{
"db_name": "PostgreSQL",
"query": "SELECT COALESCE((error_handler->>'muted_on_ui_runs')::boolean, false) AS \"muted!\"\n FROM workspace_settings WHERE workspace_id = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "muted!",
"type_info": "Bool"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
null
]
},
"hash": "0fc3318da2c8dd5304a0ba7a83f25cb2b7728ac069dcc29f9c7e76d915ea3076"
}
+1
View File
@@ -15986,6 +15986,7 @@ dependencies = [
"lazy_static",
"quick_cache",
"reqwest 0.13.5",
"semver",
"serde",
"serde_json",
"sqlx",
+3
View File
@@ -39,3 +39,6 @@ time.workspace = true
anyhow.workspace = true
jsonwebtoken = { workspace = true, optional = true }
reqwest = { workspace = true, optional = true }
[dev-dependencies]
semver.workspace = true
+17 -9
View File
@@ -140,15 +140,16 @@ impl ApiAuthed {
/// reports for these routes. Derived from the token, never from the request, because the
/// column is authority-bearing for other kinds (`app` marks a file as app-produced).
///
/// A browser session is left unstamped rather than marked [`JobTriggerKind::Ui`]: that label
/// is one a worker built before this release cannot decode, and it would strand the jobs
/// carrying it. `webhook` has always been decodable, so it is safe to write today.
/// A browser session is [`JobTriggerKind::Ui`], left unstamped until every worker can decode
/// that label: an older one would strand the jobs carrying it.
pub fn trigger_or_fallback(&self, trigger: Option<TriggerMetadata>) -> Option<TriggerMetadata> {
if trigger.is_some() {
return trigger;
}
if self.is_session_token {
return None;
return windmill_common::min_version::MIN_VERSION_SUPPORTS_UI_TRIGGER_KIND
.met_conservatively()
.then(|| TriggerMetadata::new(None, JobTriggerKind::Ui));
}
Some(TriggerMetadata::new(None, JobTriggerKind::Webhook))
}
@@ -1600,11 +1601,11 @@ mod tests {
);
}
/// A browser session is the one shape left unstamped, so the Runs page can say "a token
/// started this" without claiming the converse. Every other label — every shape a member
/// can pass to `create_token` — is `webhook`.
/// A browser session is the one shape stamped `ui`, and only once every worker can decode
/// it. Every other label — every shape a member can pass to `create_token` — is `webhook`.
#[test]
fn only_a_browser_session_is_left_unstamped() {
fn only_a_browser_session_is_stamped_ui() {
use windmill_common::min_version::MIN_VERSION;
let kind_of = |label: Option<&str>| {
ApiAuthed {
is_session_token: windmill_common::auth::is_session_label(label),
@@ -1614,7 +1615,14 @@ mod tests {
.map(|t| t.trigger_kind.to_string())
};
assert_eq!(kind_of(Some("session")), None);
let before = MIN_VERSION.load_full();
MIN_VERSION.store(std::sync::Arc::new(semver::Version::new(0, 0, 0)));
assert_eq!(kind_of(Some("session")), None, "unknown fleet");
MIN_VERSION.store(std::sync::Arc::new(semver::Version::new(1, 775, 0)));
assert_eq!(kind_of(Some("session")), None, "a worker predates ui");
MIN_VERSION.store(std::sync::Arc::new(semver::Version::new(1, 776, 0)));
assert_eq!(kind_of(Some("session")).as_deref(), Some("ui"));
MIN_VERSION.store(before);
for label in [
Some("my-personal-token"),
@@ -680,6 +680,9 @@ pub struct EditErrorHandlerNew {
pub muted_on_cancel: bool,
#[serde(default)]
pub muted_on_user_path: bool,
/// Skip runs whose `trigger_kind` is `ui`. `None` keeps the stored value, for the same
/// reason as `fallback_to_instance_alerts`.
pub muted_on_ui_runs: Option<bool>,
/// Left as `None` by clients that predate the setting (the CLI among them), which must
/// keep the stored value rather than silently reset it on every settings push.
pub fallback_to_instance_alerts: Option<bool>,
@@ -711,6 +714,7 @@ impl EditErrorHandler {
extra_args: legacy.error_handler_extra_args,
muted_on_cancel: legacy.error_handler_muted_on_cancel,
muted_on_user_path: false, // Old format doesn't have this field
muted_on_ui_runs: None,
fallback_to_instance_alerts: None,
},
}
@@ -6367,6 +6371,22 @@ async fn edit_error_handler(
if let Some(extra_args) = &ee.extra_args {
error_handler["extra_args"] = extra_args.clone();
}
// Written only when set, so the blob of every workspace that never turns it on, and
// its `settings.yaml`, stays as it was before the flag existed.
let muted_on_ui_runs = match ee.muted_on_ui_runs {
Some(muted) => muted,
None => sqlx::query_scalar!(
"SELECT COALESCE((error_handler->>'muted_on_ui_runs')::boolean, false) AS \"muted!\"
FROM workspace_settings WHERE workspace_id = $1",
&w_id
)
.fetch_optional(&mut *tx)
.await?
.unwrap_or(false),
};
if muted_on_ui_runs {
error_handler["muted_on_ui_runs"] = serde_json::Value::Bool(true);
}
sqlx::query!(
"UPDATE workspace_settings SET error_handler = $1 WHERE workspace_id = $2",
+7
View File
@@ -30843,6 +30843,10 @@ components:
muted_on_user_path:
type: boolean
default: false
muted_on_ui_runs:
type: boolean
default: false
description: Skip jobs started from the UI, whose trigger kind is `ui`. Stored only when true.
SuccessHandlerConfig:
type: object
@@ -30875,6 +30879,9 @@ components:
muted_on_user_path:
type: boolean
default: false
muted_on_ui_runs:
type: boolean
description: Skip jobs started from the UI, whose trigger kind is `ui`. Omit to leave the stored value untouched.
fallback_to_instance_alerts:
type: boolean
description: Report failed jobs to the instance critical alert channels when no workspace error handler is set. Omit to leave the stored value untouched.
File diff suppressed because one or more lines are too long
@@ -79,7 +79,7 @@
"type": "string"
},
"job_trigger_kind": {
"description": "Runs: filter by how the job was triggered — one of webhook, default_email, http, websocket, kafka, email, nats, mqtt, amqp, sqs, postgres, schedule, gcp, azure, google, github, asset, freshness, app. comma-separate to match several values, or prefix each with ! to exclude them instead (never mix included and excluded values in one filter). (e.g. '!schedule' to hide scheduled runs)",
"description": "Runs: filter by how the job was triggered — one of webhook, default_email, http, websocket, kafka, email, nats, mqtt, amqp, sqs, postgres, schedule, gcp, azure, google, github, asset, freshness, app, ui. comma-separate to match several values, or prefix each with ! to exclude them instead (never mix included and excluded values in one filter). (e.g. '!schedule' to hide scheduled runs)",
"type": "string"
},
"label": {
@@ -1235,6 +1235,12 @@ fn plan_document(
Value::is_boolean,
"a boolean",
),
(
"error_handler",
"muted_on_ui_runs",
Value::is_boolean,
"a boolean",
),
(
"variable_expiration_handler",
"muted_on_user_path",
@@ -1282,6 +1288,15 @@ fn plan_document(
}
}
}
// ...but stores this one only when on, so an off one compares as absent.
if let Some(handler) = desired
.get_mut("error_handler")
.and_then(Value::as_object_mut)
{
if handler.get("muted_on_ui_runs") != Some(&Value::Bool(true)) {
handler.remove("muted_on_ui_runs");
}
}
for key in SECRET_KEYS {
if let Some(v) = desired.remove(*key) {
if let Some(v) = resolve_secret(key, v, mc, &mut warnings) {
@@ -1429,6 +1444,7 @@ fn plan_document(
"extra_args": handler.get("extra_args"),
"muted_on_cancel": handler.get("muted_on_cancel").and_then(Value::as_bool).unwrap_or(false),
"muted_on_user_path": handler.get("muted_on_user_path").and_then(Value::as_bool).unwrap_or(false),
"muted_on_ui_runs": handler.get("muted_on_ui_runs").and_then(Value::as_bool).unwrap_or(false),
"fallback_to_instance_alerts": if fallback_changes { fallback.and_then(|f| f.as_bool()) } else { None },
}),
);
@@ -2361,6 +2377,24 @@ mod tests {
assert!(p.changes.is_empty(), "{:?}", keys(&p));
}
#[test]
fn muted_on_ui_runs_off_matches_a_blob_without_it() {
let mc = WorkspaceCrypt::new("k");
let names = DatatableNames::default();
let mut cur = current();
cur.insert(
"error_handler".into(),
json!({ "path": "f/x", "muted_on_cancel": false, "muted_on_user_path": false }),
);
let off = doc(json!({ "error_handler": { "path": "f/x", "muted_on_ui_runs": false } }));
let p = plan_document(cur.clone(), off, false, &mc, &names).unwrap();
assert!(p.changes.is_empty(), "{:?}", keys(&p));
let on = doc(json!({ "error_handler": { "path": "f/x", "muted_on_ui_runs": true } }));
let p = plan_document(cur, on, false, &mc, &names).unwrap();
assert_eq!(keys(&p), ["error_handler"]);
}
#[test]
fn variable_expiration_handler_is_managed_only_when_stated() {
let mc = WorkspaceCrypt::new("k");
@@ -48,6 +48,9 @@ pub const MIN_VERSION_SUPPORTS_LEASE_FREE_VOLUMES: VC = vc(1, 872, 0, "Lease-fre
// so a step the test mocks would run for real. Must name the release this ships in.
pub const MIN_VERSION_SUPPORTS_FLOW_TEST_SUBFLOWS: VC =
vc(1, 879, 0, "Overriding steps inside subflows in flow tests");
// A worker before this release decodes `trigger_kind` strictly and cannot read `ui`, so a job
// stamped with it would fail on every pull of that worker.
pub const MIN_VERSION_SUPPORTS_UI_TRIGGER_KIND: VC = vc(1, 776, 0, "ui trigger kind");
pub const MIN_VERSION_SUPPORTS_NODE_DEBOUNCING: VC = vc(1, 658, 0, "Flow node debouncing");
pub const MIN_VERSION_SUPPORTS_TOKEN_HASH: VC = vc(1, 659, 0, "Token hash storage");
pub const MIN_VERSION_SUPPORTS_SYNC_JOBS_DEBOUNCING: VC = vc(1, 602, 0, "Sync jobs debouncing");
+54 -50
View File
@@ -1426,8 +1426,8 @@ lazy_static::lazy_static! {
static ref RESTART_UNLESS_CANCELLED_CACHE: Cache<(i64, String), (bool, Option<i32>, Option<Vec<String>>)> = Cache::new(10000);
// Cache for workspace error handler settings with 60s TTL
// Key: workspace_id, Value: (error_handler, error_handler_extra_args, error_handler_muted_on_cancel, error_handler_muted_on_user_path, report_to_instance_alerts, expiry_timestamp)
static ref WORKSPACE_ERROR_HANDLER_CACHE: Cache<String, (Option<String>, Option<Json<Box<RawValue>>>, bool, bool, bool, i64)> = Cache::new(1000);
// Key: workspace_id, Value: (settings, expiry_timestamp)
static ref WORKSPACE_ERROR_HANDLER_CACHE: Cache<String, (WorkspaceErrorHandler, i64)> = Cache::new(1000);
// Best-effort per-worker throttle for the instance-channel fallback: a flapping runnable
// would otherwise turn every failure into outbound Slack/SMTP traffic on channels shared by
@@ -2989,19 +2989,20 @@ pub async fn report_error_to_workspace_handler_or_critical_side_channel(
}
}
#[derive(Clone)]
struct WorkspaceErrorHandler {
path: Option<String>,
extra_args: Option<Json<Box<RawValue>>>,
muted_on_cancel: bool,
muted_on_user_path: bool,
muted_on_ui_runs: bool,
report_to_instance_alerts: bool,
}
async fn fetch_error_handler_from_db(
db: &Pool<Postgres>,
w_id: &str,
) -> Result<
(
Option<String>,
Option<Json<Box<RawValue>>>,
bool,
bool,
bool,
),
Error,
> {
) -> Result<WorkspaceErrorHandler, Error> {
sqlx::query_as::<
_,
(
@@ -3009,6 +3010,7 @@ async fn fetch_error_handler_from_db(
Option<Json<Box<RawValue>>>,
Option<bool>,
Option<bool>,
Option<bool>,
bool,
),
>(
@@ -3018,6 +3020,7 @@ async fn fetch_error_handler_from_db(
(error_handler->'extra_args')::text::json,
(error_handler->>'muted_on_cancel')::boolean,
(error_handler->>'muted_on_user_path')::boolean,
(error_handler->>'muted_on_ui_runs')::boolean,
ws.error_handler_fallback_to_instance_alerts AND w.parent_workspace_id IS NULL
FROM workspace_settings ws
JOIN workspace w ON w.id = ws.workspace_id
@@ -3029,14 +3032,20 @@ async fn fetch_error_handler_from_db(
.await
.context("fetching error handler info from workspace_settings")?
.map(
|(path, extra_args, muted_on_cancel, muted_on_user_path, report_to_instance_alerts)| {
(
path,
extra_args,
muted_on_cancel.unwrap_or(false),
muted_on_user_path.unwrap_or(false),
report_to_instance_alerts,
)
|(
path,
extra_args,
muted_on_cancel,
muted_on_user_path,
muted_on_ui_runs,
report_to_instance_alerts,
)| WorkspaceErrorHandler {
path,
extra_args,
muted_on_cancel: muted_on_cancel.unwrap_or(false),
muted_on_user_path: muted_on_user_path.unwrap_or(false),
muted_on_ui_runs: muted_on_ui_runs.unwrap_or(false),
report_to_instance_alerts,
},
)
.ok_or_else(|| Error::internal_err(format!("no workspace settings for id {w_id}")))
@@ -3051,39 +3060,25 @@ pub async fn send_error_to_workspace_handler<'a, 'c, T: Serialize + Send + Sync>
let w_id = &queued_job.workspace_id;
let now = chrono::Utc::now().timestamp();
let (
error_handler,
error_handler_extra_args,
error_handler_muted_on_cancel,
error_handler_muted_on_user_path,
report_to_instance_alerts,
) = if let Some(cached) = WORKSPACE_ERROR_HANDLER_CACHE.get(w_id) {
if cached.5 > now {
(
cached.0.clone(),
cached.1.clone(),
cached.2,
cached.3,
cached.4,
)
} else {
let row = fetch_error_handler_from_db(db, w_id).await?;
let expiry = now + WORKSPACE_HANDLER_CACHE_TTL_SECONDS;
let handler = match WORKSPACE_ERROR_HANDLER_CACHE.get(w_id) {
Some((handler, expiry)) if expiry > now => handler,
_ => {
let handler = fetch_error_handler_from_db(db, w_id).await?;
WORKSPACE_ERROR_HANDLER_CACHE.insert(
w_id.clone(),
(row.0.clone(), row.1.clone(), row.2, row.3, row.4, expiry),
(handler.clone(), now + WORKSPACE_HANDLER_CACHE_TTL_SECONDS),
);
row
handler
}
} else {
let row = fetch_error_handler_from_db(db, w_id).await?;
let expiry = now + WORKSPACE_HANDLER_CACHE_TTL_SECONDS;
WORKSPACE_ERROR_HANDLER_CACHE.insert(
w_id.clone(),
(row.0.clone(), row.1.clone(), row.2, row.3, row.4, expiry),
);
row
};
let WorkspaceErrorHandler {
path: error_handler,
extra_args: error_handler_extra_args,
muted_on_cancel,
muted_on_user_path,
muted_on_ui_runs,
report_to_instance_alerts,
} = handler;
// Nothing to do for the vast majority of workspaces, and returning here keeps the
// per-runnable mute lookup below off the path of every failed job.
@@ -3091,12 +3086,12 @@ pub async fn send_error_to_workspace_handler<'a, 'c, T: Serialize + Send + Sync>
return Ok(());
}
if is_canceled && error_handler_muted_on_cancel {
if is_canceled && muted_on_cancel {
return Ok(());
}
// Skip error handler for scripts/flows starting with u/
if error_handler_muted_on_user_path {
if muted_on_user_path {
if let Some(ref path) = queued_job.runnable_path {
if path.starts_with("u/") {
return Ok(());
@@ -3104,6 +3099,15 @@ pub async fn send_error_to_workspace_handler<'a, 'c, T: Serialize + Send + Sync>
}
}
if muted_on_ui_runs
&& queued_job
.trigger_kind
.as_ref()
.is_some_and(|k| k.is(JobTriggerKind::Ui))
{
return Ok(());
}
let ws_error_handler_muted: Option<bool> = match queued_job.kind {
JobKind::Script => {
sqlx::query_scalar!(
@@ -0,0 +1,76 @@
// Alone in its binary: the worker caches a workspace's handler settings process-wide for 60s,
// keyed by workspace id, so a second test here would read the first one's settings.
mod workspace_error_handler {
use serde_json::json;
use sqlx::types::Json;
use sqlx::{Pool, Postgres};
use uuid::Uuid;
use windmill_common::jobs::{JobKind, JobTriggerKind};
use windmill_common::scripts::{ScriptHash, ScriptLang};
use windmill_common::users::username_to_permissioned_as;
use windmill_queue::jobs::{send_error_to_workspace_handler, MiniCompletedJob};
const WS: &str = "test-workspace";
const SCRIPT: &str = "f/system/test_script";
fn failed(trigger_kind: JobTriggerKind) -> MiniCompletedJob {
MiniCompletedJob {
id: Uuid::new_v4(),
workspace_id: WS.to_string(),
runnable_id: Some(ScriptHash(100001)),
scheduled_for: chrono::Utc::now(),
parent_job: None,
flow_innermost_root_job: None,
runnable_path: Some(SCRIPT.to_string()),
kind: JobKind::Script,
started_at: Some(chrono::Utc::now()),
permissioned_as: username_to_permissioned_as("test-user"),
created_by: "test-user".to_string(),
script_lang: Some(ScriptLang::Deno),
permissioned_as_email: "test@windmill.dev".to_string(),
flow_step_id: None,
trigger_kind: Some(trigger_kind.into()),
trigger: None,
priority: None,
concurrent_limit: None,
tag: "deno".to_string(),
cache_ttl: None,
cache_ignore_s3_path: None,
runnable_settings_handle: None,
build_binary_only: false,
job_token_scopes: None,
}
}
async fn handler_jobs(db: &Pool<Postgres>) -> i64 {
sqlx::query_scalar("SELECT count(*) FROM v2_job WHERE workspace_id = $1")
.bind(WS)
.fetch_one(db)
.await
.unwrap()
}
#[sqlx::test(migrations = "../migrations", fixtures("base", "schedule_push"))]
async fn muted_on_ui_runs_skips_only_ui_runs(db: Pool<Postgres>) -> anyhow::Result<()> {
sqlx::query("UPDATE workspace_settings SET error_handler = $1 WHERE workspace_id = $2")
.bind(json!({ "path": format!("script/{SCRIPT}"), "muted_on_ui_runs": true }))
.bind(WS)
.execute(&db)
.await?;
let error = json!({ "error": "boom" });
send_error_to_workspace_handler(&failed(JobTriggerKind::Ui), false, &db, Json(&error))
.await?;
assert_eq!(
handler_jobs(&db).await,
0,
"a ui run must not reach the handler"
);
send_error_to_workspace_handler(&failed(JobTriggerKind::Webhook), false, &db, Json(&error))
.await?;
assert_eq!(handler_jobs(&db).await, 1, "any other run still does");
Ok(())
}
}
+3 -4
View File
@@ -56,10 +56,9 @@ pub enum JobTriggerKind {
// produced from files a viewer forged by running a declared runnable directly.
App,
// A run started from the browser (the `/jobs/run*` request carried the session token
// minted at login). Nothing writes this yet — it exists so every binary from this release
// can decode it, which is what a later release needs before it can start stamping it.
// When that happens: attribution, not authority, unlike `App` — a member can have a
// session token minted for a script (`/users/refresh_token`), so nothing may gate on it.
// minted at login), stamped only once every worker decodes it (`trigger_or_fallback`).
// Attribution, not authority, unlike `App` — a member can have a session token minted for
// a script (`/users/refresh_token`), so no access decision may gate on it.
Ui,
}
+4
View File
@@ -27,6 +27,7 @@ export interface ErrorHandlerConfig {
extra_args?: any;
muted_on_cancel?: boolean;
muted_on_user_path?: boolean;
muted_on_ui_runs?: boolean;
}
export interface SuccessHandlerConfig {
@@ -254,6 +255,9 @@ export async function pushWorkspaceSettings(
for (const key of SETTINGS_MANAGED_ONLY_WHEN_PRESENT) {
delete (localSettings as any)[key];
}
// Such a server reads an error handler body carrying this key as the legacy format, which
// clears the handler.
delete localSettings.error_handler?.muted_on_ui_runs;
const webhookUnreadable = unreadableSecret(localSettings.webhook);
if (webhookUnreadable) {
log.warn(
+1 -1
View File
@@ -8651,7 +8651,7 @@ write a secret you were not given: keep the placeholder.
| Key | Value |
|---|---|
| \`auto_invite\` | \`{ enabled, mode: invite \\| add, operator, instance_groups?, instance_groups_roles? }\`. The instance groups are managed only when \`instance_groups\` is stated; clearing a group removes the members it added. |
| \`error_handler\` / \`success_handler\` | \`{ path, extra_args?, muted_on_cancel?, muted_on_user_path? }\`, \`path\` being \`script/<path>\` or \`flow/<path>\`. |
| \`error_handler\` / \`success_handler\` | \`{ path, extra_args?, muted_on_cancel?, muted_on_user_path?, muted_on_ui_runs? }\`, \`path\` being \`script/<path>\` or \`flow/<path>\`. \`muted_on_ui_runs\` (error handler only) skips jobs started from the UI. |
| \`error_handler_fallback_to_instance_alerts\` | Report failures to the instance critical alert channels when no error handler is set. |
| \`webhook\` | URL POSTed a JSON event on every change to the workspace's items. |
| \`ai_config\` | Providers, default and completion models, custom prompts, \`copilot_disabled\`. |
@@ -110,9 +110,8 @@ export const jobTriggerKinds: JobTriggerKind[] = [
'github',
'asset',
'freshness',
'app'
// `ui` is deliberately absent: the backend does not stamp it yet, so offering it here
// would be a filter that can only ever return nothing.
'app',
'ui'
]
export type Trigger = {
@@ -257,6 +257,7 @@
let errorHandlerDraft: HandlerDraft = $state(cloneHandlerDraft(noErrorHandler))
let errorHandlerMutedOnCancel: boolean | undefined = $state(undefined)
let errorHandlerMutedOnUserPath: boolean | undefined = $state(undefined)
let errorHandlerMutedOnUiRuns: boolean = $state(false)
let successHandlerScriptPath: string | undefined = $state(undefined)
const noVariableExpirationHandler = handlerDraftFromStored('variableExpiration', undefined)
let variableExpirationDraft: HandlerDraft = $state(cloneHandlerDraft(noVariableExpirationHandler))
@@ -337,6 +338,7 @@
let initialErrorHandlerDraft: HandlerDraft = $state(cloneHandlerDraft(noErrorHandler))
let initialErrorHandlerMutedOnCancel: boolean | undefined = $state(undefined)
let initialErrorHandlerMutedOnUserPath: boolean | undefined = $state(undefined)
let initialErrorHandlerMutedOnUiRuns: boolean = $state(false)
// Track initial success handler for unsaved changes detection
let initialSuccessHandlerScriptPath: string | undefined = $state(undefined)
@@ -851,11 +853,18 @@
usesInstanceAiConfig = copilotSettingsState.uses_instance_ai_config
instanceAiSummary = copilotSettingsState.instance_ai_summary
const errorHandler = settings.error_handler as
| { path?: string; extra_args?: any; muted_on_cancel?: boolean; muted_on_user_path?: boolean }
| {
path?: string
extra_args?: any
muted_on_cancel?: boolean
muted_on_user_path?: boolean
muted_on_ui_runs?: boolean
}
| undefined
const errorHandlerPath = errorHandler?.path ?? ''
errorHandlerMutedOnCancel = errorHandler?.muted_on_cancel
errorHandlerMutedOnUserPath = errorHandler?.muted_on_user_path
errorHandlerMutedOnUiRuns = errorHandler?.muted_on_ui_runs ?? false
criticalAlertUIMuted = settings.mute_critical_alerts
initialCriticalAlertUIMuted = settings.mute_critical_alerts
publicAppRateLimitPerMinute = settings.public_app_execution_limit_per_minute ?? undefined
@@ -950,6 +959,7 @@
initialErrorHandlerDraft = cloneHandlerDraft(errorHandlerDraft)
initialErrorHandlerMutedOnCancel = errorHandlerMutedOnCancel
initialErrorHandlerMutedOnUserPath = errorHandlerMutedOnUserPath
initialErrorHandlerMutedOnUiRuns = errorHandlerMutedOnUiRuns
// Store initial success handler state for unsaved changes detection
initialSuccessHandlerScriptPath = successHandlerScriptPath
@@ -1128,6 +1138,7 @@
extra_args: handler.args,
muted_on_cancel: errorHandlerMutedOnCancel,
muted_on_user_path: errorHandlerMutedOnUserPath,
muted_on_ui_runs: errorHandlerMutedOnUiRuns,
fallback_to_instance_alerts: false
}
})
@@ -1164,6 +1175,8 @@
)
initialErrorHandlerMutedOnCancel = errorHandlerMutedOnCancel
initialErrorHandlerMutedOnUserPath = errorHandlerMutedOnUserPath
initialErrorHandlerMutedOnUiRuns = handler.path ? errorHandlerMutedOnUiRuns : false
errorHandlerMutedOnUiRuns = initialErrorHandlerMutedOnUiRuns
}
async function editVariableExpirationHandler() {
@@ -1398,13 +1411,15 @@
function errorHandlerSettingsValue(
draft: HandlerDraft,
mutedOnCancel: boolean | undefined,
mutedOnUserPath: boolean | undefined
mutedOnUserPath: boolean | undefined,
mutedOnUiRuns: boolean
) {
return {
errorHandler: handlerDraftToStored(draft),
fallbackToInstanceAlerts: draft.selected === 'instance_alerts',
errorHandlerMutedOnCancel: mutedOnCancel,
errorHandlerMutedOnUserPath: mutedOnUserPath
errorHandlerMutedOnUserPath: mutedOnUserPath,
errorHandlerMutedOnUiRuns: mutedOnUiRuns
}
}
@@ -1414,12 +1429,14 @@
savedValue: errorHandlerSettingsValue(
initialErrorHandlerDraft,
initialErrorHandlerMutedOnCancel,
initialErrorHandlerMutedOnUserPath
initialErrorHandlerMutedOnUserPath,
initialErrorHandlerMutedOnUiRuns
),
modifiedValue: errorHandlerSettingsValue(
errorHandlerDraft,
errorHandlerMutedOnCancel,
errorHandlerMutedOnUserPath
errorHandlerMutedOnUserPath,
errorHandlerMutedOnUiRuns
)
}
}
@@ -1429,6 +1446,7 @@
errorHandlerDraft = cloneHandlerDraft(initialErrorHandlerDraft)
errorHandlerMutedOnCancel = initialErrorHandlerMutedOnCancel
errorHandlerMutedOnUserPath = initialErrorHandlerMutedOnUserPath
errorHandlerMutedOnUiRuns = initialErrorHandlerMutedOnUiRuns
}
// Combined function to check for unsaved changes across all tabs
@@ -2350,6 +2368,15 @@
bind:checked={errorHandlerMutedOnUserPath}
options={{ right: 'Do not run error handler for u/ scripts and flows' }}
/>
<Toggle
disabled={!$enterpriseLicense || errorHandlerChannelMissing}
bind:checked={errorHandlerMutedOnUiRuns}
options={{
right: 'Do not run error handler for jobs started from the UI',
rightTooltip:
'The person who started them sees the error. Schedules, triggers, webhooks, apps, and API or CLI runs still run the handler. Applies once every worker runs 1.776 or later.'
}}
/>
</SettingCard>
{/if}
</div>
+1 -1
View File
@@ -1624,7 +1624,7 @@ write a secret you were not given: keep the placeholder.
| Key | Value |
|---|---|
| \`auto_invite\` | \`{ enabled, mode: invite \\| add, operator, instance_groups?, instance_groups_roles? }\`. The instance groups are managed only when \`instance_groups\` is stated; clearing a group removes the members it added. |
| \`error_handler\` / \`success_handler\` | \`{ path, extra_args?, muted_on_cancel?, muted_on_user_path? }\`, \`path\` being \`script/<path>\` or \`flow/<path>\`. |
| \`error_handler\` / \`success_handler\` | \`{ path, extra_args?, muted_on_cancel?, muted_on_user_path?, muted_on_ui_runs? }\`, \`path\` being \`script/<path>\` or \`flow/<path>\`. \`muted_on_ui_runs\` (error handler only) skips jobs started from the UI. |
| \`error_handler_fallback_to_instance_alerts\` | Report failures to the instance critical alert channels when no error handler is set. |
| \`webhook\` | URL POSTed a JSON event on every change to the workspace's items. |
| \`ai_config\` | Providers, default and completion models, custom prompts, \`copilot_disabled\`. |
@@ -39,7 +39,7 @@ write a secret you were not given: keep the placeholder.
| Key | Value |
|---|---|
| `auto_invite` | `{ enabled, mode: invite \| add, operator, instance_groups?, instance_groups_roles? }`. The instance groups are managed only when `instance_groups` is stated; clearing a group removes the members it added. |
| `error_handler` / `success_handler` | `{ path, extra_args?, muted_on_cancel?, muted_on_user_path? }`, `path` being `script/<path>` or `flow/<path>`. |
| `error_handler` / `success_handler` | `{ path, extra_args?, muted_on_cancel?, muted_on_user_path?, muted_on_ui_runs? }`, `path` being `script/<path>` or `flow/<path>`. `muted_on_ui_runs` (error handler only) skips jobs started from the UI. |
| `error_handler_fallback_to_instance_alerts` | Report failures to the instance critical alert channels when no error handler is set. |
| `webhook` | URL POSTed a JSON event on every change to the workspace's items. |
| `ai_config` | Providers, default and completion models, custom prompts, `copilot_disabled`. |
+1 -1
View File
@@ -34,7 +34,7 @@ write a secret you were not given: keep the placeholder.
| Key | Value |
|---|---|
| `auto_invite` | `{ enabled, mode: invite \| add, operator, instance_groups?, instance_groups_roles? }`. The instance groups are managed only when `instance_groups` is stated; clearing a group removes the members it added. |
| `error_handler` / `success_handler` | `{ path, extra_args?, muted_on_cancel?, muted_on_user_path? }`, `path` being `script/<path>` or `flow/<path>`. |
| `error_handler` / `success_handler` | `{ path, extra_args?, muted_on_cancel?, muted_on_user_path?, muted_on_ui_runs? }`, `path` being `script/<path>` or `flow/<path>`. `muted_on_ui_runs` (error handler only) skips jobs started from the UI. |
| `error_handler_fallback_to_instance_alerts` | Report failures to the instance critical alert channels when no error handler is set. |
| `webhook` | URL POSTed a JSON event on every change to the workspace's items. |
| `ai_config` | Providers, default and completion models, custom prompts, `copilot_disabled`. |