feat(system): DPLAN-0154: dedicated agent branches — passport git_branch field + drone routing

Co-Authored-By: @devpulse <devpulse@aipass>
This commit is contained in:
AIOSAI
2026-04-26 10:48:36 -07:00
co-authored by @devpulse
parent ce0171f746
commit 27d55f91d1
5 changed files with 41 additions and 7 deletions
+4 -3
View File
@@ -229,9 +229,10 @@ setup.sh auto-detects which CLIs are installed and configures hooks for each.
| Version | 2.1.0 |
| Agents | 11 |
| Quality standards | 33 automated checks |
| Tests | 3,500+ (across all agents) |
| PRs merged | 260+ (created by agents, reviewed by human) |
| External projects | Full cross-project access (Vera Studio) |
| Tests | 6,500+ (across all agents) |
| PRs merged | 470+ (created by agents, reviewed by human) |
| Code coverage | 75% ([codecov](https://codecov.io/gh/AIOSAI/AIPass)) |
| CI | Green (0 failures) |
Each agent documents its own operational status in its branch README — what works, what doesn't, and why.
@@ -29,6 +29,20 @@ from aipass.drone.apps.handlers.git.lock_handler import (
)
def _resolve_git_branch(branch_name: str, branch_dir: Path) -> str:
"""Read git_branch from passport if available, else fall back to citizen/{name}."""
passport_path = branch_dir / ".trinity" / "passport.json"
if passport_path.is_file():
try:
data = _json.loads(passport_path.read_text())
git_branch = data.get("branch_info", {}).get("git_branch", "")
if git_branch:
return git_branch
except (ValueError, OSError) as exc:
logger.warning("Failed to read git_branch from passport %s: %s", passport_path, exc)
return f"citizen/{branch_name}"
def create_pr(branch_name: str, description: str, branch_dir: Path) -> dict:
"""Execute the full PR creation workflow.
@@ -57,7 +71,7 @@ def create_pr(branch_name: str, description: str, branch_dir: Path) -> dict:
Dict with success, pr_url, feature_branch, and message.
"""
repo_root = find_repo_root()
feature_branch = f"citizen/{branch_name}"
feature_branch = _resolve_git_branch(branch_name, branch_dir)
lock_acquired = False
result = {
@@ -20,8 +20,10 @@ Only authorized callers (verified via :mod:`auth`) may invoke this.
from __future__ import annotations
import json as _json
import re
import subprocess
from pathlib import Path
from aipass.prax import logger
from aipass.drone.apps.handlers.json import json_handler
@@ -52,6 +54,20 @@ def slugify(description: str) -> str:
return slug[:50]
def _resolve_system_git_branch(caller: str, repo_root: Path) -> str:
"""Read git_branch from the caller's passport, else fall back to system/{caller}-{slug}."""
for trinity_dir in repo_root.rglob(f"src/aipass/{caller}/.trinity/passport.json"):
try:
data = _json.loads(trinity_dir.read_text())
git_branch = data.get("branch_info", {}).get("git_branch", "")
if git_branch:
return git_branch
except (ValueError, OSError) as exc:
logger.warning("Failed to read git_branch from %s: %s", trinity_dir, exc)
break
return ""
def create_system_pr(description: str, caller: str) -> dict:
"""Execute the system-wide PR creation workflow.
@@ -72,7 +88,8 @@ def create_system_pr(description: str, caller: str) -> dict:
"""
repo_root = find_repo_root()
slug = slugify(description)
feature_branch = f"system/{caller}-{slug}"
passport_branch = _resolve_system_git_branch(caller, repo_root)
feature_branch = passport_branch if passport_branch else f"system/{caller}-{slug}"
lock_acquired = False
result: dict = {
@@ -14,7 +14,8 @@
"alias": "",
"path": "{{CWD}}",
"module": "{{MODULE}}",
"created": "{{DATE}}"
"created": "{{DATE}}",
"git_branch": "work/{{branchname}}"
},
"identity": {
"citizen_class": "birthright",
@@ -14,7 +14,8 @@
"alias": "",
"path": "{{CWD}}",
"module": "{{MODULE}}",
"created": "{{DATE}}"
"created": "{{DATE}}",
"git_branch": "work/{{branchname}}"
},
"identity": {
"citizen_class": "builder",