#521 [API/Race] Workflow definition hash collision on concurrent submit

closed high Created 2025-12-17 14:59 · Updated 2025-12-17 15:52

Description

Edit
**File:** api/blueprints/v1/workflows.py:236-256 **Problem:** Two concurrent submissions of same workflow can both SELECT (no definition found), both INSERT, causing duplicate key error instead of returning existing definition. **Fix:** Use INSERT ... ON CONFLICT: ```sql INSERT INTO workflow_definition (definition_id, definition_hash, ...) VALUES (%s, %s, ...) ON CONFLICT (definition_hash, tenant_id) DO UPDATE SET definition_id = EXCLUDED.definition_id RETURNING definition_id, version ``` **Impact:** 500 errors on concurrent workflow submissions.

Comments

Loading comments...

Context

Loading context...

Audit History

View All
Loading audit history...