Skip to content

Document accept backoff configuration#292

Merged
leynos merged 2 commits intodevin/1754663283-configurable-backoff-parametersfrom
codex/review-unresolved-comments-on-pr-290
Aug 8, 2025
Merged

Document accept backoff configuration#292
leynos merged 2 commits intodevin/1754663283-configurable-backoff-parametersfrom
codex/review-unresolved-comments-on-pr-290

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Aug 8, 2025

Summary

  • remove stray comments from accept delay examples
  • document accept loop backoff and BackoffConfig in server guide
  • clarify exponential backoff test naming

Testing

  • make fmt
  • make lint
  • make test
  • make markdownlint
  • make nixie (fails: Error running command mmdc -p /tmp/tmpm31eo4p1.json -i /tmp/tmpap7_ciod/async_stream_2.mmd -o /tmp/tmpap7_ciod/async_stream_2.svg for file 'examples/async_stream.md' (diagram 2): Error: Failed to launch the browser process! /root/.cache/puppeteer/chrome-headless-shell/linux-131.0.6778.204/chrome-headless-shell-linux64/chrome-headless-shell: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory)

https://chatgpt.com/codex/tasks/task_e_68963277cb6c83228122a225eebbf642

Summary by Sourcery

Document the accept loop backoff configuration in the server guide, clean up stray example comments, and clarify the exponential backoff test naming

Documentation:

  • Add a new server configuration guide detailing the accept loop exponential backoff and BackoffConfig
  • Update the documentation table of contents to link to the server configuration guide

Tests:

  • Rename the exponential backoff behavior test to test_accept_exponential_backoff_doubles_and_caps for clarity

Chores:

  • Remove stray placeholder comments from the accept delay code examples

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 8, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/review-unresolved-comments-on-pr-290

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Aug 8, 2025

Reviewer's Guide

Cleaned up stray comments in server builder examples, added a dedicated server configuration guide for accept loop backoff using BackoffConfig, and renamed the exponential backoff behavior test for clarity.

Class diagram for BackoffConfig and WireframeServer accept backoff configuration

classDiagram
    class WireframeServer {
        +accept_backoff(initial_delay: Duration, max_delay: Duration) : Self
        +accept_initial_delay(delay: Duration) : Self
        +accept_max_delay(delay: Duration) : Self
        -backoff_config: BackoffConfig
    }
    class BackoffConfig {
        +initial_delay: Duration
        +max_delay: Duration
    }
    WireframeServer --> BackoffConfig : uses
Loading

Flow diagram for accept loop backoff configuration in WireframeServer

flowchart TD
    A[User configures WireframeServer] --> B{accept_backoff called?}
    B -- Yes --> C[Set initial_delay and max_delay in BackoffConfig]
    B -- No --> D{accept_initial_delay or accept_max_delay called?}
    D -- Yes --> E[Set individual delay in BackoffConfig]
    D -- No --> F[Use default BackoffConfig values]
    C --> G[Accept loop uses exponential backoff]
    E --> G
    F --> G
Loading

File-Level Changes

Change Details Files
Removed stray example comments
  • Deleted '(important - comment)' from accept_initial_delay example
  • Deleted '(important - comment)' from accept_max_delay example
src/server/config/mod.rs
Added backoff configuration docs
  • Created docs/server/configuration.md with accept loop backoff details
  • Updated docs/contents.md to include the new server configuration guide
docs/server/configuration.md
docs/contents.md
Clarified exponential backoff test naming
  • Renamed test_accept_exponential_backoff_behavior to test_accept_exponential_backoff_doubles_and_caps
  • Added a doc comment describing the exponential delay doubling and capping behavior
src/server/config/tests.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey @leynos - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `docs/server/configuration.md:9` </location>
<code_context>
+
+## Accept loop backoff
+
+The accept loop retries failed `accept()` calls using exponential backoff. Use
+`accept_backoff(initial_delay, max_delay)` to set both bounds in one call.
+These values are stored in `BackoffConfig`:
</code_context>

<issue_to_address>
The sentence 'Use `accept_backoff...`' addresses the reader directly with an implied 'you'.

To avoid second person, rephrase as: '`accept_backoff(initial_delay, max_delay)` sets both bounds in one call.'
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread docs/server/configuration.md Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Aug 8, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 8, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos leynos merged commit 914da84 into devin/1754663283-configurable-backoff-parameters Aug 8, 2025
2 checks passed
@leynos leynos deleted the codex/review-unresolved-comments-on-pr-290 branch August 8, 2025 20:41
leynos added a commit that referenced this pull request Aug 8, 2025
* Make exponential backoff parameters configurable in accept_loop

- Add BackoffConfig struct with initial_delay and max_delay fields
- Add builder methods: accept_backoff(), accept_initial_delay(), accept_max_delay()
- Update accept_loop to use configurable parameters instead of hardcoded constants
- Maintain backward compatibility with same default values (10ms initial, 1s max)
- Add comprehensive tests for new configuration methods
- Add validation to ensure sensible minimum values

Fixes #264

Co-Authored-By: Leynos <leynos@troubledskies.net>

* Address CodeRabbit feedback: improve documentation and validation

- Add comprehensive documentation for BackoffConfig struct and field
- Add module-level docs for BackoffConfig re-export
- Fix accept_initial_delay to preserve initial ≤ max invariant
- Make accept_max_delay validation logic explicit
- Add test for initial_delay exceeding default max_delay
- Fix clippy warning for accept() function name formatting

Co-Authored-By: Leynos <leynos@troubledskies.net>

* Complete documentation examples for backoff configuration methods

- Fix incomplete documentation examples in accept_backoff, accept_initial_delay, and accept_max_delay
- Add complete method call examples showing proper usage
- Address user feedback on GitHub PR comments asking for complete examples

Co-Authored-By: Leynos <leynos@troubledskies.net>

* Address CodeRabbit feedback: make accept_backoff validation explicit

- Replace silent coercion with explicit parameter swapping and validation
- Add comprehensive documentation explaining behavior
- Add test cases for parameter swapping edge cases
- Ensure initial_delay <= max_delay invariant is preserved

Co-Authored-By: Leynos <leynos@troubledskies.net>

* Add exponential backoff behavior test

- Add test_accept_exponential_backoff_behavior() to verify actual timing behavior
- Test simulates repeated accept failures and measures timing intervals
- Verifies delays follow exponential pattern: initial → 2×initial → 4×initial → max
- Complements existing configuration tests with runtime behavior verification
- Addresses user feedback about testing actual backoff behavior vs just configuration

Co-Authored-By: Leynos <leynos@troubledskies.net>

* Document accept backoff configuration (#292)

* Document accept backoff configuration

* Rephrase accept_backoff docs

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Leynos <leynos@troubledskies.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant