Skip to content

Add behavioral tests for orchestration recovery paths #387

@PureWeen

Description

@PureWeen

Context

PR #375 added significant orchestration recovery logic (premature idle recovery, dead event stream fallback, lazy session resume). The test coverage is currently mostly structural (source-code pattern checks via Assert.Contains) rather than behavioral.

Missing behavioral test coverage

  1. EnsureSessionConnectedAsync — no end-to-end test for resume + fresh-create fallback + GetClientForGroup routing
  2. Premature idle recovery loop — no test with real ManualResetEventSlim signaling and OnSessionComplete events
  3. bestResponse multi-round accumulation — no test verifying longest response wins across recovery rounds
  4. DateTime filtering correctness — no test verifying dispatchTime filter works with local timestamps
  5. OCE handling — no test verifying bestResponse is preserved when inner recovery CTS fires
  6. Dead event stream recovery — no test for LoadHistoryFromDiskAsync fallback with temp events.jsonl

Suggested approach

Create integration-style tests using Demo mode stubs that simulate the event sequences (premature idle, dead streams, OCE). The MultiAgentRegressionTests pattern with StubCopilotSession could be extended.

Priority

Medium — structural tests catch regressions at the code-pattern level, but behavioral tests would catch logic bugs that structural tests miss.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions