-
Notifications
You must be signed in to change notification settings - Fork 52
fix: resolve #825 — slack-primitive: persist askQuestion exchanges to workflow run record #834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,21 @@ | ||||||||||||||||||||||||||||||||||||||||||||
| import { Step } from '../../types'; | ||||||||||||||||||||||||||||||||||||||||||||
| import { updateRunAskQuestionExchanges } from '../persistence/runs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||
| export async function handleSlackAskQuestion( | ||||||||||||||||||||||||||||||||||||||||||||
| step: Step, | ||||||||||||||||||||||||||||||||||||||||||||
| runId: string, | ||||||||||||||||||||||||||||||||||||||||||||
| timeoutMs: number | ||||||||||||||||||||||||||||||||||||||||||||
| ): Promise<void> { | ||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||
| const result = await step.waitForReply(timeoutMs); | ||||||||||||||||||||||||||||||||||||||||||||
| const exchange = { | ||||||||||||||||||||||||||||||||||||||||||||
| question: step.input.question, | ||||||||||||||||||||||||||||||||||||||||||||
| timestamp: new Date(), | ||||||||||||||||||||||||||||||||||||||||||||
| reply: result.reply, | ||||||||||||||||||||||||||||||||||||||||||||
| timeout: result.timeout === true | ||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||
| await updateRunAskQuestionExchanges(runId, exchange); | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+11
to
+17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Persisted exchange payload does not match the new run-record schema. On Line 11–16, the object uses Suggested mapping update+import type { AskQuestionExchange } from '../types/workflow-run-record';
- const exchange = {
- question: step.input.question,
- timestamp: new Date(),
- reply: result.reply,
- timeout: result.timeout === true
- };
+ const exchange: AskQuestionExchange = {
+ channel: step.input.channel,
+ questionTimestamp: step.input.questionTs,
+ questionText: step.input.question,
+ replierUserId: result.replierUserId,
+ replyText: result.reply,
+ replyTimestamp: result.replyTs,
+ matchedChoices: result.matchedChoices,
+ matchedRegexGroups: result.matchedRegexGroups,
+ timeoutOutcome: result.timeout ? 'timeout' : null,
+ };📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||||||||||||||||||||||||||
| throw error; | ||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+9
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify useless catch/rethrow patterns in TS files
ast-grep --lang ts --pattern $'try { $$$BODY } catch ($ERR) { throw $ERR; }'Repository: AgentWorkforce/relay Length of output: 1143 Remove the no-op catch/rethrow wrapper. The try-catch block at lines 9–20 catches and immediately rethrows the error unchanged, which violates the 🧰 Tools🪛 ESLint[error] 9-20: Unnecessary try/catch wrapper. (no-useless-catch) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| export interface WorkflowRunRecord { | ||
| id: string; | ||
| workflowId: string; | ||
| status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled'; | ||
| createdAt: Date; | ||
| updatedAt: Date; | ||
| askQuestionExchanges?: AskQuestionExchange[]; | ||
| } | ||
|
|
||
| export interface AskQuestionExchange { | ||
| channel: string; | ||
| questionTimestamp: string; | ||
| questionText: string; | ||
| replierUserId?: string; | ||
| replyText?: string; | ||
| replyTimestamp?: string; | ||
| matchedChoices?: string[]; | ||
| matchedRegexGroups?: Record<string, string>; | ||
| timeoutOutcome?: 'timeout' | 'cancelled' | null; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Exchange object fields don't match the AskQuestionExchange interface from the same PR
The exchange object constructed in
handleSlackAskQuestionuses field names and types that are completely misaligned with theAskQuestionExchangeinterface defined inpackages/runner/src/types/workflow-run-record.ts:10-20:question→ should bequestionTexttimestamp(Date) → should bequestionTimestamp(string)reply→ should bereplyTexttimeout(boolean) → should betimeoutOutcome('timeout' | 'cancelled' | null)channelSince
updateRunAskQuestionExchangesdoesn't exist yet (the persistence module is unimplemented), there is no compile-time type constraint on this object — the mismatch will silently persist until the persistence layer is wired up, at which point either this code will break or the wrong data will be stored.Prompt for agents
Was this helpful? React with 👍 or 👎 to provide feedback.