Skip to content

Fix orphaned worker scan after reconnect system messages#525

Merged
PureWeen merged 1 commit into
mainfrom
fix/orphan-scan-synthesis-detection
Apr 6, 2026
Merged

Fix orphaned worker scan after reconnect system messages#525
PureWeen merged 1 commit into
mainfrom
fix/orphan-scan-synthesis-detection

Conversation

@PureWeen
Copy link
Copy Markdown
Owner

@PureWeen PureWeen commented Apr 6, 2026

Summary

Follow-up to the recent orphaned-worker scan work: after a crash/reconnect, the orchestrator can receive a fresh system message (for example, a recreated/reconnected marker) that is newer than a workers unsynthesized response. The existing scan compared against the orchestrators last message of any type, which could suppress the warning and miss the exact orphaned result it was meant to detect.

Changes

  • compare worker timestamps against the orchestrators last assistant message instead of its last message of any type
  • ignore reconnect/recovery system messages for orphan detection
  • add a regression test covering the case where the orchestrator has a newer system message but an older assistant response

Validation

  • dotnet test PolyPilot.Tests/ --nologo -v q

This is a focused follow-up improvement based on the recent post-merge review of the multi-agent restore/orphan scan logic.

Compare worker completion timestamps against the orchestrator's last
assistant synthesis message instead of its last message of any type.
This avoids suppressing orphan warnings when reconnect/recovery adds a
newer system message after app restart.

Also adds a regression test covering the restore scenario where the
orchestrator has a newer system message but an older assistant response,
so unsynthesized worker results are still detected.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PureWeen
Copy link
Copy Markdown
Owner Author

PureWeen commented Apr 6, 2026

🔍 Multi-Model Code Review — PR #525

CI Status

⚠️ No GitHub checks reported yet on this branch.

Findings

No requested changes.

All three reviewers independently agreed that this is a focused, correct fix:

  • it closes the false-negative case where reconnect/recovery system messages could suppress orphaned-worker detection
  • it keeps the comparison scoped to the orchestrators last real assistant/synthesis message
  • it adds a targeted regression test for the restore/system-message scenario

Test Coverage Assessment

✅ The new regression test directly covers the scenario this PR is intended to fix.
✅ Existing orphaned-worker scan tests continue to cover the surrounding cases.

Recommendation

Approve — the change is minimal, correct, and appropriately tested.

@PureWeen PureWeen merged commit b6be92a into main Apr 6, 2026
@PureWeen PureWeen deleted the fix/orphan-scan-synthesis-detection branch April 6, 2026 05:03
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.

1 participant