Skip to content

Handle persisted user turns without messages during restore - #494

Merged
Sheng Chen (jdneo) merged 2 commits into
microsoft:mainfrom
mikemikimike:fix/issue-420-null-persisted-user-message
Oct 21, 2026
Merged

Sheng Chen (jdneo) merged 2 commits into
microsoft:mainfrom
mikemikimike:fix/issue-420-null-persisted-user-message

Conversation

@mikemikimike

Copy link
Copy Markdown
Contributor

Summary

Restoring a persisted conversation can fail when a turn is deserialized as UserTurnData without a MessageData object, interrupting restoration of the conversation.

Changes

  • Skip user turns that have no message and log the affected turn ID.
  • Continue restoring subsequent turns.
  • Add a regression test confirming that the malformed turn is skipped and a following valid user turn is restored.

Tests

  • npm i -f
  • ./mvnw clean verify --batch-mode
  • ./mvnw checkstyle:check --batch-mode
  • ./mvnw test --batch-mode
  • All commands passed. The Core suite reported 10,211 passing tests. The UI suite reported 490 tests, 0 failures, and 1 skipped test (EditorLifecycleListenerIntegrationTests, disabled on Linux).
  • git diff --check

Known limitation

The issue did not include the sanitized persisted conversation, so this change handles the missing-message state but does not identify why the reported conversation produced it.

Fixes #420
#420

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused null guard addresses the reported failure, with regression coverage for continued restoration and no identified blocking issues.

0 open findings

What changed in this PR

Prevents missing messages in persisted user turns from interrupting conversation restoration, addressing issue #420.

Changes:

  • Skip malformed user turns and log their IDs.
  • Add a regression test confirming subsequent valid turns still restore.
File Description
com.microsoft.copilot.eclipse.ui/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​ChatView.java Guard missing messages and extract the restoration loop.
com.microsoft.copilot.eclipse.ui.test/​src/​com/​microsoft/​copilot/​eclipse/​ui/​chat/​ChatViewTest.java Test skipping malformed turns and continuing restoration; simplify mock setup.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@jdneo Sheng Chen (jdneo) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for your contribution!

@jdneo
Sheng Chen (jdneo) merged commit d9e73b0 into microsoft:main Oct 21, 2026
4 checks passed
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.

[Bug] Opening a persisted Copilot conversation can fail with NullPointerException in ChatView.restoreTurn()

3 participants