Repository navigation
feat: add "Fork from here" to start a thread from any message - #120
Merged
abhishekgahlot2 merged 3 commits intoNov 22, 2026
Merged
Conversation
Contributor
Author
|
@abhishekgahlot please review this PR and kindly go through the demo link where I've tested the behavior after the change. |
Contributor
|
recheck |
|
All contributors have signed the CLA ✍️ ✅ |
Contributor
Author
|
@abhishekgahlot2 Can you please review this PR too |
|
Thanks @Asymtode712, merged. Fork from here is live on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #90
What
"Fork from here" on any settled answer opens the new-thread composer with the
conversation up to and including that turn, on the same repositories, branches,
engine and model. The new thread's first message links back to the original.
The original thread is never written to.
How
components/chat/thread-fork.ts: cuts the turns at the chosen run and buildsthe context with the existing
formatThreadMarkdown. The draft ridessessionStorage to
/agent/new?fork=<runId>(too large for a URL).components/chat/fork-prompt.ts: the first prompt is a small header, thehistory (prefixed with its length so it parses exactly), then the person's
request. Oldest history is trimmed to fit the backend prompt limits.
cleanPromptstrips the wrapper, so the bubble and titles show only the request.conversation.tsx: fork button beside Copy, plus a "Forked after turn N ofthe original thread" link above a forked thread's first message.
new-task-composer.tsx: reads the draft, preselects repos/branches/model,shows a removable "Forked from" chip and sends the wrapped prompt.
No backend changes: the fork is an ordinary root run via
POST /api/runs.Testing
components/chat/thread-fork.test.ts: cut at the chosen message (laterturns excluded), compose/parse round trip, fork of a fork, size trimming.
bun run typecheck,bun run lint,bun run test(frontend). The onefailing test,
terminal-surface.test.ts, fails on main too.Demo
https://drive.google.com/file/d/1GqelkEjmuRO9Q9dbhRQhzgaNqa197GCV/view?usp=sharing
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.