Skip to content

Conversation

@cruzdanilo
Copy link
Member

@cruzdanilo cruzdanilo commented Feb 2, 2026


Open with Devin

Summary by CodeRabbit

  • Bug Fixes

    • Improved error handling and recovery for proposal queue and withdrawal processing, reducing failed/blocked operations.
    • Added retry tracking to improve reliability of retries.
  • New Features

    • Withdraw completions now trigger notification delivery and improved receiver resolution (ENS and token info).
  • Chores

    • Enhanced instrumentation and tracing for proposal and withdrawal flows to aid diagnostics.

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2026

🦋 Changeset detected

Latest commit: 8b9feb6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@exactly/server Patch

Not sure what this means? Click here to learn what changesets are.

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

@cursor
Copy link

cursor bot commented Feb 2, 2026

PR Summary

Medium Risk
Touches queue processing and error-recovery paths for on-chain proposal/withdraw execution; changes are mostly instrumentation but introduce new message fields and rescheduling behavior that could affect processing if mis-handled.

Overview
Adds a patch changeset for @exactly/server.

Enriches Sentry span instrumentation for Redis-backed proposal/withdraw queues in server/hooks/block.ts: adds standard messaging.* attributes (system, operation type, body size, retry count, receive latency), scopes processing spans with per-account user/tag context via withScope, and introduces a mutex-acquisition span for proposal processing.

Adds a retryCount field to serialized Proposal/Withdraw messages and propagates it when rescheduling idle proposals on NotNext, while also attaching richer error contexts (including retry count) to captured exceptions.

Written by Cursor Bugbot for commit 8b9feb6. This will update automatically on new commits. Configure here.

@gemini-code-assist
Copy link

Summary of Changes

Hello @cruzdanilo, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Sentry instrumentation for the server's proposal and withdraw queue processing. It introduces more granular tracing details, ensures proper trace context propagation across asynchronous operations, and adds retry count tracking for improved error monitoring and debugging. These changes provide a clearer picture of message lifecycle and potential issues within the queue system.

Highlights

  • Enhanced Sentry Instrumentation: More detailed Sentry span attributes are added for proposal and withdraw queue operations, including messaging system, operation type, message body size, and retry count.
  • Trace Context Propagation: Sentry trace and baggage information are now explicitly captured and propagated with Withdraw and Proposal objects, ensuring end-to-end tracing for queue messages.
  • Retry Count Tracking: A retryCount field has been introduced to Proposal and Withdraw schemas and is used in Sentry contexts, allowing better visibility into transient errors and retries.
  • Code Refactoring for Clarity and Scope: The scheduleMessage and scheduleWithdraw functions have been refactored into processProposal and processWithdraw helper functions, wrapped with withScope for better Sentry context management.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Walkthrough

Adds per-account OpenTelemetry spans and messaging metadata to proposal and withdrawal scheduling and processing in block hooks; introduces retryCount on Proposal/Withdraw, refactors processing into scoped flows with mutex/nonce handling, enhanced error paths for NotNext/ContractFunctionExecutionError/PreExecHookReverted, and notification resolution.

Changes

Cohort / File(s) Summary
Release metadata
\.changeset/better-bobcats-stay.md
Patch changeset for @exactly/server documenting the instrumentation and behavioral changes.
Proposal & withdrawal processing and instrumentation
server/hooks/block.ts
Refactored scheduling/processing into scoped per-account flows; added OpenTelemetry messaging attributes (messaging.system, messaging.operation, messaging.destination.name, messaging.message.id, messaging.message.body.size, receive latency, retry counts); added retryCount to Proposal and Withdraw schemas; added mutex/idle/nonce handling; new error handling for NotNext, ContractFunctionExecutionError, and PreExecHookReverted; added ENS resolution and notification-send span for withdraw completion.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Hook as Block Hook
  participant Tracer as OpenTelemetry
  participant Redis as Redis (message queue)
  participant Worker as Proposal/Withdraw Processor
  participant Chain as Contract Executor
  participant ENS as ENS/Token Resolver
  participant Notifier as Notification Sender

  Hook->>Tracer: start span (withScope, set user/tag)
  Hook->>Redis: enqueue message (withdraw/proposal)
  Hook->>Tracer: add messaging.* attrs (system, op, dest, id, body.size)
  Redis->>Worker: deliver message
  Worker->>Tracer: start processing span (messaging.receive.latency, retryCount)
  Worker->>Chain: execute proposal/withdraw
  alt success
    Chain-->>Worker: tx result
    Worker->>ENS: resolve receiver, token metadata
    Worker->>Notifier: send notification
    Worker->>Tracer: record success attributes
  else NotNext error
    Chain-->>Worker: NotNext
    Worker->>Worker: fetch pending proposals / create idle proposal / reschedule
    Worker->>Tracer: record NotNext handling
  else ContractFunctionExecutionError
    Chain-->>Worker: execution error
    Worker->>Worker: adjust nonce / retry logic
    Worker->>Tracer: record execution error
  else PreExecHookReverted
    Chain-->>Worker: PreExecHookReverted
    Worker->>Worker: mark aborted, prune queue
    Worker->>Tracer: record aborted
  end
  Worker->>Tracer: end span
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: enriching instrumentation for the proposal queue span in the server, which aligns with the substantial messaging tracing metadata enhancements in server/hooks/block.ts.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch trace

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 and usage tips.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the Sentry instrumentation for proposal and withdraw queue processing. It introduces a retryCount for better tracking, adds detailed messaging attributes to spans, and refactors the scheduling logic for improved readability and tracing. These changes significantly improve the observability of the queue processing. I have one suggestion to improve error handling in scheduleWithdraw to make it more robust and consistent with similar logic elsewhere in the file.

Copy link

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

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional flags.

Open in Devin Review

@sentry
Copy link

sentry bot commented Feb 2, 2026

Codecov Report

❌ Patch coverage is 54.54545% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.67%. Comparing base (d237d61) to head (8b9feb6).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
server/hooks/block.ts 54.54% 28 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #715       +/-   ##
===========================================
+ Coverage   44.77%   65.67%   +20.90%     
===========================================
  Files         176      190       +14     
  Lines        5244     6005      +761     
  Branches     1624     1734      +110     
===========================================
+ Hits         2348     3944     +1596     
+ Misses       2783     1881      -902     
- Partials      113      180       +67     
Flag Coverage Δ
e2e 47.26% <46.96%> (+2.49%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@server/hooks/block.ts`:
- Around line 439-452: The ENS lookup can throw and will reject the entire
Promise.all, so wrap the ensClient.getEnsName call to never throw (e.g., change
the Promise.all entry to ensClient.getEnsName({ address: receiver }).catch(() =>
null)) so Promise.all still resolves and sendPushNotification runs; reference
the Promise.all invocation, ensClient.getEnsName, and sendPushNotification in
your change to mirror processProposal's behavior.

Copy link

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

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.

View issue and 4 additional flags in Devin Review.

Open in Devin Review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@cruzdanilo cruzdanilo merged commit 8b9feb6 into main Feb 3, 2026
16 checks passed
@cruzdanilo cruzdanilo deleted the trace branch February 3, 2026 01:17
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