Skip to content

fix(web): preserve provider failure reasons through reload - #541

Open
627150795 wants to merge 2 commits into
openpi-dev:mainfrom
627150795:codex/issue-469-provider-errors
Open

627150795 wants to merge 2 commits into
openpi-dev:mainfrom
627150795:codex/issue-469-provider-errors

Conversation

@627150795

Copy link
Copy Markdown
Contributor

Problem

Closes #469.

The Web message projection drops an assistant response's stopReason and errorMessage. A provider failure with empty content can therefore look like no response, and the reason disappears from SSE and snapshot views. Retry completion also leaves stale retry state visible.

Value

Users can see why a response failed, distinguish failure from cancellation or uncertain settlement, and recover the diagnostic when reopening the Session.

Approach

Preserve bounded, plain-text assistant diagnostics through projection, SSE, and snapshots. Render the outcome and reason for failed or aborted responses, including partial content. Include the outcome in transcript deduplication so empty failures do not collapse together. Project retry completion and clear its live state, display failed/uncertain turn settlement in Composer, and rebuild committed Web assets.

Validation

  • Focused Node protocol/runtime tests: 55 passed. Web Host tests: 39 passed.
  • Focused Vitest store/UI tests: 146 passed.
  • Provider Playwright suite: 2 passed. The failure regression exercises an HTTP 500 response, one deterministic retry, terminal idle state, the last assistant error, and the failed Composer hint before reload. The diagnostic remains visible after reload; the final screenshot was visually checked.
  • Browser verification uses a local fake provider and the current checkout's Web/Pi API fixture in an isolated Pi directory. It does not claim a globally installed OpenPI or real-provider smoke test.
  • bun run check, bun run typecheck, and git diff --check: passed.
  • bun run test on Windows / Node 24.14.0: 1,516 passed, 2 failed, 10 skipped. The failures were the existing git-info/process.test.ts 1-second process timeout and workflows/execute.e2e.test.ts detached-workflow settlement timeout, also seen on the audit baseline. The runner stopped before its later Windows serial and Vitest partitions. Full local suite success is not claimed.

Impact

  • User-visible behavior: bounded provider reasons and assistant outcomes remain visible in the transcript; final failed/uncertain turns receive distinct Composer feedback.
  • Model-visible context/tools: none.
  • Runtime/lifecycle: event projection only; provider retry and cancellation ownership are unchanged.
  • Persisted config/data: none. The test's retry settings are confined to its temporary Pi directory.
  • Compatibility/risk: new message fields are optional. Diagnostics are bounded before normalization and rendered as text, without adding raw provider payloads or HTML rendering.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed at ad0fc65.

This preserves bounded, sanitized provider failure diagnostics across live events and reload while keeping canonical runtime state, model-visible context, and operator-facing UI projections distinct. Failed and aborted outcomes remain separate, and retry completion clears stale diagnostic state.

Local validation: bun run check passed; 94 focused protocol/pi-runtime/web-host Node tests and 146 focused UI tests passed. Hosted CI is green.

Non-blocking follow-up: add a real fixture that streams partial assistant text and then fails, asserting the live SSE state before snapshot polling and the retained incomplete/failure state after reload.

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(web): Provider 运行失败后错误消失,界面没有失败提示

2 participants