Skip to content

case_escalation flow re-escalates a case the moment it is closed #507

Description

@yinlianghui

Found while fixing #491, reproduced live against the running dev console (2026-07-28).

case_escalation (src/flows/case-escalation.flow.ts) triggers on record-after-update with:

record.priority == "critical" && record.status != "escalated"

Closing a critical case is itself an afterUpdate that sets status: 'closed' — which passes this guard. Observed sequence:

  1. close_case writes is_closed: true, status: 'closed' (Done toast, write confirmed).
  2. The write triggers case_escalation; its condition matches (critical + status closed ≠ escalated).
  3. The flow rewrites the case to status: 'escalated', stamps escalation_reason: 'Auto-escalated: critical priority', and notifies the owner — the case the agent just closed is open again.

Note the guard cannot use is_closed != true instead: the file's own header comment documents the SQLite trap where a persisted boolean 1 makes 1 != true evaluate true (that is exactly why the guard is status-based).

Fix: extend the condition with && record.status != "closed" && record.status != "resolved" (the on-create twin inherits it via the shared nodes). Included in the #491 fix branch claude/views-pages-dashboards-refs-850098, with a regression test in test/actions-flows-integrity.test.ts ("case escalation trigger does not fight the close action").

Activity

  1. added 3 commits that reference this issue on Jul 29, 2026
    628e413
    41c2127
    baeba52
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions