Skip to content

Collapse a conversation failure a later turn superseded; only the last failed turn offers retry (APT-1365) - #48

Merged
reoring merged 3 commits into
mainfrom
fix/turn-retry-noop
Nov 19, 2026
Merged

reoring merged 3 commits into
mainfrom
fix/turn-retry-noop

Conversation

@reoring

@reoring reoring commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

森さん向けの 5 行

  1. 何が変わるか: 会話の中で、後の依頼が成功した古い失敗に「もう一度試す」が出て、押しても何も起きなかった(APT-1365、Craftsman の draft「test」)。後に会話が続いた失敗は、再試行を求めず 1 行に畳む。最後の依頼が失敗した時は、今までどおり「もう一度試す」で同じ依頼を送り直す。再送は会話の依頼だけを対象にし、Excel から作る の段の失敗は「Excel から作る」へ戻して続けさせる。
  2. 届いたときに見える変化: 古い失敗の赤 card が消え、情報の 1 行「この依頼は途中で止まりました」(英語 "This request was interrupted.")になる。押しても反応しない button は無くなる。Excel から作る の段が止まった作りかけは「Excel から作る作業が途中で止まりました。「Excel から作る」で続けてください」と、そこへの link が出る。
  3. 決めてほしい点と推奨: 1 つ(今回の範囲外): 画面設計の追加の変更だけが失敗して前の設計が残る時に計画を作らせるか = 推奨「前の版を使うと明示し、利用者が選んだ時だけ」。
  4. レビューと確かめていないこと: review = probe-sol(GPT 系、書き手は Claude 系)、記録 po/lead-2026-11-14/reviews/builder-console-48-review-authz-gaps.md。既知の残り: 0.6.1 の tab に「古い失敗の通知」と「未送信の返信」が同時に保存されている稀な場合、止まりが残る(button を押すと未送信の返信が送られて解ける)。会話が止まった原因そのもの(作業環境の volume の準備待ち)は APT-1338(rc.44 で直し済み)、期限切れの文の改善は APT-1352(platform #7152、次の rc)。
  5. 戻し方: この PR を revert して前の版の image に戻す。データ・API の形は変わらない。

Summary

APT-1365. assistantMessage (web/src/model/build/messages.ts) gave every failed conversation turn's notice retry: 'turn', but retry('turn') (web/src/features/build/use-build-session.ts) only resends when the last draft turn is failed and nothing is pending. A failed turn followed by a later turn therefore showed a red card whose button did nothing, and the card (re-derived from the draft on every render) never went away. Seen on Craftsman (0.6.1): draft 「test」, turn 1 failed with application draft conversation turn timed out at 07:56Z, turn 2 (the same request resent) succeeded at 09:00Z.

  • messagesFromDraft renders a failed conversation turn that a later conversation turn followed, and that offered a retry, as one information notice (tone: 'info', failure.superseded) without retry, detail or reference. A superseded policy refusal keeps its reason. The user's request bubble stays.
  • The last failed conversation turn keeps its error card and retry: 'turn'; pressing it resends that turn's request. Observation, the plan-start guard and retry('turn') use the conversation's last turn (shownConversationTurns), the list the conversation renders, never an Excel → app turn after it.
  • Observed turn-failure notices carry the turn id (turnId, persisted in the tab session). A notice naming a superseded failed turn is neither shown nor kept (withoutStaleTurnFailures), and the failure it set clears, so a pending reply is sent. A failed send (HTTP, no turn) keeps blocking until its retry, as before.
  • When the latest Excel → app turn (analysis or screen design) failed, the build conversation shows one line that the step stopped, with a link to continue in 「Excel から作る」 (which retries each step by its kind), instead of the 「解析と画面の決定は済んでいます」 line.
  • Mock: POST /api/v1/__mock/turn-failure {error, kind?} makes the next settling turn (of that kind; default conversation) fail once with that error (reset clears it).

Known risk (review 2, medium, not fixed): a 0.6.1 tab session that saved an observed-failure notice without turnId together with a pending reply keeps the reply blocked until the user presses that notice's 「もう一度試す」, which then sends the pending reply.

Verification

Local (head 470c80c, Bun 1.4.2, Playwright 1.65, serialize-vm-tests local):

  • bun run typecheck, bun run typecheck:e2e: clean.
  • bun test src: 2223 pass, 0 fail. src/model/build/messages.test.ts: superseded failures (collapsed only when they offered a retry; policy keeps its reason; [failed, failed] only the last retries; turn-id matching of saved notices, a different or missing turnId is still shown; language switch), the pruning table for withoutStaleTurnFailures, an Excel turn after a failed request, and the stopped Excel → app step line.
  • playwright test --grep @mock: build-turn-retry (A old failure collapsed without retry; B last failure's 「もう一度試す」 POSTs the same message and the conversation continues; C another tab's resend clears this tab's saved failure and a new reply is POSTed; D a failed screen-design turn after the failed request does not change what 「もう一度試す」 sends; E a failed screen-design turn shows the stopped line and a link to /-/excel2app?draft=<id>), app-create-excel2app, app-build-ai, app-build-console-conversation: 26 passed. Earlier on this branch also build-failure-cause, build-run-failure, app-build-malformed-response, app-create-excel2app-set, app-create-excel2app-malformed-response: passed.
  • The full mock story suite runs in CI (console-mock-stories).

…t failed turn offers retry (APT-1365)

- assistantMessage gave every failed turn's notice retry: 'turn', but retry('turn') resends only the last
  failed turn. A failure followed by a later turn kept a red card whose 「もう一度試す」 did nothing and that
  never went away (Craftsman, 0.6.1, draft 「test」: turn 1 timed out, the resent turn 2 succeeded).
- messagesFromDraft renders a failed turn that a later conversation turn followed as one information line
  「この依頼は一度止まりました」 / "This request stopped once", without retry, detail or reference. The last
  failed turn keeps its card and retry, which resends the same request. A tab's saved copy of the
  superseded failure notice is not shown again.
- Mock: POST /api/v1/__mock/turn-failure {error} fails the next settling conversation turn once.
- Tests: messages.test.ts superseded-failure cases; story build-turn-retry.mock.spec.ts (old failure
  collapsed without retry; last failure's retry POSTs the same message and the conversation continues).
@reoring reoring added the needs-human-review Waits for a person's review before merge label Nov 19, 2026
…n's own last turn (APT-1365 review)

- Review of #48: a tab's saved notice of an observed turn failure kept blocking a pending reply after the UI
  collapsed it, and retry('turn') resent the last turn of any kind (an Excel → app turn after the failed
  conversation turn). Matching saved notices by role/at/title also hid or kept the wrong ones.
- Observed turn-failure notices carry the turn id; a notice naming a superseded failed turn is neither shown
  nor kept in the tab (withoutStaleTurnFailures), and the failure it set clears, so pending replies send.
  A failed send (no turn) keeps blocking until its retry, as before.
- Observation, the plan-start guard and retry('turn') use the conversation's last turn
  (shownConversationTurns), the list the conversation renders.
- A superseded policy refusal keeps its reason; only failures that offered a retry collapse.
- Copy: 「この依頼は途中で止まりました」 / "This request was interrupted."
- Tests: turn-id matching, language switch, policy, Excel turn after a failure, a pruning table; stories C
  (another tab's resend clears this tab's saved failure and a new reply is sent) and D (a failed
  screen-design turn does not change what 「もう一度試す」 sends).
…ntinue it (APT-1365 review 2)

- Review 2 of #48: once observation and retry follow the conversation's own last turn, a draft whose
  Excel → app turn failed showed nothing on the build page (opened from 作りかけ), and an analysis that
  succeeded before a failed screen design still read as 「解析と画面の決定は済んでいます」.
- When the latest Excel → app turn (analysis or screen design) failed, the conversation shows one line
  「Excel から作る作業が途中で止まりました。「Excel から作る」で続けてください」 with a link
  「「Excel から作る」で続ける」 to that page, which retries each step by its kind; no retry here.
- Tests: stopped-step cases in messages.test.ts; story case E (a failed screen-design turn shows the
  line and the link to /-/excel2app?draft=<id>, no alert, no 「もう一度試す」).
@reoring reoring removed the needs-human-review Waits for a person's review before merge label Nov 19, 2026
@reoring
reoring merged commit 830e0d3 into main Nov 19, 2026
10 of 12 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.

1 participant