microsoft / microsoft/BotFramework-DirectLineJS

postActivity responses to an Invoke return the string 'retry'

オープン
#260 コメント 2 件 リアクション 4 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
199
フォーク
133
PR マージ指標
30日以内にマージされた PR はありません

説明

If you send an InvokeActivity to postActivity via dljs, a success will return an id with the activity ID. However, an Invoke can return other status codes for error/failure cases. When this happens, postActivity still calls the "success" trigger but with an id of 'retry'.

Repro code:

directLine.postActivity({
type: 'invoke',
name: 'good'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with a real id
},
error => {
console.log("Error posting activity", error);
}
);

directLine.postActivity({
type: 'invoke',
name: 'bad'
}).subscribe(
id => {
console.log("Posted activity, assigned ID ", id); // this is called with an id of 'retry'
},
error => {
console.log("Error posting activity", error);
}
);

For the boy, just handle invokes and return an InvokeResponse of 409 or whatnot in that bad case, and an InvokeResponse of 200 in the good case:

Here is some C# code to do this:

protected override async Task OnInvokeActivityAsync(ITurnContext turnContext, CancellationToken cancellationToken)
{
await turnContext.SendActivityAsync("Got an invoke: " + turnContext.Activity.Name);
if (turnContext.Activity.Name == "good")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 200
},
}, cancellationToken).ConfigureAwait(false);
}
else if (turnContext.Activity.Name == "bad")
{
await turnContext.SendActivityAsync(
new Activity
{
Type = ActivityTypesEx.InvokeResponse,
Value = new InvokeResponse
{
Status = 409
},
}, cancellationToken).ConfigureAwait(false);
}
else
{
await base.OnInvokeActivityAsync(turnContext, cancellationToken);
}
}

Expected behavior:

(1) At least the error case should be called.
(2) It'd be nice to get the actual result code, or the 502 saying message wasn't processed properly by the bot if that's all DirectLine returns

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

postActivity エントリポイントから開始し、Invoke のレスポンスが observable の成功パスとエラーパスにどのようにマッピングされるかを追跡します。issue にある Invoke の正常系と異常系を再現し、その後、成功ではないステータスのレスポンスが、成功した activity ID としてリテラルの 'retry' を出力しなくなっていることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
api
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。