Skip to content

fix(native-chat): recognize missing history before chat creation - #28261

Merged
brennanb2025 merged 4 commits into
mainfrom
brennanb2025/vanished-source-empty-chat
Oct 15, 2026
Merged

brennanb2025 merged 4 commits into
mainfrom
brennanb2025/vanished-source-empty-chat

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​73 $\color{#cf222e}{\Huge{\mathbf{−}}}$​49 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​36 $\color{#cf222e}{\Huge{\mathbf{−}}}$​11 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​25

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:

Current main: empty Codex Chat with connection-unconfirmed notice and Retry

This PR: retained failed Codex Chat with Chat could not be started notice and Retry

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

  • I manually tested the rendered before and after states in hidden remote macOS app profiles
  • Automated tests added/updated

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 typecheck passes, and all local CI checks pass except for the environmental typecheck:ci failure because Bun 1.3.14 lacks bun check. GitHub CI passes on b38f989a604 (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

  • Not applicable: no upstream skill-installer material is copied or translated.

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

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots attached for the visible tab and notice change
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@brennanb2025 brennanb2025 mentioned this pull request Oct 13, 2026
5 tasks done
@brennanb2025
brennanb2025 force-pushed the brennanb2025/vanished-source-empty-chat branch from 8a25572 to d168a7b Compare October 13, 2026 12:46
@brennanb2025

brennanb2025 commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor Author

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: d94e6c1acfce7a59072d840cd59046dec71b225f. Local orca-ci-checks passed 22/23 checks; the only failure was Bun 1.3.14 lacking the check script used by typecheck:ci. GitHub CI passes on the final head (PR Checks). The first CI run exposed two old mock-call expectations; a test-only follow-up now checks the uncertainty argument used during reload recovery. The PR remains draft and was not merged.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 13, 2026 23:53
@coderabbitai

coderabbitai Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 99fe2277-0777-4f6d-a842-0fa1ecec82a0
📥 Commits

Reviewing files that changed from the base of the PR and between b38f989 and a633e50.

📒 Files selected for processing: 3
  • src/main/native-chat/agent-session-wire/structured-agent-session-create-adoption.test.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-create.ts
  • src/renderer/src/components/right-sidebar/ai-vault-session-resume-in-chat-launch.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.

📝 Walkthrough

The server marks selected missing or unreadable transcript refusals as refused before commit. The renderer accepts prior create-outcome state and uses it when classifying marked refusals. Recovery and retry calls pass that state. Tests cover server refusal details, renderer outcome handling, retry notices, retained tabs, and refusal messages.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to a633e

The change preserves the distinction between confirmed pre-creation refusals and uncertain replies; no specific merge-blocking behavior is established.

Pre-merge checks: Passed 3 · Failed 2

Failed Failed checks: 2 warnings

Check name Status Explanation Resolution
Description check Warning The description is detailed and covers the user impact, implementation, rationale, testing, visual proof, compatibility, and known validation limits. However, it does not provide the required linked i… Add a valid issue reference under “Linked Issue,” such as “Fixes #1234.”
Docstring Coverage Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 12 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 3 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: recognizing missing history before native chat creation.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and covers the user impact, implementation, rationale, testing, visual proof, compatibility, and known validation limits. However, it does not provide the required linked issue; it states that no separate issue exists.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025 brennanb2025 reopened this Oct 15, 2026
@brennanb2025
brennanb2025 force-pushed the brennanb2025/vanished-source-empty-chat branch from b38f989 to 0e25236 Compare October 15, 2026 03:37
@brennanb2025
brennanb2025 force-pushed the brennanb2025/vanished-source-empty-chat branch from 0e25236 to a633e50 Compare October 15, 2026 03:44
@brennanb2025
brennanb2025 merged commit e5bdc23 into main Oct 15, 2026
53 of 55 checks passed
@brennanb2025
brennanb2025 deleted the brennanb2025/vanished-source-empty-chat branch October 15, 2026 07:53
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