feat(scenarios): add scenarios.replay() and the scenarios_replay tool - #80
Open
matejmichnak wants to merge 1 commit into
Open
feat(scenarios): add scenarios.replay() and the scenarios_replay tool#80matejmichnak wants to merge 1 commit into
matejmichnak wants to merge 1 commit into
Conversation
Adds SDK coverage for POST /scenarios/{scenarioId}/replay, which re-runs a
past execution with the trigger data the original execution received.
The method returns the ID of the NEW execution created by the replay, so a
caller can hand it straight to executions_get-detail — mirroring how
scenarios_run composes.
The tool description carries the recovery path for the two failure modes a
caller cannot predict from the inputs: 404 for an unknown execution, and
422 "Execution is not replayable" when the execution's input data has
expired or was never stored. Neither is fixed by retrying the same ID, and
no public endpoint reports replayability up front, so the description
points at executions_list for candidates and says to try a more recent
execution instead of retrying.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-class SDK + tool support for replaying a past scenario execution via POST /scenarios/{scenarioId}/replay, returning the new execution ID so it can be inspected like a normal run.
Changes:
- Added
Scenarios.replay(scenarioId, executionIds)and the exportedReplayScenarioResponsetype. - Added the
scenarios_replaytool definition (mirroringscenarios_runannotations/scope). - Added a unit test and mock fixture covering the request path/body and JSON content type.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/scenarios.spec.ts | Adds a unit test for make.scenarios.replay() request shape and headers. |
| test/mocks/scenarios/replay.json | Adds a mock response fixture { executionId } for replay. |
| src/index.ts | Exports ReplayScenarioResponse from the public SDK entrypoint. |
| src/endpoints/scenarios.ts | Implements Scenarios.replay() and introduces the response type. |
| src/endpoints/scenarios.tools.ts | Registers the new scenarios_replay tool with schema/metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+459
to
+464
| executionIds: { | ||
| type: 'array', | ||
| items: { type: 'string' }, | ||
| description: | ||
| 'Execution IDs to replay, as returned by executions_list. Currently only the first one is replayed.', | ||
| }, |
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.
https://make.atlassian.net/browse/BAR-3726
feat(scenarios): add scenarios.replay() and the scenarios_replay tool
Summary
Adds support for
POST /scenarios/{scenarioId}/replay— replaying a past scenario execution with the trigger data the original execution received. The endpoint is documented in the public API but had no SDK coverage.make.scenarios.replay(scenarioId, executionIds)→Promise<ReplayScenarioResponse>scenarios_replaytool definition, sitting alongsidescenarios_runReplayScenarioResponseexported fromsrc/index.tsThe response carries the new execution ID
replay()returns{ executionId }— the ID of the new execution the replay created, not the one being replayed. That mirrorsscenarios_runand is what makes the tool composable: an agent can hand the returned ID straight toexecutions_get-detailto inspect how the replay went.Tool description
Replay has two failure modes a caller can't predict from the inputs alone:
404— unknown execution ID422 Execution is not replayable— the execution exists, but its input data has expired or was never storedNeither is recoverable by retrying the same ID, and there is no public endpoint that tells you up front which executions are replayable. The tool description therefore states where to source candidate IDs (
executions_list) and that "not replayable" means try a more recent execution rather than retry. Without that, a model reads 422 as a transient failure and retries the same ID.The description also flags the two easy-to-miss contract details: only the first ID in
executionIdsis replayed, and the scenario must be active.annotationsmatchscenarios_run(destructiveHint: true,openWorldHint: true) — a replay starts a real execution and consumes operations exactly like a run.Testing
test/scenarios.spec.tsasserting the request path, the{ executionIds }body shape, and the JSON content type, against a newtest/mocks/scenarios/replay.jsonnpm run lint(tsc + eslint) cleannpm test— 327 tests / 46 suites passingNo integration-test case: replay needs a live execution whose input data is still stored, which can't be provisioned from the test setup. Worth adding by hand against a zone that has one.
Notes
src/tools.tschange needed —scenarios.tools.tsis already spread intoMakeTools, so the new entry is live on merge.README.mdchange — it lists tool categories, not individual tools, andscenariosis already covered.🤖 Generated with Claude Code