Conversation
Automated sync from stranske/Workflows Template hash: 8e4caa9110ae Changes synced from sync-manifest.yml
🤖 Keepalive Loop StatusPR #155 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
|
Status | ✅ no new diagnostics |
|
Autofix updated these files:
|
There was a problem hiding this comment.
Pull request overview
This PR syncs workflow templates from the stranske/Workflows repository, introducing a new multi-phase GitHub Actions workflow for issue optimization and updating the issue formatter to preserve original issue content.
Key changes:
- New workflow
agents-issue-optimizer.ymlimplementing a three-phase issue processing system (analyze, apply, format) - Enhanced
issue_formatter.pyto append original issue content in a collapsible section - Code formatting improvements in
scripts/validate_dependency_test_setup.py(style-only changes)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
.github/workflows/agents-issue-optimizer.yml |
New workflow implementing label-triggered and manual issue optimization with three phases |
scripts/langchain/issue_formatter.py |
Added functions to preserve original issue text in formatted output using dynamic code fences |
scripts/validate_dependency_test_setup.py |
Code formatting updates (quote style, line breaks) following Python style conventions |
autofix_report_enriched.json |
Updated timestamp and tracked file reference |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
| run: | | ||
| echo "Running analysis on issue #${ISSUE_NUMBER}" | ||
| python scripts/langchain/issue_optimizer.py \ |
There was a problem hiding this comment.
The workflow references 'scripts/langchain/issue_optimizer.py' which does not exist in the repository. The script execution will fail when attempting to run this file. This includes imports of IssueOptimizationResult, format_suggestions_comment, _extract_suggestions_json, and apply_suggestions which are all expected to be in this missing module.
| sys.path.insert(0, 'scripts/langchain') | ||
| from issue_optimizer import _extract_suggestions_json, apply_suggestions | ||
|
|
There was a problem hiding this comment.
The workflow references 'from issue_optimizer import _extract_suggestions_json, apply_suggestions' which relies on the non-existent 'issue_optimizer.py' module. This import will fail at runtime and prevent Phase 2 from executing successfully.
| sys.path.insert(0, 'scripts/langchain') | |
| from issue_optimizer import _extract_suggestions_json, apply_suggestions | |
| def _extract_suggestions_json(body: str): | |
| \"\"\"Extract a JSON object containing suggestions from a comment body. | |
| This looks first for a fenced ```json code block, and falls back to | |
| the first top-level JSON object found in the text. | |
| \"\"\" | |
| if not body: | |
| return None | |
| # Try to find a ```json ... ``` fenced block | |
| fenced_match = re.search(r\"```json\\s*(\\{[\\s\\S]*?\\})\\s*```\", body, re.IGNORECASE) | |
| candidate = None | |
| if fenced_match: | |
| candidate = fenced_match.group(1) | |
| else: | |
| # Fallback: first JSON object-like substring | |
| brace_match = re.search(r\"\\{[\\s\\S]*\\}\", body) | |
| if brace_match: | |
| candidate = brace_match.group(0) | |
| if not candidate: | |
| return None | |
| try: | |
| return json.loads(candidate) | |
| except Exception: | |
| return None | |
| def apply_suggestions(issue_body: str, suggestions, use_llm: bool = False): | |
| \"\"\"Apply suggestions to the issue body. | |
| Expects suggestions to contain a 'formatted_body' or similar field. | |
| Falls back to returning the original body if the structure is unknown. | |
| \"\"\" | |
| if isinstance(suggestions, dict): | |
| if 'formatted_body' in suggestions and isinstance(suggestions['formatted_body'], str): | |
| formatted = suggestions['formatted_body'] | |
| elif 'body' in suggestions and isinstance(suggestions['body'], str): | |
| formatted = suggestions['body'] | |
| elif 'issue_body' in suggestions and isinstance(suggestions['issue_body'], str): | |
| formatted = suggestions['issue_body'] | |
| else: | |
| formatted = issue_body | |
| else: | |
| formatted = issue_body | |
| return {'formatted_body': formatted} |
| phase: | ||
| description: "Phase to run (analyze, apply, or format)" | ||
| required: true | ||
| type: choice | ||
| options: | ||
| - analyze | ||
| - apply | ||
| - format |
There was a problem hiding this comment.
The PR description mentions this is "Phase 1" and includes issue formatting capabilities, but the workflow file includes references to Phase 2 (apply suggestions) and Phase 3 (format) operations that depend on the missing 'issue_optimizer.py' module. Either the PR description should clarify that this is a complete multi-phase system, or the workflow should be scoped to only include the formatting phase (Phase 3) that can work with the included 'issue_formatter.py' module.
| with open('/tmp/dedup_comments.json', encoding='utf-8') as f: | ||
| comments = json.load(f) | ||
|
|
||
| marker = issue_dedup.SIMILAR_ISSUES_MARKER | ||
| for comment in comments or []: | ||
| body = (comment or {}).get('body') or '' | ||
| if marker in body: | ||
| raise SystemExit(0) | ||
|
|
||
| # Conservative defaults; can be tuned later. | ||
| threshold = 0.82 | ||
| store = issue_dedup.build_issue_vector_store(open_issues) | ||
| if store is None: | ||
| raise SystemExit(0) | ||
|
|
||
| title = (issue.get('title') or '').strip() | ||
| body = (issue.get('body') or '').strip() | ||
| query = f"{title}\n{body}".strip() if body else title | ||
| if not query: | ||
| raise SystemExit(0) | ||
|
|
||
| matches = issue_dedup.find_similar_issues(store, query, threshold=threshold, k=5) | ||
| comment = issue_dedup.format_similar_issues_comment(matches, max_items=5) | ||
| if comment: | ||
| with open('/tmp/dedup_comment.md', 'w', encoding='utf-8') as out: | ||
| out.write(comment) |
There was a problem hiding this comment.
Inconsistent indentation in the Python inline script. Lines 159-160, 162-166, and 170-172 use 2-space indentation while lines 157-158 and 168-169 use 0-space indentation. This will cause a Python IndentationError when the script runs. All lines within the same scope should use consistent indentation (either all at the same level after the opening 'with' statements, or properly nested).
| with open('/tmp/dedup_comments.json', encoding='utf-8') as f: | |
| comments = json.load(f) | |
| marker = issue_dedup.SIMILAR_ISSUES_MARKER | |
| for comment in comments or []: | |
| body = (comment or {}).get('body') or '' | |
| if marker in body: | |
| raise SystemExit(0) | |
| # Conservative defaults; can be tuned later. | |
| threshold = 0.82 | |
| store = issue_dedup.build_issue_vector_store(open_issues) | |
| if store is None: | |
| raise SystemExit(0) | |
| title = (issue.get('title') or '').strip() | |
| body = (issue.get('body') or '').strip() | |
| query = f"{title}\n{body}".strip() if body else title | |
| if not query: | |
| raise SystemExit(0) | |
| matches = issue_dedup.find_similar_issues(store, query, threshold=threshold, k=5) | |
| comment = issue_dedup.format_similar_issues_comment(matches, max_items=5) | |
| if comment: | |
| with open('/tmp/dedup_comment.md', 'w', encoding='utf-8') as out: | |
| out.write(comment) | |
| with open('/tmp/dedup_comments.json', encoding='utf-8') as f: | |
| comments = json.load(f) | |
| marker = issue_dedup.SIMILAR_ISSUES_MARKER | |
| for comment in comments or []: | |
| body = (comment or {}).get('body') or '' | |
| if marker in body: | |
| raise SystemExit(0) | |
| # Conservative defaults; can be tuned later. | |
| threshold = 0.82 | |
| store = issue_dedup.build_issue_vector_store(open_issues) | |
| if store is None: | |
| raise SystemExit(0) | |
| title = (issue.get('title') or '').strip() | |
| body = (issue.get('body') or '').strip() | |
| query = f"{title}\n{body}".strip() if body else title | |
| if not query: | |
| raise SystemExit(0) | |
| matches = issue_dedup.find_similar_issues(store, query, threshold=threshold, k=5) | |
| comment = issue_dedup.format_similar_issues_comment(matches, max_items=5) | |
| if comment: | |
| with open('/tmp/dedup_comment.md', 'w', encoding='utf-8') as out: | |
| out.write(comment) |
| import json | ||
| from scripts.langchain import issue_dedup | ||
|
|
||
| with open('/tmp/issue.json', encoding='utf-8') as f: | ||
| issue = json.load(f) | ||
| with open('/tmp/open_issues.json', encoding='utf-8') as f: | ||
| open_issues = json.load(f) | ||
| with open('/tmp/dedup_comments.json', encoding='utf-8') as f: | ||
| comments = json.load(f) | ||
|
|
||
| marker = issue_dedup.SIMILAR_ISSUES_MARKER | ||
| for comment in comments or []: | ||
| body = (comment or {}).get('body') or '' | ||
| if marker in body: | ||
| raise SystemExit(0) | ||
|
|
||
| # Conservative defaults; can be tuned later. | ||
| threshold = 0.82 | ||
| store = issue_dedup.build_issue_vector_store(open_issues) | ||
| if store is None: | ||
| raise SystemExit(0) | ||
|
|
||
| title = (issue.get('title') or '').strip() | ||
| body = (issue.get('body') or '').strip() | ||
| query = f"{title}\n{body}".strip() if body else title | ||
| if not query: | ||
| raise SystemExit(0) | ||
|
|
||
| matches = issue_dedup.find_similar_issues(store, query, threshold=threshold, k=5) | ||
| comment = issue_dedup.format_similar_issues_comment(matches, max_items=5) | ||
| if comment: | ||
| with open('/tmp/dedup_comment.md', 'w', encoding='utf-8') as out: | ||
| out.write(comment) |
There was a problem hiding this comment.
The workflow references 'scripts.langchain.issue_dedup' module which does not exist in the repository. The import statement will fail at runtime. Either this module needs to be added as part of this PR, or the dedup check step should be removed or updated to reference an existing module.
| import json | |
| from scripts.langchain import issue_dedup | |
| with open('/tmp/issue.json', encoding='utf-8') as f: | |
| issue = json.load(f) | |
| with open('/tmp/open_issues.json', encoding='utf-8') as f: | |
| open_issues = json.load(f) | |
| with open('/tmp/dedup_comments.json', encoding='utf-8') as f: | |
| comments = json.load(f) | |
| marker = issue_dedup.SIMILAR_ISSUES_MARKER | |
| for comment in comments or []: | |
| body = (comment or {}).get('body') or '' | |
| if marker in body: | |
| raise SystemExit(0) | |
| # Conservative defaults; can be tuned later. | |
| threshold = 0.82 | |
| store = issue_dedup.build_issue_vector_store(open_issues) | |
| if store is None: | |
| raise SystemExit(0) | |
| title = (issue.get('title') or '').strip() | |
| body = (issue.get('body') or '').strip() | |
| query = f"{title}\n{body}".strip() if body else title | |
| if not query: | |
| raise SystemExit(0) | |
| matches = issue_dedup.find_similar_issues(store, query, threshold=threshold, k=5) | |
| comment = issue_dedup.format_similar_issues_comment(matches, max_items=5) | |
| if comment: | |
| with open('/tmp/dedup_comment.md', 'w', encoding='utf-8') as out: | |
| out.write(comment) | |
| import sys | |
| # The advisory issue deduplication helper module is not available | |
| # in this repository. Skip this optional check without failing | |
| # the workflow. | |
| sys.stdout.write("Advisory deduplication module not found; skipping duplicate issue check.\n") |
Sync Summary
Files Updated
Files Skipped
Review Checklist
Source: stranske/Workflows
Manifest:
.github/sync-manifest.yml