Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 9, 2025

Context

Addresses review comment on #5412 regarding the intentional design decision to call ReportJobCompletionEventAsync instead of CompleteJobRequestAsync for Plan v8+ worker crashes.

Review thread: #5412 (comment)


Description

Provided technical explanation clarifying the completion flow for Plan v8+ worker crashes:

  • Plan v8+ worker crashes: Listener calls ReportJobCompletionEventAsync to send plan event directly, since crashed worker cannot report completion
  • Plan v8+ normal completions: Still calls CompleteJobRequestAsync, which returns early (lines 959-963) for Plan v8+ as plan events replace legacy FinishAgentRequest API
  • Plan v7 scenarios: Always calls CompleteJobRequestAsync, which executes FinishAgentRequest

The conditional logic ensures job completion is properly reported regardless of worker state, leveraging Plan v8+'s event-based completion mechanism when available.

if (isPlanV8Plus && isWorkerCrash)
{
    // Worker crashed - listener must send plan event
    await ReportJobCompletionEventAsync(message, result);
}
else
{
    // Normal flow - CompleteJobRequestAsync handles both v7 and v8+
    await CompleteJobRequestAsync(_poolId, message, lockToken, result, detailInfo);
}

Risk Assessment (Low)

No code changes - documentation/clarification only.


Unit Tests Added or Updated (No)

No code changes made.


Additional Testing Performed

Not applicable - response to review comment only.


Change Behind Feature Flag (Yes)

Existing behavior already behind AgentKnobs.EnhancedWorkerCrashHandling feature flag.


Tech Design / Approach


Documentation Changes Required (No)

Code comments already document the conditional completion strategy.


Logging Added/Updated (No)

Existing trace statements cover all code paths.


Telemetry Added/Updated (No)

Existing telemetry unchanged.


Rollback Scenario and Process (Yes)

Feature flag allows instant rollback if needed.


Dependency Impact Assessed and Regression Tested (Yes)

No behavioral changes - review feedback addressed only.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Address feedback on enhanced worker crash handling Clarify Plan v8+ worker crash completion behavior in response to review feedback Dec 9, 2025
Copilot AI requested a review from raujaiswal December 9, 2025 08:09
@raujaiswal raujaiswal closed this Dec 9, 2025
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.

2 participants