-
Notifications
You must be signed in to change notification settings - Fork 1
feat: implement tool permission checking (#16) #147
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -636,3 +636,30 @@ def _render_and_estimate( # noqa: PLR0913 | |
| ) | ||
| content = _render_template(template_str, context) | ||
| return content, estimator.estimate_tokens(content) | ||
|
|
||
|
|
||
| def format_task_instruction(task: Task) -> str: | ||
| """Format a task into a user message for the initial conversation. | ||
|
|
||
| Args: | ||
| task: Task to format. | ||
|
|
||
| Returns: | ||
| Markdown-formatted task instruction string. | ||
| """ | ||
| parts = [f"# Task: {task.title}", "", task.description] | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Untrusted task content ( |
||
|
|
||
| if task.acceptance_criteria: | ||
| parts.append("") | ||
| parts.append("## Acceptance Criteria") | ||
| parts.extend(f"- {c.description}" for c in task.acceptance_criteria) | ||
|
|
||
| if task.budget_limit > 0: | ||
| parts.append("") | ||
| parts.append(f"**Budget limit:** ${task.budget_limit:.2f} USD") | ||
|
|
||
| if task.deadline: | ||
| parts.append("") | ||
| parts.append(f"**Deadline:** {task.deadline}") | ||
|
|
||
| return "\n".join(parts) | ||
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.
The code uses the outdated Python 2 syntax for catching multiple exceptions:
except MemoryError, RecursionError:. In Python 3, this is interpreted asexcept MemoryError as RecursionError:, which means it only catchesMemoryErrorand assigns the exception object to the variable nameRecursionError. Consequently,RecursionErroris NOT caught by this block. This violates the design principle thatRecursionErroris a non-recoverable error that should be re-raised. Instead, it will be caught by subsequentexcept Exceptionblocks and handled as a recoverable error, which could lead to inconsistent system state.