Skip to content

FIX Recover chat drafts after target processing failures - #2474

Open
Roman Lutz (romanlutz) wants to merge 5 commits into
microsoft:mainfrom
romanlutz:romanlutz-fix-chat-target-recovery
Open

FIX Recover chat drafts after target processing failures#2474
Roman Lutz (romanlutz) wants to merge 5 commits into
microsoft:mainfrom
romanlutz:romanlutz-fix-chat-target-recovery

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

PyRIT can persist a failed user turn and an assistant error piece while returning HTTP 200 from the message endpoint. The chat frontend previously treated that resolved request as target success, cleared the composer, and left users without a safe recovery path.

This change separates transport success from target outcome success by inspecting response_error. For retryable processing failures, the chat preserves the submitted text, attachments, and converter intent and offers Edit in clean conversation instead of automatically resending. Multi-turn targets branch immediately before the failed user turn, while single-turn targets start a fresh conversation. This avoids duplicating persisted turns or replaying diagnostic text into future target context.

Blocked and safety outcomes remain non-retryable, rejected HTTP or network sends restore the draft in place, and stale send or recovery completions cannot overwrite newer edits or navigation. Processing diagnostics are also removed from chat content and conversation previews, and internal attachment recovery values are excluded from JSON exports.

The backend's authoritative persisted-error and HTTP-200 behavior remains unchanged.

Before and after

processing-error-before-after-updated.webm

Tests and Documentation

  • Added focused Jest coverage for processing, blocked, successful, rejected, persisted-reload, single-turn, multi-turn, and race scenarios.
  • Added Playwright coverage for the HTTP-200 processing failure and clean-conversation recovery flow, including both original and recovery conversations.
  • Added backend preview tests for safe error summaries.
  • Ran 320 focused Jest tests, frontend ESLint, TypeScript type-check, production build, 7 Playwright error regressions, 19 backend preview tests, targeted Ruff checks, and pre-commit hooks.
  • Documentation and JupyText: N/A. No documentation or notebook behavior changed.

Copilot AI and others added 3 commits August 23, 2026 20:12
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 4a69a7e6-c349-4549-9179-3058526d25dc
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4a69a7e6-c349-4549-9179-3058526d25dc
Scope chat message assertions to the message list so retained in-flight drafts do not create ambiguous text locators.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4a69a7e6-c349-4549-9179-3058526d25dc
@hannahwestra25 hannahwestra25 self-assigned this Aug 24, 2026
Comment thread frontend/src/components/Chat/ChatWindow.tsx Outdated
Comment thread frontend/src/components/Chat/ChatWindow.tsx Outdated
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 4a69a7e6-c349-4549-9179-3058526d25dc
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.

3 participants