Skip to content

feat(conv): per-topic reply automation with promotion - #870

Open
kmonsoe wants to merge 2 commits into
feat/oversight-admin-overviewfrom
feat/conv-topic-automation
Open

feat(conv): per-topic reply automation with promotion#870
kmonsoe wants to merge 2 commits into
feat/oversight-admin-overviewfrom
feat/conv-topic-automation

Conversation

@kmonsoe

@kmonsoe kmonsoe commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Stacked on #869 (→ #868#867#866#865). The design's "Automation" screen and promote dialog, with the backend under them.

Backend

  • Migration 0085_conv_topic_automationconv_topics.agent_mode varchar(16) (null = inherit) + auto_promoted_at timestamptz. Idempotent (ADD COLUMN IF NOT EXISTS), journal when strictly above 0084's; smoke-tested against a DB already at 0084 and re-run to prove idempotency.
  • Effective mode — a topic's mode overrides the conversation's everywhere it is read: getConversation (what the runner acts on → promoting a topic flips its conversations to auto-send with no runtime change) and the queue DTO (agentMode resolved + raw topicAgentMode for the nudge line).
  • ConvAutomationService — per-topic 30-day review record (approved-unedited / edited / rejected via the approvedDraft and draft_reply_rejected stamps from feat(conv): review-queue read model, internal notes, draft reject stamps #865, weekly volume, auto-sent) + org-wide 7-day auto-rate; setTopicAgentMode stamps auto_promoted_at on promotion (kept on re-promotion, cleared otherwise) and emits the new conversation.topic_automation_changed catalog event.
  • SurfaceGET /v1/conversations/automation, POST /v1/conversations/topics/:topicId/agent-mode; MCP tools conv_list_topic_automation (read) / conv_set_topic_automation (destructive, pre-checked 404 on unknown topic — no bare 500s); skill promote-topic-to-auto-send documenting the evidence → judgement → promote/demote loop. Docs fixtures + openapi regenerated (218 tools, 51 skills).

Dashboard

  • pages/automation.tsx — header with the big 7-day auto-rate figure; per-topic table (volume/window, approved-unedited % with bar, cobalt at ≥90 %); actions per state: Auto-send on + one-click Back to manual, Promote to auto when the ≥90 % gate holds, or the hold note (needs ≥90% unedited / always human for off topics).
  • Promote dialog — Review → Auto-send, unedited/edited/rejected percentage grid over the reviewed sample, "stepping back is one click" explanation, Not yet / Promote.
  • Queue rows now read Topic · Auto/Review/Human (cobalt when effective mode is auto); Automation joins the Oversight nav group (admin-only). Full en + nb transcreation.

Tests

  • conv-automation.service.test.ts: disposition math incl. 7-day auto-rate, promotion stamp kept on re-promotion / cleared on demotion, event emission ×4, 404 pre-check.
  • conv.service.test.ts: topic mode overrides conversation mode in both detail and queue reads.
  • Tool-naming suite green over the two new tools. backend-core conv+mcp: 66 passed in the touched files; dashboard-pages 96 passed; typecheck clean everywhere (types, backend-core, dashboard-pages, web).

🤖 Generated with Claude Code

https://claude.ai/code/session_01CPwvC1MqF1uhpNqC8BmvQN

conv_topics gains agent_mode + auto_promoted_at (migration 0085); a
topic mode overrides the per-conversation mode in the runner detail,
queue DTO and dashboard. ConvAutomationService aggregates the 30-day
review record per topic and flips modes, emitting
conversation.topic_automation_changed. Control endpoints, MCP tools
(conv_list/set_topic_automation), promote-topic-to-auto-send skill,
and the dashboard Automation screen with readiness gate, promote
dialog and one-click demotion.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPwvC1MqF1uhpNqC8BmvQN
@kmonsoe
kmonsoe force-pushed the feat/conv-topic-automation branch from 129cdb9 to a479990 Compare August 28, 2026 16:35
The block was inserted under dashboard.overview, so the Automation
screen rendered raw message keys.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CPwvC1MqF1uhpNqC8BmvQN
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