Skip to content

test(worker): exercise Temporal workflows and gate saved-history replay - #105

Closed
rcnv55987r-code wants to merge 1 commit into
oll4com:mainfrom
rcnv55987r-code:bounty/temporal-workflow-replay
Closed

rcnv55987r-code wants to merge 1 commit into
oll4com:mainfrom
rcnv55987r-code:bounty/temporal-workflow-replay

Conversation

@rcnv55987r-code

@rcnv55987r-code rcnv55987r-code commented Oct 16, 2026 •

Copy link
Copy Markdown

Addresses #60.

The mocked workflow tests do not exercise Temporal signal ordering, durable timers, child cancellation, or replay compatibility. This adds 27 tests using real time-skipping servers and the eight production workflow implementations, plus 26 synthetic recorded histories replayed against the current bundle. A deliberately incompatible dummy workflow must fail with DeterminismViolationError.

Coverage includes activity retries and failures, dot wake/timeout and continue-as-new, memory maintenance/consolidation/mutation, current and pre-patch supervisors, signal races, active-child cancellation, 50-turn and 250-poll continuation, and bounded carried queues. A guarded test-only loader records the actual legacy branch; replay always uses unmodified current source. Production workflow behavior is unchanged.

The fixture README documents recording and retaining historical evidence; CI never regenerates fixtures. A dedicated Ubuntu job enforces a 180-second limit on the new suite and also runs existing worker tests. Existing worker/public test commands include the suite.

Validation at babb6c5:

  • Green Ubuntu 24.04 / Node 22.23.0 CI run: all 27 new tests passed in 52.36 seconds, including cold test-server startup, recorded-history replay and the negative determinism control.
  • All 215 existing worker tests passed separately in 12.38 seconds on the same runner. Worker dependency builds and typecheck passed.
  • Windows / Node 22.23.3: all 27 new tests and strict TypeScript checking of the tests passed. Full worker run had 231 passes and 11 existing failures; excluding the new suite reproduced the same 11 failures. Those failures did not occur on Ubuntu.
  • Repository-wide check/test/build have not been validated on Linux by this contribution's focused job. Local Windows root checks encounter CRLF document comparison, POSIX assumptions and gateway absolute-entry-point handling; a full repository pass is not claimed.

AI assistance: Codex implemented, inspected, and executed the tests. The submitting person has reviewed the contribution and confirmed it should be marked ready for review.

Summary by CodeRabbit

  • Tests
    • Added automated checks that replay saved workflow histories and verify workflow behavior across retries, failures, signals, cancellations, and long-running processes.
    • Added coverage for detecting incompatible workflow changes.
  • Chores
    • Added a pull request and push workflow to run worker checks automatically.
  • Documentation
    • Added guidance for recording and replaying workflow histories.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d2bd078-ea34-4b86-aecb-580e34c3f292
📥 Commits

Reviewing files that changed from the base of the PR and between 8a3e1f0 and babb6c5.

⛔ Files ignored due to path filters: 1
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing: 36
  • .github/workflows/temporal-workflows.yml
  • apps/worker/package.json
  • apps/worker/tests/fixtures/workflow-histories/README.md
  • apps/worker/tests/fixtures/workflow-histories/action-failure-patch.json
  • apps/worker/tests/fixtures/workflow-histories/dot-continued.json
  • apps/worker/tests/fixtures/workflow-histories/dot-signal.json
  • apps/worker/tests/fixtures/workflow-histories/dot-timeout.json
  • apps/worker/tests/fixtures/workflow-histories/dummy-turn-retry.json
  • apps/worker/tests/fixtures/workflow-histories/memory-consolidation-mutation.json
  • apps/worker/tests/fixtures/workflow-histories/memory-consolidation-no-change.json
  • apps/worker/tests/fixtures/workflow-histories/memory-maintenance.json
  • apps/worker/tests/fixtures/workflow-histories/memory-mutation-failure.json
  • apps/worker/tests/fixtures/workflow-histories/memory-mutation-retry.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-allocation-send-verification.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-bounded-carried-queue.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-current-250-polls.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-current-50-turns.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-current-stop.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-legacy-250-polls.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-legacy-50-turns.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-legacy-settle.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-legacy-stop.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-prepared-continued.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-prepared-follow-up.json
  • apps/worker/tests/fixtures/workflow-histories/supervisor-prepared-stop.json
  • apps/worker/tests/fixtures/workflow-histories/turn-cli-claude.json
  • apps/worker/tests/fixtures/workflow-histories/turn-codex.json
  • apps/worker/tests/fixtures/workflow-histories/turn-exhausted.json
  • apps/worker/tests/fixtures/workflow-histories/turn-opencode.json
  • apps/worker/tests/room-continuation-fixture.ts
  • apps/worker/tests/temporal-workflows.test.ts
  • apps/worker/tests/temporal/harness.ts
  • apps/worker/tests/temporal/historical-workflow-loader.cjs
  • apps/worker/tests/temporal/incompatible-workflows.ts
  • apps/worker/tests/temporal/record-histories.mjs
  • apps/worker/tests/temporal/workflows.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

The pull request adds Temporal workflow tests for worker workflows, saved history fixtures, history recording and replay support, and a dedicated GitHub Actions workflow.

Changes: Temporal workflow testing

Layer / File(s) Summary
Test harness and workflow registration
apps/worker/package.json, apps/worker/tests/temporal/{harness.ts,workflows.ts,historical-workflow-loader.cjs}
Adds a test harness that bundles current and legacy workflows, runs workers and scenarios, and optionally saves sanitized histories. The test worker re-exports production workflows.
Turn, goal, and action workflows
apps/worker/tests/temporal-workflows.test.ts, apps/worker/tests/fixtures/workflow-histories/{dot-*,dummy-turn-retry.json,turn-*,action-failure-patch.json}
Adds tests and saved histories for turn retries and failures, dot-goal signals and timeouts, and background-action failure handling.
Memory workflow coverage
apps/worker/tests/temporal-workflows.test.ts, apps/worker/tests/fixtures/workflow-histories/memory-*
Adds tests and saved histories for memory maintenance, consolidation, and mutation, including retry and failure cases.
Supervisor orchestration coverage
apps/worker/tests/temporal-workflows.test.ts, apps/worker/tests/room-continuation-fixture.ts, apps/worker/tests/fixtures/workflow-histories/supervisor-*
Adds tests and saved histories for supervisor queueing, stop and follow-up signals, continuation preparation, legacy settling, and continue-as-new behavior.
History recording, replay, and CI
apps/worker/package.json, apps/worker/tests/temporal/{record-histories.mjs,incompatible-workflows.ts}, apps/worker/tests/temporal-workflows.test.ts, apps/worker/tests/fixtures/workflow-histories/README.md, .github/workflows/temporal-workflows.yml
Adds a history-recording command, replay and incompatibility tests, fixture documentation, and a CI workflow that runs Temporal tests and remaining worker tests.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Merge Risk: ⚪ Minimal · up to babb6

This change adds Temporal workflow tests, saved-history replay checks, and a CI job without changing production workflow code. It poses no merge risk to runtime behavior.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 7 files. (25 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main changes: adding Temporal workflow tests and enforcing saved-history replay in CI.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 7 files. (25 skipped: 25 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

  • Fix all pre-merge checks with AI
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rcnv55987r-code
rcnv55987r-code marked this pull request as ready for review October 16, 2026 15:37
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.

1 participant