openworkflowdev / openworkflowdev/openworkflow

Parent workflow remains parked when child workflow deadline expires

Ouverte
#714 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
TypeScript
Étoiles
1.3k
Forks
66
Merge moyen
1 j 1 h
PR mergées (30 j)
69

Description

Background

When a child workflow run exceeds its deadlineAt, workers expire it to failed status inside claimWorkflowRun. The parent workflow parks itself waiting on the child via step.runWorkflow, which calls sleepWorkflowRun and releases the worker slot. The parent should be woken promptly when the child reaches a terminal state.

Problem

The deadline-expiry path in postgres/backend.ts:484 and sqlite/backend.ts:414 marks child runs as failed but never calls wakeParentWorkflowRun. The parent's availableAt is never updated to NOW(). The parent remains parked until its own availableAt — which is set to the runWorkflow timeout (default: 1 year from workflow start).

Steps to Reproduce

  1. Define a child workflow and a parent that calls step.runWorkflow(child, input, { timeout: "1h" }).
  2. Create the child run with deadlineAt: new Date(Date.now() + 1000) (1s).
  3. Wait 2s for the deadline to pass.
  4. Trigger a claimWorkflowRun tick.
  5. Observe: child is failed; parent availableAt remains 1 hour in the future.

Expected Behavior

When a child run is expired, the parent's availableAt is set to NOW() so it is picked up on the next poll cycle.

Proposed Solution

Postgres: Extend the expired CTE to also RETURNING "id", "parent_step_attempt_namespace_id", "parent_step_attempt_id". After the main claim UPDATE, run the same wake-parent UPDATE used by completeWorkflowRun against the expired IDs.

SQLite: After the expiry UPDATE, query the expired run IDs with RETURNING "id", "parent_step_attempt_id" and loop wakeParentWorkflowRun for each.

Acceptance Criteria

Integration test: parent wakes within one poll cycle after child deadline expires.
Both Postgres and SQLite backends pass the test.
No regression in existing child-workflow tests.

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez dans postgres/backend.ts vers la ligne 484 et dans sqlite/backend.ts vers la ligne 414, puis suivez claimWorkflowRun, completeWorkflowRun et wakeParentWorkflowRun. Ajoutez une couverture pour un parent dont le child expire et vérifiez que le parent est disponible en un cycle de polling ; les tests d’intégration Postgres et SQLite ainsi que les tests existants de child-workflow devraient tous réussir.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
postgresql, sqlite, typescript
Domaine
backend, databases, testing
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Clairement spécifiée
Accessibilité débutants
68/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.