feat(coding): add conversation archive and first-message titles

This commit is contained in:
2026-09-20 12:43:51 +08:00
parent d61226532a
commit fd0293fe3d
22 changed files with 698 additions and 69 deletions

View File

@@ -0,0 +1,48 @@
# Task: Implement coding conversation archive and naming
## Identity
- Task ID: 20260920-coding-session-controls-10fee632
- Mode: Feature
- Branch: codex/20260920-coding-session-controls-10fee632-coding-session-controls
- Worktree: D:\Datas\OthersProjects\.codex-worktrees\makelore\20260920-coding-session-controls-10fee632
- Base commit: d61226532a5946af4a0b12b4eb02ce9059d20ddb
- Owner: codex
- Status: Ready for Integration
## Scope
- Implement the approved coding conversation archive/restore, shared rename UI, and first-user-message titles in MakeLore. Own conversation metadata/service/event transport, related Renderer state/UI, focused tests, and README guidance.
## Intent And Constraints
- Concurrent Task Gate and Planning Gate passed. Official start/status matched this task, feature branch, isolated worktree and base. Read entry, active task, memory index, positioning/current-state, decisions (Pi ADR-006 and official model capabilities), architecture/domain/success criteria, evidence/commitment context and all peer task scope/intent/promotion sections. Template-only peer records remain unknown; no concrete conflicting dependency affects this isolated change. Positioning is still a template; executable code, README and accepted ADRs establish the actual boundaries.
- Follow the user-approved design in server task 20260920-ai-session-management-23c282e7 (commit 81fc375f). Main owns .makelore/conversations.json; no Pi title double-write, no automatic historical renaming, no interrupted jobs on archive, no provider secret exposure, and no changes to canonical project memory. No subagents.
- User amended automatic naming during implementation: use the first user message directly, consistent with their requested Codex behavior. This supersedes the earlier model-generated-title proposal. The final implementation uses the first nonempty user message's first line, normalized whitespace and at most 32 characters; image-only uses 附件对话. No model request or changes to Pi execution code.
- Plan: extend serialized metadata operations and one-shot Main naming lifecycle; wire metadata invalidation and archive guards; implement list menus/archive view/shared rename dialog; verify focused persistence/service/UI regressions, type checking, lint/build and supported Electron fixtures; record evidence and durable handoff.
## Outcome
- Implemented row menus and a per-Agent archived view with archive/restore, preserved running/unread indicators, and a shared 200-character rename dialog (keyboard submit/cancel, selected input, pending/error state). Menu actions do not select or prepare their target. Archiving the last recent conversation leaves an empty state instead of creating a replacement.
- Archive only changes metadata. Existing work/approvals/abort remain available; archived conversations show a restore action in place of the composer. Main rejects new prompt/steer/follow-up and fork requests while allowing retrieval of an already accepted request.
- Automatic titles use the first actual complete user message, first line, whitespace normalization and 32-character bound; image-only messages use 附件对话. A Main lifetime subscription works without a Renderer stream; hydration can recover an unassigned first title. Serialized storage applies at most once and rechecks ownership, so manual titles and deleted conversations cannot be overwritten or resurrected. Historical records default to manual; fork titles are manual. Title-only changes do not move the conversation.
- Added internal titleMode/autoTitleSet fields in schema-v2 metadata without a migration or Pi title double-write. Public responses omit these internal fields. Metadata invalidation uses the existing SSE connection without fake runtime cursors. List-only refresh coalesces events, follows changes arriving during reads, refreshes on reconnect, and discards stale results across metadata mutations/project loads.
- README describes the final behavior. No runtime provider, model-call, dependency, server, or canonical project-memory changes. Independent worktrees and unrelated original-worktree changes remain untouched.
## Verification
- pnpm install --frozen-lockfile --offline: passed using pnpm 10.33.4; lockfile unchanged.
- Focused Vitest: 114/114 passed across coding-projects-schema-v2, coding-conversation-title, coding-core-routes, coding-workspace-store, coding-chat-panel, coding-conversations-store, and pi-managed-user-entry-fork-real. The last test launches the real pinned Pi 0.84.2 runtime against local persisted history, verifies first-message naming and independent manual fork metadata; no real Provider account was used.
- coding-chat-pressure.test.tsx: 1/1 passed separately with one worker.
- Electron Playwright: conversation menus rename/archive/restore test passed (1/1), including non-selected rename, archived composer replacement, restore selection and no abort request. Test screenshot inspected at test-results/coding-session-controls.png (ignored generated output). This is a Host-fixture UI test, not a live Provider turn.
- pnpm run typecheck: passed. pnpm run lint:check: passed with 0 errors and 8 existing warnings. pnpm run build:vite: passed for Renderer/Main/preload/utility targets. git diff --check: passed.
- Explicit Main tsc remains non-passing due repository baseline diagnostics. Compared current and recorded-base sources using the TypeScript compiler API and an in-memory Git-blob overlay (same dependencies/options): 89 baseline diagnostics, 88 current, no added diagnostics. The removed diagnostic is the SSE union cursor access corrected while adding metadata events. No unrelated type repair was attempted.
- Initial checks caught two refresh tests blocked by waiting on an old project's metadata write and an ambiguous test button query; fixed the project-switch wait and scoped the UI assertion. The recorded focused suite subsequently passed.
## Follow-ups
- Ready for review/integration from this isolated feature branch; no merge, push, package or deployment performed. Existing Main type diagnostics remain repository follow-up work outside this feature.
## Promotion Candidates
- Targets: architecture data-flow/module-map and domain business-rules. Proposal: local conversation metadata owns archive and title state, Main names only new automatic conversations from the first user message, manual and historical titles are stable, and metadata invalidation is separate from runtime sequenced patches. Evidence: focused persistence/service/Renderer tests, real Pi history hydration and Electron interaction fixture above. Future impact: prevents reintroducing model-based title generation or treating archive as runtime disposal. No conflict with accepted Pi ownership; the user's explicit first-message amendment supersedes the earlier design proposal's model-generated title. No additional human product decision required; canonical promotion still requires the Integration Gate.