Skip to content

fix(web): restore started threads when navigating back - #302

Merged
adampeterhiggins merged 1 commit into
mainfrom
ah/restore-new-thread-tab-shortcut
Oct 13, 2026
Merged

adampeterhiggins merged 1 commit into
mainfrom
ah/restore-new-thread-tab-shortcut

Conversation

@adampeterhiggins

Copy link
Copy Markdown
Owner

Starting a draft thread in the background leaves its draft URL in browser history. Once promotion removes the draft record, Back redirects to the index and opens a new composer instead of returning to the thread that started.

Keep a bounded, persisted mapping from completed draft IDs to their actual environment and thread. Visiting an old draft history entry replaces it with the canonical thread route. Draft and composer cleanup still runs; unsent and failed drafts keep their existing behavior.

Validation:

  • Reproduced in an isolated dev browser: Cmd+Enter starts the thread in the background; Cmd+[ returns to the empty new-thread screen before this change and the started thread after it.
  • Verified Back/Forward round trips and normal new-tab navigation. Browser-local keyboard events were used because the preview keyboard tool did not deliver page events.
  • 311 focused tests pass across composerDraftStore, threadRoutes, ChatView.logic, and useHandleNewThread. Includes persisted route destinations, cross-environment promotion, failed sends, and bounded storage.
  • Formatting passes. Targeted lint reports only the existing inline-schema warning in composerDraftStore.ts.
  • Web typecheck reports the existing Promise.withResolvers / ES2023 error in src/terminal/ghostty/surface.test.ts:643; no errors in changed code.

Surface coverage: web and Electron share this route; sidebar Back/Forward and keyboard navigation both use browser history. Mobile uses separate navigation and is unaffected. No provider, RPC, or connection-mode changes. This fixes existing fork behavior, so no fork-differences documentation change is needed.

Before:
Back opens an empty new-thread composer
Before recording

After:
Back opens the started thread
After recording

Model: gpt-6.1-sol. Harness: Codex in T3 Code.

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