Skip to content

Fix duplicate workflow instance and execution ID fields in logs#406

Merged
cschleiden merged 3 commits intomainfrom
copilot/fix-405
Aug 14, 2025
Merged

Fix duplicate workflow instance and execution ID fields in logs#406
cschleiden merged 3 commits intomainfrom
copilot/fix-405

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Aug 14, 2025

This PR fixes an issue where workflow.instance.id and workflow.execution.id fields were appearing multiple times in workflow logs, causing unnecessary duplication and potential confusion in log analysis.

Problem

The logger passed into the Executor was already enhanced with InstanceIDKey and ExecutionIDKey fields, but then these same fields were being added again in three other places:

  1. Executor constructor - Added the fields again in the NewExecutor function (lines 113-116)
  2. WorkflowState replay logger - Added the fields again when creating the replay logger
  3. Executor event logging - Added InstanceIDKey again in executeEvent() and Close() methods

This resulted in log entries like:

{
  "msg": "Executing event",
  "workflows.instance.id": "123",
  "workflows.execution.id": "456", 
  "workflows.instance.id": "123",
  "workflows.execution.id": "456"
}

Solution

Removed all redundant field additions while keeping the primary logger enhancement that happens before the executor is created. The changes are minimal and surgical:

  • Remove duplicate .With() call in executor constructor (NewExecutor)
  • Remove duplicate .With() call in NewWorkflowState()
  • Remove InstanceIDKey from debug logging in executeEvent()
  • Remove InstanceIDKey from debug logging in Close()

Verification

  • All existing tests continue to pass
  • Manual testing with sample workflows confirms logs now show each field only once
  • Log entries now appear correctly as:
{
  "msg": "Executing event",
  "workflows.instance.id": "123",
  "workflows.execution.id": "456"
}

Fixes #405.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: cschleiden <2201819+cschleiden@users.noreply.github.com>
Copilot AI changed the title [WIP] Workflow instance logger includes duplicate fields Fix duplicate workflow instance and execution ID fields in logs Aug 14, 2025
Copilot AI requested a review from cschleiden August 14, 2025 20:53
… cleanup test file

Co-authored-by: cschleiden <2201819+cschleiden@users.noreply.github.com>
@cschleiden cschleiden marked this pull request as ready for review August 14, 2025 21:11
@cschleiden cschleiden enabled auto-merge August 14, 2025 21:11
Copilot AI requested a review from cschleiden August 14, 2025 21:11
@cschleiden cschleiden merged commit d4b4b73 into main Aug 14, 2025
7 of 8 checks passed
@cschleiden cschleiden deleted the copilot/fix-405 branch August 14, 2025 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflow instance logger includes duplicate fields

2 participants