Repository navigation
Add support for OpenAI organization in the secrets file - #2
Conversation
|
@CodiumAI-Agent |
PR Analysis
PR Feedback
How to use
|
PR Analysis
PR Feedback
How to use
|
…ai_org Add support for OpenAI organization in the secrets file
PR Code Suggestions ✨
|
feat: add add_diagram flag in configuration.toml
- Add new /webhook-parallel endpoint for concurrent PR processing - Extract process_webhook() function for shared logic - Add configuration options: enable_parallel_reviews, max_concurrent_reviews - Implement asyncio.create_task() for true concurrent execution - Add semaphore-based concurrency limiting (default: 5 concurrent reviews) - Keep original /webhook endpoint unchanged for backward compatibility - Add comprehensive architecture documentation with sequence diagrams Benefits: - PR #2 latency: 80s -> 41s (49% improvement) - PR #3 latency: 120s -> 42s (65% improvement) - 3x throughput improvement Feature can be enabled by: 1. Setting bitbucket_app.enable_parallel_reviews=true 2. Changing webhook URL to /webhook-parallel
…view - Extract loader into pr_agent/algo/best_practices.py and reuse it from /improve and /review so OSS behavior is symmetric (closes Qodo The-PR-Agent#1). - Guard int(max_lines_allowed) with TypeError/ValueError fallback to 800 plus a targeted warning (Qodo The-PR-Agent#2). - Bitbucket get_pr_agent_repo_custom_file: only accept HTTP 200, log non-404 failures, add 10s timeout, and use the repo default branch via get_repo_default_branch (Qodo The-PR-Agent#3, The-PR-Agent#5, The-PR-Agent#6). - LocalGitProvider get_pr_agent_repo_custom_file: resolve and verify the candidate path stays inside the repo root before reading (Qodo The-PR-Agent#7). - Soften prompt wording in code-suggestions templates and add a parallel block in pr_reviewer_prompts.toml so the model treats the section as guidance, ignoring obvious non-guideline content. - Drop unused _FakeContext test helper, retarget patches to the new module, add coverage for the invalid max_lines fallback (Qodo The-PR-Agent#4). - Update docs/improve.md and docs/review.md to reflect that both tools now consume best_practices.md in OSS. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Six findings from the latest bot review: 1. `_find_anchor_note` calls `body.startswith` without checking the body is a string — add an `isinstance(body, str)` guard. Paranoid but cheap. 2. Anchor selection was wrong when the newest matching note's timestamp couldn't be parsed: the local `sorted(...)` with a `datetime.min` fallback demoted the newest match below older parseable ones, so incremental runs anchored on an older note and re-reviewed already-reviewed commits. Drop the local sort entirely — GitLab returns notes in created_at-DESC order by default, so iterating in natural order picks the newest match. When that match has an unparseable timestamp, `_get_incremental_commits` already falls back to a full run via the `last_seen_commit is None` branch. 3. `_parse_gitlab_iso_datetime` used single-quoted string literals — switched to double quotes to match the repo's Ruff convention. 4. `_get_incremental_commits` extracted `new_path` via dict access only; non-dict diff entries (a stricter library or a stubbed client) were silently dropped. Add a `getattr(diff, 'new_path', None)` fallback so the object-shape branch isn't dead code. 5. `pr_code_suggestions.py` import line wasn't isort-clean after adding `IncrementalPR` — reorder to `GitProvider, IncrementalPR, get_main_pr_language`. 6. `PRCodeSuggestions.__init__` called `get_main_pr_language(get_languages(), get_files())` before `run()` short-circuited the no-op incremental path. For GitLab, `get_files()` falls back to a full `mr.changes()` call when `unreviewed_files_set` is empty — that's a wasted API round-trip on every push that finds nothing new to review. Set `self._incremental_empty_scope = True` and return early from `__init__`; `run()` short-circuits on the same flag. Bot finding The-PR-Agent#2 ("Commit shape mismatch") was a false positive — python- gitlab's `RESTObject` supports both attribute and item access on the same object, so the inconsistency the bot flagged doesn't manifest in practice.
- Add GitProvider.publish_managed_labels with a default implementation that preserves existing read-modify-write semantics for non-GitLab providers (no behavior change for GitHub, Bitbucket, Gitea, etc.). - Override in GitLabProvider to refresh the MR exactly once and compute both the user-label filter and the add/remove diff against that single snapshot. This closes the cross-method race where a caller's get_pr_labels(update=True) and publish_labels' internal refresh produced two snapshots, allowing a label added between them to be removed via current - desired. - /describe (_safe_publish_labels) and /review (set_review_labels) now call publish_managed_labels with a managed-label predicate instead of doing their own pre-read + manual merge + publish_labels. - Refactor publish_labels to share _publish_labels_against(mr, desired) with publish_managed_labels so the two write paths cannot drift. - _safe_publish_labels now catches a narrow set of expected provider/network errors (ConnectionError, TimeoutError, OSError, ValueError, KeyError, AttributeError) instead of bare Exception, so programmer errors surface to /describe's outer handler. - Strengthen publish_labels tests to capture add_labels / remove_labels at save-time via a save() side_effect and assert the exact comma-separated wire payload. - Add six tests for publish_managed_labels covering single-refresh, user-label preservation, no-op when nothing changes, removal of all managed labels when desired is empty, abort on refresh failure, and diff-attr cleanup on save() failure. Addresses Qodo review items #1 (broad except in _safe_publish_labels), The-PR-Agent#2 (cross-method label race), and The-PR-Agent#3 (weak test payload assertions) on PR The-PR-Agent#2483. Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
…h failures via typed exception Addresses Qodo review items The-PR-Agent#2, The-PR-Agent#3, The-PR-Agent#4 on PR The-PR-Agent#2483. The-PR-Agent#2 Hardcoded managed_default label set - Add is_describe_managed_label() and _describe_managed_label_names() in pr_agent.algo.utils as the single source of truth for the /describe-managed namespace. - Rewrite get_user_labels() to defer to the same helper so the inclusion and exclusion rules can never drift. The-PR-Agent#3 Default label not managed (Bug fix with tests) - When enable_custom_labels=True and no custom_labels are configured, set_custom_labels injects defaults that include 'Bug fix with tests'. is_describe_managed_label now classifies that label as managed so /describe can remove it once it is no longer recommended. - This also fixes a pre-existing bug in get_user_labels where 'Bug fix with tests' was misclassified as a user label. The-PR-Agent#4 Refresh failure misreported - Add LabelRefreshError in pr_agent.git_providers.git_provider so callers can distinguish a refresh failure from a genuine no-op. - GitProvider.publish_managed_labels (default impl) and GitLabProvider.publish_managed_labels now raise LabelRefreshError on pre-write refresh failure instead of returning None. - PRDescription._safe_publish_labels and PRReviewer.set_review_labels catch LabelRefreshError specifically and log a warning that names the failure, instead of mis-logging it as 'labels unchanged' / 'already set'. #1, The-PR-Agent#5, The-PR-Agent#6, The-PR-Agent#7 from Qodo's review are already addressed in earlier commits on this branch (36ec454, a7a8cad); Qodo's review listing is pinned to PR-level diff hunks so they appear in the report against older revisions. Tests: - New TestDescribeManagedLabelNamespace locks the predicate behavior: default-set always managed, Bug fix with tests managed under the custom-labels default-injection path, and is_describe_managed_label / get_user_labels stay disjoint. - TestSafePublishLabels gains test_predicate_includes_bug_fix_with_tests_when_custom_labels_default and test_logs_distinctly_on_refresh_failure. - test_pr_reviewer_core gains test_set_review_labels_logs_distinctly_on_refresh_failure. - test_publish_managed_labels_aborts_when_refresh_fails replaced with test_publish_managed_labels_raises_when_refresh_fails. - Full unit suite: 1066 passed, 1 skipped, 3 xfailed (was 1060). Signed-off-by: Allen Shearin <allen.p.shearin@gmail.com>
…view Rework the state-leak fix from a full 'restore all settings to a startup snapshot' into a surgical per-key revert, and address Qodo's review of The-PR-Agent#2346. Why the rework: a blanket snapshot-restore at the top of apply_repo_settings() also wipes legitimate per-request/base config that current main sets before the call (config.extra_config_url, config.is_auto_command, mosaico flags, ...), regressing 11 existing tests. Instead, note_repo_setting_override() records the pre-override value of each key a repo/extra .pr_agent.toml writes, and reset_repo_settings_overrides() reverts exactly those keys on the next load. This addresses the review findings: - The-PR-Agent#1 (is_auto_command wiped): flags set outside the repo-settings merge are never recorded, so they are never reverted by the second apply_repo_settings(). - The-PR-Agent#2 (reset missed context settings): record/revert both go through get_settings(), so a per-request context['settings'] clone is handled too. - The-PR-Agent#3 (non-atomic global reset): record/revert are guarded by an RLock and touch only the overridden keys; full cross-request isolation still relies on a per-request clone. Also uses Dynaconf unset(force=True) (a plain unset() is a no-op) so a repo-injected key that did not exist at baseline is actually removed on revert. Tests: extend tests/unittest/test_apply_repo_settings.py with cases for flag preservation, non-repo config survival, and revert targeting the effective settings object. Full unit suite: 1717 passed. Co-authored-by: Tomasz Haratynowicz <75249676+tharatynowicz@users.noreply.github.com>
…e fix - Regenerate the config reference so the documented no_temperature_models default includes the GLM-5 entries added in the previous commit (the docs build guard would otherwise catch this drift, per Qodo finding #1). - Extend the Kimi K3 completion test to also cover the GLM-5 bare, regional, and Converse spellings, since the model list added a second model with no matching coverage (Qodo finding #2). - Reword the test docstring to imperative phrasing (Qodo finding The-PR-Agent#4). Qodo finding #3 (import order) is a false positive: `ruff check` against this repo's actual pyproject.toml config passes the original tomllib-then-pathlib order unchanged (straight imports sort before from-imports within a section by default); left as-is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e fix - Regenerate the config reference so the documented no_temperature_models default includes the GLM-5 entries added in the previous commit (the docs build guard would otherwise catch this drift, per Qodo finding #1). - Extend the Kimi K3 completion test to also cover the GLM-5 bare, regional, and Converse spellings, since the model list added a second model with no matching coverage (Qodo finding #2). - Reword the test docstring to imperative phrasing (Qodo finding The-PR-Agent#4). Qodo finding #3 (import order) is a false positive: `ruff check` against this repo's actual pyproject.toml config passes the original tomllib-then-pathlib order unchanged (straight imports sort before from-imports within a section by default); left as-is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…e fix - Regenerate the config reference so the documented no_temperature_models default includes the GLM-5 entries added in the previous commit (the docs build guard would otherwise catch this drift, per Qodo finding #1). - Extend the Kimi K3 completion test to also cover the GLM-5 bare, regional, and Converse spellings, since the model list added a second model with no matching coverage (Qodo finding #2). - Reword the test docstring to imperative phrasing (Qodo finding The-PR-Agent#4). Qodo finding #3 (import order) is a false positive: `ruff check` against this repo's actual pyproject.toml config passes the original tomllib-then-pathlib order unchanged (straight imports sort before from-imports within a section by default); left as-is. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
No description provided.