feat(slack): parity phase 4 — usage display, queue notices, tracer#15
Merged
Conversation
After each usage event from the agent, post (or edit) a single 'usage line' in the session channel showing tokens, ctx size, and cost. Matches Telegram's formatUsage pattern but adapted for Slack: we track _lastUsageTs per session and use chat.update for subsequent events. Includes: - Self-heal: if chat.update fails (user deleted the message), clear cached ts so next call posts a fresh line. - Cleanup in deleteSessionThread for _lastUsageTs and _waitingNoticeTs (the latter reserved for P4.2). - Inline formatTokens helper (1.2k/3.4M) — plugin-sdk doesn't re-export it. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When a prompt is queued behind an active one, post a brief notice '📋 Message queued (#N in line)'. When the queued prompt starts processing (message:processing event), delete the notice via chat.delete. Telegram's version has interactive buttons (process now / clear / cancel / flush); without that UX in Slack, the passive post + delete pattern at least surfaces the queue state to users. Adds chat.delete to SlackMethod whitelist (Tier 3, 50rpm). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add getTracer(sessionId) → session.agentInstance.debugTracer that logs per-event traces at 6 key dispatch points: thread:create, thread:delete, dispatch:enter, dispatch:dropped, handle:text, handle:toolCall, handle:sessionEnd, permission:send. When users enable agent debug mode, Slack-side dispatch is now visible in the per-session trace alongside agent events — matching Telegram's getTracer pattern at adapter.ts:1352. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…26.525.4 Addresses 2 non-blocking notes from Phase 4 review: - Replace 'as any' cast on queueDepth with a precise structural cast. - Export formatTokens and add 3 boundary tests (< 1000, k range, M range). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes 3 more parity gaps from the May 25 audit. Bumps to `2026.525.4`.
Gaps closed
Out of scope (genuinely heavy)
Test plan
🤖 Generated with Claude Code