Skip to content

fix(flow): preserve comment anchor in getUserData - #1191

Open
baokimho wants to merge 1 commit into
ChatbotXIO:mainfrom
baokimho:fix/getuserdata-comment-anchor-1186
Open

baokimho wants to merge 1 commit into
ChatbotXIO:mainfrom
baokimho:fix/getuserdata-comment-anchor-1186

Conversation

@baokimho

Copy link
Copy Markdown

Summary

Fixes #1186.

getUserData sends a prompt, but comment-triggered private-reply flows did not treat it as a message-producing step. As a result, the commentAnchor was not passed into getUserData, and the prompt enqueue path also dropped the anchor.

This PR keeps the fix scoped to #1186:

  • adds getUserData to MESSAGE_PRODUCING_STEP_TYPES
  • forwards commentAnchor through enqueueFlowStepMessage
  • updates the related invariant/docblock
  • adds regression coverage for both unspent and spent anchor cases

Behavior

This now ensures that:

  • a question-first getUserData can use the unspent comment anchor
  • a getUserData after another message-producing step receives the spent anchor
  • normal non-comment flows remain unchanged

Validation

Biome still reports formatting findings on the touched files, but the parent revision reports the same findings unchanged, so this is a pre-existing baseline issue.

Copilot AI lite review requested due to automatic review settings September 15, 2026 19:08
@github-actions github-actions Bot added the bug Something isn't working as expected label Sep 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Messenger date/datetime prompt path still drops commentAnchor and needs propagation plus regression coverage.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

This PR fixes comment-anchor propagation for getUserData in comment-triggered flows.

Changes:

  • Treats getUserData as message-producing.
  • Forwards anchors through text prompt jobs.
  • Adds anchor lifecycle and regression tests.

A moderate review finding remains: Messenger date/datetime prompts use a direct chat-message path that drops commentAnchor.

File summaries
File Summary
apps/worker/src/integration/handlers/get-user-data.ts Forwards anchors for text prompts.
apps/worker/src/integration/handlers/flow-utils.ts Registers getUserData as message-producing; the date/datetime path still needs anchor propagation.
apps/worker/__tests__/get-user-data.test.ts Tests prompt anchor forwarding.
apps/worker/__tests__/flow.test.ts Tests anchor lifecycle behavior.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

* its first outgoing message.
*/
export const MESSAGE_PRODUCING_STEP_TYPES = new Set<StepType>([
stepTypes.enum.getUserData,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working as expected

Projects

None yet

2 participants