Skip to content

feat(slack): parity phase 4 — usage display, queue notices, tracer#15

Merged
0xmrpeter merged 4 commits into
mainfrom
feat/parity-phase-4
May 25, 2026
Merged

feat(slack): parity phase 4 — usage display, queue notices, tracer#15
0xmrpeter merged 4 commits into
mainfrom
feat/parity-phase-4

Conversation

@0xmrpeter

Copy link
Copy Markdown
Contributor

Summary

Closes 3 more parity gaps from the May 25 audit. Bumps to `2026.525.4`.

Gaps closed

# Gap Severity How
6 No in-thread usage display Major Edit-in-place usage line per session showing tokens · ctx · cost
7 (partial) No `PROMPT_WAITING` / `MESSAGE_PROCESSING` UX Major Passive notice on queue, deleted via `chat.delete` when processing starts
18 No debug tracer hook Minor `getTracer(sessionId)` → `agentInstance.debugTracer` + 8 trace points

Out of scope (genuinely heavy)

  • Assistant integration (Critical) — needs spec/brainstorm; would need AssistantManager API exposed + dedicated channel UX
  • Pinned control card with interactive bypass/TTS buttons (Major) — needs Block Kit design + button wiring
  • `registerEditableFields` — public SDK doesn't expose this method; needs SDK change
  • `tryCommandDispatch` reply callback (Minor) — needs CommandRegistry API change

Test plan

  • `pnpm build` clean
  • `pnpm test` — 120 pass / 1 skipped (was 117 before this PR — +3 formatTokens tests)
  • Independent sonnet review — 0 blockers, 2 non-blocking notes both addressed in final commit
  • Manual smoke: trigger a multi-tool prompt, verify the usage line appears once and updates in place
  • Manual smoke: send 2 messages back-to-back to a session with a long-running prompt, verify the queue notice appears and disappears

🤖 Generated with Claude Code

0xmrpeter and others added 4 commits May 25, 2026 15:38
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>
@0xmrpeter 0xmrpeter merged commit 5a22295 into main May 25, 2026
6 checks passed
@0xmrpeter 0xmrpeter deleted the feat/parity-phase-4 branch May 25, 2026 08:47
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