Skip to content

feature-pre-release: new time skipping for workflows and schedules - #1246

Open
feiyang3cat wants to merge 6 commits into
mainfrom
fx/time-skipping-cli
Open

feiyang3cat wants to merge 6 commits into
mainfrom
fx/time-skipping-cli

Conversation

@feiyang3cat

@feiyang3cat feiyang3cat commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What changed?

  • Added temporal schedule time-skipping enable, disable, and poll.
  • Added temporal workflow time-skipping enable, disable, and poll.
  • Added --enable-time-skipping (for all namespaces) server flag to enable time skipping for both workflows and schedules, and new chasm schedule will also be enabled

Checklist

Stability

  • Breaking changes are marked with 💥 in the PR title and release notes
  • Changes to JSON output (-o json / -o jsonl) are treated as breaking changes

Design

  • This feature does not depend on Cloud-only APIs or behavior (it works against an OSS server)
  • New commands follow temporal <noun> <verb> structure (e.g. temporal workflow start) (similar to temporal workflow update action the commands use temporal workflow time-skipping <verb> and temporal schedule time-skipping <verb>. The final segment is the action.)
  • New flags are named after the API concept, not the implementation mechanism (good: --search-attribute, bad: --index-field)
  • New flags don't duplicate an existing flag that serves the same purpose
  • New flags do not have short aliases without strong justification
  • Experimental features are marked with (Experimental) in commands.yaml

Help text (see style guide at the top of commands.yaml)

  • All flags shown in help text and examples are implemented and functional
  • Summaries use sentence case and have no trailing period
  • Long descriptions end with a period and include at least one example invocation (The two time-skipping group descriptions list related commands without an example invocation. The enable descriptions end with an example code block.)
  • Examples use long flags (--namespace, not -n), one flag per line
  • Placeholder values use YourXxx form (YourWorkflowId, YourNamespace)

Behavior

  • Results go to stdout; errors and warnings go to stderr
  • Error messages are lowercase with no trailing punctuation

Tests

  • Added functional test(s) (SharedServerSuite)
  • Added unit test(s) (func TestXxx) where applicable

Manual Testing

too long, added in comments

@feiyang3cat
feiyang3cat requested a review from a team as a code owner October 27, 2026 19:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T02:52:06.828745Z 42bea61 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@feiyang3cat

feiyang3cat commented Oct 27, 2026 •

Copy link
Copy Markdown
Member Author

This PR depends on

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ebca3a6d9f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +698 to +700
if errors.Is(ctx.Err(), context.DeadlineExceeded) {
cctx.Printer.Println("poll timed out")
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve global command-timeout failures

When --command-timeout expires before the poll-specific --timeout (or when --timeout is omitted), ctx inherits context.DeadlineExceeded from cctx, so this branch treats the global command failure as a normal poll timeout and returns nil. The CLI therefore exits successfully and discards the descriptive command timed out after ... cause; check whether cctx itself expired and propagate its cause before handling the child poll timeout.

Useful? React with 👍 / 👎.

@feiyang3cat

feiyang3cat commented Oct 27, 2026 •

Copy link
Copy Markdown
Member Author

manual testing

Happy Path: workflow time skipping

(1) build both dev and server with a different name

go build -o /tmp/temporal-vts ./cmd/temporal

(2)Start the local server with Workflow and Schedule time skipping enabled for all Namespaces (terminal 1)

Note: Schedule time skipping requires CHASM Schedules. This flag also enables CHASM creation for new Schedules.

/tmp/temporal-vts server start-dev \
  --namespace timeskipping-test \
  --enable-time-skipping

check webUI: http://localhost:8233/

(3)start your worker (terminal-2)

(4) start workflow first without time skipping (terimnal-3) and check in webUI

/tmp/temporal-vts workflow start \
  --namespace timeskipping-test \
  --workflow-id vts-workflow-1 \
  --type TimerWorkflow \
  --task-queue vts-test-queue

(5) (option-1) start time skipping to run the workflow to completion(terimnal-3) and check in webUI to find time is skipped and workflow runs to completion

/tmp/temporal-vts workflow time-skipping enable \
  --namespace timeskipping-test \
  --workflow-id vts-workflow-1 \

(5)(option-2) start time skipping with a shorter fast-forward if you want your time skipping stop somewhere (terimnal-3) and check in webUI

/tmp/temporal-vts workflow time-skipping enable \
  --namespace timeskipping-test \
  --workflow-id vts-workflow-1 \
  --fast-forward-duration 5h \
  --fast-forward-id manual-wf-ff-1 \

/tmp/temporal-vts workflow time-skipping poll \
  --namespace timeskipping-test \
  --workflow-id vts-workflow-1 \
  --fast-forward-id manual-wf-ff-1

check in details of the event WorkflowExecutionTimeSkippingTransitioned to see 5 hours move forward

{
  "eventId": "7",
  "eventTime": "2026-10-27T20:19:27.266214Z",
  "eventType": "WorkflowExecutionTimeSkippingTransitioned",
  "taskId": "1048603",
  "workerMayIgnore": true,
  "workflowExecutionTimeSkippingTransitionedEventAttributes": {
    "targetTime": "2026-10-28T01:19:27.266156Z",
    "disabledAfterFastForward": true,
    "wallClockTime": "2026-10-27T20:19:27.266214Z"
  },
  "links": [],
  "billableActions": 0
}

Happy Path: schedule time skipping

  1. set up server and worker in the same way

  2. create schedule and check this schedule in UI

    /tmp/temporal-vts schedule create \
      --namespace timeskipping-test \
      --schedule-id vts-schedule-1 \
      --interval 10d \
      --workflow-id vts-scheduled-workflow \
      --type TimerWorkflow \
      --task-queue vts-test-queue
  3. fast-forward 30days, poll the completion of this fast-forward duration, and check in UI

    /tmp/temporal-vts schedule time-skipping enable \
      --namespace timeskipping-test \
      --schedule-id vts-schedule-1 \
      --fast-forward-duration 720h \
      --fast-forward-id manual-schedule-ff-30d
    
    /tmp/temporal-vts schedule time-skipping poll \
      --namespace timeskipping-test \
      --schedule-id vts-schedule-1 \
      --fast-forward-id manual-schedule-ff-30d \
      --timeout 2m
  4. describe schedule to check current virtual time in time skipping field

    /tmp/temporal-vts schedule describe \
      --namespace timeskipping-test \
      --schedule-id vts-schedule-1

Error case

Schedule enable requires a fast-forward duration:

/tmp/temporal-vts schedule time-skipping enable \
    --namespace YourNamespace \
    --schedule-id YourScheduleId
echo $?

Expected error and exit code:

Error: required flag(s) "fast-forward-duration" not set
1

Workflow enable rejects a fast-forward ID without a duration:

/tmp/temporal-vts workflow time-skipping enable \
    --namespace YourNamespace \
    --workflow-id YourWorkflowId \
    --fast-forward-id YourWorkflowFastForwardId
echo $?

Expected error and exit code:

Error: --fast-forward-id requires --fast-forward-duration
1

Composition

Start another Workflow to test a partial fast-forward:

/tmp/temporal-vts workflow start \
    --namespace YourNamespace \
    --workflow-id YourPartialWorkflowId \
    --type TimerWorkflow \
    --task-queue YourTaskQueue

/tmp/temporal-vts workflow time-skipping enable \
    --namespace YourNamespace \
    --workflow-id YourPartialWorkflowId \
    --fast-forward-duration 5h

Copy the generated fast-forward ID from the output and use it as YourFastForwardId:

/tmp/temporal-vts workflow time-skipping poll \
    --namespace YourNamespace \
    --workflow-id YourPartialWorkflowId \
    --fast-forward-id YourFastForwardId

Expected output:

completed

This means the five-hour fast-forward completed. The Workflow’s ten-hour timer should still be pending.

Inspect the effective configuration and fast-forward status:

/tmp/temporal-vts workflow describe \
    --namespace YourNamespace \
    --workflow-id YourPartialWorkflowId

In the Web UI at http://localhost:8233/, select YourNamespace and open YourPartialWorkflowId. Check that the Workflow is still running and inspect its time-skipping transition event.

Disable time skipping and describe again:

/tmp/temporal-vts workflow time-skipping disable \
    --namespace YourNamespace \
    --workflow-id YourPartialWorkflowId

/tmp/temporal-vts workflow describe \
    --namespace YourNamespace \
    --workflow-id YourPartialWorkflowId

Confirm that EffectiveEnabled is false in the Time Skipping section.

For the Schedule created in the happy-path test, inspect its status, then disable time skipping:

/tmp/temporal-vts schedule describe \
    --namespace YourNamespace \
    --schedule-id YourScheduleId

/tmp/temporal-vts schedule time-skipping disable \
    --namespace YourNamespace \
    --schedule-id YourScheduleId

/tmp/temporal-vts schedule describe \
    --namespace YourNamespace \
    --schedule-id YourScheduleId

Confirm that EffectiveEnabled is false in TimeSkippingInfo.

@feiyang3cat feiyang3cat changed the title feat: add Schedule time-skipping CLI commands for-feature-release: add Schedule time-skipping CLI commands Oct 27, 2026
@feiyang3cat feiyang3cat changed the title for-feature-release: add Schedule time-skipping CLI commands Feature-PreRelease: new time skipping for workflows and schedules Oct 27, 2026
@feiyang3cat feiyang3cat changed the title Feature-PreRelease: new time skipping for workflows and schedules feature-prerelease: new time skipping for workflows and schedules Oct 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f190d21f0e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +132 to +135
if reason == "" {
cctx.Printer.Println(status)
} else {
cctx.Printer.Printlnf("%s: %s", status, reason)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Emit structured poll results for JSON output

When either time-skipping poll command is invoked with --output json or --output jsonl, Printer.Println and Printlnf intentionally discard their arguments, so the command succeeds with empty stdout instead of reporting completed, poll timed out, or failed. The Schedule poll has the same issue in commands.schedule.go:699,707-709,716; emit the status and reason through PrintStructured when JSON output is selected.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2f14e42094

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +71 to +72
if cctx.JSONOutput {
return nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Return generated fast-forward IDs for JSON output

When either enable command is run with --output json/jsonl and no --fast-forward-id, the CLI generates an ID but suppresses all output here (and likewise in printScheduleTimeSkippingResult), so callers cannot obtain the ID required by the corresponding poll command without making an additional describe request. Emit a structured update result containing at least the generated fast-forward ID instead of returning empty output.

Useful? React with 👍 / 👎.

@feiyang3cat
feiyang3cat force-pushed the fx/time-skipping-cli branch 2 times, most recently from 0d5818e to cf312a5 Compare October 27, 2026 22:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cf312a5a97

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +104 to +105
case enumspb.FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_FAILED:
return "failed", resp.GetFailedReason(), nil

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Fail the command when the fast-forward fails

When the server returns FAST_FORWARD_POLLING_RESULT_FAST_FORWARD_FAILED, this helper returns a nil error, so the caller prints failed: ... and exits successfully. Automation invoking the poll command therefore cannot distinguish a failed fast-forward from a successful one by exit status; the Schedule poll has the same behavior in commands.schedule.go when status != "pending". Return an error for terminal failures after emitting the result, consistent with other result commands such as Workflow Update and Activity result.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is business logic failure not program failure

StartDelay: opts.StartDelay.Duration(),
Summary: opts.StaticSummary,
Details: opts.StaticDetails,
StaticDetails: opts.StaticDetails,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

due to SDK version bump

@feiyang3cat
feiyang3cat force-pushed the fx/time-skipping-cli branch 9 times, most recently from faf0adb to 66ce2f0 Compare October 28, 2026 01:27
@feiyang3cat feiyang3cat changed the title feature-prerelease: new time skipping for workflows and schedules feature-pre-release: new time skipping for workflows and schedules Oct 28, 2026
return patchScheduleTimeSkipping(cctx, c.Parent.Parent, c.ScheduleId, config)
}

// TODO: need to change to SDK polling.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

waiting for SDK poll api

@feiyang3cat
feiyang3cat force-pushed the fx/time-skipping-cli branch 2 times, most recently from 470a6f5 to f87c320 Compare October 28, 2026 01:51
@feiyang3cat
feiyang3cat force-pushed the fx/time-skipping-cli branch 2 times, most recently from d184b9f to 90eb7d5 Compare October 28, 2026 02:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 90eb7d5062

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread internal/devserver/time_skipping_config.go Outdated
--namespace YourNamespace \
--workflow-id YourWorkflowId \
--fast-forward-duration 5h
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
```
```
Once enabled, the workflow execution clock fast-forwards during inactivity, expediting the completion of timers, retry waits, and start delays.

- name: temporal workflow time-skipping
summary: Manage Workflow time skipping (Experimental)
description: |
Manage Workflow time skipping.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
Manage Workflow time skipping.
Manage Workflow time skipping, where a workflow's virtual clock fast-forwards when idle. Use time skipping in testing environments to efficiently evaluate the behavior of a workflow with extended periods of inactivity.
Note: This is an experimental feature and may change in the future.

- name: temporal schedule time-skipping
summary: Manage Schedule time skipping (Experimental)
description: |
Manage Schedule time skipping.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
Manage Schedule time skipping.
Manage Schedule time skipping, where a schedule's virtual clock fast-forwards when idle. Use time skipping in testing environments to efficiently evaluate the behavior of a schedule.
Note: This is an experimental feature and may change in the future.

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