fix(chat-sdk-bridge): record the acting user on resolved approval cards#2735
Merged
Conversation
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>
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.
Type of Change
.claude/skills/<name>/, no source changes)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.onActioninsrc/channels/chat-sdk-bridge.ts) — but drops who clicked it. This appends an actor byline to the edited card:<answer> — <userName>, falling back tofullName, 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
editMessagecall derive the byline fromevent.user, and the edited markdown becomes${title}\n\n${selectedLabel}${byLine}. The sharedchat.onActionhandler 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.tsdrives the realonActionhandler through real Chat SDK dispatch (chat.processAction) with the webhook server mocked: asserts the byline withuserName, thefullNamefallback, 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), containerbun test(100/101 — the single failure is the pre-existingpoll-loop — /upload-tracetest, which makes a live network call and times out; unrelated to this host-side change).🤖 Generated with Claude Code