Skip to content

fix(approvals): persist delivery target on pending_approvals rows#2820

Open
caburi00 wants to merge 1 commit into
nanocoai:mainfrom
caburi00:fix/persist-approval-delivery-target
Open

fix(approvals): persist delivery target on pending_approvals rows#2820
caburi00 wants to merge 1 commit into
nanocoai:mainfrom
caburi00:fix/persist-approval-delivery-target

Conversation

@caburi00

Copy link
Copy Markdown

Problem

requestApproval() creates the pending_approvals row before it picks an approver, and never records where the card was ultimately delivered. So channel_type, platform_id, and platform_message_id stay NULL on every approval row.

Consequences:

  • approvals list (and approval get) can't show the real destination — the columns documented as "Channel the approval card was delivered on" are always empty.
  • There's no record of which chat a given card went to, which is needed by anything that wants to locate a still-open card later (e.g. a channel adapter repopulating an in-memory reply map).

Fix

Capture the adapter.deliver() return (the platform message id) and write the delivery target back to the row via a small new updatePendingApprovalDelivery() helper, right after the card is sent. No behavior change on the delivery path itself; purely fills in the previously-NULL columns.

Test

src/db/pending-approval-delivery.test.ts — asserts the columns start NULL on create and are populated after delivery, including the null-platform_message_id case.

🤖 Generated with Claude Code

requestApproval() created the pending_approvals row before picking an
approver and never recorded where the card was ultimately delivered, so
channel_type / platform_id / platform_message_id stayed NULL on every row.
That makes `approvals list` unable to show the real destination and leaves
no record of which chat a card went to.

Capture the adapter.deliver() result and write the target back via a new
updatePendingApprovalDelivery() helper once the card is sent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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