← Back to Pull requests

feat(inbox): show a slack card inside its channel #199

Open
unknown opened this pull request with 371 lines diff across 4 files
View on GitHub
unknown unknown commented on Nov 06, 2026 03:37 UTC
Author

What changed and why

A Slack card showed the one message it was about, alone in a tall empty card. It now reads like the channel it came from (plan 074):

1. A channel post or thread (<channel>:<ts>): the channel's 5 messages before the thread, the thread with its replies indented under its first message, and the 5 messages after it.
2. A DM: its latest messages, the same way.
3. Drawn with the chat's own Slack-style rows: a face and name on the first of a run, day pills, @channel/@here/@everyone marked, "n replies" on a message with its own thread, and Slack's red New line before the first unread message. The card opens on that line, else on its own message.

New reader: mod/slack-view.ts (slackChannelView), used only for the card (OutsideThreads cardView). New optional OutsideMessage fields: avatar, in_thread, unread, replies, more_after, so an older paired Mac still draws its cards.

Decisions for review

1. Messages after the thread: Slack's conversations.history gives the newest first, so the read pages back at most 3 pages of 100 to reach the 5 right after. Past that it shows none and says "more messages in the channel since" rather than messages from long after.
2. Cost: opening a card takes 4 to 6 Slack calls instead of 1, only on open; a rate limit is waited out as before. People are remembered per account across reads.
3. Unread: replies use the thread's last_read (on the first message from conversations.replies), falling back to the channel's from conversations.info; the person's own messages are never unread.
4. A hand-off still sends the thread alone; email cards keep their mail rows; the phone keeps its rows and gets the extra messages.
5. The card's day pill is not sticky, so it never sits over a message.

Tests

  • test/slack-view.test.ts: the before/thread/after window, paging a busy channel and giving up past three pages, people asked once per account, own messages never unread, runs/day pills/New line, @channel marking and the reply indent.

  • test/outside-threads.test.ts: a Slack card prefers the channel view and passes the new fields through; mail does not.
  • Checked by hand

    Rendered with made-up messages (a throwaway preview page, removed), dark and light:

    !Slack card in its channel, dark
    !Slack DM card, light

    Not checked against a real workspace: the thread last_read and Slack's paging order come from Slack's docs and a fake built to them.

    Checks

    npm run format:check && npm run lint && npm run typecheck && npm test && npm run test:node && npm run build:app && npm run build:mod && npm run smoke, all passing.

    🤖 Generated with Claude Code

    Diff: 371 lines (+278 / -93) across 4 files Reviewer: github-actions[bot] Review duration: 4m
    All Vouch review confidence checks passed
    Residual risk 0.31 = Change Risk (0.43) × (1 − Review Confidence (0.27)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 371 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 52% · Reviewer familiarity: 35%
    26%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #199"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 26.6% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 26.6% · Lower = rushed or shallow review
    26.6%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 31.4% · Safe to merge
    31.4%