Skip to content

Add chat session title persistence (codex) - #2435

Merged
numnx merged 1 commit into
feature/CODUX-151-menu-selects-chat-session-titlefrom
task/feature-codux-151-menu-selects-chat-session-titl-t01-codex-mr9yjcrv
Jul 7, 2026
Merged

Add chat session title persistence (codex)#2435
numnx merged 1 commit into
feature/CODUX-151-menu-selects-chat-session-titlefrom
task/feature-codux-151-menu-selects-chat-session-titl-t01-codex-mr9yjcrv

Conversation

@numnx

@numnx numnx commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

🧩 Task: Add chat session title persistence

Automated task PR opened by Code UX for T01.

📋 Summary

Sprint: Sprint 151 · Menu Selects & Chat Session Title · Task: T01

Add chat session title generation/editing, constrain header selector menus while removing the All Sprints option, and add a Jira importer Hide in Work checkbox with tests and documentation.

📝 Full Task Prompt
## Objective
Add backend support for chat session titles so the first user message creates a concise title, persists it in `session-title.md`, and future chat prompts instruct the assistant to refresh it every 20 invocations.

## Scope
- `src/contracts/connection-chat-types.ts`
- `src/repositories/connection-chat-repository.ts`
- `src/repositories/connection-chat/conversation-query-utils.ts`
- `src/server/conversation-routes.ts`
- `src/server/request-parsers.ts`
- `src/services/chat-thread-runtime-service.ts`
- `src/services/chat-reply-prompt.ts`
- `tests/backend/repositories/connection-chat-repository.test.ts`
- `tests/backend/server/dashboard-chat-api.test.ts`
- `tests/backend/services/chat-thread-runtime-service.test.ts`

## Implementation Requirements
1. Extend `UpdateConversationThreadInput` so a thread title can be patched through `PATCH /api/conversations/threads/:threadId`, validate a non-empty trimmed title, and keep existing connection/runtime-state updates working.
2. Add a title helper for chat sessions that derives a maximum 8-word title from the first dashboard user message, strips markdown/control text, falls back to the existing timestamp title only when the first message has no useful words, and stores that title in `conversation_threads.title`.
3. Persist the generated or manually updated title to a project-local `.code-ux` file named `session-title.md` under a deterministic thread-specific location, creating parent directories as needed and avoiding writes outside the project directory.
4. Update `ChatThreadRuntimeService.postMessage` so newly created chat threads generate and persist the title from the first message, while existing threads keep their current title unless explicitly patched.
5. Update `buildChatReplayPrompt`/chat prompt assembly to include the current thread title and an instruction that `session-title.md` should be updated on the first message and every 20 chat invocations with an 8-word maximum descriptive title.
6. Add backend tests for first-message title generation, max-word truncation, manual title update via the API, file persistence, and unchanged behavior for runtime-state/route updates.

## Constraints
- Do not add a database migration unless a new column is truly required; prefer the existing `conversation_threads.title` field.
- Do not overwrite a user-edited title during later normal message sends.
- Keep hidden/internal messages from driving user-facing title generation.
- Preserve existing realtime thread update events when a title changes.
- Keep path handling cross-platform and prevent path traversal outside the project `.code-ux` directory.

## Verification
- `pnpm run test:backend -- tests/backend/repositories/connection-chat-repository.test.ts tests/backend/server/dashboard-chat-api.test.ts tests/backend/services/chat-thread-runtime-service.test.ts`
- `pnpm run lint`
- Success means new threads receive an 8-word-or-less title, title patches update DB and `session-title.md`, and existing chat route/runtime tests still pass.

✅ QA Review

⏳ QA review runs after this PR is opened. Check the task card in the dashboard for the outcome once it lands.

🤖 Model & Provider

Provider Codex CLI
Model gpt-5.5

⏱️ Timing

Started 2026-07-07 01:15:37 UTC
Finished 2026-07-07 01:22:24 UTC
Duration 6m 47s

📊 Token Usage

Metric Value
Input tokens 125,987
Cached input tokens 2,586,752
Output tokens 13,394
Total tokens 2,726,133
Invocations 1
Tool calls 65
Active time 6m 17s

Included usage estimate (subscription/local login): $2.33

🌿 Branch Info

Base: feature/CODUX-151-menu-selects-chat-session-title
Head: task/feature-codux-151-menu-selects-chat-session-titl-t01-codex-mr9yjcrv


🤖 Generated by Code UX

@numnx
numnx merged commit d1234b5 into feature/CODUX-151-menu-selects-chat-session-title Jul 7, 2026
6 checks passed
@numnx
numnx deleted the task/feature-codux-151-menu-selects-chat-session-titl-t01-codex-mr9yjcrv branch July 7, 2026 01:24
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.

1 participant