Merge pull request #168 from continuedev/auto-fix-feedback
Auto-fix-feedback
This commit is contained in:
commit
4a22a641e3
3 changed files with 79 additions and 9 deletions
59
.github/workflows/respond-to-cubic-dev-ai.yml
vendored
Normal file
59
.github/workflows/respond-to-cubic-dev-ai.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
name: Respond to cubic-dev-ai Comments
|
||||
|
||||
on:
|
||||
issue_comment:
|
||||
types: [created]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
respond-to-comment:
|
||||
# Only run on pull request comments
|
||||
if: github.event.issue.pull_request
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Check if comment is from cubic-dev-ai
|
||||
id: check-author
|
||||
run: |
|
||||
if [ "${{ github.event.comment.user.login }}" = "cubic-dev-ai" ]; then
|
||||
echo "is_cubic_dev_ai=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "is_cubic_dev_ai=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Get comment content
|
||||
if: steps.check-author.outputs.is_cubic_dev_ai == 'true'
|
||||
id: comment-content
|
||||
run: |
|
||||
# Store the comment body for debugging/logging
|
||||
echo "Comment from cubic-dev-ai:"
|
||||
echo "${{ github.event.comment.body }}"
|
||||
|
||||
- name: Respond to cubic-dev-ai comment
|
||||
if: steps.check-author.outputs.is_cubic_dev_ai == 'true'
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const commentBody = `👋 Thanks for the feedback, @cubic-dev-ai!
|
||||
|
||||
I've received your comment:
|
||||
> ${{ github.event.comment.body }}
|
||||
|
||||
Your input has been acknowledged and will be reviewed by the team.`;
|
||||
|
||||
await github.rest.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
issue_number: context.issue.number,
|
||||
body: commentBody
|
||||
});
|
||||
|
||||
- name: Log acknowledgement
|
||||
if: steps.check-author.outputs.is_cubic_dev_ai == 'true'
|
||||
run: |
|
||||
echo "✅ Successfully acknowledged comment from cubic-dev-ai on PR #${{ github.event.issue.number }}"
|
||||
echo "Original comment: ${{ github.event.comment.body }}"
|
||||
|
|
@ -21,8 +21,8 @@ import type { ToolPermissionServiceState } from "./services/ToolPermissionServic
|
|||
import { telemetryService } from "./telemetry/telemetryService.js";
|
||||
import { calculateTokenCost } from "./telemetry/utils.js";
|
||||
import {
|
||||
getAllBuiltinTools,
|
||||
executeToolCall,
|
||||
getAllBuiltinTools,
|
||||
getAvailableTools,
|
||||
Tool,
|
||||
ToolCall,
|
||||
|
|
@ -38,7 +38,6 @@ import { logger } from "./util/logger.js";
|
|||
dotenv.config();
|
||||
|
||||
export function getAllTools() {
|
||||
|
||||
// Get all available tool names
|
||||
const allBuiltinTools = getAllBuiltinTools();
|
||||
const builtinToolNames = allBuiltinTools.map((tool) => tool.name);
|
||||
|
|
@ -52,18 +51,25 @@ export function getAllTools() {
|
|||
const serviceResult = getServiceSync<ToolPermissionServiceState>(
|
||||
SERVICE_NAMES.TOOL_PERMISSIONS
|
||||
);
|
||||
|
||||
|
||||
let allowedToolNames: string[];
|
||||
if (serviceResult.state === 'ready' && serviceResult.value) {
|
||||
if (serviceResult.state === "ready" && serviceResult.value) {
|
||||
// Filter out excluded tools based on permissions
|
||||
allowedToolNames = filterExcludedTools(allToolNames, serviceResult.value.permissions);
|
||||
allowedToolNames = filterExcludedTools(
|
||||
allToolNames,
|
||||
serviceResult.value.permissions
|
||||
);
|
||||
} else {
|
||||
// Service not ready - this is a critical error since tools should only be
|
||||
// requested after services are properly initialized
|
||||
logger.error("ToolPermissionService not ready in getAllTools - this indicates a service initialization timing issue");
|
||||
throw new Error("ToolPermissionService not initialized. Services must be initialized before requesting tools.");
|
||||
logger.error(
|
||||
"ToolPermissionService not ready in getAllTools - this indicates a service initialization timing issue"
|
||||
);
|
||||
throw new Error(
|
||||
"ToolPermissionService not initialized. Services must be initialized before requesting tools."
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
const allowedToolNamesSet = new Set(allowedToolNames);
|
||||
|
||||
// Filter builtin tools
|
||||
|
|
@ -81,7 +87,11 @@ export function getAllTools() {
|
|||
properties: Object.fromEntries(
|
||||
Object.entries(tool.parameters).map(([key, param]) => [
|
||||
key,
|
||||
{ type: param.type, description: param.description },
|
||||
{
|
||||
type: param.type,
|
||||
description: param.description,
|
||||
items: param.items,
|
||||
},
|
||||
])
|
||||
),
|
||||
required: Object.entries(tool.parameters)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["src/**/*"],
|
||||
"exclude": [
|
||||
"src/**/*.test.ts",
|
||||
"src/**/*.test.tsx",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue