源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,160 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""UltraQA gate — 3-agent QA cycle with stop conditions."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Any, Optional
|
||||
|
||||
from qwenpaw.loop.gates.base import StopAction, StopHandlerResult
|
||||
from qwenpaw.loop.gates.loop_gate import LoopGate
|
||||
|
||||
from ..shared.constants import ULTRAQA_MAX_CYCLES, ULTRAQA_MAX_SAME_FAILURE
|
||||
from ..shared.state import WorkflowState
|
||||
from .prompts import build_continuation as _build_prompt
|
||||
|
||||
|
||||
@dataclass
|
||||
class _UltraQAState:
|
||||
loop_dir: Path
|
||||
workspace_dir: Path
|
||||
active: bool = True
|
||||
cycle: int = 0
|
||||
max_cycles: int = ULTRAQA_MAX_CYCLES
|
||||
goal_type: str = "tests"
|
||||
custom_cmd: str = ""
|
||||
interactive: bool = False
|
||||
qa_passed: bool = False
|
||||
last_failures: list[str] = field(default_factory=list)
|
||||
|
||||
|
||||
class UltraQAGate(LoopGate):
|
||||
"""Stop gate for the UltraQA 3-agent cycle."""
|
||||
|
||||
@property
|
||||
def name(self) -> str:
|
||||
return "ultraqa"
|
||||
|
||||
@property
|
||||
def priority(self) -> int:
|
||||
return 50
|
||||
|
||||
def activate_for_qa(
|
||||
self,
|
||||
workspace_dir: Path,
|
||||
goal_type: str = "tests",
|
||||
custom_cmd: str = "",
|
||||
interactive: bool = False,
|
||||
max_cycles: int = ULTRAQA_MAX_CYCLES,
|
||||
) -> Path:
|
||||
"""Create state directory and activate the gate."""
|
||||
wf = WorkflowState(workspace_dir, "ultraqa")
|
||||
loop_dir = wf.create_instance()
|
||||
state = _UltraQAState(
|
||||
loop_dir=loop_dir,
|
||||
workspace_dir=workspace_dir,
|
||||
max_cycles=max_cycles,
|
||||
goal_type=goal_type,
|
||||
custom_cmd=custom_cmd,
|
||||
interactive=interactive,
|
||||
)
|
||||
wf.write_state(
|
||||
{
|
||||
"cycle": 0,
|
||||
"qa_passed": False,
|
||||
"last_failures": [],
|
||||
},
|
||||
)
|
||||
self.activate(state)
|
||||
return loop_dir
|
||||
|
||||
async def check(self, ctx: Any) -> Optional[StopHandlerResult]:
|
||||
if isinstance(ctx, dict) and ctx.get("has_tool_calls"):
|
||||
return StopHandlerResult(action=StopAction.BYPASS)
|
||||
|
||||
st: _UltraQAState | None = self._state()
|
||||
if st is None:
|
||||
return StopHandlerResult(
|
||||
action=StopAction.BYPASS,
|
||||
)
|
||||
|
||||
wf = WorkflowState.from_existing(
|
||||
st.workspace_dir,
|
||||
"ultraqa",
|
||||
st.loop_dir,
|
||||
)
|
||||
data = await asyncio.to_thread(wf.read_state)
|
||||
|
||||
# Agent-owned fields — never overwritten by the gate.
|
||||
st.qa_passed = data.get("qa_passed", False)
|
||||
st.last_failures = data.get(
|
||||
"last_failures",
|
||||
st.last_failures,
|
||||
)
|
||||
|
||||
if st.qa_passed:
|
||||
await asyncio.to_thread(wf.cleanup)
|
||||
self.deactivate()
|
||||
return StopHandlerResult(
|
||||
action=StopAction.TERMINATE,
|
||||
reason="QA goals achieved",
|
||||
)
|
||||
|
||||
# Gate owns cycle in memory (single writer).
|
||||
if st.cycle >= st.max_cycles:
|
||||
await asyncio.to_thread(wf.cleanup)
|
||||
self.deactivate()
|
||||
return StopHandlerResult(
|
||||
action=StopAction.TERMINATE,
|
||||
reason=f"Reached max cycles ({st.max_cycles})",
|
||||
)
|
||||
|
||||
if _repeated_failure(
|
||||
st.last_failures,
|
||||
ULTRAQA_MAX_SAME_FAILURE,
|
||||
):
|
||||
await asyncio.to_thread(wf.cleanup)
|
||||
self.deactivate()
|
||||
return StopHandlerResult(
|
||||
action=StopAction.TERMINATE,
|
||||
reason="Same failure repeated too many times",
|
||||
)
|
||||
|
||||
st.cycle += 1
|
||||
await asyncio.to_thread(
|
||||
wf.update_state,
|
||||
{"cycle": st.cycle},
|
||||
)
|
||||
|
||||
return StopHandlerResult(
|
||||
action=StopAction.INTERRUPT_AND_CONTINUE,
|
||||
reason="QA cycle in progress",
|
||||
)
|
||||
|
||||
def build_continuation(self) -> str:
|
||||
"""Build QA cycle continuation from gate state."""
|
||||
st: _UltraQAState | None = self._state()
|
||||
if st is None:
|
||||
return ""
|
||||
return _build_prompt(
|
||||
cycle=st.cycle,
|
||||
max_cycles=st.max_cycles,
|
||||
goal_type=st.goal_type,
|
||||
custom_cmd=st.custom_cmd,
|
||||
last_failures=st.last_failures,
|
||||
loop_dir=st.loop_dir,
|
||||
interactive=st.interactive,
|
||||
)
|
||||
|
||||
|
||||
def _repeated_failure(
|
||||
failures: list[str],
|
||||
threshold: int,
|
||||
) -> bool:
|
||||
"""Check if the most recent failure repeated >= threshold."""
|
||||
if len(failures) < threshold:
|
||||
return False
|
||||
last = failures[-1]
|
||||
return all(f == last for f in failures[-threshold:])
|
||||
@@ -0,0 +1,112 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""UltraQAMode — QA cycle engine with 3-agent collaboration."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import logging
|
||||
from pathlib import Path
|
||||
from typing import TYPE_CHECKING, Optional
|
||||
|
||||
from qwenpaw.runtime.slash_command_registry import CommandSpec
|
||||
|
||||
from ..shared.args import split_args
|
||||
from ..shared.loop_ui_i18n import loop_command_metadata, loop_help_text
|
||||
from ..shared.mode_base import OMPModeBase, info_msg, rewrite_user_msg
|
||||
from .gate import UltraQAGate
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing import Any
|
||||
|
||||
from agentscope.message import Msg
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_HELP = loop_help_text("ultraqa")
|
||||
|
||||
|
||||
class UltraQAMode(OMPModeBase):
|
||||
"""AgentMode for the UltraQA workflow."""
|
||||
|
||||
name = "ultraqa"
|
||||
gate_cls = UltraQAGate
|
||||
plugin_id = "__omp_ultraqa__"
|
||||
handler_name = "ultraqa-stop-handler"
|
||||
scope = "omp-ultraqa"
|
||||
|
||||
def commands(self) -> list[CommandSpec]:
|
||||
return [
|
||||
CommandSpec(
|
||||
name="ultraqa",
|
||||
handler=self._handler,
|
||||
category="builtin",
|
||||
help_text=_HELP,
|
||||
metadata=loop_command_metadata("ultraqa"),
|
||||
),
|
||||
]
|
||||
|
||||
async def _handler(self, ctx: "Any", args: str) -> Optional["Msg"]:
|
||||
if not args or not args.strip() or args.strip().lower() == "help":
|
||||
return info_msg(_HELP)
|
||||
|
||||
parsed = _parse_args(args)
|
||||
if parsed is None:
|
||||
return info_msg("Invalid arguments. " + _HELP)
|
||||
|
||||
workspace_dir = getattr(ctx, "workspace_dir", None)
|
||||
if not workspace_dir:
|
||||
return info_msg("ERROR: no workspace directory available.")
|
||||
|
||||
self.claim_workflow()
|
||||
loop_dir = await asyncio.to_thread(
|
||||
self._gate.activate_for_qa,
|
||||
Path(workspace_dir),
|
||||
parsed["goal_type"],
|
||||
parsed["custom_cmd"],
|
||||
parsed["interactive"],
|
||||
)
|
||||
|
||||
prompt = (
|
||||
f"UltraQA activated. Goal: {parsed['goal_type']}.\n"
|
||||
f"State directory: {loop_dir}\n"
|
||||
f"Read {loop_dir}/state.json and begin the QA cycle."
|
||||
)
|
||||
rewrite_user_msg(ctx, prompt)
|
||||
logger.info("UltraQA started: %s", loop_dir)
|
||||
return None
|
||||
|
||||
|
||||
def _parse_args(raw: str) -> dict | None:
|
||||
"""Parse /ultraqa arguments. ``None`` means invalid input."""
|
||||
tokens = split_args(raw)
|
||||
if tokens is None:
|
||||
return None
|
||||
|
||||
goal_type = "tests"
|
||||
custom_cmd = ""
|
||||
interactive = False
|
||||
|
||||
i = 0
|
||||
while i < len(tokens):
|
||||
t = tokens[i]
|
||||
if t == "--tests":
|
||||
goal_type = "tests"
|
||||
elif t == "--build":
|
||||
goal_type = "build"
|
||||
elif t == "--lint":
|
||||
goal_type = "lint"
|
||||
elif t == "--typecheck":
|
||||
goal_type = "typecheck"
|
||||
elif t == "--interactive":
|
||||
interactive = True
|
||||
elif t == "--custom" and i + 1 < len(tokens):
|
||||
goal_type = "custom"
|
||||
i += 1
|
||||
custom_cmd = tokens[i]
|
||||
i += 1
|
||||
|
||||
return {
|
||||
"goal_type": goal_type,
|
||||
"custom_cmd": custom_cmd,
|
||||
"interactive": interactive,
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""UltraQA continuation prompt templates."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from ..shared.role_prompts import format_spawn_call
|
||||
|
||||
|
||||
def build_continuation(
|
||||
cycle: int,
|
||||
max_cycles: int,
|
||||
goal_type: str,
|
||||
custom_cmd: str,
|
||||
last_failures: list[str],
|
||||
loop_dir: Path,
|
||||
interactive: bool = False,
|
||||
) -> str:
|
||||
"""Build the controller continuation message for one QA cycle."""
|
||||
failures_summary = (
|
||||
"\n".join(f" - {f}" for f in last_failures[-5:])
|
||||
if last_failures
|
||||
else " (none)"
|
||||
)
|
||||
|
||||
qa_step = (
|
||||
_interactive_step()
|
||||
if interactive
|
||||
else _command_step(goal_type, custom_cmd)
|
||||
)
|
||||
architect_spawn = format_spawn_call(
|
||||
"architect",
|
||||
f"DIAGNOSE FAILURE:\\nGoal: {goal_type}\\n"
|
||||
"Output: <paste QA output>\\n"
|
||||
"Provide root cause analysis and fix recommendations.",
|
||||
)
|
||||
executor_spawn = format_spawn_call(
|
||||
"executor",
|
||||
"FIX:\\nIssue: <architect diagnosis>\\n"
|
||||
"Files: <affected files>\\n"
|
||||
"Apply the fix precisely as recommended.",
|
||||
)
|
||||
|
||||
return f"""\
|
||||
UltraQA cycle {cycle}/{max_cycles}.
|
||||
Goal: {goal_type}
|
||||
Previous failures:
|
||||
{failures_summary}
|
||||
|
||||
Use the omp-roles skill for role tool/skill config.
|
||||
Role identity text is embedded in each spawn task below.
|
||||
|
||||
Execute this cycle:
|
||||
|
||||
1. {qa_step}
|
||||
2. If all checks PASS, update {loop_dir}/state.json: set qa_passed=true.
|
||||
3. If checks FAIL, dispatch an architect subagent to diagnose root cause:
|
||||
{architect_spawn}
|
||||
4. After diagnosis completes, dispatch an executor subagent to apply the fix:
|
||||
{executor_spawn}
|
||||
5. After the fix, update {loop_dir}/state.json
|
||||
with the latest last_failures."""
|
||||
|
||||
|
||||
def _command_step(goal_type: str, custom_cmd: str) -> str:
|
||||
cmd_map = {
|
||||
"tests": "Run the project test suite.",
|
||||
"build": "Run the project build.",
|
||||
"lint": "Run the linter.",
|
||||
"typecheck": "Run the type checker.",
|
||||
}
|
||||
if goal_type == "custom" and custom_cmd:
|
||||
return f"Run the QA command: `{custom_cmd}`"
|
||||
return cmd_map.get(goal_type, "Run the project test suite.")
|
||||
|
||||
|
||||
def _interactive_step() -> str:
|
||||
spawn = format_spawn_call(
|
||||
"qa-tester",
|
||||
"TEST:\\nGoal: <goal>\\nService: <how to start>\\n"
|
||||
"Test cases: <scenarios>",
|
||||
)
|
||||
return "Dispatch a qa-tester subagent for interactive testing:\n" + spawn
|
||||
Reference in New Issue
Block a user