5.5 KiB
5.5 KiB
id, title, status, wave, depends_on, plan, requirements, acceptance_criteria, system_design
| id | title | status | wave | depends_on | plan | requirements | acceptance_criteria | system_design | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 03-project-comments-across-task-sessions | Project comments across task sessions | completed | 3 |
|
plan.md |
|
|
|
Task 03: Project comments across task sessions
Summary
Replace session-filtered plan drafts with one task-plan snapshot in the web application. Render it on every Plan and composer, submit references to the selected session, and route plan-comment Run to the primary.
In scope
- Task-keyed plan-comment API, state, WebSocket snapshot reconciliation, and hooks.
- Shared Plan highlights/badges and a non-removable composer context item in every session.
- Awaited Add/edit/delete behavior with localized inline pending and failure states in the desktop Popover and mobile Drawer.
- Selected-session Send and primary-session Run request construction.
- Removal of client-side plan-comment prompt formatting and hidden-context duplication while preserving every other comment source.
Out of scope
- Legacy session-storage migration, owned by Task 04.
- Browser E2E, owned by Task 05.
- Visual redesign of Plan or composer surfaces.
Acceptance
- Changing selected or primary session never changes the task comment snapshot; every mounted Plan/composer updates from the same revisioned source.
- Send supplies the displayed refs to its selected session, Run supplies only the clicked ref to the primary, and failures preserve editor/composer state.
- Desktop and mobile use the same state/actions, keep current overlay geometry and touch behavior, and expose a visible reason when Run has no eligible primary.
Verification
cd apps && pnpm --filter @kandev/web test -- lib/ws/handlers/task-plan-comments.test.ts hooks/domains/comments/use-plan-comments.test.tsx hooks/domains/comments/use-pending-comments.test.ts hooks/domains/comments/use-run-comment.test.ts components/task/task-plan-panel.session-switch.test.tsx components/task/task-plan-panel-draft.test.ts components/task/chat/chat-input-area.test.tsx components/task/passthrough-chat-composer.test.ts
cd apps/web && pnpm run typecheck && pnpm run i18n:check && pnpm run i18n:ratchet
Files likely touched
apps/web/lib/types/backend.tsapps/web/lib/types/http-agents.tsapps/web/lib/api/domains/plan-comment-api.tsapps/web/lib/ws/router.tsapps/web/lib/ws/handlers/task-plan-comments.tsapps/web/lib/state/slices/session/types.tsapps/web/lib/state/slices/session/session-slice.tsapps/web/lib/state/slices/comments/types.tsapps/web/lib/state/slices/comments/comments-store.tsapps/web/hooks/domains/comments/use-plan-comments.tsapps/web/hooks/domains/comments/use-pending-comments.tsapps/web/hooks/domains/comments/use-run-comment.tsapps/web/components/task/task-plan-panel.tsxapps/web/components/task/plan-selection-popover.tsxapps/web/components/task/chat/use-chat-panel-state.tsapps/web/components/task/chat/chat-context-items.tsapps/web/components/task/chat/chat-input-area.tsxapps/web/hooks/use-message-handler.tsapps/web/components/task/passthrough-chat-composer.tsxapps/web/src/locales/*/task.json
Dependencies
Tasks 01 and 02.
Risks
- Several session panels can be mounted at once; effects must not issue duplicate loads or overwrite a newer task snapshot.
- The shared context chip cannot retain its current remove callback because that would become an unlabeled global delete.
- Removing
PlanCommentfrom the local union must not change persistence or send behavior for agent-message and review comments.
Parallelism
sequential
Inputs
- Requirements:
REQ-TASKS-PLAN-COMMENTS-001through003. - System design: frontend projection, composer delivery, Run routing, responsive behavior, and failure recovery.
- Existing task-plan state, Tiptap projection tags, shared composer context
items, and
useRunCommenttests.
Results
- Added a task-keyed, revision-guarded plan-comment snapshot with API and WebSocket reconciliation shared by every mounted session surface.
- Plan annotations and every composer now project the same non-removable context; ordinary Send submits all displayed references to the selected session, while Run submits only its comment to the current primary.
- Added awaited desktop Popover and mobile Drawer mutations, localized error states, reconnect refresh, and admission-conflict reconciliation.
- TypeScript, ESLint, i18n checks, and the focused frontend test suite pass.
- Deferred-response tests cover newer live primary changes, including an uncached primary and change-back races. Initial-prompt tests cover rejected delivery followed by remount, retained manual drafts, and session switching.
- These recovery fixes change shared state only. Desktop and mobile keep the existing layout, touch behavior, and composer controls.