Skip to content

fix(chat): share a slot's Auto-title state across panes - #25601

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/title-control-slot-generating-10502
Oct 29, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/title-control-slot-generating-10502

Conversation

@CrysisDeu

@CrysisDeu CrysisDeu commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: the session title control's Auto-title behaves as one control per slot, however many panes show that slot.

Follow-ups from the review of #10140 (shared SessionTitleControl in split-pane headers):

  1. generatingSlots lives in component state. With one slot open in two panes, the if (generating) return guard does not hold across panes: pressing Auto-title in the second pane fires a second api.generateTitle for the same slot (two LLM calls, last writer wins), and only the pressed pane shows the spinner.
  2. In a narrow split pane the hover-revealed "Regenerate title" label runs into the pane's own split and close buttons.

Why it matters

Item 1 spends two model calls for one press and lets the slower one overwrite the faster. Item 2 makes the pane's own controls hard to read and hit.

Not a goal

  • The issue's (hover: none) item: it is already on main ([@media(hover:none)]:opacity-70 on the Auto-title button, website/src/pages/chat/SessionTitleControl.tsx:476), so nothing changes there.
  • Server-side title conflict handling (Session title writes are last-writer-wins: generate-title can overwrite a concurrent manual rename #10149).
  • The issue's "rename shows the server's truncated title" item: it cannot happen. The editor already caps the draft at the server's 200 characters (maxLength={TITLE_MAX_LENGTH}, SessionTitleControl.tsx:70-76, commented "the client cap is never looser than the server's"), and the server only does .strip()[:200] (chat_title.py:1937), so a confirmed rename is already the server's title.

Intended? / Repro

Intended? No. The code comment above generatingSlots says the spinner "must follow the slot that is generating", and the Design Review on a36553478 asked for this.

Repro (on current main):

  • website/src/pages/chat/SessionTitleControl.tsx:120: const [generatingSlots, setGeneratingSlots] = useState<Set<string>>(new Set()), per instance.
  • Capture harness below, run against a main build: one slot in both panes of a split, press Auto-title in each → 2 generate-title POSTs. On this branch → 1.
  • 4:1 side-by-side split at 1440px, hover the narrow pane: the label overlaps the pane buttons (screenshot "before").

What changed (motivation → approach → change)

  • Shared generating state. The header's Auto-title button now claims the slot through claimSlotTitleGeneration in website/src/hooks/slotTitleGeneration.ts, the per-slot in-flight set the sidebar row and phone menu "Regenerate title" already use, and reads the spinner through useSlotTitleGenerating. One slot open in two panes, or in a pane and a menu, starts one generation, and every control showing the slot shows the spinner. The header keeps its own .then for Undo.
  • Narrow pane. ChatPane's title row is a named size container (@container/panehead). In compact mode, below 20rem of that row the Pen and the Auto-title button hide (@max-[20rem]/panehead:hidden), so the title keeps the space and stays readable. Tapping the title still opens the rename editor; Auto-title is offered in a wider pane. Hiding only the label left a title cut to one letter beside two bare glyphs. Tailwind 4 has container queries built in, so no plugin is added.
  • website/scripts/capture-pane-title-shared-generating.mjs: the capture harness behind the screenshots.

Screenshots

Real SPA builds (main and this branch) against stubbed /api (Playwright, capture-pane-title-shared-generating.mjs).

Same slot in both panes, Auto-title pressed in each, generate POST held. Before (main): both panes spin because both buttons were pressed, and the harness counted 2 generate POSTs.

Before: same slot in two panes, two generate requests

After: the second press is a no-op, both panes spin, 1 generate POST.

After: same slot in two panes, one generate request, both spinning

Narrow pane, hovered. Before: the "Regenerate title" label overlaps the pane's buttons.

Before: narrow pane label overlapping pane buttons

After: the Pen and the Auto-title button hide, and the title stays readable.

After: narrow pane keeps a readable title, no cramped controls

Backwards compatibility

Compatible. Wide panes and the main header look as before.

Removes nothing: no key, field or error path is removed.

Tests

website/src/test/SessionTitleControl.test.tsx:

  • one slot open in two panes generates once, and both panes show the spinner: fails on main (the second pane keeps its button).

Proof: not provable -- other: this host runs no local tests; CI runs them

Manual verification

Capture harness run against both builds (screenshots above); with EXPECT_FIXED=1 it asserts 2 spinners and 1 POST, and that the narrow pane shows neither the label nor the button. Static gates run locally: eslint, tsc --noEmit.

Related Issues

Fixes #10502

Sibling sweep

Swept: git grep -n "generateTitle|setGeneratingSlots" -- website/src
Sibling: website/src/pages/chat/SessionTitleControl.tsx -- changed here (the shared control both hosts use)
Sibling: website/src/hooks/slotTitleGeneration.ts -- changed here (the menus' per-slot store the header now claims through)
Sibling: website/src/pages/chat/page/MobileTopBar.tsx -- not affected (already starts generations through the shared per-slot store)

Pattern harvest

Not generalizable: the header's per-instance flag moves onto the per-slot store its menu siblings already share.

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

Contributed under the project's Apache-2.0 license.

@CrysisDeu
CrysisDeu requested review from a team and KiroCrewCaptain as code owners October 29, 2026 02:58
@CrysisDeu
CrysisDeu requested a review from mbriones98 October 29, 2026 02:58
@CrysisDeu
CrysisDeu force-pushed the fix/title-control-slot-generating-10502 branch from 9038a97 to c22462b Compare October 29, 2026 03:06
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 29, 2026
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of b1879428910ece180cfb767add096d8525545fb5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing blocks: the blind reader took both panes' spinners as one naming job. The narrow-pane fix is shown, and nothing else on screen changes.

Notes

  • Shot 4 ("after", narrow pane) titles the right pane "Pipe…", while the left pane and the sessions list say "Release checklist review" above the same messages. The blind reader concluded "no idea which name is the real one". Re-capture with the same slot in both panes so the shot proves the "title stays readable" claim.
  • Even with the Pen and Auto-title hidden, a 4:1 split cuts the title to four letters ("Pipe…"). That is better than before, but the description's "the title stays readable" overstates it. Show the full title on hover with a title attribute or tooltip on the compact title button.
  • In shots 1 and 2, "Generating title…" sits next to a title that is already filled in, and the reader asked "what 'title' it's making". Showing the old title dimmed while it is replaced would make the spinner read as the title being redone.

[UX-REVIEWED] b187942

Description read

[DESCRIPTION-READ] 98396e806f55791062eba6e7e56e87a11ebf3a9edd7bfea27807e89fbd7ddb2b

That sha256 names everything this verdict read: the PR description, plus the 7 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 29, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of b1879428910ece180cfb767add096d8525545fb5 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The header now uses the existing per-slot store, which fixes the double model call where it starts. The only extra is a screenshot script that nothing imports.

Notes

  • Item 4 — rides along: "website/scripts/capture-pane-title-shared-generating.mjs: the capture harness behind the screenshots." It is the PR's evidence and nothing at runtime depends on it. Four capture-pane-*.mjs siblings already set this convention. Subtraction: drop the script after the screenshots are taken, unless CI or docs run it.

What this change ships

Inventory (5 items) — 4 justified

Intent: pressing Auto-title on a slot open in several panes runs one generation, and every pane shows its spinner. It is a FIX (#10502).

  1. Pressing Auto-title in a second pane showing the same slot no longer sends a second LLM call — justified
  2. Every pane header showing the slot shows the spinner, including when the generation was started from the sidebar or phone menu — justified
  3. In a compact pane narrower than 20rem, the Pen and the Auto-title button are hidden — justified
  4. New dev script that captures the before/after screenshots — rides along
  5. New export claimSlotTitleGeneration, with 2 consumers: generateSlotTitle and SessionTitleControl — justified

[FIRST-PRINCIPLES-REVIEWED] b187942

Description read

[DESCRIPTION-READ] 5d4fa407a57596d9e627274717d04f103ff1f83b19469f0c765e8f02e81ed662

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 29, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of b1879428910ece180cfb767add096d8525545fb5 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] b187942

False positive or not applicable? A repository writer can comment:
/ai-review override gpt b1879428910ece180cfb767add096d8525545fb5 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of b1879428910ece180cfb767add096d8525545fb5 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the header now claims a generation through the per-slot store the menus already use, so there is one generation per slot. The narrow-pane hiding is limited to compact mode and is reversible.

Notes

  • Below 20rem, the narrow pane's header no longer offers Auto-title (@max-[20rem]/panehead:hidden). Calling that "Removes nothing" undersells it: users of that pane must widen it or use the sidebar or menu "Regenerate title" instead.

[DESIGN-REVIEWED] b187942

Description read

[DESCRIPTION-READ] a456a98708482af45c8ae359763d032a2ccb5260bfa99bdc40cfd1b6738f701d

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 29, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed b1879428910ece180cfb767add096d8525545fb5 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] b187942

Verdict parsed from the review's SHA-scoped output markers for commit b1879428910ece180cfb767add096d8525545fb5.

False positive or not applicable? A repository writer can comment:
/ai-review override fable b1879428910ece180cfb767add096d8525545fb5 false-positive: <reason, 20 to 500 characters>

@CrysisDeu
CrysisDeu force-pushed the fix/title-control-slot-generating-10502 branch from c22462b to 13072da Compare October 29, 2026 03:35
@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 29, 2026
@CrysisDeu
CrysisDeu force-pushed the fix/title-control-slot-generating-10502 branch from 13072da to c869c3b Compare October 29, 2026 04:02
With one slot open in two panes, each SessionTitleControl kept its own
generating set, so the second pane's Auto-title press fired a second
generateTitle for the same slot (two LLM calls, last writer wins). The
set now lives at module level, like renameRecovery, read through
useSyncExternalStore, so the press is a no-op and every pane shows the
spinner.

In a split pane narrower than 20rem the Pen and the Auto-title button
hide (the pane's title row is now a size container), so the title stays
readable; tapping it still renames, and Auto-title is offered in wider
panes. The hover-none persistent state the issue asked for is already on
main, and a rename cannot be truncated by the server because the editor
already caps at its 200 characters.

Fixes #10502
@CrysisDeu
CrysisDeu force-pushed the fix/title-control-slot-generating-10502 branch from c869c3b to b187942 Compare October 29, 2026 11:31
@github-actions github-actions Bot added readiness: checking Automated validation is still running 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 29, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) October 29, 2026 13:06

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Tier 1 auto-approve: fix (5 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: the pane header's Auto-title button now uses the shared per-slot generation claim, so two panes on one slot send one request and both show the spinner; a narrow pane hides the button. Tests and a capture script added.

@KiroCrewCaptain
KiroCrewCaptain merged commit 7da05d2 into main Oct 29, 2026
94 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/title-control-slot-generating-10502 branch October 29, 2026 13:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 29, 2026
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.

Session title control: key generating state by slot across panes; regenerate affordance on touch-only panes

2 participants