fix: add random suffix to log filenames to prevent collision#94
Open
PolyphonyRequiem wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: add random suffix to log filenames to prevent collision#94PolyphonyRequiem wants to merge 1 commit intomicrosoft:mainfrom
PolyphonyRequiem wants to merge 1 commit intomicrosoft:mainfrom
Conversation
When multiple workflow runs start in the same second (common when
orchestrating parallel runs), time.strftime('%Y%m%d-%H%M%S') produces
identical timestamps, causing all runs to write to the same file.
This corrupts event logs, checkpoint files, and CLI log files by
interleaving events from different runs.
Append a random 8-character hex suffix (via secrets.token_hex(4))
to filenames across all three affected locations:
- EventLogSubscriber (event_log.py)
- CheckpointManager.save_checkpoint (checkpoint.py)
- generate_log_path (cli/run.py)
Filenames change from:
conductor-workflow-20260416-014816.events.jsonl
to:
conductor-workflow-20260416-014816-a3b7c9f1.events.jsonl
Backward compatible: existing tools that glob *.events.jsonl,
*.json, or *.log continue to work.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #94 +/- ##
=======================================
Coverage ? 85.44%
=======================================
Files ? 46
Lines ? 6445
Branches ? 0
=======================================
Hits ? 5507
Misses ? 938
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
|
@microsoft-github-policy-service agree company="Microsoft" |
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.
Problem
When multiple workflow runs start in the same second (common when orchestrating parallel runs), \ ime.strftime('%Y%m%d-%H%M%S')\ produces identical timestamps, causing all runs to write to the same event log file. This corrupts event logs, checkpoint files, and CLI log files by interleaving events from different runs.
Solution
Append a random 8-character hex suffix (via \secrets.token_hex(4)) to filenames across all three affected locations:
Before
\
conductor-workflow-20260416-014816.events.jsonl
\\
After
\
conductor-workflow-20260416-014816-a3b7c9f1.events.jsonl
\\
Backward Compatibility
Fully backward compatible — existing tools that glob *.events.jsonl, *.json, or *.log\ continue to work. Filenames remain human-readable with the timestamp prefix; the suffix only prevents collisions.
Testing
Note
One pre-existing test (\ est_handles_non_serializable_data) fails on Windows due to a path separator assertion (\\\some\\path\ vs /some/path). This is unrelated to this change.