fix(bridge): disable pending generation for SafeToAutoRun
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"name": "gravity-bridge",
|
||||
"displayName": "Gravity Bridge",
|
||||
"description": "Antigravity ↔ Discord 브리지 연동 확장",
|
||||
"version": "0.5.15",
|
||||
"version": "0.5.16",
|
||||
"publisher": "variet",
|
||||
"engines": {
|
||||
"vscode": "^1.100.0"
|
||||
|
||||
@@ -343,9 +343,7 @@ function setupMonitor() {
|
||||
}
|
||||
autoRunSteps.add(actualIdx);
|
||||
const cmdText = tcArgs.CommandLine || tcArgs.command || tcArgs.Command || JSON.stringify(tcArgs);
|
||||
const truncatedCmd = cmdText.length > 500 ? cmdText.substring(0, 500) + '...' : cmdText;
|
||||
ctx.logToFile(`[AUTO-RUN] step=${actualIdx} captured`);
|
||||
ctx.writeChatSnapshot(`🤖 **[Background Execution]**\n\n\`\`\`bash\n${truncatedCmd}\n\`\`\``);
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
@@ -496,9 +494,11 @@ function setupMonitor() {
|
||||
const toolCall = oStep?.metadata?.toolCall;
|
||||
const toolName = toolCall?.name || (oStep.type || '').replace('CORTEX_STEP_TYPE_', '').toLowerCase();
|
||||
let command = toolName;
|
||||
let safeToAutoRun = false;
|
||||
if (toolCall?.argumentsJson) {
|
||||
try {
|
||||
const args = JSON.parse(toolCall.argumentsJson);
|
||||
safeToAutoRun = args.SafeToAutoRun === true || args.safeToAutoRun === true;
|
||||
if (args.CommandLine) command = `${toolName}: ${args.CommandLine.substring(0, 1500)}`;
|
||||
else if (args.TargetFile) command = `${toolName}: ${args.TargetFile}`;
|
||||
else {
|
||||
@@ -521,6 +521,8 @@ function setupMonitor() {
|
||||
// Skip pending for workspace-less AG windows (project=default)
|
||||
if (ctx.projectName === 'default') {
|
||||
ctx.logToFile(`[STEP-PROBE] skip pending: ctx.projectName=default (no workspace)`);
|
||||
} else if (safeToAutoRun) {
|
||||
ctx.logToFile(`[STEP-PROBE] skip pending: SafeToAutoRun is true (step=${actualIndex})`);
|
||||
} else {
|
||||
// Always write pending — Bot decides auto-approve (prevents double-fire)
|
||||
writePendingApproval({
|
||||
@@ -558,11 +560,13 @@ function setupMonitor() {
|
||||
const toolCall = step?.metadata?.toolCall;
|
||||
const toolName = toolCall?.name || stepType.replace('CORTEX_STEP_TYPE_', '').toLowerCase();
|
||||
let command = toolName;
|
||||
let safeToAutoRun = false;
|
||||
|
||||
// Parse argumentsJson for command details
|
||||
if (toolCall?.argumentsJson) {
|
||||
try {
|
||||
const args = JSON.parse(toolCall.argumentsJson);
|
||||
safeToAutoRun = args.SafeToAutoRun === true || args.safeToAutoRun === true;
|
||||
if (args.CommandLine) {
|
||||
command = `${toolName}: ${args.CommandLine.substring(0, 1500)}`;
|
||||
} else if (args.TargetFile) {
|
||||
@@ -588,6 +592,8 @@ function setupMonitor() {
|
||||
// Skip pending for workspace-less AG windows (project=default)
|
||||
if (ctx.projectName === 'default') {
|
||||
ctx.logToFile(`[STEP-PROBE] skip pending: ctx.projectName=default (no workspace)`);
|
||||
} else if (safeToAutoRun) {
|
||||
ctx.logToFile(`[STEP-PROBE] skip pending: SafeToAutoRun is true (step=${si})`);
|
||||
} else {
|
||||
// Always write pending — Bot decides auto-approve (prevents double-fire)
|
||||
writePendingApproval({
|
||||
@@ -640,9 +646,11 @@ function setupMonitor() {
|
||||
const toolCall = oStep?.metadata?.toolCall;
|
||||
const toolName = toolCall?.name || (oStep.type || '').replace('CORTEX_STEP_TYPE_', '').toLowerCase();
|
||||
let command = toolName;
|
||||
let safeToAutoRun = false;
|
||||
if (toolCall?.argumentsJson) {
|
||||
try {
|
||||
const args = JSON.parse(toolCall.argumentsJson);
|
||||
safeToAutoRun = args.SafeToAutoRun === true || args.safeToAutoRun === true;
|
||||
if (args.CommandLine) command = `${toolName}: ${args.CommandLine.substring(0, 1500)}`;
|
||||
else if (args.TargetFile) command = `${toolName}: ${args.TargetFile}`;
|
||||
else {
|
||||
@@ -658,7 +666,11 @@ function setupMonitor() {
|
||||
if (actualIndex > ctx.lastPendingStepIndex) ctx.lastPendingStepIndex = actualIndex;
|
||||
lastPendingTime = Date.now();
|
||||
ctx.sawRunningAfterPending = false;
|
||||
if (ctx.projectName !== 'default') {
|
||||
if (ctx.projectName === 'default') {
|
||||
ctx.logToFile(`[STEP-PROBE] skip pending: ctx.projectName=default`);
|
||||
} else if (safeToAutoRun) {
|
||||
ctx.logToFile(`[STEP-PROBE] skip pending: SafeToAutoRun is true (step=${actualIndex})`);
|
||||
} else {
|
||||
writePendingApproval({
|
||||
conversation_id: ctx.activeSessionId,
|
||||
command,
|
||||
|
||||
Reference in New Issue
Block a user