Skip to content

feat: add --all flag to agent preview end (W-22203669)#406

Open
franciscoperezsammartino wants to merge 15 commits intomainfrom
fp/W-22203669/add-all-flag-to-preview-end
Open

feat: add --all flag to agent preview end (W-22203669)#406
franciscoperezsammartino wants to merge 15 commits intomainfrom
fp/W-22203669/add-all-flag-to-preview-end

Conversation

@franciscoperezsammartino
Copy link
Copy Markdown
Contributor

Summary

  • Adds --all flag to agent preview end to terminate multiple sessions at once
  • When used alone: ends all sessions across all agents (client-side only, no org needed)
  • When combined with --api-name or --authoring-bundle: ends only sessions for that specific agent
  • Adds --no-prompt / -p flag to skip confirmation prompt (with --all only)
  • Makes --target-org optional; guard throws when --api-name is used without it
  • Adds structured PreviewEndPartialFailure error listing succeeded/failed sessions on mid-loop failure
  • Restores timestamp/sessionType columns on agent preview sessions (W-22203667 regression from shim revert)
  • Regenerates JSON schemas

Test plan

  • 258 unit tests pass (yarn test)
  • agent preview end --all ends all sessions and shows confirmation prompt
  • agent preview end --all --no-prompt skips confirmation
  • agent preview end --all --authoring-bundle <name> ends only sessions for that agent
  • agent preview end --all --api-name <name> --target-org <org> ends only sessions for that agent
  • agent preview end --all --api-name <name> (no org) throws MissingTargetOrgForApiName
  • agent preview sessions shows timestamp and sessionType columns
  • NUT tests pass for single-session end (both authoring-bundle and api-name paths)

🤖 Generated with Claude Code

- Adds --all to end multiple preview sessions at once
- When combined with --api-name or --authoring-bundle, ends only sessions
  for that specific agent; when used alone, ends all sessions in the project
- Adds --no-prompt (-p) to skip the confirmation prompt shown by --all
- Makes --target-org optional (no org needed for client-side session cleanup);
  raises a clear error when --api-name is used without --target-org
- Restores inline previewSessionStore implementation (the @salesforce/agents
  shim was broken against the installed 1.1.1 version); adds getSessionDir
  and removeCacheById helpers needed by the --all code path
- Adds 13 unit tests for the new end command behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add try/catch in endAll serial loop with structured PreviewEndPartialFailure
  error listing which sessions failed vs succeeded
- Restore timestamp/sessionType columns on agent preview sessions (W-22203667
  regression introduced by the shim revert in the previous commit)
- Add three missing tests: --all+--api-name happy path, missing --target-org guard,
  and mid-loop failure with partial results assertions
- Document --no-prompt only has effect when used with --all

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n union

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@franciscoperezsammartino franciscoperezsammartino requested a review from a team as a code owner April 28, 2026 17:37
Comment thread messages/agent.preview.end.md Outdated
Comment thread messages/agent.preview.end.md Outdated
Copy link
Copy Markdown
Contributor

@jshackell-sfdc jshackell-sfdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my small suggestions.

franciscoperezsammartino and others added 12 commits April 28, 2026 14:43
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…only

Replace the bloated inline rewrite with the correct base (commit 57fb5f7,
the last working inline implementation before the broken shim). Only the
two helpers needed by --all are added on top: getSessionDir and
removeCacheById. sessions.ts and start.ts are restored to their main state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
agentId was not in the original result type and is not needed by callers.
Kept as an internal SessionTask type for routing within endAll.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Use oclif dependsOn instead of a manual guard in run(). authoring-bundle
does not need target-org since it works client-side only.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The ScriptAgent/ProductionAgent branching was identical in the single-session
path and the endAll loop. Extracted to a module-level function.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ped removeCache

removeCache only needs getHistoryDir(), so the no-agent path in --all can
pass a plain object instead of requiring a separate removeCacheById helper.
Loosened removeCache/validatePreviewSession signatures to structural types.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…force/agents to 1.2.0

The shim was inadvertently replaced with a full inline implementation.
Restoring it to the re-export shim from main. Bumping agents to 1.2.0
which now exports the session store functions the shim references.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
Replaces manual inline object types with Pick<CommandFlags, ...> so the
method signatures stay in sync with the flag definitions automatically.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants