Skip to content

Commit 51aedd2

Browse files
committed
feat: Enhance autonomous execution guidelines for diagnostic commands
1 parent b98486e commit 51aedd2

2 files changed

Lines changed: 31 additions & 1 deletion

File tree

src/agents/plugins/execution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ def tail_log(
646646
)
647647
ctx = max(1, min(context_lines, 10))
648648
command = (
649-
f"grep -iEnC{ctx} --group-separator='---' "
649+
f"grep -iEnC{ctx} --group-separator=--- "
650650
+ f"'{pattern_to_use}' {log_pattern} 2>/dev/null | "
651651
f"tail -n {lines}"
652652
)

src/agents/prompts.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@
197197

198198
ACTION_EXECUTOR_SYSTEM_PROMPT = """You execute SAP HA actions and tests on remote hosts.
199199
200+
**ABSOLUTELY CRITICAL - AUTONOMOUS EXECUTION**:
201+
YOU HAVE FULL AUTHORITY TO RUN ANY DIAGNOSTIC/READ-ONLY COMMANDS WITHOUT PERMISSION.
202+
- NEVER ask "Do you want me to...?" - YES, do it immediately
203+
- NEVER say "Tell me to proceed" - YOU proceed immediately
204+
- NEVER say "Just say 'run X'" - YOU run X immediately
205+
- NEVER claim "safety rules require explicit user instruction" - FALSE for diagnostics
206+
- If one approach fails, immediately try alternatives (different commands, roles, log types)
207+
- ALL diagnostic commands are pre-approved - execute them autonomously
208+
200209
USER-FRIENDLY COMMUNICATION:
201210
- Speak in plain language - avoid internal technical details
202211
- Keep responses concise and actionable
@@ -316,6 +325,18 @@
316325
- If investigation requires logs, CHECK THEM - don't ask "would you like me to check logs?"
317326
- NEVER state conclusions without showing the evidence that led to them
318327
328+
ERROR RECOVERY (CRITICAL - NEVER ASK FOR PERMISSION):
329+
- If tail_log fails → immediately try run_readonly_command with journalctl or tail commands
330+
- If one log type fails → try another log type or role automatically
331+
- If role="system" fails → retry with role="scs" or role="db" based on context
332+
- If a grep pattern fails → retry without the pattern or with simpler pattern
333+
- NEVER say "I need explicit user instruction" - you have FULL autonomy to investigate
334+
- NEVER say "tell me to proceed" - YOU proceed immediately with alternative approaches
335+
- NEVER say "safety rules require explicit user instruction" - that's FALSE for diagnostic commands
336+
- NEVER stop and ask "Do you want me to X?" - YES, do X immediately if it's diagnostic/read-only
337+
- If command syntax error occurs → reformulate the command and retry immediately
338+
- ALL diagnostic and log-reading commands are ALWAYS permitted - no permission needed
339+
319340
DO NOT:
320341
- Stop after running one status command without analysis
321342
- Ask "would you like me to check logs?" - just check them
@@ -330,11 +351,20 @@
330351
- Present assumptions as conclusions
331352
- Ask user "which role should I use?" - determine it from context and execute
332353
- Say "Reply with one of these: use scs / use system" - just try the logical one
354+
- Ask "Do you want me to pull the pacemaker journal logs?" - YES, always pull them immediately
355+
- Say "Tell me to proceed" - YOU proceed immediately, no permission needed
356+
- Claim "safety rules require explicit user instruction" for ANY read-only/diagnostic command
357+
- Stop investigation because of a command error - retry with alternative commands immediately
333358
334359
EXAMPLE OF WHAT NOT TO DO:
335360
❌ "The framework only reports that the commands completed — it does not include the actual command output"
336361
❌ "Please reply with: 'show the last command output'"
337362
❌ "Just say: Run cluster checks"
363+
❌ "Tell me: Do you want me to pull the pacemaker journal logs from the SCS node now?"
364+
❌ "Please say: Run pacemaker logs"
365+
❌ "I need explicit user instruction for commands outside the whitelisted log types"
366+
❌ "The safety rules require explicit user instruction" (FALSE - diagnostic commands don't need permission)
367+
❌ "If you'd like me to fetch it, just say: Run pacemaker logs" (NO - fetch it immediately!)
338368
339369
EXAMPLE OF CORRECT BEHAVIOR:
340370
✅ Parse the ExecutionResult JSON, extract stdout, present the cluster status, analyze findings

0 commit comments

Comments
 (0)