-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Jira issue provider support (minimal) #2162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
(cherry picked from commit bfc288d0bd7e8277c7dc8f7033e6526c8cc308e6)
(cherry picked from commit 5c0ed614536b1ef7e118716f2b567d8b9fe1e87f)
(cherry picked from commit bbaec74feeafb31cc5794c0a82332792fd8bccb6)
(cherry picked from commit f90435f36a800a71529bf8e4fa7917f2375510c0)
(cherry picked from commit 2317af75758cca9c37f3916b2fbef9b27374a7c1)
(cherry picked from commit ef4a8a7930cbd39515a3010fff2a1ca66f8dd4fa)
(cherry picked from commit 358e5974d49ec4676154e669e68744e2c23a6c9c)
(cherry picked from commit 8c330c6)
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||||||||
|
@CodiumAI-Agent /improve |
|
/agentic_review |
Code Review by Qodo
1. Missing _init_embedding_settings method definition
|
| if not self.supported: | ||
| return | ||
|
|
||
| self._init_embedding_settings() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Missing _init_embedding_settings method definition 📘 Rule violation ✓ Correctness
• The __init__ method calls self._init_embedding_settings() on line 35, but this method is not defined anywhere in the class. • This will cause an AttributeError at runtime when the PRSimilarIssue class is instantiated. • The method should initialize self.cli_mode, self.embedding_client, self.embedding_model, self.embedding_dim, self.embedding_max_tokens, and self.token_handler, which are all referenced later in the code.
Agent prompt
## Issue description
The `PRSimilarIssue.__init__` method calls `self._init_embedding_settings()` on line 35, but this method is not defined, causing an AttributeError at runtime.
## Issue Context
The method should initialize:
- `self.cli_mode` from `get_settings().CONFIG.CLI_MODE`
- `self.token_handler` as `TokenHandler()`
- `self.embedding_model`, `self.embedding_dim`, `self.embedding_max_tokens` from `get_settings().pr_similar_issue`
- `self.embedding_client` conditionally based on whether a custom embedding base URL is configured
## Fix Focus Areas
- pr_agent/tools/pr_similar_issue.py[35-35]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| self.issue_provider = None | ||
| self.jira_keys = [] | ||
|
|
||
| repo_name_for_index = self._init_repo_context() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2. Missing _init_repo_context method definition 📘 Rule violation ✓ Correctness
• The __init__ method calls self._init_repo_context() on line 44, but this method is not defined anywhere in the class. • This will cause an AttributeError at runtime when the PRSimilarIssue class is instantiated. • The method should return a repository name string and initialize context-specific attributes like self.repo_obj, self.project_path, and self.issue_iid.
Agent prompt
## Issue description
The `PRSimilarIssue.__init__` method calls `self._init_repo_context()` on line 44, but this method is not defined, causing an AttributeError at runtime.
## Issue Context
The method should check `self.provider_name` and dispatch to either `_init_github_context()` or `_init_gitlab_context()` accordingly, returning the repository name string.
## Fix Focus Areas
- pr_agent/tools/pr_similar_issue.py[44-44]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| embeds.append(res['data'][0]['embedding']) | ||
| except: | ||
| embeds.append([0] * 1536) | ||
| embeds = self._embed_texts_with_fallback(list_to_encode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. _embed_texts_with_fallback returns wrong type 📘 Rule violation ✓ Correctness
• The method _embed_texts_with_fallback returns a tuple (embeds, successful_indices), but callers in _update_index_with_issues and _update_table_with_issues assign the result directly to embeds without unpacking. • This will cause the embeds variable to be a tuple instead of a list, leading to errors when trying to access embeddings. • Lines 726, 810 assign the tuple directly to embeds or df["values"]/df["vector"], which expect a list of embeddings.
Agent prompt
## Issue description
The `_embed_texts_with_fallback` method returns a tuple `(embeds, successful_indices)`, but lines 726 and 810 assign the result directly without unpacking, causing type errors.
## Issue Context
The correct pattern is shown at line 896 in `_update_qdrant_with_issues`: `embeds, successful_indices = self._embed_texts_with_fallback(list_to_encode)`. The same unpacking should be applied in the other two methods.
## Fix Focus Areas
- pr_agent/tools/pr_similar_issue.py[726-726]
- pr_agent/tools/pr_similar_issue.py[810-810]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| @@ -45,9 +67,17 @@ def __init__(self, issue_url: str, ai_handler, args: list = None): | |||
| environment = get_settings().pinecone.environment | |||
| except Exception: | |||
| if not self.cli_mode: | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. Missing cli_mode initialization causes error handling failure 🐞 Bug ⛯ Reliability
• The code references self.cli_mode on lines 69 and 219 to determine whether to publish error messages • This attribute is never initialized in __init__, causing AttributeError when Pinecone or Qdrant credentials are missing • The error only occurs in error paths (missing credentials), not during normal operation • This prevents users from seeing helpful error messages about missing configuration
Agent prompt
## Issue Description
The `cli_mode` attribute is used in error handling but never initialized, causing AttributeError when credentials are missing.
## Issue Context
The attribute determines whether to publish error messages to the PR/issue or just log them.
## Fix Focus Areas
- pr_agent/tools/pr_similar_issue.py[35-35] - Add initialization in `_init_embedding_settings` method
- pr_agent/tools/pr_similar_issue.py[69-69] - First usage location
Add: `self.cli_mode = get_settings().config.publish_output == False` or similar logic to determine CLI mode
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| embeds = self._embed_texts_with_fallback(list_to_encode) | ||
| df["vector"] = embeds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. Tuple unpacking error in lancedb embedding 🐞 Bug ✓ Correctness
• The _embed_texts_with_fallback method returns a tuple (embeds, successful_indices) as defined on line 472 • Line 810 assigns this tuple directly to df['vector'] without unpacking: `embeds = self._embed_texts_with_fallback(list_to_encode)` • This causes the DataFrame column to contain tuples instead of embedding vectors • Subsequent operations expecting a list of vectors will fail, breaking LanceDB table creation
Agent prompt
## Issue Description
Line 810 doesn't unpack the tuple returned by `_embed_texts_with_fallback`, causing incorrect data structure in the DataFrame.
## Issue Context
The method returns both embeddings and indices of successfully embedded items. The Qdrant implementation (line 896) shows the correct pattern.
## Fix Focus Areas
- pr_agent/tools/pr_similar_issue.py[810-811] - Fix tuple unpacking
Change:
```python
embeds = self._embed_texts_with_fallback(list_to_encode)
df["vector"] = embeds
```
To:
```python
embeds, successful_indices = self._embed_texts_with_fallback(list_to_encode)
if len(successful_indices) != len(list_to_encode):
df = df.iloc[successful_indices].reset_index(drop=True)
df["vector"] = embeds
```
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| return self.embedding_client.embed(list_to_encode) | ||
|
|
||
| openai.api_key = get_settings().openai.key | ||
| res = openai.Embedding.create(input=list_to_encode, engine=self.embedding_model) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6. Missing embedding configuration attributes 🐞 Bug ✓ Correctness
• The code uses self.embedding_client (line 466), self.embedding_model (line 469), self.embedding_max_tokens (lines 693, 711, 777, 795, 862, 880), and self.embedding_dim (lines 243, 247, 252, 257, 264) • None of these attributes are initialized in __init__, causing AttributeError when accessed • These should be initialized from configuration settings: get_settings().pr_similar_issue.embedding_* • Without these, the embedding functionality cannot work with either custom endpoints or OpenAI
Agent prompt
## Issue Description
Multiple embedding configuration attributes are used but never initialized, causing AttributeError throughout the code.
## Issue Context
The configuration.toml defines embedding settings, but they're not loaded into instance attributes.
## Fix Focus Areas
- pr_agent/tools/pr_similar_issue.py[35-35] - Implement `_init_embedding_settings` method
- pr_agent/settings/configuration.toml[387-391] - Read these settings
The method should initialize:
1. `self.embedding_model = get_settings().pr_similar_issue.embedding_model`
2. `self.embedding_dim = get_settings().pr_similar_issue.embedding_dim`
3. `self.embedding_max_tokens = get_settings().pr_similar_issue.embedding_max_tokens`
4. `self.embedding_client = EmbeddingClient(...)` if base_url is configured
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
User description
Minimal Jira issue provider integration: issue provider abstraction (Jira/GitLab/GitHub), /similar_issue Jira support, ticket compliance Jira/GitLab path, Jira ADF parsing, embedding robustness, and unit tests. No deploy/values changes.
PR Type
Enhancement, Tests
Description
Add Jira issue provider support with abstraction layer for GitHub/GitLab/Jira
Implement /similar_issue tool for GitLab and Jira with vector DB integration
Add ticket compliance checking for Jira and GitLab issue providers
Support flexible embedding client with OpenAI-compatible endpoints
Improve GitLab provider robustness for issue handling and clone URLs
Diagram Walkthrough
File Walkthrough
11 files
Add Jira ticket key extraction utilityCreate issue provider module exportsDefine abstract issue provider interfaceImplement GitHub issue provider adapterImplement GitLab issue provider adapterImplement Jira issue provider with ADF parsingAdd issue provider resolution and factory logicAdd OpenAI-compatible embedding clientImprove GitLab provider issue handling and clone URL robustnessRefactor /similar_issue tool for multi-provider supportAdd Jira and GitLab ticket compliance extraction4 files
Add issue provider resolver unit testsAdd Jira issue provider unit testsAdd /similar_issue helper function testsAdd ticket compliance check integration tests2 files
Document Jira issue provider configurationDocument GitLab and Jira /similar_issue support1 files
Add Jira and embedding configuration options