Unrelated test failure — observed during checkin for #1493
Failing test: Phantom.Workspaces.Llm.Tests.AgentChatResumeTests.AgentChat_Resume_RunningSubAgents_StillResolveToSucceededWithPreservedTimestamp
Failure:
System.NullReferenceException: Object reference not set to an instance of an object.
at AgentChatResumeTests.AgentChat_Resume_RunningSubAgents_StillResolveToSucceededWithPreservedTimestamp() line 474
The failure occurred once in the fast suite (1 failure among 7,364 tests). No dump was produced. The exact test then passed 10/10 isolated runs, and the complete AgentChatResumeTests class passed 10/10 runs.
Why this is unrelated to #1493
The #1493 diff does not modify AgentChatResumeTests, SubAgent, AgentChatFactory, or RunningAgentChatLease. Its only AgentChat change adds/invokes a modal-response test hook; this restore test never enters modal-response code. The CTS disposal race fixed by #1493 is in RemoteAgentSessionLease.AttachmentPublisher; this failure has no remote-session stack or ObjectDisposedException, so it is not a recurrence of that race.
Root-cause hypothesis
This is suite-order/parallelism-sensitive lifetime interference around restored sub-agent lease acquisition or disposal. The source line contains an await using acquisition, so the generated state machine can attribute a null during acquisition/disposal to line 474 without exposing the originating object. Isolation removes the trigger.
Proposed solution
- Split acquisition and disposal in this regression test into explicit statements and assert
stub and lease before use so the next occurrence identifies which value is unexpectedly null.
- Add a stress test that runs restored child materialization and parent/factory disposal concurrently.
- Audit
AgentChatFactory.ReleaseAsync/DisposeAsync coordination so factory disposal cannot clear entries while a child lease acquisition or release is in flight.
- If shared AgentChat lifecycle tests mutate process-wide state, place them in a non-parallel xUnit collection or remove that shared state.
Unrelated test failure — observed during checkin for #1493
Failing test:
Phantom.Workspaces.Llm.Tests.AgentChatResumeTests.AgentChat_Resume_RunningSubAgents_StillResolveToSucceededWithPreservedTimestampFailure:
The failure occurred once in the fast suite (1 failure among 7,364 tests). No dump was produced. The exact test then passed 10/10 isolated runs, and the complete
AgentChatResumeTestsclass passed 10/10 runs.Why this is unrelated to #1493
The #1493 diff does not modify
AgentChatResumeTests,SubAgent,AgentChatFactory, orRunningAgentChatLease. Its onlyAgentChatchange adds/invokes a modal-response test hook; this restore test never enters modal-response code. The CTS disposal race fixed by #1493 is inRemoteAgentSessionLease.AttachmentPublisher; this failure has no remote-session stack orObjectDisposedException, so it is not a recurrence of that race.Root-cause hypothesis
This is suite-order/parallelism-sensitive lifetime interference around restored sub-agent lease acquisition or disposal. The source line contains an
await usingacquisition, so the generated state machine can attribute a null during acquisition/disposal to line 474 without exposing the originating object. Isolation removes the trigger.Proposed solution
stubandleasebefore use so the next occurrence identifies which value is unexpectedly null.AgentChatFactory.ReleaseAsync/DisposeAsynccoordination so factory disposal cannot clear entries while a child lease acquisition or release is in flight.