Skip to content

fix(webapp): downgrade retryable directory-sync effect failures to warn#4200

Open
0ski wants to merge 1 commit into
mainfrom
oskar/fix-dsync-role-serialization
Open

fix(webapp): downgrade retryable directory-sync effect failures to warn#4200
0ski wants to merge 1 commit into
mainfrom
oskar/fix-dsync-role-serialization

Conversation

@0ski

@0ski 0ski commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Directory-sync effects are idempotent and the accounts-webhook worker retries
the whole event, so a single failed attempt (typically a role assignment
losing a serializable race during a backfill burst) is self-healing rather
than alert-worthy. Tag those thrown errors with logLevel "warn" so the worker
logs at warn instead of error, keeping them visible for triage without paging.

Directory-sync effects are idempotent and the accounts-webhook worker retries
the whole event, so a single failed attempt (typically a role assignment
losing a serializable race during a backfill burst) is self-healing rather
than alert-worthy. Tag those thrown errors with logLevel "warn" so the worker
logs at warn instead of error, keeping them visible for triage without paging.
@changeset-bot

changeset-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0ec12d5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds a helper function, retryableEffectError, in directorySyncEffects.server.ts that creates an Error object tagged with logLevel: "warn". This helper replaces plain Error throws in two failure paths within the applyEffect switch: the "provision" role overwrite failure and the "set_role" failure, changing the logging severity of these thrown errors used in the worker retry flow. No exported or public entity signatures are changed.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, but it does not follow the repository template or include the required issue, testing, changelog, or screenshots sections. Add the template sections: Closes #..., checklist items, testing steps, changelog summary, and screenshots or note if none.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly describes the main change: downgrading retryable directory-sync failures to warn.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch oskar/fix-dsync-role-serialization

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.

@0ski 0ski marked this pull request as ready for review July 9, 2026 12:25

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Comment on lines +14 to +24
// Directory-sync effects are idempotent and the accounts-webhook worker retries
// the whole event (maxAttempts: 5). A single failed attempt is therefore an
// expected, self-healing condition rather than an alert-worthy error — the most
// common case is a role assignment losing a serializable race during a backfill
// burst (the plugin already retries that internally; the worker retry mops up
// the rest). Tag the thrown error with `logLevel: "warn"` so the worker logs it
// at warn instead of error (see redis-worker `processItem`), keeping it visible
// for triage without paging as an error on every transient retry.
function retryableEffectError(message: string): Error {
return Object.assign(new Error(message), { logLevel: "warn" as const });
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 DLQ escalation also respects the warn log level

When the redis-worker exhausts all retry attempts and moves the item to the dead-letter queue, it also checks errorLogLevel and logs at warn instead of error (packages/redis-worker/src/worker.ts:812-814 for batch items, packages/redis-worker/src/worker.ts:971-975 for single items). This means that even a permanently failing directory-sync effect (e.g., a role that was deleted between retries) will only log at warn when it hits the DLQ. If permanent failures should escalate to error-level alerting after exhausting retries, this would need the worker to distinguish transient vs. permanent, or the logLevel approach would need to be applied per-attempt rather than on the error object. Worth confirming this is the desired behavior for the DLQ case.

Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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