# Review Pull Requests to Temporal Go Workflows for Determinism

Yes. An agent checks out each pull request, runs workflowcheck, the race tests and the replay tests, and posts one review that cites file and line for every finding.

[Run this on Rush](https://cloud.getrush.ai/run/review-pull-requests/temporal/). Opens the console with this prompt ready to send, in a Project that has your repository.

## What the agent does

The agent checks the pull request out in its own cloud sandbox and reads how the repository already checks itself, so the review runs the same commands maintainers trust. In a repository like temporalio/samples-go, `.github/workflows/ci.yml` runs `make ci-build` on Go 1.26, and the `Makefile` defines that target as `staticcheck`, `errcheck`, `workflowcheck`, `bins` and `test`: `workflowcheck -show-pos -config workflowcheck.config.yaml ./...` from `go.temporal.io/sdk/contrib/tools/workflowcheck`, a `go build` of every `main.go`, and `go test -timeout 20s -race` in every directory with a `_test.go` file, with the output collected in `test.log` and the target failing on any `--- FAIL` line. `go.mod` pins `go.temporal.io/sdk v1.49.0`, and `.github/CODEOWNERS` routes everything to the SDK team, with the `nexus*` and `googleadk` samples adding their own owners.

The agent runs those five steps on the branch and then reads the diff with Temporal's rules in mind. Workflow code must be deterministic on replay, so it looks for `time.Now()` instead of `workflow.Now(ctx)`, a `go` statement instead of `workflow.Go`, `time.Sleep` instead of `workflow.Sleep`, iteration over a map whose order reaches a decision, `rand` or `uuid` calls outside an Activity, and a changed order or signature of `ExecuteActivity`, `ExecuteChildWorkflow` or a timer in a workflow that running executions may already be in. `workflowcheck` catches the first group statically; the agent reads its `-show-pos` output and compares it with `workflowcheck.config.yaml`, where the repository lists the `googleadk` and `opentelemetry-v2` declarations it has decided are deterministic by construction, and treats a new entry in that file as a finding that needs a sentence of justification in the pull request.

Replay is the second check. `helloworld/replay_test.go` registers `Workflow` on a `worker.NewWorkflowReplayer` and calls `ReplayWorkflowHistoryFromJSONFile` against `helloworld/helloworld.json`, a history whose first event names `workflowType` `Workflow` on task queue `hello-world`; `multi-history-replay` shows the same against several histories. When a pull request changes a workflow that has a stored history, the agent runs that replay test and reads the result as the answer to whether in-flight executions survive the change. When the changed workflow has no history beside it, the agent says so, and where the sample's `Test_Using_DevServer` pattern applies, it starts the dev server through `testsuite.StartDevServer`, runs the old code to produce a history, and replays the new code against it in the sandbox to confirm a suspicion before writing it down.

Each finding becomes one review comment with the file and line, marked blocking or suggestion: a non-deterministic call in workflow code, a changed workflow signature without `workflow.GetVersion`, a new sample without a `_test.go` when `README.md` promises that each sample comes with tests, an Activity whose `StartToCloseTimeout` was removed, or a `README.md` left behind when a sample's `starter` or `worker` command changed. The review summary quotes the `staticcheck`, `errcheck`, `workflowcheck` and `go test -race` output. The agent pushes nothing to the branch; a test it wrote to confirm a finding stays in the sandbox and is quoted in the comment.

## Start it with one API call

`POST https://api.phoenix.so/o/{org}/sessions`

```json
{
  "agent": "claude",
  "input": "Review this pull request to a repository of Temporal Go workflows. Check it out and run the Makefile's ci-build steps: staticcheck, errcheck, workflowcheck with the repository's workflowcheck.config.yaml, a build of every main.go, and go test -race in every test directory. Read the diff for workflow determinism: time, sleep, goroutines, random values and map iteration used in workflow code instead of the workflow package's equivalents, changed activity or child workflow order or signatures without GetVersion, and new entries in the workflowcheck config without a reason. Run any replay test beside a changed workflow; if you suspect a replay break and there is no history, produce one with the dev server in your sandbox and replay the new code against it. Post one GitHub review that quotes the command output, separates blocking issues from suggestions and cites file and line for every finding. Do not push commits.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app/pull/42"
    }
  ]
}
```

1. **Get an API key.** In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
2. **Send the request.** POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
3. **Read what came back.** Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

## What comes back

What comes back is a review on the pull request. Its summary quotes the `staticcheck`, `errcheck` and `workflowcheck -show-pos` output and the `go test -race` lines for each package the change touched, including any replay test that ran and its result. Findings follow as inline comments with file and line, each marked blocking or suggestion, and a determinism finding names the workflow function, the call that breaks replay, and the `workflow` package call that replaces it.

The run's record keeps every command with its output, the dev server start and the history the agent produced when it needed one, so when the review says a changed workflow fails replay against its own history, the replayer's error is in the record and not only in the comment.

Before merging, a reviewer confirms each blocking comment against the cited line, runs `make ci-build` on the branch, and decides on the one call the agent cannot make: whether a signature change is safe because no execution of that workflow is in flight, which only someone who knows the deployments can say.

## Run it on every pull request opened

Create an automation in the Project with a `github` trigger on `pull_request.opened` and `pull_request.synchronize`, `branch_patterns` set to `main`, and this prompt. The trigger adds the pull request after the prompt, so every pull request and every push to it gets its own sandbox, its own Go module cache, its own dev server when one is needed, and its own review, and a `read_only` automation comments without pushing.

The review is the result on the pull request and the run is listed in the Project. `.github/dependabot.yml` keeps `open-pull-requests-limit: 0` for the Go modules and a two-week `cooldown`, so the pull requests that reach this automation are the ones people write, and `max_runs_per_hour` bounds a busy day; a fire past the cap is skipped as `rate_limited` and that pull request is reviewed on its next push.

## Why run it on Rush?

A determinism bug in a Temporal workflow does not fail on the author's laptop. It fails later, when a worker running the new code replays a history written by the old code, and by then the execution is stuck. The checks that catch it before merge, `workflowcheck`, replay tests and a dev server to produce a history, are exactly the checks a tired reviewer skips. The agent runs them on every pull request and quotes their output.

Each review happens in a sandbox with its own module cache and its own Temporal dev server, so three pull requests opened in an hour are three reviews in parallel and none of them touch a shared environment. The full record of every command stays with the run, and the branch itself is never pushed to.

## Frequently asked questions

### Will the review catch a change that breaks running workflows?

When a replay test with a stored history exists beside the workflow, yes, and the review quotes the replayer's error. When none exists, the agent can start the dev server in its sandbox, run the old code to record a history and replay the new code against it, and the review says when it did that. Whether an execution of that workflow is actually in flight in your deployments is still your call.

### Does it push fixes or add tests to my branch?

No. The automation is `read_only` and the prompt says not to push. A test the agent wrote to confirm a finding runs in the sandbox and is quoted in the comment, so the author can add it themselves.

### What about the workflowcheck allow list?

The repository's `workflowcheck.config.yaml` lists declarations it has decided are deterministic by construction, with a comment explaining why for each group. A pull request that adds an entry gets a comment asking for the same kind of reason, because an entry there silences the checker for everyone.

### Does it need a Temporal server?

Only for the replay check when no history exists, and then it uses the dev server that `go.temporal.io/sdk/testsuite` starts inside the sandbox, as `Test_Using_DevServer` in the hello world sample does. Nothing connects to your Temporal cluster or Temporal Cloud.

## More Temporal jobs

- [Upgrade npm Dependencies in a Temporal TypeScript Project](https://getrush.ai/run/upgrade-npm-dependencies/temporal/)
- [Write Tests for Temporal TypeScript Workflows That Have None](https://getrush.ai/run/write-workflow-tests/temporal/)
- [Add Activity Heartbeats to a Temporal Workflow](https://getrush.ai/run/add-activity-heartbeats/temporal/)

## The same job on other stacks

- [Review Pull Requests on a Turborepo Monorepo](https://getrush.ai/run/review-pull-requests/turborepo/)
- [Review Pull Requests on a Typer CLI](https://getrush.ai/run/review-pull-requests/typer/)
- [Review Every Pull Request on a VS Code Extension Repository](https://getrush.ai/run/review-pull-requests/vscode-extension/)

## Keep reading

- [How a Rush run works on your repository, from request to pull request](https://getrush.ai/cloud/)
- [Compare cloud agents, agent sandboxes and AI code review](https://getrush.ai/compare/)
- [Rush pricing: Free, Pro and Max](https://getrush.ai/pricing/)
