Repository navigation
fix(native-chat): recognize missing history before chat creation - #28261
Conversation
8a25572 to
d168a7b
Compare
|
Review status for this draft PR The problem is that a conversation can remain listed in Session History after its saved file disappears. On current main, clicking Resume in New Native Chat then opens an empty chat saying Chat connection could not be confirmed. even though the host can know this particular start was refused before creating a chat. This PR keeps the existing chat tab and Retry action, but shows the existing Chat could not be started. state for that definite refusal. Session History also uses its existing missing-history toast. The host sends an optional fact about this one refused attempt; earlier lost replies and older hosts remain uncertain. The failed tab and toast can report the same failure, and Retry cannot succeed until the source file returns. Those are deferred product decisions, not changes in this PR. Two independent review rounds, an up-front architecture check, user-visible result traces, and readiness review found no remaining code finding. After the one final main sync, 78 tests across eight focused files passed and plain typecheck passed. The two reviewed commits have identical patches on the new base, and the final worktree is clean. Hidden remote macOS validation used real indexed rows and the actual Resume menu in disposable profiles. The current-main image shows the empty chat with its connection-unconfirmed notice; the PR image shows the retained Failed chat and existing start-failed notice/Retry. A separate file-present resume succeeded, confirming that the profile could start a normal chat. Neither the current-main raw create response nor the branch refusal code was captured, so these images establish the visible states rather than the exact host-refusal path. The branch screenshot was captured about 12 seconds after the action; the history toast was not visible and its emission was not verified. A final retake stopped when the permitted OpenCode driver hit its rate limit; those two live checks remain unverified, while focused tests cover the corresponding paths. The screenshots in the PR body are the rendered evidence. Final head: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
b38f989 to
0e25236
Compare
0e25236 to
a633e50
Compare
ELI5
If a saved conversation file disappears after Session History lists it, clicking Resume in New Native Chat opens an empty chat that says its connection could not be confirmed. The host already knows that this attempt stopped before creating the chat, but the client treats that answer like a lost reply.
The chat now uses the existing Chat could not be started state with Retry, and Session History shows its existing message that the conversation's history could not be loaded. The failed tab remains, matching other failed starts.
What Changed
The execution host adds an optional fact to this missing-transcript refusal saying that this attempt stopped before committing. The client uses that fact, the error code, and the missing-transcript reason to enter its existing failed-start path. When an earlier reply was lost, reconciliation still keeps the outcome uncertain and reuses the same request.
Why
The error code also occurs when an existing chat's identity is unavailable, so treating every use of it as a definite failure would be unsafe. This keeps the decision at the host's existing preparation boundary and preserves recovery after a timeout. There is no new stored state or operation. Older hosts without the optional fact retain today's uncertain state; older clients can ignore it.
Linked Issue
Internal bug found during Session History validation; no separate issue.
Visual Proof
These whole-window screenshots use an actual indexed Session History row, its Resume in New Native Chat action, and a removed saved conversation file in disposable macOS profiles:
The images prove the visible states; neither the current-main raw create response nor the branch refusal code was captured, so they do not prove the exact host-refusal path. A separate file-present resume succeeded in the same disposable profile, confirming normal chats can start there. The branch screenshot was captured about 12 seconds after the action; the Session History toast was not visible and its emission was not verified in live UI.
Testing
After consolidating repeated cases, 63 tests across seven touched files pass, covering history removed before creation, the retained failed tab with Retry, the existing missing-history toast, older-host refusals, and reuse of the same request after a lost create reply. The existing adoption test also covers successful committed replay after the source file disappears.
pnpm run typecheckpasses, and all local CI checks pass except for the environmentaltypecheck:cifailure because Bun 1.3.14 lacksbun check. GitHub CI passes onb38f989a604(PR checks); the existing hidden remote macOS screenshots are unchanged, and Windows, Linux, and live SSH UI have not been validated.Review
Two independent review rounds, an up-front architecture challenge, and the full readiness check found no remaining code issue. Remote Electron validation captured the visible before and after tab states, with the evidence limits stated above.
Agent skill upstream boundary
Notes
Authored for @BrennanKB5. The existing failed tab and missing-history toast both report this failure, and Retry cannot succeed while the source file remains missing. Those are possible follow-up product decisions; this PR preserves the existing surfaces and wording.
The optional response field is compatible with independently updated desktop and paired hosts. Transcript discovery stays on the execution host; losing an SSH connection never proves a chat absent. The same response handling applies to folder workspaces.
Checklist
pnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)