opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): fork slash command for keyboard-friendly session forking (resolves #5599)

Open ariane-emory opened this issue 1 month ago • 3 comments

This PR adds a /fork slash command which pops a "Fork from message" modal dialog window resembling the existing timeline dialog window. Upon selection of a message in this window, the session is immediately forked upon that message, as if the user had clicked on the message and selected the fork option.

This command may also be bound to a key using the key command name session_fork if the user chooses to bind it in their opencode.json file (but is not bound to any key by default).

Screenshot 2025-12-16 at 12 25 02 AM

Note: I do think it is slightly awkward that this timeline includes ignored/synthatic messages from plugins in the list (the DCP messages shown in the screenshot), but filtering them out would make it inconsistent with the behaviour of the existing session timeline, and I do prefer consistency. Addressing this by making both of these timeline dialogs exclude these plugin methods is probably outside the scope of this particular PR, and so I'll leave that as something to consider for the future.

Resolves #5599.

ariane-emory avatar Dec 16 '25 05:12 ariane-emory

Work is proceeding, this is coming along well so far. After I get some caffeine and some breakfast in me, I'm going to spend a couple more hours testing it to make sure everything is airtight and tidy before it comes out of draft.

ariane-emory avatar Dec 16 '25 11:12 ariane-emory

LGTM now, let me know if you guys have any thoughts or concerns.

ariane-emory avatar Dec 16 '25 19:12 ariane-emory

@rekram1-node Any concerns here?

ariane-emory avatar Dec 17 '25 21:12 ariane-emory

/review

rekram1-node avatar Dec 18 '25 15:12 rekram1-node

I think we may as well make the timeline not show synthetic or ignored ones and then do that here too like why not right?

rekram1-node avatar Dec 18 '25 15:12 rekram1-node

@rekram1-node Great, will do. Just to filter them from /fork's timeline, or from the standard session_timeline as well? LMK and I'll take care of it presently. :)

ariane-emory avatar Dec 18 '25 15:12 ariane-emory

prolly both?

rekram1-node avatar Dec 18 '25 16:12 rekram1-node

@rekram1-node Done, ignored / synthetic messages are now filtered from both modals.

ariane-emory avatar Dec 18 '25 16:12 ariane-emory

/review

rekram1-node avatar Dec 18 '25 16:12 rekram1-node

lgtm

github-actions[bot] avatar Dec 18 '25 16:12 github-actions[bot]