@W-22167805@ add sf agent trace read command#411
Merged
WillieRuemmele merged 49 commits intowr/deleteTracesfrom May 8, 2026
Merged
@W-22167805@ add sf agent trace read command#411WillieRuemmele merged 49 commits intowr/deleteTracesfrom
WillieRuemmele merged 49 commits intowr/deleteTracesfrom
Conversation
W-22203672 Adds a hidden --agent-json flag that accepts a file path to a pre-compiled AgentJSON, bypassing the compile step in ScriptAgent. Intended for internal developer testing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
W-22203672 - Apply jshackell's wording suggestion for flag summary - Add dependsOn authoring-bundle to --agent-json flag - Add telemetry for AgentJsonReadError - Add --agent-json flag to interactive agent preview command - Add NUT tests for --agent-json flag Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
W-22203672 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
test: fix NUTs @W-22293348@
W-22203672 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…PI call Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and instanceof narrowing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The static fixture had an empty defaultAgentUser, causing bypassUser to resolve to false and the preview sessions API to reject the request. Patch it at runtime with the real agent user from the shared test session, matching what the compile-then-start path does via string replacement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The preview sessions API rejected "AgentforceAgent" with HTTP 400 "Define a valid value for ''agent_type''". Updated to "customer" which matches the AgentType union type in @salesforce/agents. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
"customer" was also rejected by the preview sessions API. The unit test for --agent-json uses "AgentforceServiceAgent", which matches the value the compile API returns for service-type agents. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…agents to 1.4.0 The preview sessions API rejected all prior agentType values. The bot-meta.xml for the test project's service agent uses "EinsteinServiceAgent", which matches what the compile API returns for this agent type. Also bumps @salesforce/agents to 1.4.0. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Setting defaultAgentUser to a valid org user made bypassUser=true, which caused the preview sessions API to validate permission sets that aren't assigned, resulting in a 500. An empty defaultAgentUser keeps bypassUser=false and skips that check entirely. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
A static fixture's agentVersion is rejected by the preview sessions API with a 500. Compile the agent at test time via Agent.init+compile(), write the real compiledArtifact to a temp file, and pass that as --agent-json. This tests the flag plumbing while ensuring the body is API-compatible. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Bumps [yaml](https://github.com/eemeli/yaml) from 2.8.3 to 2.8.4. - [Release notes](https://github.com/eemeli/yaml/releases) - [Commits](eemeli/yaml@v2.8.3...v2.8.4) --- updated-dependencies: - dependency-name: yaml dependency-version: 2.8.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
…ml-2.8.4 fix(deps): bump yaml from 2.8.3 to 2.8.4
…lag-preview-start W-22203672: add hidden --agent-json flag to agent preview start
@W-22203670 feat: add --verbose and --concise flags to agent publish authoring-bundle
…o @salesforce/agents W-22203426 Removes local copies of evalNormalizer, evalFormatter, and yamlSpecTranslator now that they live in the shared library. Rewrites run-eval.ts as a thin CLI shell that imports normalizePayload, translateTestSpec, resolveAgent, executeBatches, buildResultSummary, and formatResults from @salesforce/agents. Promotes the command from state='beta'/hidden to state='ga'. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove state='ga' (GA commands omit state to avoid oclif help regression) - Remove unused --wait flag - Wrap parseTestSpec/translateTestSpec in try/catch for named SfError - Validate test.steps is an array before injection loop - Hoist isYamlTestSpec to avoid double-call - Extract resolveAndInjectAgent helper to stay within complexity limit - Fix test stubs to use $$.SANDBOX, remove sinon.restore(), fix describe label Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…emoval Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wr/ngt @W-22143479@ @W-22143478@
Six NUT cases asserted ensureExitCode: 1 but the commands fail at
oclif flag-parse time (Flags.file({ exists: true }), parse callbacks
that throw, validate callbacks, and missing required flags), which
exits with code 2. Update the assertions to match.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The exit code for these oclif parse failures differs by sf-plugins-core version: 12.2.6 (bundled in CLI 2.135.0) emits 2, while 12.2.13 (used in plugin-agent's own CI) catches the parse error and re-emits exit 1. Use 'nonZero' so the assertion is correct in both environments. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
fix: expect oclif parse exit code 2 for invalid-input NUTs @W-22403352
…or-to-library W-22203426: feat: promote agent test run-eval to GA and delegate logic to @salesforce/agents
Contributor
QA Release Notes: Agent Trace Read CommandThe functionality of the new 🧪 Test Scenarios
|
Contributor
|
@WillieRuemmele I've noticed a small typo in the error message. When the session ID is incorrect, the command-line interface suggests running |
Contributor
Author
|
@sreckomileta - the command/message is correct, it's ../../oss/plugin-agent/bin/run.js agent trace list
┌───────────────────┬──────────────────────────────────────┬──────────────────────────────────────┬──────────────────────────┬────────┬───────┐
│ Agent │ Session ID │ Plan ID │ Recorded At │ Size │ Path │
├───────────────────┼──────────────────────────────────────┼──────────────────────────────────────┼──────────────────────────┼────────┼───────┤
│ Local_Info_Agent │ 85b4d4c5-956e-4bc0-b952-8ea162ac3b22 │ 9e21ae60-98d4-41a4-b1dd-4b5a9df994a5 │ 2026-04-07T18:32:45.183Z │ 17581B │ /Use… │ |
…written to the project dir Without cwd, preview start/send/end wrote the session cache relative to the runner's working directory, causing trace read/delete NUTs to throw SessionNotFound when they ran with cwd: session.project.dir.
listCachedPreviewSessions only returns sessions still in the index, but agent preview end removes the entry when it cleans up the active-session marker. Both trace read and trace delete now fall back to a filesystem scan of .sfdx/agents/<agentId>/sessions/ so they work on ended sessions.
When sessions are run with --simulate-actions, the turn index exists but planId entries are null. --turn N now falls back to positional trace file order rather than throwing TurnIndexNotFound. Also relaxes the grounding NUT assertion since simulated sessions may not produce LLMExecutionStep rows with React prompt names.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Work Item
@W-22167805@
Summary
Adds the
sf agent trace readcommand for reading and analyzing trace files from an agent preview session. No org connection required.Changes
sf agent trace read--session-id(required),--format(summary|detail|raw, default: summary),--dimension(actions|grounding|routing|errors, required with--format detail),--turn(scope to a single turn)--format summary: per-turn table showing topic, user input, agent response, actions executed, latency, errors--format detail: dimension-specific drill-down (actions, grounding, routing, errors)--format raw: prints unprocessed trace JSON--turn N: scopes any format to a single conversation turn via turn-index.jsonlistSessionTracesfile order when no turn index existsmessages/agent.trace.read.mdFiles Changed
src/commands/agent/trace/read.tsmessages/agent.trace.read.mdschemas/agent-trace-read.jsoncommand-snapshot.jsontest/commands/agent/trace/read.test.tsTest Plan
npm run buildandnpm testpass cleanlyDependencies