Skip to content

[2476 by Claude Opus 5] Keep a new plan's title in sync with its prompt and LLM-generated name instead of freezing the first word - #2481

Merged
integry merged 1 commit into
mainfrom
2476/claude-opus-5-keep-a-new-plan-s-title-i-20260923-1155-xku
Sep 23, 2026
Merged

integry merged 1 commit into
mainfrom
2476/claude-opus-5-keep-a-new-plan-s-title-i-20260923-1155-xku

Conversation

@propr-dev

@propr-dev propr-dev Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

AI Implementation Summary

Closes #2476

Branch: 2476/claude-opus-5-keep-a-new-plan-s-title-i-20260923-1155-xku
Commits: ✅ Changes committed (4c64063)


AI Processing Completed

Execution Details:

Summary:
Implementation complete. Summary of what I did for issue #2476:

New propr-ui/src/components/TaskPlanner/planDisplayName.ts

  • isStalePromptDerivedName(name, prompt) — true when the prompt starts with the name (trailing ... ignored) and the name is shorter than the title the current prompt would produce.
  • getDraftDisplayName(draft, fallback) — refreshes stale prompt-derived names via truncateToSentences (so the UI matches exactly what the server stores), shows LLM-generated and user-provided names unchanged, and falls back prompt-title → fallback text.

setupWizardHooks.ts — exported PromptPersistedUpdate, added an optional fifth onPersisted parameter to usePromptPersistence held in a ref (so an inline callback doesn't recreate enqueuePromptSave), fired after updateDraft resolves inside the save queue — which covers debounced saves and pre-generation flushes alike.

SetupWizard.tsx — new onDraftMetadataPersisted prop, forwarded through a third parameter of useSetupWizardLoaders into usePromptPersistence.

PlanStudioPage.tsx — added metadataOverride state + applyMetadataOverride, used only for the page title and only while the draft is in draft/failed status; it is deliberately not merged into the draft prop given to SetupWizard (that would reset useDebouncedDraftPersistence and drop keystrokes). The title now prefers the refetched draft over the one-time inPlaceDraft snapshot, and the override resets on location.key. getTaskTitle/getDocumentTitle use the helper.

PlanEditor.tsx, ApprovedPlanView.tsx, PlansPageComponents.tsx — switched from draft.name || draft.initial_prompt to getDraftDisplayName. No backend/API changes.

Tests: new planDisplayName.test.ts (12 cases) and two new cases in setupWizardHooks.persistence.test.tsx covering onPersisted on debounced save and on flush.

Two notes worth flagging:

  • npm test -w propr-ui passes in full (158 files, 1242 tests), as do typecheck and lint --max-warnings 0. Getting lint green required compacting a few lines in SetupWizard.tsx and setupWizardHooks.ts — both files sat exactly at the 400-line max-lines cap, and my additions pushed them over. I compacted in the dense one-line style those files already use (e.g. the SetupWizardLoadersParams interface, savePromptDirectly), changing no behavior.
  • I verified the acceptance criteria I could exercise without a running backend (helper behavior, persistence callback, title-computation wiring, no character loss in existing persistence tests). The live end-to-end tab-title check on /studio/new I did not run, since it needs the API and database stack.

For preview evidence I rendered the real PlansListItem against a temporary Vite harness and captured before/after screenshots with Playwright, then removed the harness. The before shot shows the frozen Add / Fix titles; the after shot shows the full derived titles with the LLM name and user rename untouched. The browser tab title change is not capturable in a screenshot, so it is not represented in the previews.

Detailed Logs:

  • Conversation: 115 messages
  • Session: 056875cc-a76b-491a-b1a3-c76915f0cefb

Log files stored at:

  • conversation: /tmp/claude-logs/issue-2476-2026-09-23T12-07-13-037Z-conversation.json
  • output: /tmp/claude-logs/issue-2476-2026-09-23T12-07-13-037Z-output.txt
Latest Conversation Messages
ASSISTANT: [content unavailable]

ASSISTANT: Implementation complete. Summary of what I did for issue #2476:

**New `propr-ui/src/components/TaskPlanner/planDisplayName.ts`**
- `isStalePromptDerivedName(name, prompt)` — true when the prompt star...


This PR was created automatically by ProPR after processing issue #2476.


💡 Need changes?

Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!


Visual preview

Plans list before

Plans list before

Plans list rendered by the real PlansListItem component before the fix. The first two plans, whose stored name was captured from the first word the user typed, show the frozen titles "Add" and "Fix".

Original unavailable: managed storage is unavailable or the upload has expired.

Plans list after

Plans list after

Same component and same data after the fix. Stale prompt-derived names are refreshed from the current prompt ("Add dark mode toggle to settings.", "Fix the flaky planner autosave test on CI."), while the LLM-generated name "Dark Mode Settings Toggle" and the user rename "Settings polish" are shown u

Original unavailable: managed storage is unavailable or the upload has expired.

New `propr-ui/src/components/TaskPlanner/planDisplayName.ts`
- `isStalePromptDerivedName(name, prompt)` — true when the prompt starts with the name (trailing `...` ignored) and the name is shorter than the title the current prompt would produce.
- `getDraftDisplayName(draft, fallback)` — refreshes stale prompt-derived names via `truncateToSentences` (so the UI matches exactly what the server stores), shows LLM-generated and user-provided names unchanged, and falls back prompt-title → fallback text.

`setupWizardHooks.ts` — exported `PromptPersistedUpdate`, added an optional fifth `onPersisted` parameter to `usePromptPersistence` held in a ref (so an inline callback doesn't recreate `enqueuePromptSave`), fired after `updateDraft` resolves inside the save queue — which covers debounced saves and pre-generation flushes alike.

`SetupWizard.tsx` — new `onDraftMetadataPersisted` prop, forwarded through a third parameter of `useSetupWizardLoaders` into `usePromptPersistence`.

`PlanStudioPage.tsx` — added `metadataOverride` state + `applyMetadataOverride`, used only for the page title and only while the draft is in `draft`/`failed` status; it is deliberately not merged into the `draft` prop given to `SetupWizard` (that would reset `useDebouncedDraftPersistence` and drop keystrokes). The title now prefers the refetched `draft` over the one-time `inPlaceDraft` snapshot, and the override resets on `location.key`. `getTaskTitle`/`getDocumentTitle` use the helper.

`PlanEditor.tsx`, `ApprovedPlanView.tsx`, `PlansPageComponents.tsx` — switched from `draft.name || draft.initial_prompt` to `getDraftDisplayName`. No backend/API changes.

Tests: new `planDisplayName.test.ts` (12 cases) and two new cases in `setupWizardHooks.persistence.test.tsx` covering `onPersisted` on debounced save and on flush.

Two notes worth flagging:
- `npm test -w propr-ui` passes in full (158 files, 1242 tests), as do `typecheck` and `lint --max-warnings 0`. Getting lint green required compacting a few lines in `SetupWizard.tsx` and `setupWizardHooks.ts` — both files sat exactly at the 400-line `max-lines` cap, and my additions pushed them over. I compacted in the dense one-line style those files already use (e.g. the `SetupWizardLoadersParams` interface, `savePromptDirectly`), changing no behavior.
- I verified the acceptance criteria I could exercise without a running backend (helper behavior, persistence callback, title-computation wiring, no character loss in existing persistence tests). The live end-to-end tab-title check on `/studio/new` I did not run, since it needs the API and database stack.

For preview evidence I rendered the real `PlansListItem` against a temporary Vite harness and captured before/after screenshots with Playwright, then removed the harness. The before shot shows the frozen `Add` / `Fix` titles; the after shot shows the full derived titles with the LLM name and user rename untouched. The browser tab title change is not capturable in a screenshot, so it is not represented in the previews.
@propr-dev

propr-dev Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

/ultrafix
Triggered automatically by Planner execution settings.

@propr-dev propr-dev Bot added the ultrafix label Sep 23, 2026
@propr-dev

propr-dev Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

🔄 Ultrafix loop started (goal: 8/10, max cycles: 10)

First action: /review

💡 Tip: Remove the ultrafix label from this PR to stop further ultrafix cycles.

@propr-dev

propr-dev Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ AI Code Review Complete requested by @propr-ultrafix

Posted 1 review:

View Task Details

@propr-dev

propr-dev Bot commented Sep 23, 2026

Copy link
Copy Markdown
Contributor Author

🔍 AI Code Review — claude:claude-opus-5

Overall Evaluation

This PR fixes the "frozen first word" plan title by (a) introducing a shared getDraftDisplayName helper that detects a name derived from an earlier, shorter version of the prompt and re-derives the title from the current prompt, (b) plumbing an onPersisted callback out of usePromptPersistence so PlanStudioPage learns the name that was actually written to the server, and (c) preferring the refetched draft over the one-time inPlaceDraft snapshot for the document title. The approach is localized, the helper is pure and well tested, and the title-only override is deliberately kept out of the draft passed to SetupWizard so the debounced prompt save is not reset.

I traced the changed paths and found no correctness or safety regression that blocks merge. The staleness heuristic is conservative in the right direction: because the client truncateToSentences (100-char cap) never produces a longer title than the server variant (200-char cap), a legitimate server-written name is never shorter than the client-derived title for the same prompt, so it is not misclassified as stale. The metadataOverride is guarded by both draftId equality and isDraftStatus, and reset on location.key, so it cannot leak across plans.

✅ Pure, well-covered display helper — planDisplayName.ts isolates the heuristic behind two small pure functions, and planDisplayName.test.ts covers the prefix case, the non-prefix (LLM/user name) case, ellipsis stripping, two-sentence truncation, and the empty/null fallbacks.

✅ Deliberate, documented separation of title state from editor state — the comment above applyMetadataOverride in PlanStudioPage.tsx explains precisely why the persisted metadata is not merged into the draft handed to SetupWizard (it would reset the debounced prompt save and drop keystrokes), and the implementation matches that reasoning.

✅ Callback wired through a ref, not a dependency — onPersistedRef in setupWizardHooks.ts keeps enqueuePromptSave stable so an inline consumer callback cannot retrigger the debounce machinery, and the two new hook tests assert the payload for both the debounced and the flushPrompt path.

Status: ready to merge once the pending CI shards complete.

Merge blockers

No merge blockers.

Suggestions

These are optional follow-ups and are not sent to /fix.

S1: 🟢 Duplicate truncation rules diverge

planDisplayName.ts documents that the refreshed title "matches what the server stores on the next save", but the UI truncateToSentences (setupWizardPrompt.ts, 100-char cap) and the server one (packages/core/src/services/planning/sentenceTruncation.ts, 200-char cap) disagree for punctuation-less prompts between 100 and 200 characters. When previewService or taskPlanningService writes the name, the stored value and the value the UI would display differ, producing a brief title flip after a refetch. It is not a blocker because the length comparison in isStalePromptDerivedName errs toward keeping the stored name, but sharing one truncation implementation (or at least one cap constant) would remove a real source of drift.

S2: 🟢 No test for the page-level title glue

The user-visible defect lives in PlanStudioPage.tsx (applyMetadataOverride, titleDraft, and the draft || inPlaceDraft preference), and that wiring is untested — the added tests cover the pure helper and the hook payload only. A component-level test that renders the studio in new mode, fires the debounced save, and asserts the document title moves from Add to the full prompt title would lock in the actual regression, including the isDraftStatus guard. Optional because the individual pieces are covered and the composition is small.

S3: 🟢 getTaskTitle still bypasses the helper for fetched drafts

getTaskTitle in PlanStudioPage.tsx keeps draftAny?.task_title ahead of getDraftDisplayName, and the API sets task_title = draft.name on every GET/PUT response (plannerRoutes.ts:209, :240). So for any server-fetched draft the staleness correction is skipped there, and only the in-place creation response (which has no task_title) benefits. That is not a regression — it is strictly more correct than before — but it undercuts the "single source of truth" claim in the helper's docstring and is worth reconciling.

S4: 🟢 Unrelated line-compaction churn

The diff collapses the isMountedRef effect and savePromptDirectly in setupWizardHooks.ts, plus SetupWizardLoadersParams in SetupWizard.tsx, onto single lines. This appears to be pressure from the max-lines: 400 warning in propr-ui/eslint.config.js, but it mixes readability-reducing reformatting into a behavioral PR and makes future blame harder. Extracting a module instead of compressing lines would be a cleaner way to stay under the limit.

S5: 🟢 Heuristic can override a deliberate short title

isStalePromptDerivedName treats any name that is a prefix of the prompt and shorter than the derived title as stale. If a rename feature is ever added, a user title like "Refactor auth" over the prompt "Refactor auth module. Add tests." would be silently replaced in the UI. A persisted name_source discriminator (prompt vs user vs generated) would make this deterministic instead of heuristic. Optional now because no rename UI exists in the current codebase.

S6: 🟢 Callback ref assigned during render

onPersistedRef.current = onPersisted; in usePromptPersistence mutates a ref in the render body. This is a widely used pattern and is safe in the current synchronous rendering mode, but under concurrent rendering a discarded render can still write the ref. Moving it into a useLayoutEffect, and skipping the callback when isMountedRef.current is false, would make the hook's contract tighter without changing behavior today.

Score

The PR achieves its objective with a small, well-reasoned change set, adds focused unit tests for the new helper and the new hook callback, and I found no PR-introduced correctness or safety regression; the remaining items are duplication, coverage, and style follow-ups. Merge readiness is conditional only on the eight pending CI checks completing.

Score: 8/10


🤖 Review Details

  • Model: Claude Opus 5
  • Time: 3m 22s
  • Tokens: 74,966 (58,297 in / 16,669 out)
  • Cost: $0.78

View Task


💡 Next step: Comment /fix to address F# merge blockers only.
F# IDs increment across review comments and remain permanent, so selectors such as /fix F3 F5 stay unambiguous across cycles. Suggestions require a separate ordinary follow-up request.

🤖 Review by ProPR

@propr-dev propr-dev Bot removed the ultrafix label Sep 23, 2026
@integry
integry merged commit 68cf948 into main Sep 23, 2026
46 checks passed
@integry
integry deleted the 2476/claude-opus-5-keep-a-new-plan-s-title-i-20260923-1155-xku branch September 23, 2026 12:37
propr-dev Bot pushed a commit that referenced this pull request Sep 23, 2026
…CI failures were already resolved by the previous commit.

The dashboard is rebuilt to the Studio guidelines, and the CI failures were already resolved by the previous commit.

## CI failures (comments 1, 2, 3, 5)

Already fixed by `1760d21ec`, the commit after the one CI reported against (`bd9892fa3`). I verified rather than assumed: `apps/desktop/scripts/packaged-acceptance-stats.test.mjs` now passes (6/6), and it still passes after my changes — it greps the dashboard component sources, so it was worth re-running.

## Design regressions (comment 4)

**1. Card Hell — eliminated.** The page is `bg-white` end to end. Every section lost `rounded-xl border shadow-sm`, the `gap-4` between cards is gone, and structure now comes from 1px rules: a `border-b` per section, a full-height `lg:border-r` pane divider, and tinted utility headers. Because grid cells stretch, the horizontal rules in both columns land on the same pixel — the "Horizon Line" from §2A.

**4. Entity tagging — schema enforced.** `WorkReference` no longer emits bare numbers; it's `Issue #118` or `PR #2481`, always. `RepositoryLabel` became a monospace chip too, so `example/workspace` gets the same `font-mono bg-slate-100 border-slate-200 rounded-sm` treatment as an ID.

**6. Semantic colour — corrected.** `merged` was `text-teal-700` while `completed` was slate; both are now `text-slate-600` with a checkmark, so two successful end states can't be told apart by colour. Cancelled dropped orange. Failed stays red. Active work swapped the pulsing dot for a spinner — a filled circle reads as a status light, and a teal one reads green at a glance. The histogram was uniformly `#14B8A6`; settled days are now slate-300 and only the in-progress day is teal.

**7. KPI cards — demolished.** The four boxes are one compact row of label-beside-number pairs, roughly 34px instead of ~120px. Section counts also moved inline into the utility headers as `HAPPENING NOW (6)`.

## Guarding against another relapse

Since the complaint is that this regressed after prior correction, I added `Dashboard.designRules.test.tsx` — 7 tests asserting the rendered chrome (no rounded/shadow sections, no bare `#118`, identical classes for merged and completed, no green in the active section, neutral history bars, no card-shaped counts). I mutation-checked them: reverting the bare-number chip, the teal `merged`, and the card chrome each fails a test. Shared fixtures moved to `Dashboard.fixtures.ts`, which also cleared a pre-existing `max-lines` warning on the test file.

## Verification

1251/1251 UI tests, 4/4 dashboard Playwright specs (including the 320px no-overflow check), typecheck clean, eslint clean with zero warnings on all changed files, desktop acceptance test 6/6.

One judgment call worth flagging: the review asked for either a compact data row *or* counts folded into section headers. I did both — the row keeps the drill-down links that the original PR's acceptance criteria depend on, while the headers carry counts where a section already owns one. If you'd rather drop the row entirely and rely only on headers, that's a small change, but it costs the four filtered-list entry points.

PR: #2486
Comment by: @propr-dev[bot] (ID: 5795997485)
Comment by: @propr-dev[bot] (ID: 5795997900)
Comment by: @propr-dev[bot] (ID: 5796059106)
Comment by: @integry (ID: 5796089352)
Comment by: @propr-dev[bot] (ID: 5796207333)
Comment by: @github-actions[bot] (ID: 5796208101)
Model: claude-opus-5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Keep a new plan's title in sync with its prompt and LLM-generated name instead of freezing the first word

1 participant