Repository navigation
Description
Context
A new plan is saved automatically while the user types in Planner Studio (/studio/new). useAutoDraftCreation waits for a 1-second pause, then calls createDraft(repo, prompt). The backend stores the plan name from the prompt as it was at that moment. Users often pause after the first word, so the saved name is something like Add or Fix.
The name is already partly corrected on the server. usePromptPersistence (in setupWizardHooks.ts) later calls updateDraft(draftId, { initial_prompt, name: truncateToSentences(prompt) }). The UI still shows the stale title for three reasons:
- The in-place draft object is never refreshed.
PlanStudioPagestores the created draft ininPlaceDraftthroughhandleDraftCreatedInPlaceand computesactiveDraft = inPlaceDraft || draft. The document/tab title comes fromgetDocumentTitle(activeDraft).inPlaceDraftis only set once, at creation, so the title stays at the first word even after the server has a better name. - Prompt saves give no feedback.
usePromptPersistencewrites the new name to the server but tells nobody, so no component can update its local copy. - Display code uses
draft.namedirectly. Other places (PlanEditor.getPlanName,ApprovedPlanView,PlansListIteminPlansPageComponents.tsx,PlanStudioPage.getTaskTitle) renderdraft.name || draft.initial_prompt. If a stale prompt-derived name reaches them before the next prompt save lands (for example, the user reloads within the debounce window), they show the one-word title even thoughinitial_promptholds the full text.
The LLM-generated title is set server-side (for example, the epic/plan title generated with the summarization model during finalization). It must always win over anything derived from the prompt. Today it does win once the draft is refetched. The inPlaceDraft || draft ordering, however, can keep showing the stale in-place copy.
Requirements
- Create a single display-name helper,
getDraftDisplayName(draft, fallback), and use it everywhere a plan title is shown.- If
namelooks like it was derived from an earlier, shorter version of the current prompt, show a title derived from the current prompt using the existingtruncateToSentences. - A name counts as stale-derived when the current prompt starts with it (ignoring a trailing
...) and the name is shorter than the title the current prompt would produce. - Any other name (LLM-generated or user-provided) is shown unchanged.
- With no name, fall back to the prompt-derived title, then to the fallback text.
- If
- Add an optional
onPersistedcallback tousePromptPersistence. After each successful save, including flushes before generation, call it with{ draftId, initial_prompt, name }. - Add an optional
onDraftMetadataPersistedprop toSetupWizardand pass it tousePromptPersistencethroughuseSetupWizardLoaders. - In
PlanStudioPage:- Store the latest persisted metadata in a
metadataOverridestate and use it only for the page title, and only while the draft is still in setup (draft/failedstatus). - Do not merge the override into the
draftprop passed toSetupWizard. Changingdraft.initial_promptthere resetsuseDebouncedDraftPersistence, which cancels a pending debounced save and could lose the user's latest keystrokes. - Prefer the refetched
draftfromuseDraftover the one-timeinPlaceDraftsnapshot when computing the title, so an LLM-generated name shows up as soon as it is fetched. - Reset the override on navigation (
location.key), as is already done forinPlaceDraft.
- Store the latest persisted metadata in a
- Replace direct
draft.name || draft.initial_promptusage withgetDraftDisplayNameinPlanEditor.tsx,ApprovedPlanView.tsx,PlansPageComponents.tsxandPlanStudioPage.tsx(getTaskTitle,getDocumentTitle). - Make no backend or API changes. The server already stores the corrected name on every prompt save and the LLM title on finalization; only the UI is stale.
Implementation Specification
- New file
propr-ui/src/components/TaskPlanner/planDisplayName.ts: exportisStalePromptDerivedNameandgetDraftDisplayName. It importstruncateToSentencesfrom./setupWizardPromptso the displayed title matches exactly what the server will store. - New test
propr-ui/src/components/TaskPlanner/planDisplayName.test.ts. setupWizardHooks.ts:- Export a
PromptPersistedUpdateinterface. - Add a fifth optional parameter
onPersistedtousePromptPersistence, stored in a ref so changing callbacks do not recreateenqueuePromptSave. - Call it after
updateDraftresolves inside the save queue.
- Export a
SetupWizard.tsx:- Add the
onDraftMetadataPersistedprop. - Add a third parameter to
useSetupWizardLoadersand forward it tousePromptPersistence.
- Add the
PlanStudioPage.tsx:- Add the override state, the handler and the
applyMetadataOverridehelper. - Pass
onDraftMetadataPersistedtoNewDraftViewandDraftView(both renderSetupWizard). - Update the title helpers.
- Add the override state, the handler and the
PlanEditor.tsx,ApprovedPlanView.tsx,PlansPageComponents.tsx: switch togetDraftDisplayName.setupWizardHooks.persistence.test.tsx: add a test provingonPersistedreceives the derived name.
Acceptance Criteria
- Open
/studio/new, typeAdd, wait about 1.5 s so the draft is created, then keep typingAdd dark mode toggle to settings.. Within about 1 s of stopping, the browser tab title changes fromAdd | ProPRtoAdd dark mode toggle to settings. | ProPRwithout a page reload. - Stored name
Addandinitial_promptAdd dark mode toggle to settings.: the Plans list, Plan Editor header and Approved view show the full derived title. - A name that is not a prefix of the prompt (LLM-generated such as
Dark Mode Settings Toggle, or user-renamed) is always shown unchanged. - After finalization, when the server sets an LLM title, the studio header and tab title show that title once the draft is refetched. The one-time in-place snapshot does not override it.
- Typing continuously never loses characters. The override is not passed into
SetupWizard'sdraftprop, and existing persistence tests still pass. -
npm test -w propr-uipasses, including the newplanDisplayName.test.tsand the new persistence test. -
npm run typecheck -w propr-uiandnpm run lint -w propr-ui -- --max-warnings 0pass.
Created by ProPR AI Planner
Activity
propr-dev commentedon Sep 23, 2026
Suggested Implementation:
Implementation Approach
The server already holds the right data. Every debounced prompt save writes
name: truncateToSentences(prompt), and finalization writes an LLM-generated title. The bug is purely client-side: the UI keeps a one-time snapshot of the draft (inPlaceDraft) and rendersdraft.namedirectly. The fix has two parts:usePromptPersistencereports each successful save through an optional callback.PlanStudioPagestores that metadata in a title-only override, so the tab title updates as soon as the save lands.getDraftDisplayNamehelper recognises a name that was frozen from an earlier, shorter prompt and shows the current prompt's title instead. It never overrides a name that is not a prompt prefix, so LLM or user titles always win.Alternatives considered:
useDraftinto a loading state, which unmounts the wizard (PlanStudioPagerendersLoadingViewwhile loading).SetupWizard'sdraftprop. Rejected.useDebouncedDraftPersistenceclears the pending debounce timer wheneverdraft.initial_promptchanges, which would drop the user's latest keystrokes.Trade-off: a user-chosen name that is exactly a prefix of the prompt would be displayed as the longer prompt-derived title. There is no rename UI today and LLM titles are never literal prompt prefixes, so this edge case is acceptable.
File:
propr-ui/src/components/TaskPlanner/planDisplayName.ts(new file)Why this file: One source of truth for how a plan title is displayed, so the studio, editor, approved view and Plans list cannot disagree. It reuses
truncateToSentencesso the displayed fallback is byte-identical to what the next prompt save will persist, which avoids a visible title change when the server catches up.File:
propr-ui/src/components/TaskPlanner/planDisplayName.test.ts(new file)Why this file: Locks down the two properties that matter: first-word names get replaced, and LLM/user titles are never replaced.
File:
propr-ui/src/components/TaskPlanner/setupWizardHooks.tsWhy this file:
usePromptPersistenceis the only place that knows when the corrected name reached the server. Exposing a callback lets the page update its title without refetching. The callback is kept in a ref so passing a new inline function on each render does not changeenqueuePromptSave's identity. That would re-run the debounce effect and cancel pending saves.File:
propr-ui/src/components/TaskPlanner/SetupWizard.tsxWhy this file:
SetupWizardowns theusePromptPersistencecall (throughuseSetupWizardLoaders) and is rendered byPlanStudioPagefor both new and existing drafts. It forwards the callback upward and has no title logic of its own.File:
propr-ui/src/pages/PlanStudioPage.tsxWhy this file: This page produces the tab title and holds the stale
inPlaceDraftsnapshot. It receives the persisted metadata and applies it only to the title. It must never apply it to thedraftprop passed toSetupWizard, because that would reset the prompt debounce. It also prefers the refetcheddraft, so a server-side LLM title wins over the creation snapshot.Note:
activeDraftstays as it is because other code in the component may read it. Only the title now usestitleDraft. Thedraftprop given toSetupWizard(inPlaceDraft/draft) is left unchanged on purpose, for the reason explained in the comment.File:
propr-ui/src/components/TaskPlanner/PlanEditor.tsxWhy this file: The review-stage header shows
planName. Using the shared helper keeps it consistent with the tab title.File:
propr-ui/src/components/TaskPlanner/ApprovedPlanView.tsxWhy this file: The execution-stage header. After finalization it should show the LLM title, or a correct prompt-derived fallback.
File:
propr-ui/src/pages/PlansPageComponents.tsxWhy this file: The Plans list re-fetches on status changes. It should still never render a stale one-word name when
initial_promptalready holds the full text.File:
propr-ui/src/components/TaskPlanner/setupWizardHooks.persistence.test.tsxWhy this file: Proves the new callback fires with the persisted name. This covers the exact in-place flow: the draft is created from
Add, then the prompt grows.Verification Steps
npm run typecheck -w propr-ui,npm run lint -w propr-ui -- --max-warnings 0andnpm test -w propr-ui./studio/new, typeAdd, and pause 2 s.propr-dev commentedon Sep 23, 2026
🤖 AI processing has started for this issue using claude agent with claude-opus-5 model.
I'll analyze the problem and work on a solution. This may take a few minutes.
Processing Details:
claudeclaude-opus-52476/claude-opus-5-keep-a-new-plan-s-title-i-20260923-1155-xkumainissue-2476-20260923-1155-claude-opus-5-xku🔍 Track Task Execution
Implementation complete. Summary of what I did for issue #2476: