Skip to content

get_workflow_state's cron/scheduled and graph-event candidates read inconsistent extends-chain views (cache vs. live, no shared snapshot) #2828

Closed

Description

@mstomar125

Context

Surfaced during review of PR #2817 (core#2769 — merging fields/relationships across the extends chain in get_workflow_state's diagnostic candidate enumeration).

Problem

get_workflow_state (packages/core/src/playbook/workflow_state.rs) assembles its response from several independent reads that are not taken from one consistent snapshot:

  1. Cron/scheduled candidates read a cache; graph-event candidates read live. The scheduled-trigger ancestor fan-out (lm.ancestors_of(&node.node_type)) reads PlaybookLifecycleManager::ancestor_cache, which is refreshed asynchronously by PlaybookEngine::refresh_ancestor_cache and can be stale if a refresh previously failed (see refresh_ancestor_cache's own warn!("Failed to refresh extends ancestry cache (will retry on next event)")). Meanwhile the PropertyChanged/field candidates read the extends chain live via NodeService::resolve_field_owners/resolve_type_chain on every call. So within one get_workflow_state response, the scheduled half and the graph-event half of the answer can be computed against two different views of the same node's ancestry.
  2. Multiple independent async reads with no shared snapshot. The old code read a node's schema once, synchronously, at the top of the function. This PR replaces that with several independent async calls (get_schema_with_relationships, resolve_field_owners, and — per condition, per path hop — resolve_field_owners/resolve_relationships/get_schema_with_relationships again inside walk_path_against_schema). A concurrent schema write (an extends re-target, a field/relationship add) landing mid-call can make different parts of one response reflect different points in time — e.g. the candidate-key loop sees the field set before a write, but a later hop's known_fields sees it after.

Impact

Both are real but narrow race windows on a read-only diagnostic path — not a correctness bug in the common case (schema writes are rare, administrative operations), and not on the live engine's trigger-dispatch path. Worth fixing for internal consistency of a single response, not urgent.

Suggested approach

Not prescribed — options include: resolving the extends chain once per get_workflow_state call and threading it through instead of re-resolving per hop/per candidate-key loop, and/or having the cron/scheduled fan-out use the same live-resolved chain as the graph-event candidates instead of ancestor_cache.

Non-goals

No change to the live engine's trigger-dispatch path (engine.rs/cel.rs) or to PlaybookLifecycleManager::ancestor_cache's existing refresh semantics — scoped to get_workflow_state's internal consistency.

Activity

  1. added
    bug
    on Sep 22, 2026
  2. mstomar125 commented on Sep 23, 2026

    @mstomar125
    ContributorAuthor

    Frontend: 5264 passed (262 files)

  3. self-assigned this
    on Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

backendbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions