Skip to content

Failing test: Dispatcher - dispatches fire actions for non-suppressed episodes and suppress actions for suppressed ones when alert episodes have user actions #300336

Description

@kibanamachine

A test failed on a tracked branch

Scout Test Details:

Field Value
Test ID 98e07605e6e2555-5c049b2017b1c88
Target cloud-serverless-observability_complete
Location x-pack/platform/plugins/shared/alerting_v2/test/scout/engine_dispatcher/api/tests/dispatcher.spec.ts
Duration 11.33s
Module alertingVTwo (plugin)
Config path x-pack/platform/plugins/shared/alerting_v2/test/scout/engine_dispatcher/api/playwright.config.ts
Code Owners elastic/rna-project-team
Error: expect(received).toHaveLength(expected)

Expected length: 5
Received length: 10
Received array:  [{"@timestamp": "2026-10-24T12:36:28.127841730Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-2", "last_series_event_timestamp": "2026-10-24T12:33:32.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.127995982Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-1", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128035009Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-3", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128081905Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-2", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128109652Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-1", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128134663Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-2", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128159147Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-002-series-1", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-002", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128184656Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-005-series-1", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-005", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128208057Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-005-series-2", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-005", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-24T12:36:28.128231310Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-001-series-1", "last_series_event_timestamp": "2026-10-24T12:33:42.673Z", "reason": "dispatched by policy np-1", "rule_id": "rule-001", "source": "internal", "space_id": "default"}]
    at x-pack/platform/plugins/shared/alerting_v2/test/scout/engine_dispatcher/api/tests/dispatcher.spec.ts:809:35

First failure: appex-qa-serverless-kibana-scout-tests - main

Test history: passes and failures over time

Activity

  1. added
    failed-testA test failure on a tracked branch, potentially flaky-test
    scout-playwrightScout (Playwright) related issues and PRs
    on Oct 24, 2026
  2. github-actions commented on Oct 24, 2026

    @github-actions
    Contributor

    Test needs an update — events are seeded before the user actions the dispatcher must see

    A dispatcher tick landed ~455 ms into the test, in the gap between ruleEvents.seed(events) and alertActionsEvents.seed(userActions), so all 10 episodes dispatched as fire and expect(fireActions).toHaveLength(5) received 10.

    Details

    Proposed fix

    Seed the user actions before the rule events, so no dispatcher tick can ever observe episodes without their suppression state. Both arrays are pure data built from the same baseTime, so this is a pure statement reorder — move the ruleEvents.seed(events) call below the alertActionsEvents.seed(userActions) call in each test:

    dispatcher.spec.ts Change
    :651 Move ruleEvents.seed(events) to after alertActionsEvents.seed(userActions) (:732)
    :890 Same reorder, relative to alertActionsEvents.seed(userActions) (:963)

    This is the ordering already used and documented at :1001 in this same file — "Seed the ack first: the dispatcher only picks up episodes from .rule-events, so it can never evaluate episode-2 without the ack already in place." A tick in the reordered gap sees user actions but no events, and dispatches nothing.

    The reorder is safe for dedup: the watermark at queries.ts:62 only takes max(last_series_event_timestamp) over fire/suppress/unmatched, so pre-seeding ack/unack/snooze/deactivate rows cannot advance it or cause the series to be skipped.

    Separately, the waitForAtLeast(10, { actionTypes: ['fire', 'suppress'] }) gate is composition-blind — 10 wrong rows satisfy it just as well as 10 right ones — so it reports the race as an assertion failure rather than a timeout. Worth tightening to the expected split once the ordering is fixed, but it is not the cause.

    Root cause & evidence

    The dispatcher is a free-running singleton task; the test never gates it, and queries.ts reads .rule-events and .alert-actions in one ES|QL statement, so each tick evaluates whatever state is committed at that instant. Both seeds use refresh: true, which makes each one individually visible — and therefore makes the window between them observable.

    The timestamps pin the tick inside that window. Reconstructing baseTime from the reported rows: last_series_event_timestamp: 2026-10-24T12:33:42.673Z is eventTs(165), i.e. baseTime − 165s, giving baseTime = 12:36:27.673. All 10 rows were written between 12:36:28.127841730 and 12:36:28.128231310 — within 390 μs of each other (a single batch), ~455 ms after the test started.

    12:36:27.673  baseTime = Date.now()
    12:36:27.9xx  ruleEvents.seed(events) commits  -> 10 episodes visible
    12:36:28.128  dispatcher tick: 10 episodes, 0 user actions -> writes 10x fire
    12:36:28.2xx  alertActionsEvents.seed(userActions) commits -> too late
    

    Every received row carries reason: "dispatched by policy np-1" — the generic policy-dispatch reason — and not one carries ack, snooze, or deactivate, confirming the tick saw an empty .alert-actions rather than mis-evaluating the suppression rules. The set is also exactly the 10 expected series/episode rows, with the 5 that should have been suppress flipped to fire.

    The failure is terminal, not slow: those 10 rows advance the dedup watermark above every seeded event timestamp, so last_fired < @timestamp excludes all 10 series on every later tick. No additional waiting could have recovered the correct composition — which is why this surfaces as a hard count mismatch.

    Additional context

    • Ruled out: not a product bug (the dispatcher behaved correctly for the state it could see — no user actions means fire); not lane/neighbor pollution (beforeEach wipes both streams, and all 10 rows carry this test's own baseTime-derived timestamps); not a timeout or an under-budget poll (the gate was satisfied, then the assertion failed on composition).
    • Why it is rare: it needs the tick to land in a sub-second window, so it depends on where the dispatcher's schedule happens to fall relative to test start — hence first observed here rather than consistently.
    • Verification: node scripts/scout run-tests --config x-pack/platform/plugins/shared/alerting_v2/test/scout/engine_dispatcher/api/playwright.config.ts. Note a green run is weak evidence for this class — the race only fires on an unlucky tick alignment, so review the seed ordering directly.

    Tip

    Marked "AI-fixable". Add ai:fix-flaky to request a fix now; otherwise it will be requested automatically if the test fails again.

    Generated by Failed Test Investigator for #300336 · claude · opus · 203.7 AIC · ⌖ 35.1 AIC · ⊞ 14.1K · ◷

  3. added
    failure:ai-fixableFailed test investigator: a fix is available and a PR can be opened
    failure:test-needs-updateFailed test investigator: failure lives in the test code
    on Oct 24, 2026
  4. kibanamachine commented on Oct 25, 2026

    @kibanamachine
    ContributorAuthor

    New failure for "cloud-serverless-observability_complete" target: appex-qa-serverless-kibana-scout-tests - main

    Test history: passes and failures over time

    New error message:

    Error: expect(received).toHaveLength(expected)
    
    Expected length: 5
    Received length: 10
    Received array:  [{"@timestamp": "2026-10-25T03:34:49.062115335Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-2", "last_series_event_timestamp": "2026-10-25T03:31:53.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062247405Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-1", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062286195Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-3", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062315527Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-2", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062344551Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-1", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062371079Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-2", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062397727Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-002-series-1", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-002", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062423025Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-005-series-1", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-005", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062448632Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-005-series-2", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-005", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T03:34:49.062474983Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-001-series-1", "last_series_event_timestamp": "2026-10-25T03:32:03.625Z", "reason": "dispatched by policy np-1", "rule_id": "rule-001", "source": "internal", "space_id": "default"}]
    
  5. github-actions commented on Oct 25, 2026

    @github-actions
    Contributor

    ✅ Flaky Test Fixer completed successfully!

    Generated by Flaky Test Fixer for #300336

  6. github-actions commented on Oct 25, 2026

    @github-actions
    Contributor

    ➡️ A fix PR is ready for review: #300354

    It seeds the dispatcher test's user actions before its rule events, closing the window where a tick saw 10 episodes with an empty .alert-actions and fired all of them.

    Generated by Flaky Test Fixer for #300336 · claude · opus · 268.5 AIC · ⌖ 57.5 AIC · ⊞ 15.2K · ◷

  7. kibanamachine commented on Oct 25, 2026

    @kibanamachine
    ContributorAuthor

    New failure for "cloud-serverless-observability_complete" target: appex-qa-serverless-kibana-scout-tests - main

    Test history: passes and failures over time

    New error message:

    Error: expect(received).toHaveLength(expected)
    
    Expected length: 5
    Received length: 10
    Received array:  [{"@timestamp": "2026-10-25T12:34:01.531680503Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-2", "last_series_event_timestamp": "2026-10-25T12:31:06.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.531905184Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-1", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.531948823Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-3", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.531980639Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-003-series-2", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-003", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.532008143Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-1", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.532057676Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-004-series-2", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-004", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.532085284Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-002-series-1", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-002", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.532129574Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-005-series-1", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-005", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.532155906Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-005-series-2", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-005", "source": "internal", "space_id": "default"}, {"@timestamp": "2026-10-25T12:34:01.532180371Z", "action_type": "fire", "actor": {"type": "internal"}, "group_hash": "rule-001-series-1", "last_series_event_timestamp": "2026-10-25T12:31:16.093Z", "reason": "dispatched by policy np-1", "rule_id": "rule-001", "source": "internal", "space_id": "default"}]
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:rna-projectfailed-testA test failure on a tracked branch, potentially flaky-testfailure:ai-fixableFailed test investigator: a fix is available and a PR can be openedfailure:test-needs-updateFailed test investigator: failure lives in the test codescout-playwrightScout (Playwright) related issues and PRs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions