@W-22167805@ add sf agent trace list command#409
Merged
WillieRuemmele merged 27 commits intomainfrom May 8, 2026
Merged
Conversation
3 tasks
…ndle with --agent
Contributor
…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.
@W-22167805@ add sf agent trace read command
Move the ended-session filesystem scan into src/agentSessionScanner.ts so all three trace commands (list, read, delete) share the same logic and no longer miss sessions that were ended via agent preview end. Also add missing cwd to the z4.agent.trace.list NUT before() hook.
@W-22167805@ add sf agent trace delete command
EstebanRomero84
approved these changes
May 8, 2026
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 listcommand for listing trace files recorded during agent preview sessions. Reads from the local.sfdx/agents/cache — no org connection required.Changes
sf agent trace list--agent(substring match, replaces separate--api-name/--authoring-bundle),--session-id,--since(ISO 8601, validated at flag-parse time)messages/agent.trace.list.mdFiles Changed
src/commands/agent/trace/list.tsmessages/agent.trace.list.mdschemas/agent-trace-list.jsoncommand-snapshot.jsontest/commands/agent/trace/list.test.tsTest Plan
npm run buildandnpm testpass cleanlyDependencies