agent preview start --authoring-bundle crashes for AgentforceEmployeeAgent without default_agent_user (reading 'replace')

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

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

評価

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

調査の方向性

報告された391行目の @salesforce/agents/lib/agents/scriptAgent.js から始め、近くにある AgentforceEmployeeAgent と bypassUser の処理を読んでください。default_agent_user を省略した従業員用オーサリングバンドルで再現し、関連するプレビューテストを実行してください。このケースでプレビューの開始時にクラッシュしなくなり、他のエージェントタイプも引き続き動作すれば完了です。

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

説明

area:afdx bug owned by another team
Summary

sf agent preview start --authoring-bundle <name> crashes for an Agent Script agent of type AgentforceEmployeeAgent that has no default_agent_user in its config block (employee agents run as the logged-in user, so this field is not set).

Steps to reproduce
  1. Agent Script authoring bundle with:
    config:
        developer_name: "My_Employee_Agent"
        agent_type: "AgentforceEmployeeAgent"
    
    (no default_agent_user)
  2. sf agent validate authoring-bundle --api-name My_Employee_Agent → success
  3. sf agent preview start --authoring-bundle My_Employee_Agent --use-live-actions --target-org <sandbox> --json
Expected result

A preview session starts (as it does for sf agent preview start --api-name My_Employee_Agent on the published, activated version — that works fine).

Actual result
PreviewStartFailed: Failed to start preview session: Cannot read properties of undefined (reading 'replace')
  cause: TypeError: Cannot read properties of undefined (reading 'replace')
      at ScriptAgent.startPreview (@salesforce/agents/lib/agents/scriptAgent.js:391:93)
Cause

@salesforce/agents/lib/agents/scriptAgent.js line 391:

const escapedDefaultAgentUser = this.agentJson.globalConfiguration.defaultAgentUser.replace(/'/g, "''");

defaultAgentUser is undefined for employee agents without default_agent_user. A guard such as (defaultAgentUser ?? '') — or skipping the user lookup when it is undefined, since bypassUser is forced to false for AgentforceEmployeeAgent a few lines later anyway — would fix it.

System information
  • @salesforce/cli/2.156.8 darwin-arm64 node-v24.22.1
  • @salesforce/plugin-agent 2.2.3, @salesforce/agents 2.3.1
  • Also reproduced on @salesforce/cli/2.154.4
  • Target org: sandbox, Agentforce employee agent
主要言語
言語のデータがありません
スター
575
フォーク
80
平均マージ
11時間 37分
マージ済み PR(30日)
6

環境構築

はじめの一歩

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

forcedotcom/cli のほかの issue

forcedotcom/cli の issue をすべて見る

似ている issue

Backend & API Design の issue をもっと見る

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

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