Skip to content

valkryhx/google_adk_agent / skills/agent_team_to_be_update

Agent 团队协作(去中心化拉模型)

Flagged

赋予 Agent 作为集群指挥官(Leader)的能力,通过去中心化任务队列将子任务派发给 Worker 节点并发执行。

FileKindSize
SKILL.mdskill md17.9 KB
decentralized_tools.pyscript36.2 KB
dependency_analyzer.pyscript10.9 KB
inbox_watcher.pyscript8.5 KB
loop_executor.pyscript16.4 KB
mailbox.pyscript15.3 KB
models.pyscript9.1 KB
path_guard.pyscript13.3 KB
planner.pyscript14.6 KB
polling_daemon.pyscript7.7 KB
self_claim_loop.pyscript20.1 KB
task_queue.pyscript24.1 KB
team_config.pyscript7.5 KB
test/__init__.pyscript40 B
test/test_blog_system_develop.pyscript12.0 KB
test/test_dag_create_validation.pyscript2.7 KB
test/test_decentralized_arch.pyscript36.9 KB
test/test_deepresearch.pyscript14.6 KB
test/test_loop_dag.pyscript17.0 KB
test/test_real_training.pyscript9.2 KB
test/test_tdd_gate.pyscript4.5 KB
tools.pyscript85.8 KB
verification_hooks.pyscript10.7 KB
worktree_manager.pyscript12.8 KB

test/test_tdd_gate.py

View on GitHub
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
TDD Gate Tests for SelfClaimLoop verification hook integration.

Verifies that:
1. A task with a FAILING verification_command is NOT marked completed
   (status stays pending after handle_task_error resets it).
2. A task with a PASSING verification_command IS marked completed.
3. A task with no verification_commands completes unconditionally.
"""

import asyncio
import os
import sys
import tempfile

sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))

from models import Task
from task_queue import TaskQueue
from self_claim_loop import SelfClaimLoop


def _make_queue(tmpdir: str, team_id: str = "tdd_test") -> TaskQueue:
    return TaskQueue(team_id=team_id, base_dir=tmpdir)


def _make_loop(queue: TaskQueue, tmpdir: str) -> SelfClaimLoop:
    loop = SelfClaimLoop(
        agent_id="test_worker",
        agent_port=0,
        team_id=queue.team_id,
        coordination_dir=tmpdir,
        task_executor=lambda task: {"success": True},  # always "succeeds"
    )
    # Bypass mailbox send (no real mailbox in unit test)
    loop.mailbox = _NoOpMailbox()
    loop._leader_agent_id = "test_leader"
    return loop


class _NoOpMailbox:
    """Stub mailbox that silently drops messages."""
    def send_message(self, **kwargs):
        pass


async def _run_task(loop: SelfClaimLoop, task: Task):
    """Helper: claim and execute a single task through SelfClaimLoop."""
    await loop._try_claim_and_execute(task)


# ---------------------------------------------------------------------------
# Test 1: Failing verification_command keeps task out of completed
# ---------------------------------------------------------------------------
def test_failing_verification_blocks_completion():
    with tempfile.TemporaryDirectory() as tmpdir:
        queue = _make_queue(tmpdir)
        task = queue.create_task(
            name="failing_task",
            description="Should fail verification",
            verification_commands=["python -c \"assert 1 == 2, 'intentional failure'\""],
        )

        scl = _make_loop(queue, tmpdir)
        asyncio.run(_run_task(scl, task))

        refreshed = queue.get_task(task.id)
        assert refreshed.status != "completed", (
            f"Expected task NOT completed after failing verification, got status={refreshed.status}"
        )
        print(f"[PASS] test_failing_verification_blocks_completion: status={refreshed.status}")


# ---------------------------------------------------------------------------
# Test 2: Passing verification_command allows completion
# ---------------------------------------------------------------------------
def test_passing_verification_allows_completion():
    with tempfile.TemporaryDirectory() as tmpdir:
        queue = _make_queue(tmpdir)
        task = queue.create_task(
            name="passing_task",
            description="Should pass verification",
            verification_commands=["python -c \"assert 1 == 1\""],
        )

        scl = _make_loop(queue, tmpdir)
        asyncio.run(_run_task(scl, task))

        refreshed = queue.get_task(task.id)
        assert refreshed.status == "completed", (
            f"Expected task completed after passing verification, got status={refreshed.status}"
        )
        print(f"[PASS] test_passing_verification_allows_completion: status={refreshed.status}")


# ---------------------------------------------------------------------------
# Test 3: No verification_commands — task completes unconditionally
# ---------------------------------------------------------------------------
def test_no_verification_commands_completes():
    with tempfile.TemporaryDirectory() as tmpdir:
        queue = _make_queue(tmpdir)
        task = queue.create_task(
            name="no_verification_task",
            description="No verification commands set",
        )

        scl = _make_loop(queue, tmpdir)
        asyncio.run(_run_task(scl, task))

        refreshed = queue.get_task(task.id)
        assert refreshed.status == "completed", (
            f"Expected task completed (no verification), got status={refreshed.status}"
        )
        print(f"[PASS] test_no_verification_commands_completes: status={refreshed.status}")


if __name__ == "__main__":
    print("\n" + "=" * 60)
    print("TDD Gate Tests")
    print("=" * 60 + "\n")

    test_failing_verification_blocks_completion()
    test_passing_verification_allows_completion()
    test_no_verification_commands_completes()

    print("\n" + "=" * 60)
    print("All TDD gate tests passed!")
    print("=" * 60)
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall