Skip to content

fix(workflow-executor): retry 404 in markSucceeded/markFailed (PRD-392)#1595

Merged
Scra3 merged 8 commits into
feat/prd-214-server-step-mapperfrom
fix/prd-392-activity-log-retry-404
May 27, 2026
Merged

fix(workflow-executor): retry 404 in markSucceeded/markFailed (PRD-392)#1595
Scra3 merged 8 commits into
feat/prd-214-server-step-mapperfrom
fix/prd-392-activity-log-retry-404

Conversation

@Scra3
Copy link
Copy Markdown
Member

@Scra3 Scra3 commented May 26, 2026

Summary

  • withRetry gains an optional retry404 flag (default false) — when true, 404 responses are treated as transient and retried with the existing 100/500/2000 ms backoff
  • markSucceeded and markFailed pass retry404: true to absorb eventual-consistency 404s on updateActivityLogStatus
  • Error log labels lose the misleading "after retries" suffix (was "failed after retries", now just "failed")

Why

When a step completes very quickly (condition, guidance), markSucceeded/markFailed can fire a few ms after createActivityLog. The server returns 404 if the record isn't yet visible on the read path. withRetry didn't retry 404s, so the call failed silently with a misleading log. createPending is intentionally left unchanged — a 404 there is a genuine error.

Test plan

  • with-retry.test.ts: 404 without flag → immediate throw; 404 with flag → full backoff; 404 with flag → success on 2nd attempt
  • forestadmin-client-activity-log-port.test.ts: markSucceeded and markFailed retry on 404; log message is "Activity log mark* failed" (no "after retries")

fixes PRD-392

🤖 Generated with Claude Code

Note

Retry 404 responses in markSucceeded and markFailed activity log calls

  • Adds HTTP 404 to the RETRYABLE_STATUS set in with-retry.ts, so transient 404s from the Forest Admin API are retried alongside 408, 429, 5xx errors.
  • Retry log entries now include the HTTP status code of the triggering error.
  • Updates error log message text in forestadmin-client-activity-log-port.ts for consistency across createPending, markSucceeded, and markFailed.
  • Behavioral Change: 404 responses in any withRetry-wrapped call are now retried up to the configured retry limit instead of failing immediately.

Changes since #1595 opened

  • Removed HTTP 404 from the default set of retryable statuses in withRetry and added an extraRetryStatuses parameter to allow callers to opt-in to retrying additional HTTP status codes including 404 [a9faf2d]
  • Added HTTP 404 to extraRetryStatuses in ForestadminClientActivityLogPort.markSucceeded and ForestadminClientActivityLogPort.markFailed methods to retry when updateActivityLogStatus returns 404 [a9faf2d]
  • Changed retry logging level from logger.info to logger.warn in the withRetry function [a9faf2d]
  • Updated test expectations to reflect that HTTP 404 errors are no longer retried by default and that retry logs are emitted at warn level instead of info level [a9faf2d]

Macroscope summarized 2d0c033.

…le eventual consistency

Server may return 404 on updateActivityLogStatus called too quickly after
createActivityLog — the record is not yet visible on the read path.
Add retry404 option to withRetry (default false, only active for mark methods).
Also removes misleading "after retries" suffix from error log labels.

fixes PRD-392

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented May 26, 2026

PRD-392

…istency

Simpler than a per-caller flag: 404 is now retried everywhere.
Callers that hit a genuine 404 still get the error after exhausting retries.

fixes PRD-392

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qltysh
Copy link
Copy Markdown

qltysh Bot commented May 26, 2026

Qlty


Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
...-executor/src/adapters/forestadmin-client-activity-log-port.ts100.0%
Coverage rating: A Coverage rating: A
packages/workflow-executor/src/adapters/with-retry.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

alban bertolini and others added 5 commits May 26, 2026 15:54
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…reatePending)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, stronger assertions, createPending 404 test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…re critical

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…failure

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…raRetryStatuses

Eventual consistency: updateActivityLogStatus can 404 when called
immediately after createActivityLog (record not yet visible on read
path). Pass extraRetryStatuses: [404] to withRetry only for mark
calls — createPending 404 stays a hard failure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Scra3 Scra3 merged commit 15c1425 into feat/prd-214-server-step-mapper May 27, 2026
30 checks passed
@Scra3 Scra3 deleted the fix/prd-392-activity-log-retry-404 branch May 27, 2026 13:26
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