Skip to content

Commit f77b971

Browse files
authored
Feature/Add mvp manual reviewer agent (#401)
* Reviewer MVP * fix: args type errors * add manual ReviewerAgent and adapt PlannerAgent for review loop * add logging session_memory, fix planner reasoning display, fix pydantic warnings * replace print with logger in run_chat.py * fix condition commit and push * fix: add logging * refactor logging + add docstrings * fix black * fix tests after merge * refactor: DocVal and PaperVal integrate in agents logic * refactor: add proper logging events for agent logic * fix black * operations are wrapped in try except fix WhatHasBeenDoneReportGenerator generation summary * minor fices after merge * fix typo + increment OSA version
1 parent 86bfa1a commit f77b971

File tree

55 files changed

+1966
-917
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1966
-917
lines changed

docs/core/operations/OPERATIONS.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ This document is auto-generated. Do not edit manually.
77
| Name | Priority | Intents | Scopes | Args Schema | Executor | Method |
88
|------|----------|---------|--------|-------------|----------|--------|
99
| `generate_report` | 5 | new_task | full_repo, analysis || `ReportGenerator` | `build_pdf` |
10+
| `convert_notebooks` | 30 | new_task | full_repo, codebase | ConvertNotebooksArgs | `NotebookConverter` | `convert_notebooks` |
1011
| `translate_dirs` | 40 | new_task | full_repo, codebase || `RepositoryStructureTranslator` | `rename_directories_and_files` |
1112
| `generate_docstrings` | 50 | new_task, feedback | full_repo, codebase | GenerateDocstringsArgs | `DocstringsGenerator` | `run` |
1213
| `ensure_license` | 60 | new_task | full_repo, docs | EnsureLicenseArgs | `LicenseCompiler` | `run` |
1314
| `generate_documentation` | 65 | new_task | full_repo, docs || `generate_documentation` | `` |
1415
| `generate_requirements` | 67 | new_task | full_repo, codebase || `RequirementsGenerator` | `generate` |
15-
| `generate_readme` | 70 | new_task, feedback | full_repo, docs | GenerateReadmeArgs | `ReadmeAgent` | `generate_readme` |
16+
| `generate_readme` | 70 | new_task, feedback | full_repo, docs | | `ReadmeAgent` | `generate_readme` |
1617
| `translate_readme` | 75 | new_task, feedback | full_repo, docs | TranslateReadmeArgs | `ReadmeTranslator` | `translate_readme` |
17-
| `generate_about` | 80 | new_task | full_repo, docs || `AboutGenerator` | `generate_about_content` |
18+
| `generate_about` | 80 | new_task | full_repo, docs || `AboutGenerator` | `generate_about_content` |
19+
| `organize` | 90 | new_task | full_repo, codebase || `RepoOrganizer` | `organize` |

osa_tool/config/prompts/analysis.toml

Lines changed: 21 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -49,131 +49,39 @@ RULES:
4949
5050
"""
5151

52-
after_report_text_prompt = """
53-
DEFINITIONS:
54-
55-
translate_dirs — Translate directory names to English
56-
convert_notebooks — Convert Jupyter notebooks to Python scripts
57-
translate_readme — Translate README file to English
58-
ensure_license — Ensure a LICENSE file is present
59-
community_docs — Add or update community documentation files
60-
docstring — Add or update docstrings in source code
61-
report — Generate refactoring report
62-
readme — Create a README file
63-
requirements — Add or update requirements file
64-
organize — Reorganize project structure
65-
about — Add project description or about section
66-
validate_paper — Validate academic paper files
67-
validate_doc — Validate documentation files
68-
generate_workflows — Generate CI or automation workflows
69-
include_tests — Add or include tests
70-
include_black — Add Black code formatter
71-
include_pep8 — Add PEP8 compliance checks
72-
include_autopep8 — Add autopep8 formatter
73-
include_fix_pep8 — Automatically fix PEP8 issues
74-
include_pypi — Prepare project for PyPI publishing
75-
python_versions — Specify supported Python versions
76-
pep8_tool — Configure PEP8 checking tool
77-
use_poetry — Use Poetry for dependency management
78-
include_codecov — Add Codecov integration
79-
80-
81-
INPUT DATA (tasks list):
82-
83-
{tasks_list}
52+
after_report_summary_from_events_prompt = """
53+
INPUT DATA (operations list):
8454
85-
TASK:
55+
{operations}
8656
87-
Write a connected textual summary of the repository refactoring.
57+
TASK:
58+
Write a short factual summary of what was performed.
8859
8960
REQUIREMENTS:
90-
- Write approximately two short paragraphs
91-
- Use plain text only
61+
- Use only operations with performed == Yes
62+
- Base the wording on the provided events and result fields
63+
- Keep it concise (about two short paragraphs)
9264
- Do not use markdown
9365
- Do not use bullet points or lists
94-
- Do NOT mention tasks that were not performed
95-
- Do NOT explain why something was not done
96-
- Do NOT use modal or speculative language (avoid words like "may", "might", "likely")
97-
- Describe only actions that were actually performed
98-
- Use neutral but natural technical language
99-
- Write in confident past tense
100-
- Base the text ONLY on tasks with value "Yes"
101-
102-
STYLE:
103-
- Clear and readable
104-
- Slightly narrative, but professional
105-
- No bureaucratic or legalistic phrasing
106-
- No assumptions or interpretation beyond task definitions
10766
10867
OUTPUT:
109-
Return only the text summary.
110-
Do not add any explanations or extra text.
68+
Return ONLY JSON matching the system message schema.
11169
"""
11270

113-
after_report_blocks_prompt = """
114-
TASK DEFINITIONS:
115-
116-
translate_dirs — Translate directory names to English
117-
convert_notebooks — Convert Jupyter notebooks to Python scripts
118-
translate_readme — Translate README file to English
119-
ensure_license — Ensure a LICENSE file is present
120-
community_docs — Add or update community documentation files
121-
docstring — Add or update docstrings in source code
122-
report — Generate refactoring report
123-
readme — Create a README file
124-
requirements — Add or update requirements file
125-
organize — Reorganize project structure
126-
about — Add project description or about section
127-
validate_paper — Validate academic paper files
128-
validate_doc — Validate documentation files
129-
generate_workflows — Generate CI or automation workflows
130-
include_tests — Add or include tests
131-
include_black — Add Black code formatter
132-
include_pep8 — Add PEP8 compliance checks
133-
include_autopep8 — Add autopep8 formatter
134-
include_fix_pep8 — Automatically fix PEP8 issues
135-
include_pypi — Prepare project for PyPI publishing
136-
python_versions — Specify supported Python versions
137-
pep8_tool — Configure PEP8 checking tool
138-
use_poetry — Use Poetry for dependency management
139-
include_codecov — Add Codecov integration
140-
141-
142-
INPUT DATA (tasks list):
143-
144-
{tasks_list}
145-
146-
TASK:
147-
148-
You must summarize the result of repository refactoring based ONLY on the tasks listed above.
149-
150-
Group tasks into logical blocks.
151-
Each logical block must contain:
152-
- a short name (plain sentence)
153-
- a short description (plain sentence)
154-
- a list of task numbers that belong to this block
71+
after_report_blocks_from_events_prompt = """
72+
INPUT DATA (operations list):
15573
156-
OUTPUT FORMAT:
74+
{operations}
15775
158-
Return ONLY valid JSON.
159-
No extra text, no explanations, no markdown.
160-
161-
JSON structure:
162-
[
163-
{{
164-
"name": "Block name as a plain sentence",
165-
"description": "Short description as a plain sentence",
166-
"tasks": [1, 2]
167-
}}
168-
]
169-
170-
RULES (IMPORTANT):
76+
TASK:
77+
Group performed operations into logical blocks.
17178
172-
1. Use double quotes only
173-
2. Output must be valid JSON
174-
3. Use ONLY task numbers from the input list
175-
4. Every task from 1 to 7 MUST be used exactly once
176-
5. Do NOT invent new tasks
177-
7. "tasks" must contain only numbers
79+
REQUIREMENTS:
80+
- Include ONLY operations with performed == Yes
81+
- Each performed operation must appear in exactly one block
82+
- "tasks" must list operation names exactly as provided (strings)
83+
- Do not invent operations
17884
85+
OUTPUT:
86+
Return ONLY JSON matching the system message schema.
17987
"""

osa_tool/config/prompts/osa_agent.toml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
[prompts]
22
intent_router = """
3-
Analyze the following user request and any attached context:
3+
Analyze the following active request and any attached context:
44
5-
User Request: {user_request}
5+
Active Request: {active_request}
66
Attachment: {attachment}
77
88
Return the result **strictly in the JSON format described above**.
99
"""
1010

1111
planner = """
12-
User request:
13-
{user_request}
12+
Active Request:
13+
{active_request}
1414
1515
Detected intent: {intent}
1616
Task scope: {task_scope}
1717
18+
Plan history:
19+
{plan_history_section}
20+
1821
Repository overview:
1922
{repo_data}
2023
@@ -25,13 +28,39 @@ Select the operations that best satisfy the user request.
2528
"""
2629

2730
detect_arguments = """
28-
User request:
29-
{user_request}
31+
Active Request:
32+
{active_request}
3033
3134
Operations with additional arguments:
3235
{operations}
3336
"""
3437

38+
fill_missing_after_clarification = """
39+
Missing Fields (to fill):
40+
{missing}
41+
42+
User Provided Answers:
43+
{user_answers}
44+
"""
45+
46+
reviewer_user_prompt = """
47+
User feedback received: {feedback_text}
48+
49+
Current workflow configuration:
50+
- Current intent: {current_intent}
51+
- Current task_scope: {current_task_scope}
52+
53+
Analyze the feedback and determine:
54+
55+
1. Does it require a new intent? (set "requires_new_intent")
56+
2. Does it require only a new or updated task_scope? (set "requires_new_task_scope")
57+
3. If new intent or task_scope is required, fill in "new_intent" and/or "new_task_scope".
58+
4. If no changes are needed, leave new_intent and new_task_scope as null.
59+
5. Provide a short summary in "reviewer_summary" explaining your decision.
60+
61+
Return the output **strictly in JSON format** as specified in the system message.
62+
"""
63+
3564
pr_summarizer = """
3665
Summarize the following repository changes into a Pull Request description.
3766

0 commit comments

Comments
 (0)