Skip to content

feat(chat): fork with earlier or later messages from the message menu - #21961

Merged
bolichen97 merged 1 commit into
kirodotdev:mainfrom
neilieva:feat/18611-fork-direction-menu
Oct 19, 2026
Merged

bolichen97 merged 1 commit into
kirodotdev:mainfrom
neilieva:feat/18611-fork-direction-menu

Conversation

@neilieva

@neilieva neilieva commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let a user who keeps Tail-only Fork on take a full-history fork from the message menu at the moment they fork, without flipping the global setting first.

"Fork conversation from here" follows one global setting, Tail-only Fork (tail_fork_enabled). Off, the fork copies the transcript up to the chosen message. On, it keeps only the messages after that point. The setting applies to every session at once, so a user who wants both kinds of fork has to open Settings before each one, and a toggle left in the wrong position silently changes what the next fork produces.

This continues #19963 by @javenciu, which was closed unmerged with three open review items. The commit carries their work with a Co-authored-by trailer.

Why it matters

People who split long threads with tail forks also want ordinary forks that keep the history. Today that costs a trip to Settings per fork, and forgetting the trip gives them the wrong fork with no warning.

Not a goal

  • Changing the server's fork contract or chat_fork.py.
  • Changing the menu when Tail-only Fork is off.
  • A per-session or per-fork default for the setting.

What changed (motivation → approach → change)

With Tail-only Fork on, the message menu offers both forks side by side. Each entry has a short line naming what the new chat holds, so the choice is made at the moment of forking. useChatPageSlotSwitches.ts sends an explicit head for the second entry and lets the setting decide for the plain one, and ChatPage.tsx passes the choice to the transcript.

Entry (setting on) Sends Its line
Fork with later messages only tail Leaves out this message. Only the ones after it go to a new chat. This chat is not changed.
Fork with earlier messages head Starts a new chat with this message and the ones before it. This chat is not changed.

On the newest message the later-messages entry is held and its line reads "No messages after this one yet.", because the server refuses an empty tail with no_messages_after_fork_point. transcriptRendering.tsx passes a stable forkHasLaterMessages check that reads the live list of user and assistant rows, the same roles the server counts. The menu asks it when it opens and again on select, and AssistantMessage.tsx uses it, so an older reply re-enables once a newer message arrives even though settled turns do not re-render. If the server still refuses, utils/forkFailure.ts shows the same words, and its too-large advice names the menu entry that copies fewer messages. While a fork runs, the chosen entry reads "Forking…" and the other entry's line reads "Another fork is starting." While both entries show, the menu is capped to the viewport so their lines wrap on a phone. The new strings are in all 13 catalogs under website/src/i18n with translator context, and history.md documents the second entry.

Backwards compatibility

Compatible: with Tail-only Fork off the menu is unchanged, and the server already accepts an explicit direction="head".

Removes nothing: the change only adds a menu entry, its hint lines and a client-side hold.

Tests

  • AssistantMessage.test.tsx: the two entries, their order, labels, icons and hints; head from the second entry and the plain call from the first; the newest-message hold; the hold re-reading on menu open; a held entry staying inert while its menu stays open; a select refused when the live check changes; busy labels and hints for each entry; the menu unchanged with the setting off.
  • ChatPageMoreCoverage.test.tsx: the page offers the choice only while the setting is on, sends head from the second entry whatever the setting says, and hands rows a check that flips once a message is appended after an older reply, with the same function identity.
  • forkFailure.test.ts: no_messages_after_fork_point reads like the held entry, other codes keep the server's text, and the too-large advice names the control it is given.
  • ChatPageMoreCoverage.test.tsx (too-large refusal): with the setting on, the advice names "Fork with earlier messages" for a head fork and "Fork with later messages only" for a tail fork; with it off, it names "Fork conversation from here".

Determinism: the new tests are synchronous component and store assertions with no timers or network. I ran the touched suites repeatedly and in the full related frontend set (489 files, 13057 tests) with no failures.

Manual verification

website/scripts/capture-18611-fork-menu.mjs drives website/capture/fork-menu.html in Chromium with hit-tested clicks: 93 checks pass, covering setting on (dark and light) and off, the newest reply, a fork in flight from each entry, the empty-tail and too-large refusal banners fed through the real utils/forkFailure.ts, and 320 / 390 / 760 px widths with no entry wrapping when the setting is off.

Screenshots / video

This is a fork PR, so the stills are committed under temp-screenshots/fork-menu/.

Setting on: temp-screenshots/fork-menu/fork-menu-setting-on.png

Setting on

Fork in flight: temp-screenshots/fork-menu/fork-menu-fork-in-flight.png

Fork in flight

Setting on, light theme: temp-screenshots/fork-menu/fork-menu-setting-on-light.png

Setting on, light theme

Fork in flight from Fork with later messages only: temp-screenshots/fork-menu/fork-menu-fork-in-flight-later.png

Fork in flight, later entry

Empty-tail refusal: temp-screenshots/fork-menu/fork-menu-refusal-empty-tail.png

Empty-tail refusal

Too-large refusal, setting on: temp-screenshots/fork-menu/fork-menu-refusal-too-large.png

Too-large refusal

Newest reply: temp-screenshots/fork-menu/fork-menu-newest-reply.png

Newest reply

Setting off, 320 px and 390 px

Setting off
320 px
390 px

Related Issues

Closes #18611

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@neilieva
neilieva requested review from a team and KiroCrewCaptain as code owners October 18, 2026 20:56
@neilieva
neilieva requested a review from bolichen97 October 18, 2026 20:56
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 18, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to ship from my read, pending CI and the review lanes on this head.

Head reviewed: 139fcc7. The review lanes had not run on this head because the fork workflows were waiting for approval. I approved those runs, so I make no claim about their verdicts yet.

What I checked by hand:

  • forkHasLaterMessages compares the window index from visibleIndexMap (user and assistant rows only) with the same map's size. This matches the server's tail split in chat_fork.py, which refuses an empty tail with no_messages_after_fork_point.
  • With Tail-only Fork off, forkDirectionChoice is false, so the menu, labels and the too-large advice are unchanged.
  • The too-large advice now names the entry that was pressed. The head and tail sentences still point at the correct end of the transcript.
  • The server contract is unchanged. The client only adds an explicit direction="head", which the server already accepts.
  • No CI trust path, security path or manifest is touched. The capture page and script follow the existing website/capture/ and website/scripts/capture-* pattern.

🔴 0 must-fix. 🟡 1 should-fix (inline, non-blocking): the new i18n key names do not match their strings.

Comment thread website/src/i18n/locales/en.manual.json Resolved
@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5, fork) — ✅ PASS

Design-level review of 86dc00dbbded32dace89fe7328cc2eed32bb8b2b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Check that forkHasLaterMessages (forkIndex < visibleIndexMap.size - 1) uses the same index space as forkIndex when older history is only partly loaded.

[DESIGN-REVIEWED] 86dc00d

Description read

[DESCRIPTION-READ] 881d640ca93254be2068f376ebad993887c9b7380a0b47461da447a4621544d6

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5, fork) — 🟡 CONCERNS

Premise-level review of 86dc00dbbded32dace89fe7328cc2eed32bb8b2b via the fork AI-review pipeline — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

The new "Forking…" label and "Another fork is starting." line add two strings to all 13 catalogs for a state that spinner-plus-dimming already shows.

Not justified as shipped

  • Item 7 — oversized: on base the only fork entry shows its busy state with a spinner and nothing else. In this diff both entries are already aria-disabled and drawn at opacity-50, and the chosen entry's icon becomes the spinner. On top of that, fork_in_progress replaces the chosen entry's label and fork_other_in_progress replaces the other entry's hint. Neither has a harm that is named or reported.
    Subtraction: delete fork_in_progress and fork_other_in_progress (13 catalogs plus en.context.json), along with their branches in plainForkHint and the label and hint ternaries in AssistantMessage.tsx. Keep the spinner and dimming, as the single-entry menu already does.
    Clears when: both strings are removed, or choose tail-only or full-history when forking, instead of one global setting #18611 or a user report shows people misreading a held entry when it shows only the spinner and dimming.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a Tail-only Fork user choose a full-history fork at the moment they fork, without a trip to Settings. ADDITION.

  1. With the setting on, the menu adds "Fork with earlier messages" — justified
  2. With the setting on, the plain entry is relabelled "Fork with later messages only" — justified
  3. A hint line under each entry — justified
  4. On the newest message the later-messages entry is held, with a reason — justified
  5. The empty-tail refusal now reads in the held entry's words — justified
  6. The too-large advice names the entry that is on screen — justified
  7. During a fork: "Forking…" label, and the other entry reads "Another fork is starting." — oversized: spinner and dimming already show it
  8. The menu is width-capped and padded while both entries show — justified
  9. Capture harness, script and screenshots — justified
  10. history.md documents the second entry — justified

[FIRST-PRINCIPLES-REVIEWED] 86dc00d

Description read

[DESCRIPTION-READ] 3c21a5ddcb4ace485f49cc914e8c44a072d6c410596082ebdcd5b2ae5f212101

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5, fork) — 🟡 CONCERNS

UX-level review of 86dc00dbbded32dace89fe7328cc2eed32bb8b2b via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

UX-Verdict: CONCERNS

Every fork state has a still, but no first-time reader has seen them, so nobody has checked that users can tell "earlier" from "later only".

Watch

  • The two fork entries look nearly identical. Both use the same GitFork icon and differ by one word ("Fork with later messages only" vs "Fork with earlier messages"; attachment-10, attachment-09). Users have to read the hint lines to pick the right one, every time they fork. A wrong pick is cheap but happens on every fork. Severity: medium (frequent × friction × persistent). Smallest fix: give each entry its own icon.
  • The earlier-messages label promises less than the fork copies. "Fork with earlier messages" sounds like it stops before this message, but its hint says the new chat starts "with this message and the ones before it". Users who skim only the label won't know this message is included. Severity: low. Fix: "Fork up to this message".

Suggestions

  • In fork_earlier_messages_hint and fork_later_messages_only_hint, drop the repeated "This chat is not changed." Forking never changes the current chat, and the sentence adds two lines of muted text to a menu people open every day (attachment-10).
  • Make the fallback banner read on its own: "Fork failed: No messages after this one yet." (attachment-06) sits away from the menu, so "this one" refers to nothing. Use "Fork failed: nothing comes after that message yet."

[UX-REVIEWED] 86dc00d

Description read

[DESCRIPTION-READ] a3417b83ae6acd2f343d18ca0c8ecbf38707e5326c50b14627b4ef26e84b4b65

That sha256 names everything this verdict read: the PR description, plus the 13 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review (fork) — ✅ no blocking findings

Reviewed 86dc00dbbded32dace89fe7328cc2eed32bb8b2b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 86dc00d

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review (fork) — ✅ no blocking findings

Reviewed 86dc00dbbded32dace89fe7328cc2eed32bb8b2b via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 86dc00d

@neilieva
neilieva force-pushed the feat/18611-fork-direction-menu branch from 139fcc7 to 6b6b714 Compare October 18, 2026 21:22
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 18, 2026
@neilieva

Copy link
Copy Markdown
Contributor Author
  • Item 6: the forkFailure.ts fallback rides along

rebutted: the hold cannot see two cases the server still refuses with no_messages_after_fork_point.
Before the ['dashboardConfig'] query resolves, forkDirectionChoice is false, so no hold renders, yet handleFork reads the config and can send tail.
A row the client shows before the server saves it counts as a later message on the client only.
Without the fallback both cases show the raw server text. The fallback reuses the held entry's own string, so it adds no new copy.

@neilieva

Copy link
Copy Markdown
Contributor Author
  • Item 8: the menu cap applies when the setting is off

fixed in 6b6b714: collisionPadding and the max-w cap now apply only while both fork entries show (forkWithHistory). With Tail-only Fork off the menu content is back to main's min-w-[210px], matching "Not a goal".

@neilieva

Copy link
Copy Markdown
Contributor Author
  • The labels only make sense with their hints

rebutted: each hint sits inside its own menu item and is that item's aria-describedby, so no reader, sighted or not, meets a label without it.
The labels name the side of the transcript the new chat keeps, and "only" marks the narrower one. Saying whether the clicked message is included is the hint's job. Putting it in the label would make both entries too long to fit at 320 px.

@neilieva

Copy link
Copy Markdown
Contributor Author
  • The too-large error points only one way

rebutted: the advice keeps the direction the user just chose. A user who pressed "Fork with earlier messages" wants the history side, so it says to pick a message nearer the start with that same entry.
Offering the other entry would change what kind of fork they get, not just its size. Which side to keep is the user's call, and both entries are in the menu they just used.

@neilieva

Copy link
Copy Markdown
Contributor Author
  • Rows that keep Fork as their own row button

rebutted: those rows are unchanged from main. forkItemsInMenu is forkIndex === undefined || !!forkMessageId, so a row with a resolvable index but no message id keeps the row button, labelled "Fork conversation from here", and handleFork sends the direction the setting picks, as on main.
The two-entry choice needs a message id the server can resolve, which only menu rows have. Widening it to row buttons is outside this PR's goal.

@neilieva

Copy link
Copy Markdown
Contributor Author
  • forkHasLaterMessages counts the same rows the server counts

verified: visibleIndexMap counts role user and assistant rows only, the same filter as visible in chat_fork.py. Streaming rows are role streaming, so neither side counts them.
The client holds only the loaded window, but that window always ends at the newest row, so "no row after this index" agrees with visible[at_index + 1 :] being empty.
The one gap is a row the client shows before the server saves it. There the click goes through and the server refusal shows the held entry's own words.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 18, 2026
@neilieva
neilieva force-pushed the feat/18611-fork-direction-menu branch from 6b6b714 to 87c4d10 Compare October 18, 2026 23:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 19, 2026
With Tail-only Fork on, the message menu lists "Fork with later messages only" and "Fork with earlier messages", each with a line naming what the new chat holds, so a full-history fork no longer needs the global setting flipped first. On the newest message the later-messages entry is held, because a tail fork there has nothing to copy and the server refuses it with `no_messages_after_fork_point`. The hold is read when the menu opens and again on select, so an older reply re-enables once a newer message arrives, and a refusal that still reaches the server reads "No messages after this one yet." While a fork runs, the chosen entry reads "Forking…" and the other entry says another fork is starting. With the setting off the menu is unchanged.

Closes kirodotdev#18611

Co-authored-by: Javen Cinocca <129346815+javenciu@users.noreply.github.com>
@neilieva
neilieva force-pushed the feat/18611-fork-direction-menu branch from 87c4d10 to 86dc00d Compare October 19, 2026 02:50
@neilieva

Copy link
Copy Markdown
Contributor Author
  • Inconsistent scope between the two entries

fixed in 86dc00d: the hint under "Fork with later messages only" now opens with "Leaves out this message.", then "Only the ones after it go to a new chat. This chat is not changed."
The same reordering is applied in all 12 translated catalogs, en-XA is regenerated, and the translator note in en.context.json says the clause comes first.
fork-menu-setting-on.png and fork-menu-setting-on-light.png show the new line.

@neilieva

Copy link
Copy Markdown
Contributor Author
  • No light-theme stills

fixed in 86dc00d: temp-screenshots/fork-menu/fork-menu-setting-on-light.png shows the setting-on menu in the light theme, with both hint lines.
The capture script asserts the light theme is active before it takes the shot.

@neilieva

Copy link
Copy Markdown
Contributor Author

The three UX evidence gaps are closed in 86dc00d. Each still is asserted by website/scripts/capture-18611-fork-menu.mjs (93 checks pass) and is in the description:

  • Plain entry in flight: fork-menu-fork-in-flight-later.png, the menu reopened after choosing "Fork with later messages only".
  • Empty-tail refusal: fork-menu-refusal-empty-tail.png, the banner reads "Fork failed: No messages after this one yet."
  • Too-large refusal: fork-menu-refusal-too-large.png, with the setting on, the advice names "Fork with earlier messages".

Both refusal stills go through the real showTranscriptForkFailure and ErrorNotice, not hand-written strings.

The workflows on the new head need maintainer approval. The red Backend Tests (3.12, 2) shard on the old head was the tree-scan timeout tracked in #22004, which this frontend-only diff doesn't touch. If it times out again on the new head, could a maintainer rerun just the failed jobs once? I can't rerun jobs here.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 19, 2026

@bolichen97 bolichen97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving on head 86dc00d. Checked: readiness passed with the PR Readiness check green, no failing or pending checks, no blocking reviewer lane, mergeable against main, linked issue is tier T2, and no file on the security path denylist. Thanks for the change.

@bolichen97
bolichen97 merged commit 54aec11 into kirodotdev:main Oct 19, 2026
219 of 226 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

choose tail-only or full-history when forking, instead of one global setting

2 participants