You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(service-automation): one enablement gate in activateFlowTrigger, so a trigger registered after ledger hydration never arms a disabled flow
activateFlowTrigger now refuses to arm a flow isFlowEnabled answers false
for, so registerFlow, registerTrigger, the enable toggle and any later
arming path inherit it; registerFlow's caller-side check is folded into
it. The trigger-fired callback says a failure is in the run history only
for a run that dispatched and failed (status 'failed'), and a
FLOW_DISABLED refusal that still reaches it is logged at info as a
refusal, not at error as a failed run.
Claude-Session: https://claude.ai/code/session_01XY5uCwTjZj7884yYtyur4H
Co-authored-by: Claude <noreply@anthropic.com>
fix(service-automation): a flow switched off in the activation ledger stays unbound after a restart, and a trigger-fired refusal no longer logs an ERROR claiming a run-history row (#20677)
6
+
7
+
Clause-②: no
8
+
9
+
**What was wrong.** A packaged flow switched off through the ADR-0126 activation
10
+
ledger (`POST /api/v1/automation/:name/toggle` with `enabled: false`) came back
11
+
`bound: true` after every cold restart. Its runs were still refused, so the switch
12
+
itself held, but its trigger was armed again. At boot the automation service pulls
13
+
the flows and applies the ledger, which leaves a switched-off flow unbound. The
14
+
trigger plugins register later, at `kernel:ready`, and registering a trigger armed
15
+
every matching flow without asking whether it may run. So `GET
16
+
/api/v1/automation/_status` reported the flow `enabled: false, bound: true`. Each
17
+
matching event also logged `ERROR Trigger-fired run of flow '…' failed`, saying the
18
+
failure "is recorded in the flow's run history", while no run row was written.
19
+
20
+
**What changed.**
21
+
22
+
- The engine checks whether a flow may run in one place: at the step that arms a
23
+
trigger. Every arming path goes through it: flow registration (boot pull,
24
+
publish, hot reload), trigger registration, and the enable toggle. A flow that
25
+
either disable dimension switches off (the activation ledger, or an `obsolete` /
26
+
`invalid` status) is never armed, whenever its trigger registers.
27
+
- Re-enabling a flow arms it on its trigger as before. Re-enabling the ledger bit
28
+
of a flow whose `status` is still `obsolete` or `invalid` no longer arms it, since
29
+
every run it fired would be refused.
30
+
- A trigger-fired run refused because the flow is disabled (for example, an event
31
+
already in flight when the flow was switched off) is logged at `info`, saying
32
+
nothing ran and no run-history row records it. It is no longer an `ERROR`.
33
+
- The `ERROR` line for any other trigger-fired failure says the failure is
34
+
recorded in the run history only for a run that dispatched and failed. A run
35
+
refused before it dispatched gets the same line without that claim.
36
+
37
+
**What is not affected.** The runtime refusal (`FLOW_DISABLED`) and its message are
38
+
unchanged. The enabled flows beside a disabled one arm exactly as before. No export,
0 commit comments