Chuyển đến nội dung
Skillpedia
Lập trình chung7.8k · #13026

verify-success-after-unknown-error

Skill này làm gì

Skill này bảo AI agent kiểm tra xem công việc đã thực sự hoàn thành hay chưa trước khi thử lại sau một lỗi không rõ ràng. Nó dành cho những người có công cụ báo lỗi không rõ nguyên nhân ngay cả khi file đã được tạo.

Khi nào nên dùng

  • ✓Khi sandbox mã trả về lỗi không rõ nguyên nhân nhưng mã có thể đã chạy xong.
  • ✓Khi một lệnh shell thất bại với thông báo không rõ ràng trên một tác vụ file.
  • ✓Khi việc tạo hoặc thay đổi file báo lỗi mà có thể là sai.

Liên kết skill

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/verify-success-after-unknown-error/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/verify-success-after-unknown-error/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Công cụ báo lỗi không rõ nguyên nhân khi tôi tạo PDF, nhưng file có thể đã có đó. Hãy kiểm tra xem nó đã được tạo và đọc được chưa trước khi thử lại.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent liệt kê thư mục đầu ra mong đợi và kiểm tra từng file cần có có tồn tại không. Sau đó nó mở các file để xác nhận chúng có nội dung như mong đợi, để không thử lại công việc đã thành công.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Verify Success After Unknown Error

Purpose

When execute_code_sandbox or run_shell return "unknown error" messages, the underlying task may have actually succeeded. This skill provides a systematic approach to verify actual completion before assuming failure and retrying unnecessarily.

When to Apply

Use this pattern when:

  • execute_code_sandbox returns "unknown error" but your code may have completed
  • run_shell fails with unclear error messages
  • File creation, modification, or transformation tasks report errors
  • The error message is generic/unspecified rather than a clear failure reason

Verification Steps

Step 1: Check Expected Output Files

After receiving an unknown error, immediately verify if expected files were created:

# Example: Verify file creation after execute_code_sandbox
from tools import list_dir, read_file

# List directory to check if files exist
files = list_dir(path="/workspace/output")
print(files)

# Check specific file existence
expected_files = ["report.pdf", "data.xlsx"]
for f in expected_files:
    try:
        content = read_file(filetype="pdf", file_path=f"/workspace/output/{f}")
        print(f"✓ {f} exists and is readable")
    except:
        print(f"✗ {f} not found or unreadable")

Step 2: Validate File Content/State

Don't just check existence — verify the files have expected content:

# For spreadsheets
file_content = read_file(filetype="xlsx", file_path="/workspace/output/schedule.xlsx")
# Verify expected sheets, columns, or data exist

# For text/json files
file_content = read_file(filetype="txt", file_path="/workspace/output/result.json")
# Parse and validate structure

# For directories
dir_contents = list_dir(path="/workspace/output")
# Verify expected number of files or specific files exist

Step 3: Decision Logic

IF expected files exist AND content is valid:
    → Task succeeded despite error message
    → Proceed to next step without retry
    
ELIF files exist but content is incomplete:
    → Partial success, may need targeted fix
    
ELSE (files missing or corrupted):
    → True failure, retry or debug required

Code Example: Complete Pattern

def execute_with_verification(code, expected_files):
    """Execute code and verify success even if error returned."""
    
    # Attempt execution
    result = execute_code_sandbox(code=code)
    
    # Check for unknown/generic errors
    if "unknown error" in result.get("output", "").lower() or result.get("error"):
        print("Received error, verifying actual outcome...")
        
        # Verify filesystem state
        all_present = True
        for f in expected_files:
            try:
                list_dir(path=f"/workspace/{f}")  # or appropriate path
                print(f"✓ {f} verified")
            except:
                print(f"✗ {f} missing")
                all_present = False
        
        if all_present:
            print("Task completed successfully despite error message")
            return {"status": "success_verified", "files": expected_files}
        else:
            print("True failure - files not created")
            return {"status": "failed", "error": result.get("error")}
    
    return {"status": "success", "output": result.get("output")}

Shell Command Example

# After run_shell returns error, verify with:
ls -la /workspace/output/
test -f /workspace/output/result.pdf && echo "File exists" || echo "File missing"
file /workspace/output/result.pdf  # Verify file type is correct

Benefits

  • Saves iterations: Avoids unnecessary retries when task already succeeded
  • Handles tool bugs: Works around sandbox/shell tool reporting issues
  • Faster completion: Move forward immediately when verification passes
  • Clearer debugging: Distinguishes true failures from false positives

Anti-Patterns to Avoid

  • ✗ Immediately retrying on any error without verification
  • ✗ Assuming "unknown error" means complete failure
  • ✗ Only checking file existence without validating content
  • ✗ Skipping verification for "minor" tasks (any file output should be verified)

Related Tools

  • list_dir — Check directory contents
  • read_file — Validate file content and accessibility
  • execute_code_sandbox — Primary execution tool this pattern supports
  • run_shell — Shell execution tool this pattern supports
Câu hỏi thường gặp

Tại sao kiểm tra trước khi thử lại?

Skill nói công việc có thể đã thành công dù công cụ báo lỗi không rõ nguyên nhân, nên thử lại có thể lãng phí công sức.

Kiểm tra nội dung thêm được gì?

Mở file xác nhận nó chứa dữ liệu mong đợi, chứ không chỉ là tồn tại.

Nó kiểm tra những file nào?

Nó kiểm tra các file đầu ra mà nhiệm vụ được mong đợi tạo ra.

Chi tiết

Mô tả gốc của tác giả

Verify task completion by checking filesystem state when execute_code_sandbox or run_shell return misleading unknown errors

repo: HKUDS/AgentPilot

Độ phổ biến

Sao GitHub
7.8k
Vị trí xếp hạng
#13026
Giấy phép
MIT
Cập nhật
1/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự