Skip to content

automation: on 19.0.0-next.2, the run-history overflow prune warns "Record run_… not found in sys_automation_run" for rows it just counted (57 per test shard in hotcrm) #38303

Duplicate

Description

@objectstack-fleet

repo:hotcrm#2 · sunhaolin · session_017xRBcV3h25dAMNWki8e1ns

What a consumer sees

On @objectstack/* 19.0.0-next.2, the hotcrm test suite logs WARNs like this one:

WARN [automation] run-history overflow prune failed for 'lead_assignment': Record run_run_023873c5-6cdb-4cf1-9a90-a3410fae8cb9 not found in sys_automation_run

Possibly related: the first bulk import got slower

In the same suite, the first case of test/import-values-accepted.test.ts:90 (a lead bulk import that fires lead_assignment) takes:

Version Where Time
next.2 CI 5455 ms (failed at the 5 s default), then 6285 ms
next.2 local 2.0–2.6 s
18.6.0 local 1.0 s

With the template imports skipped, the case takes 0.65 s on both versions. The hotcrm dev's reading is that the extra time is work the bulk import leaves running after its writes return. That reading is an inference; it is not traced to a function.

Suspected cause (inferred, not traced)

#37742 (fix for #37705) moved a run's history row to land a moment after the triggering write commits. An overflow prune that counts runs and deletes the oldest could now race the deferred insert: it picks a row id whose row has not landed yet, or deletes one twice. That would fit both the "not found" WARNs and the extra work after the writes return.

Asks

  1. Confirm or refute the race between the overflow prune and the deferred history insert.
  2. If confirmed, make the prune tolerate a row that has not landed yet, or order it after the insert, so it does not log a failure per run.
  3. Say whether the slowdown of the first bulk import is expected on 19.

hotcrm gave that one test a 30 s budget with the measurement beside it. Its assertions are unchanged, and it will cite this card.

Activity

  1. added
    finding
    on Nov 28, 2026
  2. objectstack-fleet commented on Nov 28, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · sunhaolin · session_017xRBcSxvUE3fDrox79CL9t

    Triage: lands in packages/services/service-automation/src/suspended-run-store.ts (pruneFlowOverflow) · area:workflow · domain:server · Bug · p3 · pm:queue · size S. Rationale: each new terminal run triggers an overflow prune, and a prune that finds its row already gone only logs a WARN. The named producer (hotcrm CI #2820 shard 3) shows 57 such lines on 19.0.0-next.2. Nothing is stored wrong, so Impeded × developers/operators ⇒ p3. A second explanation besides the filed deferred-insert theory: concurrent prunes after a bulk import read the same overflow list and both delete it. The dev confirms which one and answers ask 3 (is the slowdown expected on 19?) in the report. A measured end-user bulk-import slowdown re-grades upward. Dedupe: #37705 (closed) is a different mechanism.
    Path: none
    Source: fleet (filed from the hotcrm seat's CI reading) · Filing gate: ① finding (a), reach measured.
    Grade: area:workflow · Bug · Impeded · reach: developers and operators reading logs (named producer) · evidence: measured downstream, mechanism read.

    Recorded 2026-11-28T13:57Z.

  3. added
    area:workflow
    domain:server
    pm:queue
    and removed
    finding
    on Nov 28, 2026
  4. objectstack-fleet commented on Nov 29, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:hotcrm#2 · sunhaolin · session_017xRBcV3h25dAMNWki8e1ns

    More evidence for this card, from hotcrm card #2849 and PR #2854 (dev report: hotcrm comment 7250571615). The slowdown also shows on approval and record-change flow work in test/psa-approvals.test.ts.

    Local, same box, two runs each, --maxWorkers=2, comparing 18.6.0 (hotcrm 332710e8) with 19.0.0-next.2 (hotcrm c6e64eed):

    What 18.6.0 19.0.0-next.2
    Whole file 24.0–25.3 s 28.7–29.0 s (about +15–20 %)
    "is approved by a Project Director" 517–535 ms 644–711 ms
    "sends a report totalling 2000 or more" 873–969 ms 1216–1275 ms
    "puts the expenses of each project" on CI 1.6–1.8 s 3.4–3.7 s

    A phase profile found no polling wait. Each vi.waitFor on approval requests resolves on its first poll, in 1–2 ms. So the time is spent in the flow and approval work itself.

    Four bulk-submit cases in that file now cross hotcrm's 5 s default on CI shard 2. hotcrm gave them a measured 15 s per-case budget that cites this card.

  5. objectstack-fleet commented on Dec 5, 2026

    @objectstack-fleet
    ContributorAuthor

    triage@hotlong · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH

    Folded 2026-12-05T02:45Z into this week's area:workflow sweep card #39770, as row "#38303 — automation: on 19.0.0-next.2, the run-history overflow prune warns "Record run_… not found in sys_automation_r", on the maintainer's word in the triage report: 「同意,14 个专题都开,内部卡并清扫卡」. This card is internal engineering work with no direct customer effect, small and unclaimed, which is what the sweep takes. Its body stays the detail of the row; the sweep PR that ships the row names this card. Reopen it if it turns out larger than one file or one mechanism.

  6. removed
    pm:queue
    on Dec 5, 2026
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

    area:workflowdomain:serverpriority:p3

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions