perf(workflow): batch step persistence after execution - #722
Open
xiami762 wants to merge 8 commits into
Open
Conversation
Keep workflow callbacks storage-free while batching complete step history and serializing interactive progress writes. Isolate terminal persistence from stats and retention failures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove obsolete persistence options and duplicated step/row handling while preserving atomic completion and nonblocking progress behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
tool_context_required: falsefork()without waiting on inherited aiosqlite worker threadsPersistence behavior and guarantees
The normal high-frequency trigger write sequence is:
Only the final summary and its step batch share the completion transaction. If that transaction fails, both are rolled back. Stats and retention run after the terminal transaction; failures are logged and do not roll back the already committed summary and steps.
Step callbacks do not call
record_step,record_steps, orrun_coroutine_threadsafe. Completed step details are buffered until terminal persistence, so running executions expose current-node and progress summary fields but detailed step rows become queryable after completion.Performance validation
Real SQLite benchmark for the completion transaction only, with four concurrent executions and seven steps each:
These completion numbers intentionally exclude the queued-row, stats, retention, progress, and audit writes described above. End-to-end trigger persistence normally performs at least four SQLite commits per execution.
Production validation also confirmed that the Kafka ToolContext opt-out removes the multi-second temporary Session/Message setup for workflows that do not require session tools.
Safety bounds and trade-offs
Validation
tests/server/routes/test_workflow_run_route.py: 16 passedtests/workflow/test_workflow_store.py: 7 passedtests/ingest/test_kafka_manager.py: 18 passedgit diff --check: passed