Skip to content

fix(chat-sdk-bridge): record the acting user on resolved approval cards#2735

Merged
gavrielc merged 1 commit into
mainfrom
fix/approval-card-actor-byline
Jun 11, 2026
Merged

fix(chat-sdk-bridge): record the acting user on resolved approval cards#2735
gavrielc merged 1 commit into
mainfrom
fix/approval-card-actor-byline

Conversation

@gavrielc

Copy link
Copy Markdown
Collaborator

Type of Change

  • Feature skill - adds a channel or integration (source code changes + SKILL.md)
  • Utility skill - adds a standalone tool (code files in .claude/skills/<name>/, no source changes)
  • Operational/container skill - adds a workflow or agent skill (SKILL.md only, no source changes)
  • Fix - bug fix or security fix to source code
  • Simplification - reduces or simplifies source code
  • Documentation - docs, README, or CONTRIBUTING changes only

Strictly speaking this is a small UX/audit improvement rather than a bug fix — nothing crashes without it — but Fix is the closest category for a 4-line source change to the card-edit path.

Description

What: When a button on an approval/question card is clicked, the Chat SDK bridge edits the card down to the title and selected answer (chat.onAction in src/channels/chat-sdk-bridge.ts) — but drops who clicked it. This appends an actor byline to the edited card: <answer> — <userName>, falling back to fullName, omitted entirely when the actor has no resolvable name.

Why: In shared channels, every member sees the same resolved card. Once the buttons disappear, the audit trail of which user approved or rejected is lost — there is no record in the channel of who acted.

How: Two lines before the editMessage call derive the byline from event.user, and the edited markdown becomes ${title}\n\n${selectedLabel}${byLine}. The shared chat.onAction handler covers every Chat SDK webhook platform in one place. The Discord Gateway interaction path keeps its own card-edit code and is intentionally left unchanged.

Tested: New guard test src/channels/chat-sdk-bridge-byline.test.ts drives the real onAction handler through real Chat SDK dispatch (chat.processAction) with the webhook server mocked: asserts the byline with userName, the fullName fallback, and the no-name omission — and goes red if the byline concatenation is removed. Full validation: pnpm test (352 passed), pnpm run build, pnpm run typecheck, pnpm run lint (baseline: 114 problems / 13 errors), container bun test (100/101 — the single failure is the pre-existing poll-loop — /upload-trace test, which makes a live network call and times out; unrelated to this host-side change).

🤖 Generated with Claude Code

When a button on an approval/question card is clicked, the bridge edits
the card down to the title and the selected answer — but not who clicked
it. In shared channels every member sees the same resolved card, so the
audit trail of which user approved or rejected is lost the moment the
buttons disappear.

Append an actor byline (" — <userName>", falling back to fullName) to
the edited card markdown. The shared chat.onAction handler covers every
Chat SDK webhook platform; cards edited for actors with no resolvable
name stay byline-free.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gavrielc gavrielc requested a review from gabi-simons as a code owner June 11, 2026 10:54
@github-actions github-actions Bot added follows-guidelines PR was created using the current contributing template PR: Fix Bug fix labels Jun 11, 2026
@gavrielc gavrielc merged commit 1c85fd6 into main Jun 11, 2026
2 checks passed
@gavrielc gavrielc deleted the fix/approval-card-actor-byline branch June 11, 2026 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

follows-guidelines PR was created using the current contributing template PR: Fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant