Skip to content

fix(workflow-core): reuse only completed workflow executions - #2700

Merged
kang-heewon merged 2 commits into
trunkfrom
fix/2660-workflow-reuse
Sep 8, 2026
Merged

kang-heewon merged 2 commits into
trunkfrom
fix/2660-workflow-reuse

Conversation

@kang-heewon

@kang-heewon kang-heewon commented Sep 8, 2026

Copy link
Copy Markdown
Member

Summary

Workflow replays return cached success only when the stored execution is completed. Duplicate pending or running invocations raise a conflict Problem. Failed or timed-out executions raise a non-retryable failure Problem while retaining the original persisted failure and its retryability. Cancelled executions, missing failure records, and foreign retrying records reject explicitly.

Existing matching retry resumption and completed-step reuse remain intact. Both public Problems are covered by API snapshots, generated registries, recovery guidance, API documentation, and patch changesets.

Closes #2660

Validation

Elevated profile for concurrency, idempotency, retry semantics, and public Problem contracts.

  • Negative controls: seven expected failures before the reuse fix; three expected failures before the terminal retryability fix.
  • Workflow suite: 84 passed; package typecheck and lint passed.
  • Full build, typecheck, and test: 243/243 tasks passed each. A terminated typecheck session was rerun successfully.
  • Documentation static build: 5,561 pages.
  • Independent code-reviewer and verifier: PASS for the final authored revision.
  • Committed-diff PR companion: PASS, including architecture, public API, Problem registry, documentation triggers, and the full repository policy gate with benchmarks.

Head: 99e9656d4ae8413e2ea080c14346dde590ba0b04. Validation base: 98fcaed613d648bde489686c5f1ae622f59070cd.

Visual evidence

Generated documentation, stable built preview, 1440 × 1000. All six routes returned HTTP 200 with no console/page errors or horizontal overflow.

/api/problems-core/src/classes/problem/ — new workflow Problems in subclass list

new workflow Problems in subclass list, 1440 × 1000

/api/problems-core/src/variables/croco_problem_code_registry/ — terminal workflow failure is not retryable

terminal workflow failure is not retryable, 1440 × 1000

/api/workflow-core/src/classes/workflowexecutionfailedproblem/ — new public Problem constructor

new public Problem constructor, 1440 × 1000

/api/workflow-core/src/classes/workflowexecutioninprogressproblem/ — new public Problem constructor

new public Problem constructor, 1440 × 1000

/en/reference/problem-recovery-cookbook/#workflow-core-workflow-execution-failed — failed execution recovery section

failed execution recovery section, 1440 × 1000

/en/reference/problem-recovery-cookbook/#workflow-core-workflow-execution-in-progress — in-progress execution recovery section

in-progress execution recovery section, 1440 × 1000

CI and integration evidence

Current head is 99e9656d4ae8413e2ea080c14346dde590ba0b04. The normal pre-push test and guarded typecheck hooks passed. CI run 34191519443 passed the required validate, repository-contracts, and docs-sync-check gates. The benchmark gate and companion also passed. All selected CI gates are complete.

The sole actionable review thread was fixed, replied to with regression evidence, and resolved. No requested changes or review requests remain. GitHub reports no merge conflict.

Current base advanced to c2a26539a965065486813fda9462a0bae6d82212. The cumulative changes cover auth tenant claims, customer-health schema indexes, and Meilisearch document keys with separate docs/tests; inspection found no interaction with workflow reuse, execution persistence, the modified Problem contracts, or their generated artifacts. The dry-run companion retains the same issue scope; prior applicable gates are reused. No rebase was performed. GitHub candidate bda5613139d9ac0c4a64b59a3f68c9d6cda9b063 has this base and the validated head as parents; its tree differs only by those inspected base changes.

All six GitHub-hosted images were verified decoded and visible in the PR at 1440 × 1000. The two changed recovery/registry surfaces explicitly show not-retryable; four unchanged surfaces reuse byte-identical documentation evidence.

Final convergence: all four GitHub-required checks passed on head 99e9656d4ae8413e2ea080c14346dde590ba0b04. Current base is 98b1a1792bc422912b18c873c7da9d217654e709; the additional billing webhook/order-store changes have no workflow/execution consumers or changes to the modified Problem contracts. Cumulative base drift remains non-interacting; no rebase or duplicate full validation was needed. No unresolved review threads, requested changes, or merge conflicts remain.

The optional coverage-security shadow failed on unbuilt @croco/ratelimit-core imports in eight unchanged HTTP suites (393 tests passed); the affected problems-core suite passed119 tests. The optional split-validation-shadow failure aggregates that failure and its skipped dependent coverage warning. Both failures were inspected and are not counted as passing. Required validate passed independently, including its blocking checks. These shadow failures do not affect the selected workflow contract or the ordinary merge policy.

Copilot AI lite review requested due to automatic review settings September 8, 2026 03:22

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 8, 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-09-08T03:27:26.078415Z 1e54f1a PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: b79fd0ad-cc70-4368-8f9c-814fb7ce45ba

📥 Commits

Reviewing files that changed from the base of the PR and between 98fcaed and 1e54f1a.

⛔ Files ignored due to path filters (1)
  • packages/problems-core/src/generated/problem-code-registry.ts is excluded by !**/generated/**
📒 Files selected for processing (13)
  • .changeset/calm-workflows-reject-phantom-success.md
  • docs/problem-code-registry.json
  • packages/docs/src/content/docs/api/problems-core/src/classes/Problem.md
  • packages/docs/src/content/docs/api/problems-core/src/variables/CROCO_PROBLEM_CODE_REGISTRY.md
  • packages/docs/src/content/docs/api/workflow-core/src/classes/WorkflowExecutionFailedProblem.md
  • packages/docs/src/content/docs/api/workflow-core/src/classes/WorkflowExecutionInProgressProblem.md
  • packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
  • packages/workflow-core/src/index.ts
  • packages/workflow-core/src/libs/WorkflowRunner.ts
  • packages/workflow-core/src/libs/problems/WorkflowProblems.ts
  • packages/workflow-core/src/tests/WorkflowCore.spec.ts
  • public-api-surface.snapshot.json
  • scripts/problem-registry.mts

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


Important

Approval pending

CodeRabbit has no unresolved comments, but it could not review the latest commit because the review limit was reached. Follow the review guidance in this comment to continue.

📝 Walkthrough

Walkthrough

WorkflowRunner는 completed 실행만 재사용합니다. pending 또는 running 실행에는 충돌 Problem을, failed 또는 timed_out 실행에는 실패 Problem을 발생시킵니다. 새 Problem 코드와 공개 API, 테스트, 복구 문서를 추가했습니다.

Changes

워크플로 실행 재사용

Layer / File(s) Summary
실행 상태 Problem 계약
packages/workflow-core/src/libs/problems/WorkflowProblems.ts, packages/workflow-core/src/index.ts, public-api-surface.snapshot.json, packages/docs/src/content/docs/api/...
WorkflowExecutionInProgressProblemWorkflowExecutionFailedProblem을 추가하고 공개 API와 API 문서에 반영했습니다.
재사용 상태 분기와 테스트
packages/workflow-core/src/libs/WorkflowRunner.ts, packages/workflow-core/src/tests/WorkflowCore.spec.ts, .changeset/calm-workflows-reject-phantom-success.md
completed 상태만 재사용합니다. pendingrunning 상태는 충돌 Problem을 발생시킵니다. failedtimed_out 상태는 저장된 실패 정보를 포함한 Problem을 발생시킵니다. 기타 상태는 invalidStateTransition을 발생시킵니다. 관련 테스트와 changeset을 갱신했습니다.
Problem 레지스트리와 복구 문서
scripts/problem-registry.mts, docs/problem-code-registry.json, packages/docs/src/content/docs/en/reference/problem-recovery-cookbook.md
두 Problem 코드의 복구 메타데이터, 레지스트리 항목, 소스 참조, 복구 쿡북 내용을 추가하거나 갱신했습니다.

Priority: ⬆️ High — Impact reflects high issue severity.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Severity of issue fixed: High

Merge Risk: ⚪ Minimal · up to 1e54f

Duplicate workflow invocations now reuse only completed results; active executions return a conflict and failed executions retain failure details. The changed behavior and public Problem contracts are covered without an actionable current-head risk.

Sequence Diagram(s)

sequenceDiagram
  participant WorkflowCaller
  participant WorkflowRunner
  participant ExecutionManager
  WorkflowCaller->>WorkflowRunner: 멱등성 키로 execute 요청
  WorkflowRunner->>ExecutionManager: 기존 실행 상태 조회
  ExecutionManager-->>WorkflowRunner: 상태와 결과 또는 실패 정보 반환
  alt completed
    WorkflowRunner-->>WorkflowCaller: reused 결과 반환
  else pending 또는 running
    WorkflowRunner-->>WorkflowCaller: workflow-execution-in-progress 발생
  else failed 또는 timed_out
    WorkflowRunner-->>WorkflowCaller: workflow-execution-failed 발생
  else 기타 상태
    WorkflowRunner-->>WorkflowCaller: execution/invalid-state-transition 발생
  end
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed #2660의 요구사항을 충족합니다. completed 실행만 재사용하고, pending 또는 running 실행은 충돌 Problem으로 거부하며, failed 또는 timed_out 실행은 실패 정보를 보존합니다. 관련 테스트도 상태별 거부 코드와 재사용 동작을 검증합니다.
Out of Scope Changes check ✅ Passed 변경 사항은 #2660과 PR 목표에 관련된 WorkflowRunner 멱등성 처리, 공개 Problem 타입, 레지스트리, 복구 문서, API 문서 및 테스트로 구성됩니다. Saga 보상 상태 머신 변경과 같은 무관한 변경은 확인되지 않습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 5…
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 완료된 워크플로 실행만 재사용하도록 변경한 PR의 주요 목적을 정확하고 간결하게 설명합니다.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2660-workflow-reuse

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.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

📊 Benchmark Results

✅ All benchmarks passed

Benchmark p75 Threshold Baseline vs Baseline Status Notes
CrocoApp constructor 62.4μs 30.0ms 8.2μs +663.8% -
CrocoApp lambdaHandler (10 controllers) 2.2ms 50.0ms 258.4μs +765.7% -
Lambda cold-start simulation 2.0ms 80.0ms 418.1μs +375.1% -
Lambda cold-start with headers 1.7ms 80.0ms 369.7μs +355.6% -
Lambda cold-start with binary body 1.6ms 80.0ms 339.1μs +365.4% -
Lambda cold-start with query params 1.5ms 80.0ms 301.3μs +410.5% -
Lambda cold-start with authorizer context 1.5ms 80.0ms 299.8μs +414.4% -
Lambda cold-start realistic scenario 1.5ms 80.0ms 299.2μs +416.9% -
EventBusConfig.start (10 handlers) 1.6μs 10.0ms 1.4μs +14.0% -
EventPublisher.publishNow single event 1.8μs 2.0ms 1.7μs +6.5% -
DefaultHandlerResolver.resolve × 10 0.1μs 5.0ms 0.1μs +1.3% -
Container.get singleton (cold) 93.7μs 5.0ms 70.3μs +33.3% -
Container.register × 50 components 3.2ms 10.0ms 3.2ms -1.8% -
Container.validate (50 components) 3.9ms 20.0ms 3.4ms +15.1% -
Container.get singleton (warm) 1.4μs 500.0μs 1.6μs -17.1% -
TelemetryRuntime.init (lambda preset) 12.9μs 200.0ms 1.1ms -98.8% -
lambdaPreset config creation 1.5μs 2.0ms 1.4μs +2.8% -

Updated: 2026-09-08T05:43:31.778Z · Commit: 99e9656

@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: 1e54f1a5e2

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/workflow-core/src/libs/problems/WorkflowProblems.ts Outdated
@kang-heewon
kang-heewon merged commit 1d12013 into trunk Sep 8, 2026
19 of 21 checks passed
@kang-heewon
kang-heewon deleted the fix/2660-workflow-reuse branch September 8, 2026 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants