Skip to content

fix(web): keep the typed prompt when a draft changes repo - #6393

Merged
t3dotgg merged 3 commits into
mainfrom
carry-draft-prompt-on-repo-change
Aug 12, 2026
Merged

fix(web): keep the typed prompt when a draft changes repo#6393
t3dotgg merged 3 commits into
mainfrom
carry-draft-prompt-on-repo-change

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Aug 12, 2026

Copy link
Copy Markdown
Member

Reported by dominicroy0: start writing a prompt, notice you are in the wrong repo, switch repos in the draft hero — and your text is gone. The switch minted a fresh empty draft and the typed prompt stayed behind on the old project.

Now the prompt and image attachments move with you to the new project's draft. Session-bound extras (terminal/element contexts, preview annotations, review comments) stay on the source draft because they reference the old thread's sessions; if nothing else remains there, the old draft empties out and drops its sidebar row.

Only the draft repo picker opts into the carry (carryComposerContent). Explicit new-thread surfaces (button, hotkeys, palette, sidebar) keep their mint-fresh behavior.

Store tests cover the move, placeholder stripping, and that blob preview URLs are not revoked.


Written by Claude Fable 5 via Claude Code.


Note

Low Risk
Localized draft/composer state changes with guards against clobbering invested destination drafts; no auth, API, or persistence schema changes.

Overview
Fixes losing composer text when switching projects from the draft hero: prompt and image attachments now move to the new project's draft instead of staying on the old one.

Adds moveComposerPromptAndImages on the composer draft store to transfer prompt + images between draft targets without revoking blob preview URLs. Session-bound extras (terminal/element contexts, preview annotations, review comments) stay on the source; inline terminal placeholders are stripped from the moved text and re-applied for the destination's contexts.

useHandleNewThread gains optional carryComposerContent: when set and the user is on a draft route, it moves content after the destination draft is resolved (including async paths), and skips the move if the destination already has user content. Only DraftHeroHeadline's project picker passes this flag; other new-thread entry points stay mint-fresh.

Store tests cover the move, placeholder handling, same-target no-op, and non-revocation of preview URLs.

Reviewed by Cursor Bugbot for commit 41e3f33. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Keep typed prompt and images when changing a draft's repo in the chat composer

  • When a user changes the selected project on a draft via the project picker, the current prompt text and image attachments are moved to the new draft instead of being discarded.
  • Adds moveComposerPromptAndImages to composerDraftStore, which re-anchors inline terminal context placeholders for the destination and clears the source without revoking image preview URLs.
  • Extends useHandleNewThread in useHandleNewThread.ts with a carryComposerContent option that triggers the move after the destination draft is resolved, skipping it if the destination already has user content.

Macroscope summarized 41e3f33.

Picking a different repo in the draft hero used to land you in a fresh
empty draft; the text you had typed stayed behind on the old project.
Now the prompt and image attachments move with you. Session-bound
extras (terminal/element contexts, annotations, review comments) stay
on the source draft since they reference the old thread's sessions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 17c0733b-0173-4948-a02a-f6e95104b67d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Aug 12, 2026
Comment thread apps/web/src/hooks/useHandleNewThread.ts
Text typed during the env-mode await was left behind when the draft
was empty at click time. Review finding from macroscope.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread apps/web/src/hooks/useHandleNewThread.ts
Guards a racing repo change from overwriting a prompt an earlier
carry already moved in. Review finding from macroscope.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 11.3 KiB 11.3 KiB −2 B (−0.0%) 15.1 KiB
Codex Thread snapshot wire 5.5 KiB 5.5 KiB 0 B (0.0%) 7.3 KiB
Codex Live turn WebSocket wire 5.9 KiB 5.9 KiB −2 B (−0.0%) 7.8 KiB
Codex Live turn WebSocket decoded 49.7 KiB 49.7 KiB 0 B (0.0%) 66.4 KiB
Codex Live turn messages 16 16 0 (0.0%) 21
Claude Total thread wire 11.4 KiB 11.3 KiB −36 B (−0.3%) 15.1 KiB
Claude Thread snapshot wire 5.5 KiB 5.5 KiB +6 B (+0.1%) 7.3 KiB
Claude Live turn WebSocket wire 5.9 KiB 5.8 KiB −42 B (−0.7%) 7.8 KiB
Claude Live turn WebSocket decoded 50.6 KiB 50.6 KiB 0 B (0.0%) 66.4 KiB
Claude Live turn messages 16 16 0 (0.0%) 21

Baseline: ac1264e · PR result: 41e3f33 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 94.6 KiB
  • Claude decoded thread snapshot: 95.4 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@macroscopeapp

macroscopeapp Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved 41e3f33

Self-contained UX fix that keeps typed prompt content when a draft changes repo. Well-tested with appropriate guards against edge cases, and limited in scope to draft-to-draft content movement.

You can customize Macroscope's approvability policy. Learn more.

@t3dotgg
t3dotgg merged commit 1e59b4c into main Aug 12, 2026
18 checks passed
@t3dotgg
t3dotgg deleted the carry-draft-prompt-on-repo-change branch August 12, 2026 23:26
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Aug 13, 2026
## What's Changed
* fix(web): cmd+click sidebar PR numbers open in the browser by @t3dotgg in pingdotgg/t3code#6378
* feat(web): project favicon and workspace icons in command subtitles by @gsimone in pingdotgg/t3code#6330
* web/settings: fix source control scan on relay environments by @dominic-r in pingdotgg/t3code#6230
* fix(web): make reset zoom hover visible by @t3-code[bot] in pingdotgg/t3code#6385
* fix(web): keep the typed prompt when a draft changes repo by @t3dotgg in pingdotgg/t3code#6393

## New Contributors
* @gsimone made their first contribution in pingdotgg/t3code#6330
* @dominic-r made their first contribution in pingdotgg/t3code#6230

**Full Changelog**: pingdotgg/t3code@v0.0.34-nightly.20260812.1079...v0.0.34-nightly.20260813.1081

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.34-nightly.20260813.1081
0veek pushed a commit to 0veek/Ronin that referenced this pull request Aug 13, 2026
…6393)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
(cherry picked from commit 1e59b4c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant