← Back to Pull requests

fix(slack): cut long tag values in a gate's context line so the gate still posts #1240

Closed
unknown closed this pull request without merging on Oct 13, 2026 20:48 UTC
View on GitHub
unknown unknown commented on Oct 13, 2026 17:43 UTC
Author

What a person gets: a workflow gate parked on a person always reaches Slack, even when its row carries a very long workflow:, instance: or step: tag.

The cause


  • #1143, by @akushonkamen, added one context line to a human-seat gate's message: "Workflow <workflow> · instance <instance> · step <step>". It tells two parked instances of the same workflow apart.

  • The line is built from the row's own tags, with no length limit.

  • The message's complete fallback text has a budget (SLACK_TEXT_CAP, enforced by bounded(), which refuses rather than cuts). So a hand-made gate row with a very long tag made the whole message refuse before it reached Slack. Before #1143, the same row posted.

  • Tags written by the workflow projector (a spec id and a ULID) are short, so ordinary gates were never affected.
  • The change


    buildGateContextLine (packages/daemon/src/domain/gateway/slack/message.ts):
  • redacts each tag value, as before;

  • shortens a value longer than GATE_CONTEXT_VALUE_CAP (80) characters to its first 32 and last 33 characters around …, then the first 12 hex characters of the SHA-256 of the whole redacted value. Labels that differ at the start or end stay visibly distinct. For labels that differ only in the cut middle, the digest makes a collision unlikely but doesn't rule it out. A value of 80 or fewer characters, such as a ULID instance, is shown whole.

  • counts by code point, and treats the [redacted-secret] marker as one unit, so no surrogate pair is split and the marker is shown whole or left out, never cut;

  • only then escapes the line for Slack, so no &lt;-style escape is split.
  • buildOutboundMessage: the line is supplementary. When it alone would push the complete fallback past SLACK_TEXT_CAP (a near-limit summary with long escaped tags), instance <value> alone is tried, and the line is left out of both the fallback text and the blocks only when even that doesn't fit. The gate still posts.

    Tests


    slack-message.test.ts:
  • Long tags: a 5,000-character workflow, a 2,000-< instance and a 200-emoji step build. Each shows 32 characters, …, its last 33 and a 12-hex digest, with whole &lt; escapes and whole emoji. The fallback text and the context block carry the same line, within SLACK_TEXT_CAP.

  • Two instances: two instance labels of 79 p plus -A or -B render distinctly (…pp-A #… vs …pp-B #…). Two 85-character labels that differ only in the middle, whose digests share their first 6 characters, render distinctly through the 12-hex digest. A ULID instance is shown whole.

  • The redaction marker: a secret at 41 positions in a long instance value never leaves part of the marker, and the token itself never shows.

  • Near the budget:

  • - a 2,990-character summary with long & tags shows only the instance part;
    - with a long Evidence line as well, it leaves the line out;
    - an ordinary summary keeps the whole line.
  • The existing gate and message tests: unchanged.
  • Refs #1013

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01WfCu2MmcrSGRNX9Rjv1h6u

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    Summary by CodeRabbit

    Improvements
    Slack gate context redacts secrets and shortens long workflow, instance, and step values while preserving missing-value behavior. Shortened values retain excerpts and a digest to distinguish labels that might otherwise look alike, and redaction markers remain intact.
    * When full context exceeds the fallback message budget, the message retains instance-only context if it fits; otherwise, context is omitted. Existing fallback limits still apply.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 471 lines (+353 / -118) across 5 files Reviewer: mvschwarz Review duration: 185m
    All Vouch review confidence checks passed
    Residual risk 0.18 = Change Risk (0.46) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.46 · 471 lines diff across 5 files
    0.46
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    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.368
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1240"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% 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: 45.7% (MEDIUM) · Higher = larger blast radius
    45.7%
    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: 60.5% · Lower = rushed or shallow review
    60.5%
    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: 18.1% · Safe to merge
    18.1%