Skip to content

refactor: move per-reviewer defaults into adapters, add greptile adapter#167

Merged
ichoosetoaccept merged 1 commit intomainfrom
feat/adapter-defaults-greptile
Feb 17, 2026
Merged

refactor: move per-reviewer defaults into adapters, add greptile adapter#167
ichoosetoaccept merged 1 commit intomainfrom
feat/adapter-defaults-greptile

Conversation

@ichoosetoaccept
Copy link
Member

@ichoosetoaccept ichoosetoaccept commented Feb 16, 2026

Summary

Adapters become the source of truth for per-reviewer defaults. ReviewerConfig stays for user overrides via JSON-in-env (CRB_REVIEWERS). Adds greptile adapter.

Changes

  • Adapter default properties: default_resolve_levels and default_auto_resolve_stale on ReviewerAdapter base, overridden by Devin, CodeRabbit, Greptile
  • Delete _REVIEWER_DEFAULTS dict: _apply_reviewer_defaults validator now queries adapter registry directly
  • Greptile adapter: identifies greptile-apps/greptile-apps[bot], needs_manual_rereview=True, rereview via @greptileai review
  • JSON-in-env docs: README documents CRB_REVIEWERS pattern with adapter defaults table, dev setup snippet
  • Server instructions: mention greptile, JSON-in-env config pattern
  • Tests: greptile adapter tests, adapter default property tests, config defaults updated

Closes #165, closes #166

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@greptile-apps
Copy link

greptile-apps bot commented Feb 16, 2026

Greptile Summary

Refactors per-reviewer defaults to be adapter-owned instead of config-owned, adding Greptile support. Adapters now declare default_auto_resolve_stale and default_resolve_levels as properties, eliminating the hardcoded _REVIEWER_DEFAULTS dictionary. Config validation queries the adapter registry directly to apply defaults.

Key changes:

  • Moved default resolution policies from config.py dict to adapter properties on ReviewerAdapter base class
  • Added GreptileAdapter with broad username matching (identifies any author containing "greptile")
  • Deleted request_rereview tool and RereviewResult model (replaced with direct gh pr comment instructions in server docs)
  • Removed adapter configuration injection (apply_config, configure() method, rereview_trigger() method)
  • Updated README with CRB_REVIEWERS JSON config pattern and adapter defaults table
  • Comprehensive test coverage for new adapter and default properties

Architecture improvement:
The refactoring makes adapters the single source of truth for their behavior, following the principle that behavior and data should live together. The config system now queries adapters for defaults rather than duplicating them in a separate dict.

Confidence Score: 5/5

  • Safe to merge - clean refactoring with comprehensive test coverage and no breaking API changes
  • The refactoring is well-executed with proper abstraction. All adapters correctly override the new default properties, tests verify the behavior matches previous hardcoded values, and the deletion of request_rereview is properly documented with migration instructions in the README. The only minor concern is the broad username matching in GreptileAdapter.identify(), but this follows the existing pattern used by DevinAdapter and CodeRabbitAdapter.
  • No files require special attention - all changes follow consistent patterns

Important Files Changed

Filename Overview
src/codereviewbuddy/reviewers/base.py Removed rereview and config injection logic, added default property methods for adapter-specific defaults
src/codereviewbuddy/reviewers/greptile.py New adapter for Greptile reviewer with broad identification pattern
src/codereviewbuddy/config.py Replaced hardcoded defaults dict with adapter registry query, removed rereview_message field
src/codereviewbuddy/reviewers/registry.py Added GreptileAdapter to registry
src/codereviewbuddy/reviewers/devin.py Added default_auto_resolve_stale and default_resolve_levels properties
src/codereviewbuddy/reviewers/coderabbit.py Added default_auto_resolve_stale and default_resolve_levels properties

Class Diagram

classDiagram
    class ReviewerAdapter {
        <<abstract>>
        +name: str
        +auto_resolves_comments: bool
        +default_auto_resolve_stale: bool
        +default_resolve_levels: list[Severity]
        +classify_severity(comment_body) Severity
        +auto_resolves_thread(comment_body) bool
        +identify(author) bool
    }
    
    class UnblockedAdapter {
        +name = "unblocked"
        +auto_resolves_comments = False
        +default_auto_resolve_stale = True
        +default_resolve_levels = all
        +identify(author) bool
    }
    
    class DevinAdapter {
        +name = "devin"
        +auto_resolves_comments = True
        +default_auto_resolve_stale = False
        +default_resolve_levels = [INFO]
        +classify_severity(comment_body) Severity
        +auto_resolves_thread(comment_body) bool
        +identify(author) bool
    }
    
    class CodeRabbitAdapter {
        +name = "coderabbit"
        +auto_resolves_comments = True
        +default_auto_resolve_stale = False
        +default_resolve_levels = []
        +identify(author) bool
    }
    
    class GreptileAdapter {
        +name = "greptile"
        +auto_resolves_comments = False
        +default_auto_resolve_stale = True
        +default_resolve_levels = all
        +identify(author) bool
    }
    
    class Config {
        +reviewers: dict[str, ReviewerConfig]
        +_apply_reviewer_defaults() Config
        +get_reviewer(name) ReviewerConfig
        +can_resolve(reviewer_name, severity) tuple
    }
    
    class ReviewerConfig {
        +enabled: bool
        +auto_resolve_stale: bool
        +resolve_levels: list[Severity]
        +require_reply_before_resolve: bool
    }
    
    ReviewerAdapter <|-- UnblockedAdapter
    ReviewerAdapter <|-- DevinAdapter
    ReviewerAdapter <|-- CodeRabbitAdapter
    ReviewerAdapter <|-- GreptileAdapter
    
    Config --> ReviewerAdapter : queries REVIEWERS registry
    Config "1" *-- "*" ReviewerConfig : contains
Loading

Last reviewed commit: d1ac435

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

11 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@ichoosetoaccept ichoosetoaccept force-pushed the feat/adapter-defaults-greptile branch from d66bca2 to cf6e9b1 Compare February 16, 2026 22:40
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

11 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@ichoosetoaccept ichoosetoaccept force-pushed the feat/adapter-defaults-greptile branch from cf6e9b1 to d1ac435 Compare February 17, 2026 01:12
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

21 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@ichoosetoaccept ichoosetoaccept merged commit fd02139 into main Feb 17, 2026
11 checks passed
@ichoosetoaccept ichoosetoaccept deleted the feat/adapter-defaults-greptile branch February 17, 2026 08:20
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.

refactor: inline per-reviewer guardrails into adapters, remove user-config layer feat: add greptile adapter

1 participant