Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-authored-by: Carlos Florencio <carlosmflorencio@gmail.com>
3.7 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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 01-publish-compact-session-attention | Publish compact session attention | completed | 1 | plan.md |
|
|
|
Task 01: Publish compact session attention
Summary
Publish per-session pending clarification and permission changes through a compact workspace event. Keep message content session-scoped and merge compact status with the existing revision-aware task-session projection.
In scope
- Add the internal semantic event and public WebSocket action
session.pending_action_changed. - Publish a complete pending-action replacement after authoritative pending projection changes.
- Route the event to the owning workspace and fail closed when workspace identity is unavailable.
- Add frontend action typing, registration, and a handler that reuses
setTaskSessionPendingActionrevision ordering. - Preserve existing workspace-scoped lifecycle/activity updates and session-scoped message delivery.
- Add backend payload/routing and frontend stale-revision tests before production changes.
Out of scope
- Transcript delivery, task-summary schema, persistence migrations, polling, session list redesign, or Threads layout.
Acceptance
- Clarification, permission, and clear transitions publish exact session, task, workspace, value, and revision fields without message content.
- Only authorized clients in the owning workspace receive the compact event.
- The frontend updates loaded or keyed compact session projection and ignores older revisions.
Verification
Start with focused tests that fail because the action and routing do not exist. Then run:
(cd apps/backend && rtk go test ./internal/task/service ./internal/gateway/websocket ./pkg/websocket -run 'PendingAction|TaskEventBroadcaster|SessionPending' -race)
(cd apps && pnpm --filter @kandev/web test -- --run lib/ws/handlers/session-pending-action.test.ts lib/state/slices/session/update-session-read-cursor.test.ts)
Files likely touched
apps/backend/internal/events/types.goapps/backend/internal/task/service/service_events.goapps/backend/internal/gateway/websocket/task_notifications.goapps/backend/internal/gateway/websocket/task_notifications_test.goapps/backend/pkg/websocket/actions.goapps/web/lib/types/backend.tsapps/web/lib/ws/handlers/types.tsapps/web/lib/ws/handlers/index.tsapps/web/lib/ws/handlers/session-pending-action.tsapps/web/lib/ws/handlers/session-pending-action.test.tsapps/web/lib/state/slices/session/task-session-projection-actions.ts
Dependencies
None.
Risks
- Do not route the existing message event to a workspace. Build a separate compact payload.
- Preserve the current epoch and sequence comparison across list, message, and compact-event sources.
Parallelism
sequential
Results
Implemented and verified. The compact workspace event is emitted for pending action replacements, routed only to the owning workspace, and consumed by the revision-aware frontend session projection. Focused backend and frontend checks pass.
The review fix-up retains orphan projections until the session list hydrates, rejects stale successors, and suppresses unchanged pending-action fan-out after message events. The backend race suite passes 33 matching tests.