Bug: executeCode tool schema: `capturePlot` is missing `.optional()`, breaking tool calls when omitted

オープン 初心者向け
#107 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript
領域
tooling

調査の方向性

dist/extension.js の executeCode の入力スキーマビルダー H0e(t) から始め、次に W0e を調べて capturePlot に対する既存のフォールバック動作を確認します。スキーマで capturePlot をオプションにし、それを省略したツール呼び出しが検証を通過してフォールバック動作を使用することを確認します。

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

説明

Environment
  • Extension: Posit Assistant (posit.assistant) v1.4.1
  • IDE: Positron
  • OS: macOS (Darwin arm64)
Description

In Posit Assistant v1.4.1, when a language model invokes the executeCode tool without explicitly providing the capturePlot parameter (which is common for non-plotting tasks such as summary(model), data inspections, or whenever models omit optional-seeming parameters), the tool schema validation fails immediately before executing any code in the console.

The Assistant UI displays:

Tool input was not valid JSON or did not match the tool's schema. Please re-issue the tool call with valid JSON arguments that match the schema.
[
  {
    "expected": "boolean",
    "code": "invalid_type",
    "path": [
      "capturePlot"
    ],
    "message": "Invalid input: expected boolean, received undefined"
  }
]
Root Cause

In the executeCode input schema builder (H0e(t) in dist/extension.js):

function H0e(t) {
  // ...
  return t.includeCapturePlotHint && (n.capturePlot = ft().describe(sao)),
  t.timeoutParamDefaultMs !== void 0 && (n.timeout = tt().optional().describe(...)),
  n;
}
  1. While timeout (tt().optional()) and dangerReason (V().optional()) are explicitly marked as optional, capturePlot is instantiated as ft().describe(sao) without .optional().
  2. This causes capturePlot to be placed into the JSON Schema's "required" array:
    "required": [
      "code",
      "intent",
      "language",
      "capturePlot"
    ]
    
  3. In the execution implementation (W0e):
    expectsPlot: t.capturePlot ?? !0
    
    The runtime already provides a fallback (?? !0), confirming that capturePlot was intended to be optional.
Expected Behavior

capturePlot should be optional in the schema so that tool calls omitting this parameter pass schema validation, with expectsPlot falling back to true.

Suggested Fix

Wrap capturePlot with .optional() in the tool input schema definition:

- t.includeCapturePlotHint && (n.capturePlot = ft().describe(sao))
+ t.includeCapturePlotHint && (n.capturePlot = ft().optional().describe(sao))
主要言語
言語のデータがありません
スター
5
フォーク
0
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

posit-dev/assistant-feedback のほかの issue

posit-dev/assistant-feedback の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

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

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