Compare commits

...
4 changed files with 90 additions and 50 deletions

No files matched your search

+71 -45
View File
@@ -1,65 +1,91 @@
framework: "praisonai"
process: workflow
topic: "Autonomous Issue Resolution and PR Creation"
planning: true
planning: false
roles:
issue_analyst:
role: "GitHub Issue Analyst"
goal: "Read the GitHub issue, understand the required changes, and map the problem to the local codebase"
backstory: "You are an expert software analyst who reads bug reports and feature requests. You excel at taking a problem description and finding exactly which files in the codebase need to be modified. Your primary job is discovery."
backstory: "You are an expert software analyst who reads bug reports and feature requests. You excel at taking a problem description and finding exactly which files in the codebase need to be modified. Your primary job is discovery and planning."
tools:
- "execute_command"
software_engineer:
role: "Autonomous Software Engineer"
goal: "Checkout a new branch, rewrite the code to fix the issue, and ensure the changes are correct locally"
backstory: "You are a senior software engineer who writes flawless code. You branch off main, use terminal commands to rewrite files using sed, echo, or other secure tools, and verify that your changes perfectly address the analyst's findings."
role: "Autonomous Software Engineer"
goal: "Create a branch, implement the required code changes, run tests, then commit and push"
backstory: "You are a senior software engineer who writes flawless code. You always branch off main first, implement changes using shell commands, verify with git diff, run tests, then commit and push."
tools:
- "execute_command"
- "github_create_branch"
release_manager:
role: "Release and CI Manager"
goal: "Commit the changes, push the branch to remote, and create the Pull Request linking back to the issue"
backstory: "You are a DevOps Release Engineer. Your job is strictly to ensure that any code changes are properly committed, pushed to the GitHub repository, and framed as a clean Pull Request that automatically links to the issue."
tools:
- "github_create_pull_request"
- "github_create_branch"
- "github_commit_and_push"
release_manager:
role: "Release and CI Manager"
goal: "Open the Pull Request linking to the issue and notify the user"
backstory: "You are a DevOps Release Engineer. You open clean Pull Requests using the gh CLI and post a summary comment on the issue."
tools:
- "github_create_pull_request"
- "execute_command"
steps:
- name: analyze_issue
- name: Analyze Issue
agent: issue_analyst
action: |
Thoroughly analyze the Issue and the repository:
0. CRITICAL: Your wrapper has already pre-fetched the complete issue description and Pull Request diff securely.
1. Read the pre-fetched context natively using `execute_command` with the `command` argument set to `cat .github/triage-context.md`. Do NOT provide a `cwd` argument.
2. Identify the exact problem or feature request.
3. Use tools like `grep`, `find`, or `cat` to explore the codebase and find the specific files that need modification.
4. Create a specific, file-level plan of what needs to change.
expected_output: "A detailed analysis report including the files that must be changed and exactly what lines or logic must be altered to solve the Issue."
- name: implement_fix
action: >
Thoroughly analyze the issue and the repository. Follow these steps in order.
First, set up git identity by running two commands via execute_command: run
'git config user.name PraisonAI' and then 'git config user.email [email protected]'.
Second, read the pre-fetched issue context by running via execute_command: 'cat .github/triage-context.md'.
Do NOT pass a cwd argument.
Third, read architecture guidelines by running via execute_command: 'cat src/praisonai-agents/AGENTS.md'.
Fourth, validate architecture before writing any code.
Determine if this is a Core SDK change (praisonaiagents/), a Wrapper change (praisonai/),
or a Tools change that belongs in the MervinPraison/PraisonAI-Tools repository.
Check whether it duplicates existing functionality or adds new dependencies.
If any check fails or the issue is invalid, do NOT create a PR — just report the findings.
Fifth, explore the codebase using execute_command with grep, find, or cat
to identify the exact files and line numbers that need to change.
Output a detailed plan listing the routing decision, architecture validation result,
and the exact files and lines to modify.
expected_output: A detailed analysis with routing decision, architecture validation, and a file-level change plan.
- name: Implement Fix
agent: software_engineer
action: |
Implement the changes required to solve the issue:
1. Review the analyst's plan.
2. Check out a dedicated fix branch by using the `github_create_branch` tool with `branch_name` set to `praisonai/issue-{{ISSUE_NUMBER}}`.
3. Carefully modify the necessary files in the repository using bash commands (e.g. `cat`, `sed`, `echo`, or small inline scripts).
4. Double-check your edits by inspecting the file outputs or running `git diff` to ensure you changed what was required.
expected_output: "Confirmation that the git branch was successfully created and the files were reliably modified without syntax errors."
- name: create_pull_request
action: >
You are working inside the cloned repository. Determine the repository root by running
execute_command with command='git rev-parse --show-toplevel'.
Do NOT ask for confirmation. Do NOT use placeholder paths. Act immediately.
Step 1 — Create branch: call github_create_branch with branch_name=praisonai/issue-{{ISSUE_NUMBER}}.
Step 2 — Implement changes. Use execute_command (no cwd argument) to write files.
To replace text in a file run: python3 -c "content=open('file').read(); open('file','w').write(content.replace('OLD','NEW'))"
After each edit verify with execute_command: git diff
Step 3 — Run tests: execute_command with command=python3 -m pytest src/praisonai-agents/tests/ -x -q --timeout=30 -p no:warnings
Step 4 — Commit and push: call github_commit_and_push with a descriptive commit_message.
expected_output: Confirmation that the branch was created, changes implemented, tests passed, and branch pushed.
dependencies: [Analyze Issue]
- name: Create Pull Request
agent: release_manager
action: |
Push the code and submit the PR:
1. Use the native `github_commit_and_push` tool and provide a commit message like "PraisonAI Automated Fix".
2. Use the native `github_create_pull_request` tool with the arguments:
- title: "Fix Issue {{ISSUE_NUMBER}}"
- body: "Automated triage by PraisonAI Native Issue Triage."
- head_branch: "praisonai/issue-{{ISSUE_NUMBER}}"
- base_branch: "main"
3. Post a comment on the original issue letting the user know: `execute_command`: `gh issue comment {{ISSUE_NUMBER}} -b "I have autonomously analyzed the codebase and written a fix for this issue! I've opened a Pull Request for your review."`
expected_output: "The URL of the successfully created Pull Request."
dependencies: [analyze_issue, implement_fix]
action: >
Open the Pull Request and notify the issue author. Follow these steps in order.
First, create the PR using the github_create_pull_request tool with
title set to 'fix: resolve issue #{{ISSUE_NUMBER}}',
body set to 'Fixes #{{ISSUE_NUMBER}}. Autonomously resolved by PraisonAI.',
head_branch set to praisonai/issue-{{ISSUE_NUMBER}},
and base_branch set to main.
Second, post a comment on the issue via execute_command running:
gh issue comment {{ISSUE_NUMBER}} -b "PraisonAI has analyzed the issue and opened a Pull Request with a fix."
expected_output: The URL of the successfully created Pull Request.
dependencies: [Implement Fix]
+2 -2
View File
@@ -1,3 +1,3 @@
# GitHub Issue #1337: Big Task: Document CLI Router Architecture
# GitHub Issue #1341: Add a comment to shell_tools.py execute_command
Please thoroughly trace how src/praisonai/praisonai/cli/main.py interfaces with typer across all command modules. Produce a detailed architecture document in a new file docs/cli_architecture_test.md.
Please add a single-line comment '# shell command execution' at the top of the execute_command method docstring in src/praisonai-agents/praisonaiagents/tools/shell_tools.py
@@ -1,7 +1,4 @@
import os
import subprocess
from pydantic import BaseModel, Field
from typing import Dict, Any, Optional
import logging
from .decorator import tool
@@ -50,7 +50,14 @@ class ShellTools:
Returns:
Dictionary with execution results
"""
# shell command execution
try:
# Strip wrapping quotes the LLM sometimes adds around the whole command string
if command and len(command) >= 2 and command[0] == command[-1] and command[0] in ("'", '"'):
command = command[1:-1]
# Treat empty-string cwd same as None to avoid subprocess failure
if not cwd:
cwd = None
# Always split command for safety (no shell execution)
# Use shlex.split with appropriate posix flag
if platform.system() == 'Windows':
@@ -59,6 +66,16 @@ class ShellTools:
else:
command = shlex.split(command)
# Guard against empty command after parsing
if not command:
return {
'stdout': '',
'stderr': 'Empty command provided',
'exit_code': 1,
'success': False,
'execution_time': 0
}
# Expand tilde and environment variables in command arguments
# (shell=False means the shell won't do this for us)
command = [os.path.expanduser(os.path.expandvars(arg)) for arg in command]