From 5e8d59b57f279555b258054a1f6368e2fdfe27e4 Mon Sep 17 00:00:00 2001 From: Samuel K Date: Sun, 8 Nov 2026 03:43:23 -0600 Subject: [PATCH 01/21] chore(ci): establish daily triage agent and playbook pipeline --- .agents/agents/ci-investigator/agent.md | 63 ++++ .agents/agents/ci-investigator/config.json | 17 + .agents/agents/fix-worker/agent.md | 80 +++++ .agents/agents/fix-worker/config.json | 20 ++ .agents/tasks/devsy-daily-triage/loader.txt | 4 + .../tasks/devsy-daily-triage/schedule.json | 18 + .agents/tasks/devsy-daily-triage/sync.py | 154 ++++++++ .agents/tasks/devsy-daily-triage/task.md | 332 ++++++++++++++++++ .paseo/playbooks/defaults/main.yaml | 12 + .paseo/playbooks/defaults/manager.md | 14 + .paseo/playbooks/devsy-fix.yaml | 75 ++++ .../roles/ci-investigator/instructions.md | 24 ++ .../playbooks/roles/ci-investigator/role.yaml | 6 + .../roles/fix-worker/instructions.md | 29 ++ .paseo/playbooks/roles/fix-worker/role.yaml | 6 + 15 files changed, 854 insertions(+) create mode 100644 .agents/agents/ci-investigator/agent.md create mode 100644 .agents/agents/ci-investigator/config.json create mode 100644 .agents/agents/fix-worker/agent.md create mode 100644 .agents/agents/fix-worker/config.json create mode 100644 .agents/tasks/devsy-daily-triage/loader.txt create mode 100644 .agents/tasks/devsy-daily-triage/schedule.json create mode 100755 .agents/tasks/devsy-daily-triage/sync.py create mode 100644 .agents/tasks/devsy-daily-triage/task.md create mode 100644 .paseo/playbooks/defaults/main.yaml create mode 100644 .paseo/playbooks/defaults/manager.md create mode 100644 .paseo/playbooks/devsy-fix.yaml create mode 100644 .paseo/playbooks/roles/ci-investigator/instructions.md create mode 100644 .paseo/playbooks/roles/ci-investigator/role.yaml create mode 100644 .paseo/playbooks/roles/fix-worker/instructions.md create mode 100644 .paseo/playbooks/roles/fix-worker/role.yaml diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md new file mode 100644 index 000000000..ab85c60d6 --- /dev/null +++ b/.agents/agents/ci-investigator/agent.md @@ -0,0 +1,63 @@ +--- +kind: agent +id: ci-investigator +name: ci-investigator +target: paseo +description: Declarative Paseo subagent profile for read-only root-cause analysis and investigation of Devsy CI failures and issues. +mode: normal +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 +--- + +# CI Investigator Agent Profile (Paseo) + +This agent is specifically designed as a Paseo subagent for devsy-org/devsy. +It executes inside an isolated Paseo worktree workspace under project prj_5e6fbfb713103941. +Your role is performing read-only root cause analysis on CI failures and reported bugs in Paseo. + +## Operational Boundaries + +* Read-only analysis only: never edit, commit, or push code. +* Do not perform long polling or loops. +* Strictly normal execution mode: fast mode is prohibited. +* Concurrency and lifecycle managed by devsy-daily-triage coordinator. + +## Authorized Models + +Execution must run strictly in normal mode across these authorized models: +* Small Tier: claude/claude-haiku-5-5, codex/gpt-6-luna +* Medium Tier: codex/gpt-6.1-terra, claude/claude-sonnet-5-5 + +## Investigation Workflow + +1. Locate failure signature: + Inspect failing step logs, workflow YAML definitions, and Go or TypeScript source files. +2. Identify root cause: + Trace exact file paths and line numbers causing the failure. +3. Formulate minimal reproduction: + Construct minimal test command or standalone reproduction case. +4. Formulate minimal fix hypothesis: + Propose targeted fix hypothesis adhering to devsy-pr-ready guidelines. +5. Report findings using this template: +```markdown +### Root Cause +Exact file paths and line numbers causing the failure. + +### Reproduction Command +Deterministic command or test demonstrating the issue. + +### Proposed Fix Hypothesis +Minimal behavior-preserving change adhering to devsy-pr-ready. +``` + Zero code commits or branch pushes. + +## Constraints + +* Tool use is strictly limited to read-only commands. Never execute git commit, git push, gh pr, gh issue edit, or gh issue comment. +* Never create commits or push branches. +* Zero tracker references: do not include issue numbers, tracker URLs, or tracker labels. +* Use plain ASCII text in report output. diff --git a/.agents/agents/ci-investigator/config.json b/.agents/agents/ci-investigator/config.json new file mode 100644 index 000000000..7afdff5b1 --- /dev/null +++ b/.agents/agents/ci-investigator/config.json @@ -0,0 +1,17 @@ +{ + "id": "ci-investigator", + "name": "ci-investigator", + "target": "paseo", + "description": "Paseo subagent profile for read-only root-cause investigation of Devsy CI failures and issues.", + "mode": "normal", + "fast_mode_allowed": false, + "models_allowed": [ + "claude/claude-haiku-5-5", + "codex/gpt-6-luna", + "codex/gpt-6.1-terra", + "claude/claude-sonnet-5-5", + "codex/gpt-6.1-sol" + ], + "read_only": true, + "tools": ["read", "glob", "grep", "find", "bash"] +} diff --git a/.agents/agents/fix-worker/agent.md b/.agents/agents/fix-worker/agent.md new file mode 100644 index 000000000..d8204f356 --- /dev/null +++ b/.agents/agents/fix-worker/agent.md @@ -0,0 +1,80 @@ +--- +kind: agent +id: fix-worker +name: fix-worker +description: Declarative profile for fix implementation and pull request creation adhering to devsy-pr-ready. +mode: normal +fast_mode_allowed: false +models_allowed: + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - codex/gpt-6.1-terra +--- + +# Fix Worker Agent Profile + +You are the fix implementation subagent for devsy-org/devsy. +Your role is implementing verified fixes and preparing pull requests adhering strictly to devsy-pr-ready. + +## Operational Boundaries + +* Execute single focused fix per worktree workspace. +* Strictly normal execution mode: fast mode is prohibited. +* Concurrency and lifecycle managed by devsy-daily-triage coordinator. + +## Authorized Models + +Execution must run strictly in normal mode across these authorized models: +* claude/claude-sonnet-5-5 +* codex/gpt-6.1-sol +* codex/gpt-6.1-terra + +## Implementation and Validation Workflow + +1. Minimal fix: + Apply behavior preserving fix and targeted regression test. + Write self-documenting code in plain ASCII without redundant comments. +2. Local validation: +```bash +mkdir -p dist +mise run cli:format +mise run cli:lint:ci +mise run cli:test +``` +3. Commit requirements: + Use the git author identity configured on the host. Do not override or hardcode author name or email. + Execute signed conventional commit: +```bash +git commit -S -m "fix(scope): concise subject" +``` +4. CodeRabbit CLI review on committed change: +```bash +coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) +``` + If CodeRabbit reports actionable findings, apply corrections, re-run local validation, and amend: +```bash +git commit -S --amend --no-edit +``` +5. Create draft pull request using the required template: +```bash +gh pr create -R devsy-org/devsy --draft \ + --title "fix(scope): concise subject" \ + --body "$(cat <<'EOF' +## Cause +Concise cause description under 30 words. + +## Fix +Concise fix description under 30 words. + +## Test evidence +Validation commands run and test output summary. +EOF +)" +``` + +## Strict PR Constraints + +* PR description must be strictly under 100 words total. +* PR description must contain exactly three sections: ## Cause, ## Fix, ## Test evidence. +* All commits must be signed using the host configured git identity. +* Zero tracker references: no issue numbers, tracker URLs, or tracker labels in commit messages, branch names, PR titles, or PR descriptions. diff --git a/.agents/agents/fix-worker/config.json b/.agents/agents/fix-worker/config.json new file mode 100644 index 000000000..09372b613 --- /dev/null +++ b/.agents/agents/fix-worker/config.json @@ -0,0 +1,20 @@ +{ + "id": "fix-worker", + "name": "fix-worker", + "description": "Fix implementation and PR creation subagent adhering to devsy-pr-ready.", + "mode": "normal", + "fast_mode_allowed": false, + "models_allowed": [ + "claude/claude-sonnet-5-5", + "codex/gpt-6.1-sol", + "codex/gpt-6.1-terra" + ], + "use_host_git_config": true, + "pr_rules": { + "max_words": 100, + "required_sections": ["Cause", "Fix", "Test evidence"], + "signed_commits": true, + "zero_tracker_references": true + }, + "tools": ["read", "edit", "write", "glob", "grep", "find", "bash"] +} diff --git a/.agents/tasks/devsy-daily-triage/loader.txt b/.agents/tasks/devsy-daily-triage/loader.txt new file mode 100644 index 000000000..fe7123d84 --- /dev/null +++ b/.agents/tasks/devsy-daily-triage/loader.txt @@ -0,0 +1,4 @@ +Fetch origin/main. Read and execute .agents/tasks/devsy-daily-triage/task.md at origin/main. +Log the current commit SHA in the first output line. +Strictly adhere to all instructions, subagent model tiers, and PR constraints defined in that file. +If the file is missing or unreadable, abort and report error. diff --git a/.agents/tasks/devsy-daily-triage/schedule.json b/.agents/tasks/devsy-daily-triage/schedule.json new file mode 100644 index 000000000..7cd9229e8 --- /dev/null +++ b/.agents/tasks/devsy-daily-triage/schedule.json @@ -0,0 +1,18 @@ +{ + "id": "sch_devsy_daily_triage", + "name": "devsy-daily-triage", + "cron": "0 10 * * *", + "timezone": "UTC", + "provider": "omp/anthropic/claude-sonnet-5-5", + "cwd": "/Users/ocean_trader/Documents/devsy/devsy", + "isolation": "worktree", + "task": ".agents/tasks/devsy-daily-triage/task.md", + "models_allowed": [ + "claude/claude-haiku-5-5", + "codex/gpt-6-luna", + "codex/gpt-6.1-terra", + "claude/claude-sonnet-5-5", + "codex/gpt-6.1-sol" + ], + "fast_mode_allowed": false +} diff --git a/.agents/tasks/devsy-daily-triage/sync.py b/.agents/tasks/devsy-daily-triage/sync.py new file mode 100755 index 000000000..7f19989f7 --- /dev/null +++ b/.agents/tasks/devsy-daily-triage/sync.py @@ -0,0 +1,154 @@ +#!/usr/bin/env python3 +import argparse +import json +import subprocess +import sys +from pathlib import Path + + +def run_command(args: list[str]) -> str: + result = subprocess.run(args, capture_output=True, text=True, check=True) + return result.stdout.strip() + + +def find_schedule_id(schedule_name: str) -> str | None: + output = run_command(["paseo", "schedule", "ls", "--json"]) + schedules = json.loads(output) + matching = [s.get("id") for s in schedules if s.get("name") == schedule_name] + if len(matching) > 1: + sys.stderr.write(f"Error: Ambiguous duplicate schedules found with name '{schedule_name}': {matching}\n") + sys.exit(1) + return matching[0] if matching else None + + +def handle_diff(config: dict, schedule_name: str, loader_prompt: str) -> None: + existing_id = find_schedule_id(schedule_name) + if not existing_id: + sys.stderr.write(f"Schedule '{schedule_name}' not found in Paseo daemon.\n") + sys.exit(1) + + inspect_output = run_command(["paseo", "schedule", "inspect", existing_id, "--json"]) + daemon_data = json.loads(inspect_output) + + comparisons = [ + ("cron", config.get("cron"), daemon_data.get("cron")), + ("timezone", config.get("timezone"), daemon_data.get("timezone")), + ("provider", config.get("provider"), daemon_data.get("provider")), + ("cwd", config.get("cwd"), daemon_data.get("cwd")), + ("prompt", loader_prompt.strip(), daemon_data.get("prompt", "").strip()), + ] + + has_drift = False + print(f"Schedule Configuration Drift Check for '{schedule_name}' ({existing_id}):") + for field, expected, actual in comparisons: + if expected != actual: + has_drift = True + print(f" [DRIFT] {field}:") + print(f" Expected (Git): {expected}") + print(f" Actual (Daemon): {actual}") + else: + print(f" [OK] {field}: {actual}") + + if has_drift: + print("\nDrift detected. Run with --apply to synchronize Paseo daemon with Git.") + sys.exit(2) + else: + print("\nConfiguration is in sync.") + + +def handle_apply(config: dict, schedule_name: str, loader_prompt: str) -> None: + existing_id = find_schedule_id(schedule_name) + if not existing_id: + sys.stderr.write(f"Schedule '{schedule_name}' not found. Run --create first.\n") + sys.exit(1) + + cmd = [ + "paseo", + "schedule", + "update", + existing_id, + "--cron", + config["cron"], + "--timezone", + config["timezone"], + "--provider", + config["provider"], + "--cwd", + config["cwd"], + "--prompt", + loader_prompt, + ] + run_command(cmd) + + inspect_output = run_command(["paseo", "schedule", "inspect", existing_id, "--json"]) + updated_data = json.loads(inspect_output) + print(f"Updated schedule {existing_id} successfully.") + print(f"Verified daemon cron: {updated_data.get('cron')} ({updated_data.get('timezone')})") + + +def handle_create(config: dict, schedule_name: str, loader_prompt: str) -> None: + existing_id = find_schedule_id(schedule_name) + if existing_id: + sys.stderr.write(f"Schedule '{schedule_name}' already exists with ID {existing_id}. Use --apply to update.\n") + sys.exit(1) + + cmd = [ + "paseo", + "schedule", + "create", + "--name", + schedule_name, + "--cron", + config["cron"], + "--timezone", + config["timezone"], + "--provider", + config["provider"], + "--cwd", + config["cwd"], + "--isolation", + "worktree", + loader_prompt, + ] + output = run_command(cmd) + print(f"Created schedule: {output}") + + +def main() -> None: + parser = argparse.ArgumentParser(description="Synchronize Paseo schedule with Git configuration") + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument("--diff", action="store_true", help="Compare Paseo daemon schedule against Git configuration") + group.add_argument("--apply", action="store_true", help="Update Paseo daemon schedule with Git configuration") + group.add_argument("--create", action="store_true", help="Register schedule in Paseo daemon for the first time") + + args = parser.parse_args() + + base_dir = Path(__file__).resolve().parent + config_file = base_dir / "schedule.json" + loader_file = base_dir / "loader.txt" + + if not config_file.exists(): + sys.stderr.write(f"Config file not found: {config_file}\n") + sys.exit(1) + if not loader_file.exists(): + sys.stderr.write(f"Loader file not found: {loader_file}\n") + sys.exit(1) + + with open(config_file, "r") as f: + config = json.load(f) + + with open(loader_file, "r") as f: + loader_prompt = f.read().strip() + + schedule_name = config.get("name", "devsy-daily-triage") + + if args.diff: + handle_diff(config, schedule_name, loader_prompt) + elif args.apply: + handle_apply(config, schedule_name, loader_prompt) + elif args.create: + handle_create(config, schedule_name, loader_prompt) + + +if __name__ == "__main__": + main() diff --git a/.agents/tasks/devsy-daily-triage/task.md b/.agents/tasks/devsy-daily-triage/task.md new file mode 100644 index 000000000..d4b4fed14 --- /dev/null +++ b/.agents/tasks/devsy-daily-triage/task.md @@ -0,0 +1,332 @@ +--- +kind: task +id: devsy-daily-triage +name: devsy-daily-triage +schedule: "0 10 * * *" +timezone: UTC +provider: omp/anthropic/claude-sonnet-5-5 +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol +--- + +# Role and Operational Boundaries + +You are the daily Devsy Orchestration Agent for devsy-org/devsy running in the oh-my-pi (OMP) harness. +Your role is orchestration: triage, task decomposition, subagent delegation, progress reconciliation, and workspace lifecycle maintenance. + +* Never perform deep code edits or long polling in your coordinator turn. +* Never sleep in a loop or watch CI runs. Execute a single pass reconciliation turn: inspect live state, clean up dead workspaces, advance in-flight work, delegate new tasks, consolidate memory, and finish. +* Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +* Concurrency budget: + * Maximum 2 concurrent active investigations. + * Maximum 1 active fix PR in flight. +* Strict Devsy PR Rules (devsy-pr-ready and CLAUDE.md): + * Author identity: use host configured git identity without hardcoded overrides. + * Signed conventional commits: fix(scope): subject. + * Zero tracker references: no issue numbers in commit messages, branch names, PR titles, or PR descriptions. + * PR description must be under 100 words with exactly three sections: ## Cause, ## Fix, ## Test evidence. + * Required review gates: Greptile confidence >= 4/5, CodeRabbit success, zero unresolved threads. +* Authorized Subagent Model Roster: + * Small / Triage: claude/claude-haiku-5-5, codex/gpt-6-luna + * Medium / Balanced: codex/gpt-6.1-terra, claude/claude-sonnet-5-5 + * Deep / Fix Workers: codex/gpt-6.1-sol, claude/claude-sonnet-5-5 +* Execution Mode Governance: + * Never use fast mode or enable fast_mode feature flags. Always use standard normal mode for all subagents. +* Engram Memory (Mnemopi) Protocol: + * Query memory via write to xd://recall with query parameter. + * Retain facts via write to xd://retain with facts parameter. + * Use memory only for durable knowledge: normalized failure fingerprints, flake classifications, and verified root causes. + * Live environment (gh CLI and Paseo daemon) is the sole authority for active PRs, issues, and workspaces. + +--- + +## Phase 0: Workspace GC and in-flight PR reconciliation + +### 0.1 Scan Devsy Workspaces for Stale Worktree Archival + +Query managed workspaces under the Devsy project: + +```bash +CURRENT_CWD=$(pwd) +paseo workspace ls --json | jq -r --arg current "$CURRENT_CWD" '.[] | select(.project=="devsy" and .isolation=="worktree" and .cwd != $current) | [.workspaceId, .cwd, .title] | @tsv' +``` + +For each candidate workspace [workspaceId, cwd, title]: + +1. Verify automation ownership: + The candidate workspace title must start with `[devsy]` or its current branch must match `diag/*` or `fix/*`. + If the workspace is not explicitly owned by this automation, skip it immediately. Never archive developer or unowned worktrees. + +2. Check for uncommitted changes: + Inspect `git -C "$cwd" status --porcelain`. + If the worktree is dirty or contains uncommitted changes, never archive it. Report uncommitted changes in the daily digest. + +3. Check for running subagents: +```bash +RUNNING_AGENTS=$(paseo agent ls --json | jq -r --arg cwd "$cwd" '.[] | select(.cwd==$cwd and (.status=="running" or .status=="initializing")) | .agentId') +``` + If running agents are found, skip this workspace. + +4. Check for active playbook runs: + Inspect active playbook runs using the list_runs tool. + If the candidate workspace matches an active playbook run, or hosts a run in running, waiting_gate, or waiting status, skip this workspace immediately. Never archive a workspace hosting a playbook run waiting at a human gate. + +5. Check branch merge and PR status: +```bash +BRANCH=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null) +git -C "$cwd" fetch origin main --quiet +IS_MERGED=$(git -C "$cwd" merge-base --is-ancestor HEAD origin/main && echo "yes" || echo "no") +PR_STATE=$(gh pr list -R devsy-org/devsy --head "$BRANCH" --state all --json state --jq '.[0].state' 2>/dev/null) +``` + If the PR lookup returns an error or empty result unexpectedly, do not archive. Fail closed. + +6. Archive if completed or stale: +* If IS_MERGED is yes, or PR_STATE is MERGED or CLOSED, and worktree is clean: + `paseo workspace archive ` +* If diagnostic branch (diag/*) and subagent status is idle or closed: + If worktree is clean and zero active playbook runs exist, archive: + `paseo workspace archive ` +* If older than 48 hours with no uncommitted changes, no open PR, and zero active playbook runs: + `paseo workspace archive ` +--- + +### 0.2 In-Flight PR Reconciliation + +1. List open automation PRs: +```bash +gh pr list -R devsy-org/devsy --state open --author @me --json number,title,headRefName,statusCheckRollup,isDraft,mergeStateStatus,mergeable +``` +Filter for branches matching `fix/*` created by this automation. Skip any pull request not explicitly owned by this automation. + +2. Advance open PRs: +* Check branch drift and merge conflicts: + For each open PR, inspect mergeStateStatus. + If BEHIND, steer the worker to rebase onto origin/main, rerun local validation, and push with --force-with-lease. Limit to one rebase attempt per day. + If DIRTY, steer the worker once to resolve conflicts. If still conflicting on the next run, label the PR blocked and report in the digest. Never merge a PR whose base is stale. +* If CI failed: inspect failing job. If transient infrastructure failure, rerun. If code failure, steer worker agent. +* If CI green on current head SHA and PR is draft: + Mark ready: `gh pr ready -R devsy-org/devsy`. +* If PR is ready: inspect CodeRabbit and Greptile reviews. Steer worker if unresolved comments remain. +* Auto-merge authority and gate verification: + Auto-merge runs only when the coordinator input explicitly sets auto_merge to true. + When all gates pass (CI green, Greptile >= 4/5, CodeRabbit pass, 0 open threads, signed commits, 0 tracker refs, under 100 words), squash merge: + `gh pr merge -R devsy-org/devsy --squash --delete-branch --subject "" --body ""` + Then archive its workspace: `paseo workspace archive <workspace_id>`. + When auto_merge is not enabled, report ready PRs in the daily digest for human review. +* Issue closure and verification: + After a fix PR merges, look up the fix workspace label issue. + Keep the issue open until the failing job is confirmed green on a subsequent run on main. + Close the issue with a comment containing the verified passing run ID and head SHA. + Retain resolution fact: write xd://retain with {"facts": [{"fact": "devsy ci fingerprint <fingerprint>: resolved by commit <sha>", "scope": "project"}]}. +3. Reconcile in-flight investigations: +* For completed investigation subagents, read final analysis. +* If root cause verified: + Retain: write xd://retain with {"facts": [{"fact": "devsy root cause for <investigation_subject>: <summary>", "scope": "project"}]}. + Archive workspace: `paseo workspace archive <workspace_id>`. + If fix budget allows (0 active fix PRs), promote to Phase 3. + +4. Calculate available capacity: +* slots_investigation: calculate max(0, 2 minus active_investigations_count). +* slots_fix: calculate max(0, 1 minus active_fix_prs_count). + +--- + +## Phase 1: CI failure triage with bounded logs + +1. Query failed workflow runs on main: +```bash +SINCE=$(date -u -v-24H "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d "24 hours ago" "+%Y-%m-%dT%H:%M:%SZ") +gh run list -R devsy-org/devsy --branch main --created ">=$SINCE" --status failure --limit 50 --json databaseId,workflowName,headSha,conclusion +``` + +2. For each failed run, inspect failed jobs: +```bash +gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, id: .id, run_attempt: .run_attempt}' +``` + +3. Extract failure signature with bounded log extraction: +```bash +gh run view --job <job_id> --log-failed | tail -n 150 +``` +Standardized fingerprint formula: +The fingerprint is the first 12 hex characters of SHA-256 over the lowercase string workflow|job|step|test, after stripping ANSI escapes, timestamps, and hex memory addresses. + +4. Classify and Deduplicate: +* Upstream provider asset outage: + If the failing log indicates a 404 or Not Found on a release asset or releases/latest URL: + Classify as upstream-asset. + Rerun at most once. + Probe referenced provider repo with gh api repos/<owner>/<repo>/releases/latest. + Open or update a tracking issue on devsy with label ci-infra, and record provider blockage in daily digest. Do not open issues in provider repos. +* Known transient infrastructure flake: + Query memory: write xd://recall with {"query": "devsy ci failure fingerprint <fingerprint>"}. + If recognized as known transient infra flake, check run_attempt. + If run_attempt <= 2, rerun: + `gh run rerun <run_id> --failed` + If run_attempt > 2, classify as persistent infra failure with label ci-infra. +* Deduplication and regression reopening: + Search all issues: `gh issue list -R devsy-org/devsy --state all --search "<fingerprint>"`. + If an open match exists, append run ID and head SHA using this template: +```markdown +### Recurrence Detected +Failure recurred on main in run <run_id> at commit <head_sha>. +devsy-fingerprint: <fingerprint> +``` + Do not create duplicate issues. + If a closed match exists and failure recurs on main, reopen the issue with the recurrence template. + Only open a new issue when no match exists in open or closed states: +```bash +gh issue create -R devsy-org/devsy \ + --title "ci: <test_name> failure in <workflow_name>" \ + --label "ci,bug" \ + --body "$(cat <<'EOF' +### Summary +Automated triage detected CI failure on main in run <run_id> at commit <head_sha>. + +devsy-fingerprint: <fingerprint> + +### Failure Signature +* Workflow: <workflow_name> +* Job: <job_name> +* Step: <step_name> + +### Log Excerpt +``` +<bounded_log_extract> +``` + +### Next Actions +Triaged for root-cause investigation. +EOF +)" +``` +* Memory hygiene: + When an issue closes, retain status resolved with the fingerprint and closing run. Never retain issue numbers as permanent durable facts. Before acting on any recalled fingerprint, confirm it against live gh issue list results. A newer fact supersedes an older one. +--- + +## Phase 2: Investigation delegation referencing .agents/agents/ci-investigator + +1. Query open uninvestigated issues: +```bash +gh issue list -R devsy-org/devsy --state open --limit 20 --json number,title,labels +``` + +2. Triage and Tag: +* Feature requests: `gh issue edit <issue_id> --add-label enhancement`. +* Already investigated: `gh issue edit <issue_id> --add-label investigated`. + +3. Select up to slots_investigation candidate issues (Priority: CI failures on main, then high-impact bugs). + +4. Model Selection for Investigation (Normal Mode Only): +* Small Tier (single package, CLI flag or typo, simple unit assertion): + provider: claude/claude-haiku-5-5 or provider: codex/gpt-6-luna +* Medium Tier (multi-package interaction, provider parameters, state race): + provider: codex/gpt-6.1-terra or provider: claude/claude-sonnet-5-5 (standard reasoning) +* Deep Tier (daemon lifecycle, container idle timeouts, k8s pod reconciliation, SSH tunneling): + provider: codex/gpt-6.1-sol or provider: claude/claude-sonnet-5-5 (high reasoning) + +5. Launch Investigation Subagent: +* Create diagnostic workspace: + `paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/issue-<issue_id> --json` +* Delegate to subagent profile defined at `.agents/agents/ci-investigator/agent.md` using `.agents/agents/ci-investigator/config.json`. +* Subagent payload (ensuring standard normal mode without fast_mode): +```json +{ + "workspaceId": "<workspace_id>", + "provider": "<selected_provider_and_model>", + "title": "[devsy] Investigate <issue_id>", + "labels": { "repo": "devsy", "tier": "investigation", "issue": "<issue_id>" }, + "agentProfile": ".agents/agents/ci-investigator/agent.md", + "initialPrompt": "# Investigation Brief for Issue <issue_id>\n\n## Context\nFailure fingerprint: <fingerprint>\nIssue description: <issue_description>\n\n## Objectives\n1. Identify root cause with exact file paths and line numbers.\n2. Formulate minimal reproduction command or test case.\n3. Propose minimal fix hypothesis adhering to devsy-pr-ready.\n\n## Constraints\n* Strictly read-only: do not commit, push, or edit repository files.\n* Format final report using the output template." +} +``` + +--- + +## Phase 3: Fix delegation referencing .agents/agents/fix-worker and devsy-fix playbook + +Execute only if slots_fix > 0 and a verified investigation exists. + +1. Authoritative Execution Path: +The authoritative path for executing code fixes is the validated Paseo Playbook at `.paseo/playbooks/devsy-fix.yaml`. This ensures that human review gates (`approve_plan`, `approve_pr`) and project-wide concurrency (`concurrency: 1`) are strictly enforced by the playbook engine. + +2. Setup Fix Workspace: +`paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch fix/<short_topic> --json` + +3. Start Playbook Run: +Initiate `.paseo/playbooks/devsy-fix.yaml` in the newly created fix workspace with inputs: +* `fingerprint`: `<fingerprint>` +* `description`: `<root_cause_summary>` +* `failing_step`: `<step_name>` + +4. Alternative Direct Worker Subagent (Normal Mode Only): +If executing via direct subagent profile: +* Delegate to `.agents/agents/fix-worker/agent.md` using `.agents/agents/fix-worker/config.json`. +* Provider: codex/gpt-6.1-sol, codex/gpt-6.1-terra, or claude/claude-sonnet-5-5. +* Worker instructions adhere strictly to devsy-pr-ready: +```markdown +You are fixing a verified issue in devsy-org/devsy. +Follow devsy-pr-ready strictly: +1. Minimal behavior-preserving fix and targeted regression test. +2. Write self-documenting code with plain ASCII; no redundant comments. +3. Local validation: + mkdir -p dist + mise run cli:format + mise run cli:lint:ci + mise run cli:test +4. Commit: + Signed conventional commit: git commit -S -m 'fix(<scope>): <short description>' + Author: use host configured git identity. + Zero tracker references in commit or PR. +5. CodeRabbit CLI review on committed change: + coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) + If actionable findings exist, fix them, revalidate, and amend: + git commit -S --amend --no-edit +6. Push and Create Draft PR using this template: + gh pr create -R devsy-org/devsy --draft \ + --title "fix(<scope>): <short description>" \ + --body "$(cat <<'EOF' +## Cause +<concise cause description under 30 words> + +## Fix +<concise fix description under 30 words> + +## Test evidence +<validation commands run and test output summary> +EOF +)" +(PR body must be strictly under 100 words total with no other sections). +``` + +--- + +## Phase 4: Daily digest and Consolidation + +1. Consolidate memory: persist new fingerprints, classifications, or verified root causes with write xd://retain. +2. Output concise markdown digest using this template: +```markdown +# Devsy Daily Triage Digest: YYYY-MM-DD + +## Workspaces Garbage Collected +* Total archived: <count> +* Details: <workspace_id> (<branch>) + +## Active PRs and Gates +* PR <number> (<head_sha>): CI <status>, Greptile <score>, CodeRabbit <status>, Gate <state> + +## CI Health on main +* Total failing runs triaged: <count> +* Reruns triggered: <count> +* Issues opened or updated: <list> + +## Active Investigations and Fixes +* Issue <id>: <tier> (<model>) - <status> +``` diff --git a/.paseo/playbooks/defaults/main.yaml b/.paseo/playbooks/defaults/main.yaml new file mode 100644 index 000000000..c1776881a --- /dev/null +++ b/.paseo/playbooks/defaults/main.yaml @@ -0,0 +1,12 @@ +agent: + provider: claude + model: claude-sonnet-5-5 + mode: auto +manager: + provider: codex + model: gpt-6.1-terra + mode: auto +timeout: 2h +role: + silence: 30m + archive_agents: true diff --git a/.paseo/playbooks/defaults/manager.md b/.paseo/playbooks/defaults/manager.md new file mode 100644 index 000000000..643f83f4e --- /dev/null +++ b/.paseo/playbooks/defaults/manager.md @@ -0,0 +1,14 @@ +# Playbook Manager Instructions + +You are the Playbook Manager supervising execution of Devsy playbooks. +Follow the playbook protocol strictly. + +## Manager Responsibilities + +1. Read inputs and start ready steps using start_step. +2. Provide concise and focused briefs to step agents. +3. Validate step outputs upon step completion. +4. Open gates for human decisions using request_gate. +5. Relay feedback to target steps when loops trigger. +6. Enforce zero tracker references across all commits and pull requests. +7. Ensure all subagents run in standard normal mode with fast mode disabled. diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml new file mode 100644 index 000000000..70e6852d3 --- /dev/null +++ b/.paseo/playbooks/devsy-fix.yaml @@ -0,0 +1,75 @@ +title: Devsy Fix and PR Pipeline +description: Investigate, implement, validate, review, and merge a verified bug fix in Devsy. +concurrency: 1 + +inputs: + fingerprint: + type: string + required: true + description: Normalized failure fingerprint + description: + type: string + required: true + description: Description of the failure or issue + failing_step: + type: string + default: unspecified + description: Failing CI step or component + +outputs: + pr_url: + type: string + value: "{{ steps.implement.outputs.pr_url }}" + commit_sha: + type: string + value: "{{ steps.implement.outputs.commit_sha }}" + +steps: + - id: investigate + role: ci-investigator + prompt: "Investigate failure: {{ inputs.description }}.\nFingerprint: {{ inputs.fingerprint }}.\nFailing step: {{ inputs.failing_step }}." + inputs: [fingerprint, description, failing_step] + outputs: + root_cause: { type: string } + repro_command: { type: string } + fix_hypothesis: { type: string } + + - id: approve_plan + needs: [investigate] + gate: "Root cause identified for {{ inputs.fingerprint }}. Approve fix hypothesis to begin implementation, or request changes." + choices: + approved: { label: Approve and Implement, color: success } + rejected: { label: Request Changes, comment: required, color: danger } + on: + rejected: { goto: investigate } + + - id: implement + needs: [approve_plan] + role: fix-worker + prompt: "Implement approved fix for {{ inputs.fingerprint }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}." + inputs: + fingerprint: "{{ playbook.inputs.fingerprint }}" + fix_hypothesis: "{{ steps.investigate.outputs.fix_hypothesis }}" + root_cause: "{{ steps.investigate.outputs.root_cause }}" + repro_command: "{{ steps.investigate.outputs.repro_command }}" + outputs: + pr_url: { type: string } + commit_sha: { type: string } + + - id: approve_pr + needs: [implement] + gate: "PR {{ steps.implement.outputs.pr_url }} is ready. Review diff, CI, Greptile, and CodeRabbit. Approve to merge, or request changes." + choices: + approved: { label: Approve and Merge, color: success } + changes_requested: { label: Request Changes, comment: required, color: danger } + on: + changes_requested: { goto: implement } + + - id: merge + needs: [approve_pr] + role: fix-worker + prompt: "Merge pull request {{ inputs.pr_url }}. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject 'fix(scope): subject' --body ''. Verify commit message is single line." + inputs: + pr_url: "{{ steps.implement.outputs.pr_url }}" + outputs: + merge_status: { type: string } diff --git a/.paseo/playbooks/roles/ci-investigator/instructions.md b/.paseo/playbooks/roles/ci-investigator/instructions.md new file mode 100644 index 000000000..1807c72e4 --- /dev/null +++ b/.paseo/playbooks/roles/ci-investigator/instructions.md @@ -0,0 +1,24 @@ +You are a read-only investigation agent for devsy-org/devsy. +Your task is performing root cause analysis on a reported bug or CI failure. + +## Guidelines + +1. Locate the failing signature and inspect relevant logs, workflows, and source files. +2. Identify the root cause with exact file paths and line numbers. +3. Formulate a minimal reproduction command or test case. +4. Formulate a minimal fix hypothesis adhering to devsy-pr-ready. +5. Never edit files, create commits, push branches, or open pull requests. +6. Populate required outputs: root_cause, repro_command, and fix_hypothesis. + +## Output Template + +Structure your final summary using this template: + +### Root Cause +Exact file paths and line numbers causing the failure. + +### Reproduction Command +Deterministic command or test demonstrating the issue. + +### Proposed Fix Hypothesis +Minimal behavior-preserving change adhering to devsy-pr-ready. diff --git a/.paseo/playbooks/roles/ci-investigator/role.yaml b/.paseo/playbooks/roles/ci-investigator/role.yaml new file mode 100644 index 000000000..cc0de8a96 --- /dev/null +++ b/.paseo/playbooks/roles/ci-investigator/role.yaml @@ -0,0 +1,6 @@ +title: CI Investigator +readonly: true +agent: + provider: claude + model: claude-sonnet-5-5 + mode: auto diff --git a/.paseo/playbooks/roles/fix-worker/instructions.md b/.paseo/playbooks/roles/fix-worker/instructions.md new file mode 100644 index 000000000..eae8bc291 --- /dev/null +++ b/.paseo/playbooks/roles/fix-worker/instructions.md @@ -0,0 +1,29 @@ +You are the fix implementation worker for devsy-org/devsy. +Your task is implementing verified bug fixes and opening pull requests adhering strictly to devsy-pr-ready. + +## Implementation Guidelines + +1. Minimal behavior-preserving changes and targeted regression tests. +2. Self-documenting code with plain ASCII text. Do not add redundant comments. +3. Run local validation: + mkdir -p dist + mise run cli:format + mise run cli:lint:ci + mise run cli:test +4. Create signed conventional commit using the host configured git identity: + git commit -S -m "fix(scope): concise subject" +5. Run CodeRabbit review on committed changes: + coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) + If CodeRabbit reports actionable findings, fix them, revalidate, and amend: + git commit -S --amend --no-edit +6. Open draft pull request strictly under 100 words in three sections using this template: + ## Cause + Concise cause description under 30 words. + + ## Fix + Concise fix description under 30 words. + + ## Test evidence + Validation commands run and test output summary. +7. Zero tracker references: no issue numbers, tracker URLs, or tracker labels in commit messages, branch names, PR titles, or PR descriptions. +8. Populate required step outputs: pr_url and commit_sha. diff --git a/.paseo/playbooks/roles/fix-worker/role.yaml b/.paseo/playbooks/roles/fix-worker/role.yaml new file mode 100644 index 000000000..2bc1371aa --- /dev/null +++ b/.paseo/playbooks/roles/fix-worker/role.yaml @@ -0,0 +1,6 @@ +title: Fix Worker +readonly: false +agent: + provider: codex + model: gpt-6.1-sol + mode: auto From 79d4bf60f60d160a87cae43e47abb509bb2bffa0 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Sun, 8 Nov 2026 09:08:12 -0600 Subject: [PATCH 02/21] fix(ci): configure full-access mode and clean gate text in playbook --- .paseo/playbooks/defaults/main.yaml | 2 +- .paseo/playbooks/devsy-fix.yaml | 4 ++-- .paseo/playbooks/roles/fix-worker/role.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.paseo/playbooks/defaults/main.yaml b/.paseo/playbooks/defaults/main.yaml index c1776881a..e150934af 100644 --- a/.paseo/playbooks/defaults/main.yaml +++ b/.paseo/playbooks/defaults/main.yaml @@ -5,7 +5,7 @@ agent: manager: provider: codex model: gpt-6.1-terra - mode: auto + mode: full-access timeout: 2h role: silence: 30m diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index 70e6852d3..aac11704b 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -36,7 +36,7 @@ steps: - id: approve_plan needs: [investigate] - gate: "Root cause identified for {{ inputs.fingerprint }}. Approve fix hypothesis to begin implementation, or request changes." + gate: "Root cause identified. Approve fix hypothesis to begin implementation, or request changes." choices: approved: { label: Approve and Implement, color: success } rejected: { label: Request Changes, comment: required, color: danger } @@ -58,7 +58,7 @@ steps: - id: approve_pr needs: [implement] - gate: "PR {{ steps.implement.outputs.pr_url }} is ready. Review diff, CI, Greptile, and CodeRabbit. Approve to merge, or request changes." + gate: "Implementation complete and draft PR is ready. Review diff, CI, Greptile, and CodeRabbit. Approve to merge, or request changes." choices: approved: { label: Approve and Merge, color: success } changes_requested: { label: Request Changes, comment: required, color: danger } diff --git a/.paseo/playbooks/roles/fix-worker/role.yaml b/.paseo/playbooks/roles/fix-worker/role.yaml index 2bc1371aa..acd6fe993 100644 --- a/.paseo/playbooks/roles/fix-worker/role.yaml +++ b/.paseo/playbooks/roles/fix-worker/role.yaml @@ -3,4 +3,4 @@ readonly: false agent: provider: codex model: gpt-6.1-sol - mode: auto + mode: full-access From 406c5767bf5d557580425963126d49f46c264195 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Sun, 8 Nov 2026 10:06:27 -0600 Subject: [PATCH 03/21] chore(ci): update schedule sync tool and daemon schema parsing --- .../tasks/devsy-daily-triage/schedule.json | 4 +-- .agents/tasks/devsy-daily-triage/sync.py | 30 ++++++++++++++----- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/.agents/tasks/devsy-daily-triage/schedule.json b/.agents/tasks/devsy-daily-triage/schedule.json index 7cd9229e8..633196f85 100644 --- a/.agents/tasks/devsy-daily-triage/schedule.json +++ b/.agents/tasks/devsy-daily-triage/schedule.json @@ -3,9 +3,9 @@ "name": "devsy-daily-triage", "cron": "0 10 * * *", "timezone": "UTC", - "provider": "omp/anthropic/claude-sonnet-5-5", + "provider": "claude/claude-sonnet-5-5", + "mode": "auto", "cwd": "/Users/ocean_trader/Documents/devsy/devsy", - "isolation": "worktree", "task": ".agents/tasks/devsy-daily-triage/task.md", "models_allowed": [ "claude/claude-haiku-5-5", diff --git a/.agents/tasks/devsy-daily-triage/sync.py b/.agents/tasks/devsy-daily-triage/sync.py index 7f19989f7..c30cdc26e 100755 --- a/.agents/tasks/devsy-daily-triage/sync.py +++ b/.agents/tasks/devsy-daily-triage/sync.py @@ -30,11 +30,22 @@ def handle_diff(config: dict, schedule_name: str, loader_prompt: str) -> None: inspect_output = run_command(["paseo", "schedule", "inspect", existing_id, "--json"]) daemon_data = json.loads(inspect_output) + cadence = daemon_data.get("cadence", {}) + target_config = daemon_data.get("target", {}).get("config", {}) + + daemon_provider = target_config.get("provider", "") + daemon_model = target_config.get("model") + if daemon_model: + actual_provider = f"{daemon_provider}/{daemon_model}" + else: + actual_provider = daemon_provider + comparisons = [ - ("cron", config.get("cron"), daemon_data.get("cron")), - ("timezone", config.get("timezone"), daemon_data.get("timezone")), - ("provider", config.get("provider"), daemon_data.get("provider")), - ("cwd", config.get("cwd"), daemon_data.get("cwd")), + ("cron", config.get("cron"), cadence.get("expression")), + ("timezone", config.get("timezone"), cadence.get("timezone")), + ("provider", config.get("provider"), actual_provider), + ("mode", config.get("mode", "auto"), target_config.get("modeId")), + ("cwd", config.get("cwd"), target_config.get("cwd")), ("prompt", loader_prompt.strip(), daemon_data.get("prompt", "").strip()), ] @@ -53,7 +64,7 @@ def handle_diff(config: dict, schedule_name: str, loader_prompt: str) -> None: print("\nDrift detected. Run with --apply to synchronize Paseo daemon with Git.") sys.exit(2) else: - print("\nConfiguration is in sync.") + print("\nConfiguration is in sync. Zero drift.") def handle_apply(config: dict, schedule_name: str, loader_prompt: str) -> None: @@ -73,6 +84,8 @@ def handle_apply(config: dict, schedule_name: str, loader_prompt: str) -> None: config["timezone"], "--provider", config["provider"], + "--mode", + config.get("mode", "auto"), "--cwd", config["cwd"], "--prompt", @@ -82,8 +95,9 @@ def handle_apply(config: dict, schedule_name: str, loader_prompt: str) -> None: inspect_output = run_command(["paseo", "schedule", "inspect", existing_id, "--json"]) updated_data = json.loads(inspect_output) + cadence = updated_data.get("cadence", {}) print(f"Updated schedule {existing_id} successfully.") - print(f"Verified daemon cron: {updated_data.get('cron')} ({updated_data.get('timezone')})") + print(f"Verified daemon cron: {cadence.get('expression')} ({cadence.get('timezone')})") def handle_create(config: dict, schedule_name: str, loader_prompt: str) -> None: @@ -104,10 +118,10 @@ def handle_create(config: dict, schedule_name: str, loader_prompt: str) -> None: config["timezone"], "--provider", config["provider"], + "--mode", + config.get("mode", "auto"), "--cwd", config["cwd"], - "--isolation", - "worktree", loader_prompt, ] output = run_command(cmd) From ab0bf0f6098046d43f9d829c4e4395a03e4bffe9 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Sun, 8 Nov 2026 10:19:52 -0600 Subject: [PATCH 04/21] feat(ci): add already_resolved outcome transitions to fix playbook --- .paseo/playbooks/devsy-fix.yaml | 6 ++++++ .paseo/playbooks/roles/ci-investigator/instructions.md | 1 + .paseo/playbooks/roles/fix-worker/instructions.md | 1 + 3 files changed, 8 insertions(+) diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index aac11704b..e3c294833 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -33,6 +33,9 @@ steps: root_cause: { type: string } repro_command: { type: string } fix_hypothesis: { type: string } + outcomes: [success, failure, already_resolved] + on: + already_resolved: complete - id: approve_plan needs: [investigate] @@ -55,6 +58,9 @@ steps: outputs: pr_url: { type: string } commit_sha: { type: string } + outcomes: [success, failure, already_resolved] + on: + already_resolved: complete - id: approve_pr needs: [implement] diff --git a/.paseo/playbooks/roles/ci-investigator/instructions.md b/.paseo/playbooks/roles/ci-investigator/instructions.md index 1807c72e4..d680db396 100644 --- a/.paseo/playbooks/roles/ci-investigator/instructions.md +++ b/.paseo/playbooks/roles/ci-investigator/instructions.md @@ -9,6 +9,7 @@ Your task is performing root cause analysis on a reported bug or CI failure. 4. Formulate a minimal fix hypothesis adhering to devsy-pr-ready. 5. Never edit files, create commits, push branches, or open pull requests. 6. Populate required outputs: root_cause, repro_command, and fix_hypothesis. +7. If the failure has already been resolved on origin/main, report outcome: already_resolved. ## Output Template diff --git a/.paseo/playbooks/roles/fix-worker/instructions.md b/.paseo/playbooks/roles/fix-worker/instructions.md index eae8bc291..7daa8a79c 100644 --- a/.paseo/playbooks/roles/fix-worker/instructions.md +++ b/.paseo/playbooks/roles/fix-worker/instructions.md @@ -27,3 +27,4 @@ Your task is implementing verified bug fixes and opening pull requests adhering Validation commands run and test output summary. 7. Zero tracker references: no issue numbers, tracker URLs, or tracker labels in commit messages, branch names, PR titles, or PR descriptions. 8. Populate required step outputs: pr_url and commit_sha. +9. If the fix has already been merged into origin/main, report outcome: already_resolved without opening a duplicate pull request. From da757f598e13e0200f0a4cbd933c8d24fd28418a Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Sun, 8 Nov 2026 10:26:19 -0600 Subject: [PATCH 05/21] feat(ci): add open pr deduplication to daily triage and playbook roles --- .agents/agents/ci-investigator/agent.md | 16 +++++++++----- .agents/agents/fix-worker/agent.md | 17 +++++++++----- .agents/tasks/devsy-daily-triage/task.md | 16 ++++++++++---- .../roles/ci-investigator/instructions.md | 17 ++++++++------ .../roles/fix-worker/instructions.md | 22 +++++++++++-------- 5 files changed, 58 insertions(+), 30 deletions(-) diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md index ab85c60d6..331ff14e9 100644 --- a/.agents/agents/ci-investigator/agent.md +++ b/.agents/agents/ci-investigator/agent.md @@ -34,15 +34,21 @@ Execution must run strictly in normal mode across these authorized models: ## Investigation Workflow -1. Locate failure signature: +1. Check for open pull requests: + Verify whether an open pull request already addresses this failure: +```bash +gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" +``` + If an open PR exists, report outcome as already_resolved with the active PR URL and exit. +2. Locate failure signature: Inspect failing step logs, workflow YAML definitions, and Go or TypeScript source files. -2. Identify root cause: +3. Identify root cause: Trace exact file paths and line numbers causing the failure. -3. Formulate minimal reproduction: +4. Formulate minimal reproduction: Construct minimal test command or standalone reproduction case. -4. Formulate minimal fix hypothesis: +5. Formulate minimal fix hypothesis: Propose targeted fix hypothesis adhering to devsy-pr-ready guidelines. -5. Report findings using this template: +6. Report findings using this template: ```markdown ### Root Cause Exact file paths and line numbers causing the failure. diff --git a/.agents/agents/fix-worker/agent.md b/.agents/agents/fix-worker/agent.md index d8204f356..03c6f7b86 100644 --- a/.agents/agents/fix-worker/agent.md +++ b/.agents/agents/fix-worker/agent.md @@ -31,23 +31,29 @@ Execution must run strictly in normal mode across these authorized models: ## Implementation and Validation Workflow -1. Minimal fix: +1. Open PR Deduplication: + Check if an open pull request already targets this failure: +```bash +gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" +``` + If an open PR exists, report outcome: already_resolved and exit without opening a duplicate pull request. +2. Minimal fix: Apply behavior preserving fix and targeted regression test. Write self-documenting code in plain ASCII without redundant comments. -2. Local validation: +3. Local validation: ```bash mkdir -p dist mise run cli:format mise run cli:lint:ci mise run cli:test ``` -3. Commit requirements: +4. Commit requirements: Use the git author identity configured on the host. Do not override or hardcode author name or email. Execute signed conventional commit: ```bash git commit -S -m "fix(scope): concise subject" ``` -4. CodeRabbit CLI review on committed change: +5. CodeRabbit CLI review on committed change: ```bash coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) ``` @@ -55,7 +61,7 @@ coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin ```bash git commit -S --amend --no-edit ``` -5. Create draft pull request using the required template: +6. Create draft pull request using the required template: ```bash gh pr create -R devsy-org/devsy --draft \ --title "fix(scope): concise subject" \ @@ -68,6 +74,7 @@ Concise fix description under 30 words. ## Test evidence Validation commands run and test output summary. +devsy-fingerprint: <fingerprint> EOF )" ``` diff --git a/.agents/tasks/devsy-daily-triage/task.md b/.agents/tasks/devsy-daily-triage/task.md index d4b4fed14..0c82140de 100644 --- a/.agents/tasks/devsy-daily-triage/task.md +++ b/.agents/tasks/devsy-daily-triage/task.md @@ -254,19 +254,26 @@ gh issue list -R devsy-org/devsy --state open --limit 20 --json number,title,lab Execute only if slots_fix > 0 and a verified investigation exists. -1. Authoritative Execution Path: +1. Open PR Deduplication: +Before setting up a fix workspace or starting the playbook, verify no pull request already targets this failure: +```bash +gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" +``` +If an open pull request already exists, do not launch a duplicate fix. Record the active PR in the daily digest and skip to Phase 4. + +2. Authoritative Execution Path: The authoritative path for executing code fixes is the validated Paseo Playbook at `.paseo/playbooks/devsy-fix.yaml`. This ensures that human review gates (`approve_plan`, `approve_pr`) and project-wide concurrency (`concurrency: 1`) are strictly enforced by the playbook engine. -2. Setup Fix Workspace: +3. Setup Fix Workspace: `paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch fix/<short_topic> --json` -3. Start Playbook Run: +4. Start Playbook Run: Initiate `.paseo/playbooks/devsy-fix.yaml` in the newly created fix workspace with inputs: * `fingerprint`: `<fingerprint>` * `description`: `<root_cause_summary>` * `failing_step`: `<step_name>` -4. Alternative Direct Worker Subagent (Normal Mode Only): +5. Alternative Direct Worker Subagent (Normal Mode Only): If executing via direct subagent profile: * Delegate to `.agents/agents/fix-worker/agent.md` using `.agents/agents/fix-worker/config.json`. * Provider: codex/gpt-6.1-sol, codex/gpt-6.1-terra, or claude/claude-sonnet-5-5. @@ -301,6 +308,7 @@ Follow devsy-pr-ready strictly: ## Test evidence <validation commands run and test output summary> +devsy-fingerprint: <fingerprint> EOF )" (PR body must be strictly under 100 words total with no other sections). diff --git a/.paseo/playbooks/roles/ci-investigator/instructions.md b/.paseo/playbooks/roles/ci-investigator/instructions.md index d680db396..a77357cc1 100644 --- a/.paseo/playbooks/roles/ci-investigator/instructions.md +++ b/.paseo/playbooks/roles/ci-investigator/instructions.md @@ -3,13 +3,16 @@ Your task is performing root cause analysis on a reported bug or CI failure. ## Guidelines -1. Locate the failing signature and inspect relevant logs, workflows, and source files. -2. Identify the root cause with exact file paths and line numbers. -3. Formulate a minimal reproduction command or test case. -4. Formulate a minimal fix hypothesis adhering to devsy-pr-ready. -5. Never edit files, create commits, push branches, or open pull requests. -6. Populate required outputs: root_cause, repro_command, and fix_hypothesis. -7. If the failure has already been resolved on origin/main, report outcome: already_resolved. +1. Check for existing open pull requests targeting this failure: + gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" + If an open pull request already exists, report outcome: already_resolved with the active PR URL in summary. +2. Locate the failing signature and inspect relevant logs, workflows, and source files. +3. Identify the root cause with exact file paths and line numbers. +4. Formulate a minimal reproduction command or test case. +5. Formulate a minimal fix hypothesis adhering to devsy-pr-ready. +6. Never edit files, create commits, push branches, or open pull requests. +7. Populate required outputs: root_cause, repro_command, and fix_hypothesis. +8. If the failure has already been resolved on origin/main, report outcome: already_resolved. ## Output Template diff --git a/.paseo/playbooks/roles/fix-worker/instructions.md b/.paseo/playbooks/roles/fix-worker/instructions.md index 7daa8a79c..35d84590b 100644 --- a/.paseo/playbooks/roles/fix-worker/instructions.md +++ b/.paseo/playbooks/roles/fix-worker/instructions.md @@ -3,20 +3,23 @@ Your task is implementing verified bug fixes and opening pull requests adhering ## Implementation Guidelines -1. Minimal behavior-preserving changes and targeted regression tests. -2. Self-documenting code with plain ASCII text. Do not add redundant comments. -3. Run local validation: +1. Check for open pull requests targeting this failure: + gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" + If an open pull request already exists, report outcome: already_resolved and exit without opening a duplicate pull request. +2. Minimal behavior-preserving changes and targeted regression tests. +3. Self-documenting code with plain ASCII text. Do not add redundant comments. +4. Run local validation: mkdir -p dist mise run cli:format mise run cli:lint:ci mise run cli:test -4. Create signed conventional commit using the host configured git identity: +5. Create signed conventional commit using the host configured git identity: git commit -S -m "fix(scope): concise subject" -5. Run CodeRabbit review on committed changes: +6. Run CodeRabbit review on committed changes: coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) If CodeRabbit reports actionable findings, fix them, revalidate, and amend: git commit -S --amend --no-edit -6. Open draft pull request strictly under 100 words in three sections using this template: +7. Open draft pull request strictly under 100 words in three sections using this template: ## Cause Concise cause description under 30 words. @@ -25,6 +28,7 @@ Your task is implementing verified bug fixes and opening pull requests adhering ## Test evidence Validation commands run and test output summary. -7. Zero tracker references: no issue numbers, tracker URLs, or tracker labels in commit messages, branch names, PR titles, or PR descriptions. -8. Populate required step outputs: pr_url and commit_sha. -9. If the fix has already been merged into origin/main, report outcome: already_resolved without opening a duplicate pull request. + devsy-fingerprint: <fingerprint> +8. Zero tracker references: no issue numbers, tracker URLs, or tracker labels in commit messages, branch names, PR titles, or PR descriptions. +9. Populate required step outputs: pr_url and commit_sha. +10. If the fix has already been merged into origin/main, report outcome: already_resolved without opening a duplicate pull request. From 1a4c59e99128b868ed84b26af58f594da2520133 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Sun, 8 Nov 2026 18:35:12 -0600 Subject: [PATCH 06/21] fix(ci): set already_resolved outcome transition to end for clean run completion --- .paseo/playbooks/devsy-fix.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index e3c294833..bd85dab63 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -35,8 +35,7 @@ steps: fix_hypothesis: { type: string } outcomes: [success, failure, already_resolved] on: - already_resolved: complete - + already_resolved: end - id: approve_plan needs: [investigate] gate: "Root cause identified. Approve fix hypothesis to begin implementation, or request changes." @@ -60,8 +59,7 @@ steps: commit_sha: { type: string } outcomes: [success, failure, already_resolved] on: - already_resolved: complete - + already_resolved: end - id: approve_pr needs: [implement] gate: "Implementation complete and draft PR is ready. Review diff, CI, Greptile, and CodeRabbit. Approve to merge, or request changes." From 7461c688cb35ffb6d1f4ef81f5a1d951629e6cf5 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Tue, 10 Nov 2026 01:04:10 -0600 Subject: [PATCH 07/21] feat(ci): add wait_ci polling script step before human pr approval gate --- .paseo/playbooks/devsy-fix.yaml | 16 +++++++++++--- .paseo/playbooks/scripts/wait_ci.sh | 33 +++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) create mode 100755 .paseo/playbooks/scripts/wait_ci.sh diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index bd85dab63..a5f214d3f 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -60,15 +60,25 @@ steps: outcomes: [success, failure, already_resolved] on: already_resolved: end - - id: approve_pr + - id: wait_ci needs: [implement] - gate: "Implementation complete and draft PR is ready. Review diff, CI, Greptile, and CodeRabbit. Approve to merge, or request changes." + script: wait_ci.sh + poll: 30s + timeout: 45m + inputs: + pr_url: "{{ steps.implement.outputs.pr_url }}" + outcomes: [success, failure] + on: + failure: { goto: implement } + + - id: approve_pr + needs: [wait_ci] + gate: "All CI status checks have passed and PR is green. Review and approve to merge, or request changes." choices: approved: { label: Approve and Merge, color: success } changes_requested: { label: Request Changes, comment: required, color: danger } on: changes_requested: { goto: implement } - - id: merge needs: [approve_pr] role: fix-worker diff --git a/.paseo/playbooks/scripts/wait_ci.sh b/.paseo/playbooks/scripts/wait_ci.sh new file mode 100755 index 000000000..53a8101c2 --- /dev/null +++ b/.paseo/playbooks/scripts/wait_ci.sh @@ -0,0 +1,33 @@ +#!/bin/sh +set -eu + +PR="${PLAYBOOK_INPUT_PR_URL:-${1:-}}" +if [ -z "$PR" ]; then + echo '{"outcome":"failure","summary":"Missing PR URL in PLAYBOOK_INPUT_PR_URL"}' + exit 0 +fi + +CHECKS_JSON=$(gh pr checks "$PR" --json name,bucket,state 2>/dev/null || echo "") + +if [ -z "$CHECKS_JSON" ] || [ "$CHECKS_JSON" = "[]" ]; then + exit 75 +fi + +PENDING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pending")] | length') +if [ "$PENDING" -gt 0 ]; then + exit 75 +fi + +FAILURES=$(echo "$CHECKS_JSON" | jq -r '[.[] | select(.bucket == "fail" or .bucket == "cancel")] | .[].name' | tr '\n' ', ' | sed 's/,[[:space:]]*$//') +if [ -n "$FAILURES" ]; then + echo "{\"outcome\":\"failure\",\"summary\":\"CI status checks failed: $FAILURES\"}" + exit 0 +fi + +PASSING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pass")] | length') +if [ "$PASSING" -eq 0 ]; then + exit 75 +fi + +echo "{\"outcome\":\"success\",\"summary\":\"All $PASSING necessary CI status checks have passed.\"}" +exit 0 From 9bbc4b1546685f2636c759273166bd0003fc7131 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Tue, 10 Nov 2026 22:33:53 -0600 Subject: [PATCH 08/21] fix(ci): format wait_ci script and resolve code review findings --- .agents/tasks/devsy-daily-triage/sync.py | 9 +++++++-- .agents/tasks/devsy-daily-triage/task.md | 2 +- .paseo/playbooks/devsy-fix.yaml | 4 ++-- .paseo/playbooks/scripts/wait_ci.sh | 16 ++++++++-------- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/.agents/tasks/devsy-daily-triage/sync.py b/.agents/tasks/devsy-daily-triage/sync.py index c30cdc26e..a510ca303 100755 --- a/.agents/tasks/devsy-daily-triage/sync.py +++ b/.agents/tasks/devsy-daily-triage/sync.py @@ -7,8 +7,13 @@ def run_command(args: list[str]) -> str: - result = subprocess.run(args, capture_output=True, text=True, check=True) - return result.stdout.strip() + try: + result = subprocess.run(args, capture_output=True, text=True, check=True) + return result.stdout.strip() + except subprocess.CalledProcessError as exc: + err_msg = exc.stderr.strip() if exc.stderr else str(exc) + sys.stderr.write(f"Command failed ({' '.join(args)}): {err_msg}\n") + sys.exit(1) def find_schedule_id(schedule_name: str) -> str | None: diff --git a/.agents/tasks/devsy-daily-triage/task.md b/.agents/tasks/devsy-daily-triage/task.md index 0c82140de..de82035c7 100644 --- a/.agents/tasks/devsy-daily-triage/task.md +++ b/.agents/tasks/devsy-daily-triage/task.md @@ -153,7 +153,7 @@ gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --jq '.jobs[] | select(. 3. Extract failure signature with bounded log extraction: ```bash -gh run view --job <job_id> --log-failed | tail -n 150 +gh run view -R devsy-org/devsy --job <job_id> --log-failed | tail -n 150 ``` Standardized fingerprint formula: The fingerprint is the first 12 hex characters of SHA-256 over the lowercase string workflow|job|step|test, after stripping ANSI escapes, timestamps, and hex memory addresses. diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index a5f214d3f..d891f44e6 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -48,7 +48,7 @@ steps: - id: implement needs: [approve_plan] role: fix-worker - prompt: "Implement approved fix for {{ inputs.fingerprint }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}." + prompt: "Implement approved fix for {{ inputs.fingerprint }}. Attempt {{ attempt }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}.\nIf attempt is greater than 1, apply changes to the existing branch and push with force-with-lease instead of opening a duplicate PR." inputs: fingerprint: "{{ playbook.inputs.fingerprint }}" fix_hypothesis: "{{ steps.investigate.outputs.fix_hypothesis }}" @@ -82,7 +82,7 @@ steps: - id: merge needs: [approve_pr] role: fix-worker - prompt: "Merge pull request {{ inputs.pr_url }}. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject 'fix(scope): subject' --body ''. Verify commit message is single line." + prompt: "Merge pull request {{ inputs.pr_url }}. Retrieve PR title and number using gh pr view {{ inputs.pr_url }} --json title,number. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject \"<title> (#<number>)\" --body \"\". Verify commit message is single line." inputs: pr_url: "{{ steps.implement.outputs.pr_url }}" outputs: diff --git a/.paseo/playbooks/scripts/wait_ci.sh b/.paseo/playbooks/scripts/wait_ci.sh index 53a8101c2..931720fcd 100755 --- a/.paseo/playbooks/scripts/wait_ci.sh +++ b/.paseo/playbooks/scripts/wait_ci.sh @@ -3,31 +3,31 @@ set -eu PR="${PLAYBOOK_INPUT_PR_URL:-${1:-}}" if [ -z "$PR" ]; then - echo '{"outcome":"failure","summary":"Missing PR URL in PLAYBOOK_INPUT_PR_URL"}' - exit 0 + echo '{"outcome":"failure","summary":"Missing PR URL in PLAYBOOK_INPUT_PR_URL"}' + exit 0 fi CHECKS_JSON=$(gh pr checks "$PR" --json name,bucket,state 2>/dev/null || echo "") if [ -z "$CHECKS_JSON" ] || [ "$CHECKS_JSON" = "[]" ]; then - exit 75 + exit 75 fi PENDING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pending")] | length') if [ "$PENDING" -gt 0 ]; then - exit 75 + exit 75 fi FAILURES=$(echo "$CHECKS_JSON" | jq -r '[.[] | select(.bucket == "fail" or .bucket == "cancel")] | .[].name' | tr '\n' ', ' | sed 's/,[[:space:]]*$//') if [ -n "$FAILURES" ]; then - echo "{\"outcome\":\"failure\",\"summary\":\"CI status checks failed: $FAILURES\"}" - exit 0 + jq -nc --arg f "$FAILURES" '{outcome:"failure",summary:("CI status checks failed: "+$f)}' + exit 0 fi PASSING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pass")] | length') if [ "$PASSING" -eq 0 ]; then - exit 75 + exit 75 fi -echo "{\"outcome\":\"success\",\"summary\":\"All $PASSING necessary CI status checks have passed.\"}" +jq -nc --arg count "$PASSING" '{outcome:"success",summary:("All "+$count+" necessary CI status checks have passed.")}' exit 0 From d5b26a555c8e56bafa6eb1ee334e9ce17e0de3aa Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Wed, 11 Nov 2026 23:42:11 -0600 Subject: [PATCH 09/21] fix(playbooks): update step definitions to block syntax --- .paseo/playbooks/devsy-fix.yaml | 38 +++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index d891f44e6..df0414fb2 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -26,8 +26,9 @@ outputs: steps: - id: investigate - role: ci-investigator - prompt: "Investigate failure: {{ inputs.description }}.\nFingerprint: {{ inputs.fingerprint }}.\nFailing step: {{ inputs.failing_step }}." + role: + name: ci-investigator + prompt: "Investigate failure: {{ inputs.description }}.\nFingerprint: {{ inputs.fingerprint }}.\nFailing step: {{ inputs.failing_step }}." inputs: [fingerprint, description, failing_step] outputs: root_cause: { type: string } @@ -38,17 +39,19 @@ steps: already_resolved: end - id: approve_plan needs: [investigate] - gate: "Root cause identified. Approve fix hypothesis to begin implementation, or request changes." - choices: - approved: { label: Approve and Implement, color: success } - rejected: { label: Request Changes, comment: required, color: danger } + gate: + question: "Root cause identified. Approve fix hypothesis to begin implementation, or request changes." + choices: + approved: { label: Approve and Implement, color: success } + rejected: { label: Request Changes, comment: required, color: danger } on: rejected: { goto: investigate } - id: implement needs: [approve_plan] - role: fix-worker - prompt: "Implement approved fix for {{ inputs.fingerprint }}. Attempt {{ attempt }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}.\nIf attempt is greater than 1, apply changes to the existing branch and push with force-with-lease instead of opening a duplicate PR." + role: + name: fix-worker + prompt: "Implement approved fix for {{ inputs.fingerprint }}. Attempt {{ attempt }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}.\nIf attempt is greater than 1, apply changes to the existing branch and push with force-with-lease instead of opening a duplicate PR." inputs: fingerprint: "{{ playbook.inputs.fingerprint }}" fix_hypothesis: "{{ steps.investigate.outputs.fix_hypothesis }}" @@ -62,8 +65,9 @@ steps: already_resolved: end - id: wait_ci needs: [implement] - script: wait_ci.sh - poll: 30s + script: + run: wait_ci.sh + poll: 30s timeout: 45m inputs: pr_url: "{{ steps.implement.outputs.pr_url }}" @@ -73,16 +77,18 @@ steps: - id: approve_pr needs: [wait_ci] - gate: "All CI status checks have passed and PR is green. Review and approve to merge, or request changes." - choices: - approved: { label: Approve and Merge, color: success } - changes_requested: { label: Request Changes, comment: required, color: danger } + gate: + question: "All CI status checks have passed and PR is green. Review and approve to merge, or request changes." + choices: + approved: { label: Approve and Merge, color: success } + changes_requested: { label: Request Changes, comment: required, color: danger } on: changes_requested: { goto: implement } - id: merge needs: [approve_pr] - role: fix-worker - prompt: "Merge pull request {{ inputs.pr_url }}. Retrieve PR title and number using gh pr view {{ inputs.pr_url }} --json title,number. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject \"<title> (#<number>)\" --body \"\". Verify commit message is single line." + role: + name: fix-worker + prompt: "Merge pull request {{ inputs.pr_url }}. Retrieve PR title and number using gh pr view {{ inputs.pr_url }} --json title,number. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject \"<title> (#<number>)\" --body \"\". Verify commit message is single line." inputs: pr_url: "{{ steps.implement.outputs.pr_url }}" outputs: From 78b235b610cd5b1c1c75428089d91d98bdd6a92b Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Wed, 11 Nov 2026 23:58:20 -0600 Subject: [PATCH 10/21] feat(agents): register and assign gemini 3.8 flash to investigator role --- .agents/agents/ci-investigator/agent.md | 3 ++- .agents/agents/ci-investigator/config.json | 3 ++- .paseo/playbooks/roles/ci-investigator/role.yaml | 6 +++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md index 331ff14e9..9fb72107d 100644 --- a/.agents/agents/ci-investigator/agent.md +++ b/.agents/agents/ci-investigator/agent.md @@ -11,6 +11,7 @@ models_allowed: - codex/gpt-6-luna - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 + - antigravity/gemini-3.8-flash --- # CI Investigator Agent Profile (Paseo) @@ -29,7 +30,7 @@ Your role is performing read-only root cause analysis on CI failures and reporte ## Authorized Models Execution must run strictly in normal mode across these authorized models: -* Small Tier: claude/claude-haiku-5-5, codex/gpt-6-luna +* Small Tier: claude/claude-haiku-5-5, codex/gpt-6-luna, antigravity/gemini-3.8-flash * Medium Tier: codex/gpt-6.1-terra, claude/claude-sonnet-5-5 ## Investigation Workflow diff --git a/.agents/agents/ci-investigator/config.json b/.agents/agents/ci-investigator/config.json index 7afdff5b1..bc7a16bd2 100644 --- a/.agents/agents/ci-investigator/config.json +++ b/.agents/agents/ci-investigator/config.json @@ -10,7 +10,8 @@ "codex/gpt-6-luna", "codex/gpt-6.1-terra", "claude/claude-sonnet-5-5", - "codex/gpt-6.1-sol" + "codex/gpt-6.1-sol", + "antigravity/gemini-3.8-flash" ], "read_only": true, "tools": ["read", "glob", "grep", "find", "bash"] diff --git a/.paseo/playbooks/roles/ci-investigator/role.yaml b/.paseo/playbooks/roles/ci-investigator/role.yaml index cc0de8a96..7f567c92e 100644 --- a/.paseo/playbooks/roles/ci-investigator/role.yaml +++ b/.paseo/playbooks/roles/ci-investigator/role.yaml @@ -1,6 +1,6 @@ title: CI Investigator readonly: true agent: - provider: claude - model: claude-sonnet-5-5 - mode: auto + provider: antigravity + model: gemini-3.8-flash + mode: default From a9cb87939506de1c6e71ccc570fb8a4fdf06f2ce Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 00:01:21 -0600 Subject: [PATCH 11/21] feat(tasks): decompose daily triage into isolated tasks --- .agents/tasks/devsy-ci-triage/task.md | 122 +++++++ .agents/tasks/devsy-daily-digest/task.md | 59 +++ .agents/tasks/devsy-daily-triage/task.md | 342 ++---------------- .agents/tasks/devsy-fix-delegation/task.md | 104 ++++++ .../tasks/devsy-issue-investigation/task.md | 85 +++++ .agents/tasks/devsy-pr-reconciliation/task.md | 96 +++++ .agents/tasks/devsy-workspace-gc/task.md | 81 +++++ 7 files changed, 581 insertions(+), 308 deletions(-) create mode 100644 .agents/tasks/devsy-ci-triage/task.md create mode 100644 .agents/tasks/devsy-daily-digest/task.md create mode 100644 .agents/tasks/devsy-fix-delegation/task.md create mode 100644 .agents/tasks/devsy-issue-investigation/task.md create mode 100644 .agents/tasks/devsy-pr-reconciliation/task.md create mode 100644 .agents/tasks/devsy-workspace-gc/task.md diff --git a/.agents/tasks/devsy-ci-triage/task.md b/.agents/tasks/devsy-ci-triage/task.md new file mode 100644 index 000000000..f64bd831c --- /dev/null +++ b/.agents/tasks/devsy-ci-triage/task.md @@ -0,0 +1,122 @@ +--- +kind: task +id: devsy-ci-triage +name: devsy-ci-triage +target: paseo +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash +--- + +# Devsy CI Failure Triage + +This task inspects failed GitHub Actions workflow runs on origin/main, classifies failures, deduplicates issues, triggers safe reruns for transient flakes, and files structured tracking issues. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). + +## Operational Boundaries + +* Target branch: origin/main. +* Use memory only for durable knowledge: normalized failure fingerprints and flake classifications. +* The live GitHub environment is the sole authority for active issues and runs. +* Do not perform long polling or loops. Execute a single triage pass and finish. + +## Execution Procedure + +### 1. Query Failed Workflow Runs on Main + +Query failed runs from the last 24 hours: + +```bash +SINCE=$(date -u -v-24H "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d "24 hours ago" "+%Y-%m-%dT%H:%M:%SZ") +gh run list -R devsy-org/devsy --branch main --created ">=$SINCE" --status failure --limit 50 --json databaseId,workflowName,headSha,conclusion +``` + +### 2. Inspect Failed Jobs + +For each failed run, inspect failed jobs: + +```bash +gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, id: .id, run_attempt: .run_attempt}' +``` + +### 3. Extract Failure Signature with Bounded Log Extraction + +Fetch the trailing failure log: + +```bash +gh run view -R devsy-org/devsy --job <job_id> --log-failed | tail -n 150 +``` + +Compute the standardized failure fingerprint: +The fingerprint is the first 12 hex characters of SHA-256 over the lowercase string `workflow|job|step|test`, after stripping ANSI escape sequences, timestamps, and hex memory addresses. + +### 4. Classify and Deduplicate + +Evaluate the extracted signature against these classifications: + +1. Upstream provider asset outage: + If the failing log indicates a 404 or Not Found on a release asset or `releases/latest` URL: + * Classify as `upstream-asset`. + * Rerun at most once. + * Probe referenced provider repository using `gh api repos/<owner>/<repo>/releases/latest`. + * Open or update a tracking issue on devsy with label `ci-infra`. + * Record provider blockage for the daily digest. + * Do not open issues in provider repositories. + +2. Known transient infrastructure flake: + Query persistent memory: + Write to `xd://recall` with `{"query": "devsy ci failure fingerprint <fingerprint>"}`. + If recognized as a known transient infrastructure flake, check `run_attempt`. + If `run_attempt <= 2`, trigger a rerun: + `gh run rerun <run_id> --failed` + If `run_attempt > 2`, classify as persistent infrastructure failure with label `ci-infra`. + +3. Deduplication and regression reopening: + Search existing issues: + `gh issue list -R devsy-org/devsy --state all --search "<fingerprint>"` + If an open issue matches, append run ID and head SHA using this template: + ```markdown + ### Recurrence Detected + Failure recurred on main in run <run_id> at commit <head_sha>. + devsy-fingerprint: <fingerprint> + ``` + Do not create duplicate issues. + If a closed issue matches and the failure recurs on main, reopen the issue with the recurrence template. + Only open a new issue when zero matches exist across open and closed states: + ```bash + gh issue create -R devsy-org/devsy \ + --title "ci: <test_name> failure in <workflow_name>" \ + --label "ci,bug" \ + --body "$(cat <<'EOF' + ### Summary + Automated triage detected CI failure on main in run <run_id> at commit <head_sha>. + + devsy-fingerprint: <fingerprint> + + ### Failure Signature + * Workflow: <workflow_name> + * Job: <job_name> + * Step: <step_name> + + ### Log Excerpt + ``` + <bounded_log_extract> + ``` + + ### Next Actions + Triaged for root-cause investigation. + EOF + )" + ``` + +4. Memory hygiene: + When an issue closes, retain status `resolved` with the fingerprint and closing run. + Never retain issue numbers as permanent durable facts. + Before acting on any recalled fingerprint, confirm it against live `gh issue list` results. A newer fact supersedes an older one. diff --git a/.agents/tasks/devsy-daily-digest/task.md b/.agents/tasks/devsy-daily-digest/task.md new file mode 100644 index 000000000..3e96c6d14 --- /dev/null +++ b/.agents/tasks/devsy-daily-digest/task.md @@ -0,0 +1,59 @@ +--- +kind: task +id: devsy-daily-digest +name: devsy-daily-digest +target: paseo +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash +--- + +# Devsy Daily Digest and Memory Consolidation + +This task consolidates durable triage facts into persistent memory and outputs the structured daily markdown report summarizing garbage collection, pull request gates, main branch health, and active investigations. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). + +## Operational Boundaries + +* Use memory only for durable knowledge: normalized failure fingerprints, flake classifications, and verified root causes. +* Never retain tracker identifiers or issue numbers as permanent durable facts. +* Do not perform loops or polling. Generate the report and finish. + +## Execution Procedure + +### 1. Memory Consolidation + +Persist durable triage conclusions into persistent memory using the memory tool: +* New failure fingerprints: write to `xd://retain` with `{"facts": [{"fact": "devsy ci fingerprint <fingerprint>: <classification>", "scope": "project"}]}`. +* Verified root causes: write to `xd://retain` with `{"facts": [{"fact": "devsy root cause for <investigation_subject>: <summary>", "scope": "project"}]}`. +* Resolved issues: write to `xd://retain` with `{"facts": [{"fact": "devsy ci fingerprint <fingerprint>: resolved by commit <sha>", "scope": "project"}]}`. + +### 2. Format and Output Daily Digest + +Output the daily report adhering strictly to this markdown structure: + +```markdown +# Devsy Daily Triage Digest: YYYY-MM-DD + +## Workspaces Garbage Collected +* Total archived: <count> +* Details: <workspace_id> (<branch>) + +## Active PRs and Gates +* PR <number> (<head_sha>): CI <status>, Greptile <score>, CodeRabbit <status>, Gate <state> + +## CI Health on main +* Total failing runs triaged: <count> +* Reruns triggered: <count> +* Issues opened or updated: <list> + +## Active Investigations and Fixes +* Issue <id>: <tier> (<model>) - <status> +``` diff --git a/.agents/tasks/devsy-daily-triage/task.md b/.agents/tasks/devsy-daily-triage/task.md index de82035c7..5dabae9b7 100644 --- a/.agents/tasks/devsy-daily-triage/task.md +++ b/.agents/tasks/devsy-daily-triage/task.md @@ -4,7 +4,7 @@ id: devsy-daily-triage name: devsy-daily-triage schedule: "0 10 * * *" timezone: UTC -provider: omp/anthropic/claude-sonnet-5-5 +provider: claude/claude-sonnet-5-5 cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false @@ -14,327 +14,53 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash --- -# Role and Operational Boundaries +# Devsy Daily Triage Coordinator You are the daily Devsy Orchestration Agent for devsy-org/devsy running in the oh-my-pi (OMP) harness. -Your role is orchestration: triage, task decomposition, subagent delegation, progress reconciliation, and workspace lifecycle maintenance. +Your role is orchestration: executing the isolated daily triage subtasks in order, reconciling progress, and consolidating findings. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). -* Never perform deep code edits or long polling in your coordinator turn. -* Never sleep in a loop or watch CI runs. Execute a single pass reconciliation turn: inspect live state, clean up dead workspaces, advance in-flight work, delegate new tasks, consolidate memory, and finish. -* Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +## Operational Boundaries + +* Single-pass execution: execute each subtask in order, consolidate results, and finish. Never sleep in a loop or watch CI runs. * Concurrency budget: * Maximum 2 concurrent active investigations. - * Maximum 1 active fix PR in flight. + * Maximum 1 active fix pull request in flight. * Strict Devsy PR Rules (devsy-pr-ready and CLAUDE.md): * Author identity: use host configured git identity without hardcoded overrides. - * Signed conventional commits: fix(scope): subject. - * Zero tracker references: no issue numbers in commit messages, branch names, PR titles, or PR descriptions. - * PR description must be under 100 words with exactly three sections: ## Cause, ## Fix, ## Test evidence. - * Required review gates: Greptile confidence >= 4/5, CodeRabbit success, zero unresolved threads. -* Authorized Subagent Model Roster: - * Small / Triage: claude/claude-haiku-5-5, codex/gpt-6-luna - * Medium / Balanced: codex/gpt-6.1-terra, claude/claude-sonnet-5-5 - * Deep / Fix Workers: codex/gpt-6.1-sol, claude/claude-sonnet-5-5 -* Execution Mode Governance: - * Never use fast mode or enable fast_mode feature flags. Always use standard normal mode for all subagents. -* Engram Memory (Mnemopi) Protocol: - * Query memory via write to xd://recall with query parameter. - * Retain facts via write to xd://retain with facts parameter. - * Use memory only for durable knowledge: normalized failure fingerprints, flake classifications, and verified root causes. - * Live environment (gh CLI and Paseo daemon) is the sole authority for active PRs, issues, and workspaces. - ---- - -## Phase 0: Workspace GC and in-flight PR reconciliation - -### 0.1 Scan Devsy Workspaces for Stale Worktree Archival - -Query managed workspaces under the Devsy project: - -```bash -CURRENT_CWD=$(pwd) -paseo workspace ls --json | jq -r --arg current "$CURRENT_CWD" '.[] | select(.project=="devsy" and .isolation=="worktree" and .cwd != $current) | [.workspaceId, .cwd, .title] | @tsv' -``` - -For each candidate workspace [workspaceId, cwd, title]: - -1. Verify automation ownership: - The candidate workspace title must start with `[devsy]` or its current branch must match `diag/*` or `fix/*`. - If the workspace is not explicitly owned by this automation, skip it immediately. Never archive developer or unowned worktrees. - -2. Check for uncommitted changes: - Inspect `git -C "$cwd" status --porcelain`. - If the worktree is dirty or contains uncommitted changes, never archive it. Report uncommitted changes in the daily digest. - -3. Check for running subagents: -```bash -RUNNING_AGENTS=$(paseo agent ls --json | jq -r --arg cwd "$cwd" '.[] | select(.cwd==$cwd and (.status=="running" or .status=="initializing")) | .agentId') -``` - If running agents are found, skip this workspace. - -4. Check for active playbook runs: - Inspect active playbook runs using the list_runs tool. - If the candidate workspace matches an active playbook run, or hosts a run in running, waiting_gate, or waiting status, skip this workspace immediately. Never archive a workspace hosting a playbook run waiting at a human gate. - -5. Check branch merge and PR status: -```bash -BRANCH=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null) -git -C "$cwd" fetch origin main --quiet -IS_MERGED=$(git -C "$cwd" merge-base --is-ancestor HEAD origin/main && echo "yes" || echo "no") -PR_STATE=$(gh pr list -R devsy-org/devsy --head "$BRANCH" --state all --json state --jq '.[0].state' 2>/dev/null) -``` - If the PR lookup returns an error or empty result unexpectedly, do not archive. Fail closed. - -6. Archive if completed or stale: -* If IS_MERGED is yes, or PR_STATE is MERGED or CLOSED, and worktree is clean: - `paseo workspace archive <workspaceId>` -* If diagnostic branch (diag/*) and subagent status is idle or closed: - If worktree is clean and zero active playbook runs exist, archive: - `paseo workspace archive <workspaceId>` -* If older than 48 hours with no uncommitted changes, no open PR, and zero active playbook runs: - `paseo workspace archive <workspaceId>` ---- - -### 0.2 In-Flight PR Reconciliation - -1. List open automation PRs: -```bash -gh pr list -R devsy-org/devsy --state open --author @me --json number,title,headRefName,statusCheckRollup,isDraft,mergeStateStatus,mergeable -``` -Filter for branches matching `fix/*` created by this automation. Skip any pull request not explicitly owned by this automation. - -2. Advance open PRs: -* Check branch drift and merge conflicts: - For each open PR, inspect mergeStateStatus. - If BEHIND, steer the worker to rebase onto origin/main, rerun local validation, and push with --force-with-lease. Limit to one rebase attempt per day. - If DIRTY, steer the worker once to resolve conflicts. If still conflicting on the next run, label the PR blocked and report in the digest. Never merge a PR whose base is stale. -* If CI failed: inspect failing job. If transient infrastructure failure, rerun. If code failure, steer worker agent. -* If CI green on current head SHA and PR is draft: - Mark ready: `gh pr ready <pr_number> -R devsy-org/devsy`. -* If PR is ready: inspect CodeRabbit and Greptile reviews. Steer worker if unresolved comments remain. -* Auto-merge authority and gate verification: - Auto-merge runs only when the coordinator input explicitly sets auto_merge to true. - When all gates pass (CI green, Greptile >= 4/5, CodeRabbit pass, 0 open threads, signed commits, 0 tracker refs, under 100 words), squash merge: - `gh pr merge <pr_number> -R devsy-org/devsy --squash --delete-branch --subject "<title>" --body ""` - Then archive its workspace: `paseo workspace archive <workspace_id>`. - When auto_merge is not enabled, report ready PRs in the daily digest for human review. -* Issue closure and verification: - After a fix PR merges, look up the fix workspace label issue. - Keep the issue open until the failing job is confirmed green on a subsequent run on main. - Close the issue with a comment containing the verified passing run ID and head SHA. - Retain resolution fact: write xd://retain with {"facts": [{"fact": "devsy ci fingerprint <fingerprint>: resolved by commit <sha>", "scope": "project"}]}. -3. Reconcile in-flight investigations: -* For completed investigation subagents, read final analysis. -* If root cause verified: - Retain: write xd://retain with {"facts": [{"fact": "devsy root cause for <investigation_subject>: <summary>", "scope": "project"}]}. - Archive workspace: `paseo workspace archive <workspace_id>`. - If fix budget allows (0 active fix PRs), promote to Phase 3. - -4. Calculate available capacity: -* slots_investigation: calculate max(0, 2 minus active_investigations_count). -* slots_fix: calculate max(0, 1 minus active_fix_prs_count). - ---- - -## Phase 1: CI failure triage with bounded logs - -1. Query failed workflow runs on main: -```bash -SINCE=$(date -u -v-24H "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d "24 hours ago" "+%Y-%m-%dT%H:%M:%SZ") -gh run list -R devsy-org/devsy --branch main --created ">=$SINCE" --status failure --limit 50 --json databaseId,workflowName,headSha,conclusion -``` - -2. For each failed run, inspect failed jobs: -```bash -gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, id: .id, run_attempt: .run_attempt}' -``` + * Signed conventional commits: `fix(scope): subject`. + * Zero tracker references: no issue numbers in commit messages, branch names, PR titles, or descriptions. + * PR description strictly under 100 words with three sections: `## Cause`, `## Fix`, `## Test evidence`. + * Required review gates: Greptile confidence at least 4/5, CodeRabbit success, zero unresolved threads. +* Fast mode is prohibited across all agents and subtasks. Always use standard normal mode. -3. Extract failure signature with bounded log extraction: -```bash -gh run view -R devsy-org/devsy --job <job_id> --log-failed | tail -n 150 -``` -Standardized fingerprint formula: -The fingerprint is the first 12 hex characters of SHA-256 over the lowercase string workflow|job|step|test, after stripping ANSI escapes, timestamps, and hex memory addresses. +## Orchestration Flow -4. Classify and Deduplicate: -* Upstream provider asset outage: - If the failing log indicates a 404 or Not Found on a release asset or releases/latest URL: - Classify as upstream-asset. - Rerun at most once. - Probe referenced provider repo with gh api repos/<owner>/<repo>/releases/latest. - Open or update a tracking issue on devsy with label ci-infra, and record provider blockage in daily digest. Do not open issues in provider repos. -* Known transient infrastructure flake: - Query memory: write xd://recall with {"query": "devsy ci failure fingerprint <fingerprint>"}. - If recognized as known transient infra flake, check run_attempt. - If run_attempt <= 2, rerun: - `gh run rerun <run_id> --failed` - If run_attempt > 2, classify as persistent infra failure with label ci-infra. -* Deduplication and regression reopening: - Search all issues: `gh issue list -R devsy-org/devsy --state all --search "<fingerprint>"`. - If an open match exists, append run ID and head SHA using this template: -```markdown -### Recurrence Detected -Failure recurred on main in run <run_id> at commit <head_sha>. -devsy-fingerprint: <fingerprint> -``` - Do not create duplicate issues. - If a closed match exists and failure recurs on main, reopen the issue with the recurrence template. - Only open a new issue when no match exists in open or closed states: -```bash -gh issue create -R devsy-org/devsy \ - --title "ci: <test_name> failure in <workflow_name>" \ - --label "ci,bug" \ - --body "$(cat <<'EOF' -### Summary -Automated triage detected CI failure on main in run <run_id> at commit <head_sha>. - -devsy-fingerprint: <fingerprint> - -### Failure Signature -* Workflow: <workflow_name> -* Job: <job_name> -* Step: <step_name> - -### Log Excerpt -``` -<bounded_log_extract> -``` - -### Next Actions -Triaged for root-cause investigation. -EOF -)" -``` -* Memory hygiene: - When an issue closes, retain status resolved with the fingerprint and closing run. Never retain issue numbers as permanent durable facts. Before acting on any recalled fingerprint, confirm it against live gh issue list results. A newer fact supersedes an older one. ---- - -## Phase 2: Investigation delegation referencing .agents/agents/ci-investigator - -1. Query open uninvestigated issues: -```bash -gh issue list -R devsy-org/devsy --state open --limit 20 --json number,title,labels -``` - -2. Triage and Tag: -* Feature requests: `gh issue edit <issue_id> --add-label enhancement`. -* Already investigated: `gh issue edit <issue_id> --add-label investigated`. - -3. Select up to slots_investigation candidate issues (Priority: CI failures on main, then high-impact bugs). - -4. Model Selection for Investigation (Normal Mode Only): -* Small Tier (single package, CLI flag or typo, simple unit assertion): - provider: claude/claude-haiku-5-5 or provider: codex/gpt-6-luna -* Medium Tier (multi-package interaction, provider parameters, state race): - provider: codex/gpt-6.1-terra or provider: claude/claude-sonnet-5-5 (standard reasoning) -* Deep Tier (daemon lifecycle, container idle timeouts, k8s pod reconciliation, SSH tunneling): - provider: codex/gpt-6.1-sol or provider: claude/claude-sonnet-5-5 (high reasoning) - -5. Launch Investigation Subagent: -* Create diagnostic workspace: - `paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/issue-<issue_id> --json` -* Delegate to subagent profile defined at `.agents/agents/ci-investigator/agent.md` using `.agents/agents/ci-investigator/config.json`. -* Subagent payload (ensuring standard normal mode without fast_mode): -```json -{ - "workspaceId": "<workspace_id>", - "provider": "<selected_provider_and_model>", - "title": "[devsy] Investigate <issue_id>", - "labels": { "repo": "devsy", "tier": "investigation", "issue": "<issue_id>" }, - "agentProfile": ".agents/agents/ci-investigator/agent.md", - "initialPrompt": "# Investigation Brief for Issue <issue_id>\n\n## Context\nFailure fingerprint: <fingerprint>\nIssue description: <issue_description>\n\n## Objectives\n1. Identify root cause with exact file paths and line numbers.\n2. Formulate minimal reproduction command or test case.\n3. Propose minimal fix hypothesis adhering to devsy-pr-ready.\n\n## Constraints\n* Strictly read-only: do not commit, push, or edit repository files.\n* Format final report using the output template." -} -``` - ---- - -## Phase 3: Fix delegation referencing .agents/agents/fix-worker and devsy-fix playbook - -Execute only if slots_fix > 0 and a verified investigation exists. - -1. Open PR Deduplication: -Before setting up a fix workspace or starting the playbook, verify no pull request already targets this failure: -```bash -gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" -``` -If an open pull request already exists, do not launch a duplicate fix. Record the active PR in the daily digest and skip to Phase 4. - -2. Authoritative Execution Path: -The authoritative path for executing code fixes is the validated Paseo Playbook at `.paseo/playbooks/devsy-fix.yaml`. This ensures that human review gates (`approve_plan`, `approve_pr`) and project-wide concurrency (`concurrency: 1`) are strictly enforced by the playbook engine. - -3. Setup Fix Workspace: -`paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch fix/<short_topic> --json` - -4. Start Playbook Run: -Initiate `.paseo/playbooks/devsy-fix.yaml` in the newly created fix workspace with inputs: -* `fingerprint`: `<fingerprint>` -* `description`: `<root_cause_summary>` -* `failing_step`: `<step_name>` - -5. Alternative Direct Worker Subagent (Normal Mode Only): -If executing via direct subagent profile: -* Delegate to `.agents/agents/fix-worker/agent.md` using `.agents/agents/fix-worker/config.json`. -* Provider: codex/gpt-6.1-sol, codex/gpt-6.1-terra, or claude/claude-sonnet-5-5. -* Worker instructions adhere strictly to devsy-pr-ready: -```markdown -You are fixing a verified issue in devsy-org/devsy. -Follow devsy-pr-ready strictly: -1. Minimal behavior-preserving fix and targeted regression test. -2. Write self-documenting code with plain ASCII; no redundant comments. -3. Local validation: - mkdir -p dist - mise run cli:format - mise run cli:lint:ci - mise run cli:test -4. Commit: - Signed conventional commit: git commit -S -m 'fix(<scope>): <short description>' - Author: use host configured git identity. - Zero tracker references in commit or PR. -5. CodeRabbit CLI review on committed change: - coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) - If actionable findings exist, fix them, revalidate, and amend: - git commit -S --amend --no-edit -6. Push and Create Draft PR using this template: - gh pr create -R devsy-org/devsy --draft \ - --title "fix(<scope>): <short description>" \ - --body "$(cat <<'EOF' -## Cause -<concise cause description under 30 words> - -## Fix -<concise fix description under 30 words> - -## Test evidence -<validation commands run and test output summary> -devsy-fingerprint: <fingerprint> -EOF -)" -(PR body must be strictly under 100 words total with no other sections). -``` - ---- +Execute the isolated tasks in sequence: -## Phase 4: Daily digest and Consolidation +### Phase 1: Workspace Garbage Collection +Execute `.agents/tasks/devsy-workspace-gc/task.md`. +Scans managed Devsy worktrees, verifies automation ownership, checks for uncommitted changes or active runs, and archives completed or stale workspaces. -1. Consolidate memory: persist new fingerprints, classifications, or verified root causes with write xd://retain. -2. Output concise markdown digest using this template: -```markdown -# Devsy Daily Triage Digest: YYYY-MM-DD +### Phase 2: In-Flight PR Reconciliation +Execute `.agents/tasks/devsy-pr-reconciliation/task.md`. +Reconciles open automation pull requests, checks branch drift and review gates, auto-merges authorized pull requests, verifies issue closure on subsequent main runs, reconciles completed investigations, and calculates operational capacity slots (`slots_investigation`, `slots_fix`). -## Workspaces Garbage Collected -* Total archived: <count> -* Details: <workspace_id> (<branch>) +### Phase 3: CI Failure Triage +Execute `.agents/tasks/devsy-ci-triage/task.md`. +Queries failed runs on origin/main from the last 24 hours, extracts failure logs, computes normalized fingerprints, classifies failures, reruns transient flakes, and creates or updates tracking issues. -## Active PRs and Gates -* PR <number> (<head_sha>): CI <status>, Greptile <score>, CodeRabbit <status>, Gate <state> +### Phase 4: Issue Investigation Delegation +Execute `.agents/tasks/devsy-issue-investigation/task.md`. +Triages open uninvestigated issues within `slots_investigation` capacity, selects model tiers (Small, Medium, Deep), creates diagnostic workspaces, and delegates to `.agents/agents/ci-investigator`. -## CI Health on main -* Total failing runs triaged: <count> -* Reruns triggered: <count> -* Issues opened or updated: <list> +### Phase 5: Fix Delegation and Playbook Orchestration +Execute `.agents/tasks/devsy-fix-delegation/task.md`. +If `slots_fix > 0` and a verified investigation exists, checks open pull request deduplication, creates a fix workspace, and initiates `.paseo/playbooks/devsy-fix.yaml` (or delegates to `.agents/agents/fix-worker`). -## Active Investigations and Fixes -* Issue <id>: <tier> (<model>) - <status> -``` +### Phase 6: Daily Digest and Memory Consolidation +Execute `.agents/tasks/devsy-daily-digest/task.md`. +Consolidates durable findings into persistent memory with `xd://retain` and prints the final structured markdown digest. diff --git a/.agents/tasks/devsy-fix-delegation/task.md b/.agents/tasks/devsy-fix-delegation/task.md new file mode 100644 index 000000000..b31d5a5df --- /dev/null +++ b/.agents/tasks/devsy-fix-delegation/task.md @@ -0,0 +1,104 @@ +--- +kind: task +id: devsy-fix-delegation +name: devsy-fix-delegation +target: paseo +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash +--- + +# Devsy Fix Delegation and Playbook Orchestration + +This task orchestrates bug fix implementation for verified issues, enforcing open pull request deduplication, human approval gates, and PR readiness standards. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). + +## Operational Boundaries + +* Execute only if `slots_fix > 0` and a verified investigation exists. +* Strictly enforce Devsy PR rules (devsy-pr-ready and CLAUDE.md): + * Use host configured git identity without hardcoded overrides. + * Signed conventional commit: `fix(scope): subject`. + * Zero tracker references in commit messages, branch names, PR titles, or bodies. + * PR description strictly under 100 words with three sections: `## Cause`, `## Fix`, `## Test evidence`. +* Fast mode is prohibited. Subagents must run strictly in normal mode. + +## Execution Procedure + +### 1. Open Pull Request Deduplication + +Before creating a fix workspace or starting the fix pipeline, verify that no open pull request already targets this failure: + +```bash +gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" +``` + +If an open pull request already exists, do not launch a duplicate fix. Record the active pull request for the daily digest and finish. + +### 2. Authoritative Execution Path: Paseo Playbook + +The authoritative path for executing code fixes is the declarative Paseo Playbook at `.paseo/playbooks/devsy-fix.yaml`. This ensures that human review gates (`approve_plan`, `approve_pr`) and project-wide concurrency (`concurrency: 1`) are strictly enforced by the playbook engine. + +1. Setup fix workspace: + ```bash + paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch fix/<short_topic> --json + ``` + +2. Start Playbook Run: + Initiate `.paseo/playbooks/devsy-fix.yaml` in the newly created fix workspace with inputs: + * `fingerprint`: `<fingerprint>` + * `description`: `<root_cause_summary>` + * `failing_step`: `<step_name>` + +### 3. Alternative Direct Worker Subagent (Normal Mode Only) + +If executing via direct subagent profile: + +1. Delegate to `.agents/agents/fix-worker/agent.md` using `.agents/agents/fix-worker/config.json`. +2. Authorized provider configurations: + * `codex/gpt-6.1-sol` + * `codex/gpt-6.1-terra` + * `claude/claude-sonnet-5-5` +3. Worker instructions adhering strictly to devsy-pr-ready: + ```markdown + You are fixing a verified issue in devsy-org/devsy. + Follow devsy-pr-ready strictly: + 1. Minimal behavior-preserving fix and targeted regression test. + 2. Write self-documenting code with plain ASCII; no redundant comments. + 3. Local validation: + mkdir -p dist + mise run cli:format + mise run cli:lint:ci + mise run cli:test + 4. Commit: + Signed conventional commit: git commit -S -m 'fix(<scope>): <short description>' + Author: use host configured git identity. + Zero tracker references in commit or PR. + 5. CodeRabbit CLI review on committed change: + coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) + If actionable findings exist, fix them, revalidate, and amend: + git commit -S --amend --no-edit + 6. Push and Create Draft PR using this template: + gh pr create -R devsy-org/devsy --draft \ + --title "fix(<scope>): <short description>" \ + --body "$(cat <<'EOF' + ## Cause + <concise cause description under 30 words> + + ## Fix + <concise fix description under 30 words> + + ## Test evidence + <validation commands run and test output summary> + devsy-fingerprint: <fingerprint> + EOF + )" + (PR body must be strictly under 100 words total with no other sections). + ``` diff --git a/.agents/tasks/devsy-issue-investigation/task.md b/.agents/tasks/devsy-issue-investigation/task.md new file mode 100644 index 000000000..83b1e372b --- /dev/null +++ b/.agents/tasks/devsy-issue-investigation/task.md @@ -0,0 +1,85 @@ +--- +kind: task +id: devsy-issue-investigation +name: devsy-issue-investigation +target: paseo +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash +--- + +# Devsy Issue Investigation Delegation + +This task triages open issues, tags feature requests and already investigated issues, selects priority failure candidates within capacity, and delegates read-only diagnostic investigations to subagents using `.agents/agents/ci-investigator`. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). + +## Operational Boundaries + +* Concurrency limit: up to `slots_investigation` concurrent active investigations (maximum 2 total). +* Strictly read-only investigation: subagents never edit, commit, or push code. +* Strictly standard normal mode: fast mode is prohibited across all subagents. +* Target branch: origin/main. + +## Execution Procedure + +### 1. Query Open Uninvestigated Issues + +List recent open issues: + +```bash +gh issue list -R devsy-org/devsy --state open --limit 20 --json number,title,labels +``` + +### 2. Triage and Tag + +Review issues for preliminary classification: +* Feature requests: label with enhancement: + `gh issue edit <issue_id> -R devsy-org/devsy --add-label enhancement` +* Already investigated issues: label with investigated: + `gh issue edit <issue_id> -R devsy-org/devsy --add-label investigated` + +### 3. Select Candidate Issues + +Select up to `slots_investigation` candidate issues. +Prioritize CI failures on main first, followed by high-impact bugs. + +### 4. Select Model Tier for Investigation (Normal Mode Only) + +Select the model configuration according to failure complexity: + +* Small Tier (single package, CLI flag or typo, simple unit assertion): + provider: `claude/claude-haiku-5-5`, `codex/gpt-6-luna`, or `antigravity/gemini-3.8-flash` +* Medium Tier (multi-package interaction, provider parameters, state race): + provider: `codex/gpt-6.1-terra` or `claude/claude-sonnet-5-5` (standard reasoning) +* Deep Tier (daemon lifecycle, container idle timeouts, k8s pod reconciliation, SSH tunneling): + provider: `codex/gpt-6.1-sol` or `claude/claude-sonnet-5-5` (high reasoning) + +### 5. Launch Investigation Subagent + +For each selected candidate issue: + +1. Create an isolated diagnostic workspace: + ```bash + paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/issue-<issue_id> --json + ``` + +2. Delegate to the subagent profile defined at `.agents/agents/ci-investigator/agent.md` using configuration `.agents/agents/ci-investigator/config.json`. + +3. Format the subagent payload: + ```json + { + "workspaceId": "<workspace_id>", + "provider": "<selected_provider_and_model>", + "title": "[devsy] Investigate <issue_id>", + "labels": { "repo": "devsy", "tier": "investigation", "issue": "<issue_id>" }, + "agentProfile": ".agents/agents/ci-investigator/agent.md", + "initialPrompt": "# Investigation Brief for Issue <issue_id>\n\n## Context\nFailure fingerprint: <fingerprint>\nIssue description: <issue_description>\n\n## Objectives\n1. Identify root cause with exact file paths and line numbers.\n2. Formulate minimal reproduction command or test case.\n3. Propose minimal fix hypothesis adhering to devsy-pr-ready.\n\n## Constraints\n* Strictly read-only: do not commit, push, or edit repository files.\n* Format final report using the output template." + } + ``` diff --git a/.agents/tasks/devsy-pr-reconciliation/task.md b/.agents/tasks/devsy-pr-reconciliation/task.md new file mode 100644 index 000000000..94296151d --- /dev/null +++ b/.agents/tasks/devsy-pr-reconciliation/task.md @@ -0,0 +1,96 @@ +--- +kind: task +id: devsy-pr-reconciliation +name: devsy-pr-reconciliation +target: paseo +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash +--- + +# Devsy In-Flight Pull Request Reconciliation + +This task reconciles open pull requests created by this automation, checks review gates, verifies issue resolution, and reconciles completed investigations. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). + +## Operational Boundaries + +* Concurrency budget: + * Maximum 2 concurrent active investigations. + * Maximum 1 active fix pull request in flight. +* Review gates required before merge: + * CI status checks passing. + * Greptile confidence score at least 4 out of 5. + * CodeRabbit review passing with zero unresolved threads. + * Signed conventional commit. + * Zero tracker references in commit message, branch name, title, or body. + * Description under 100 words in three exact sections. + +## Execution Procedure + +### 1. List Open Automation Pull Requests + +Query open pull requests authored by this automation: + +```bash +gh pr list -R devsy-org/devsy --state open --author @me --json number,title,headRefName,statusCheckRollup,isDraft,mergeStateStatus,mergeable +``` + +Filter for branches matching `fix/*` created by this automation. Skip any pull request not explicitly owned by this automation. + +### 2. Advance Open Pull Requests + +For each open automation pull request: + +1. Check branch drift and merge conflicts: + Inspect `mergeStateStatus`. + If BEHIND, steer the worker to rebase onto origin/main, rerun local validation, and push with `--force-with-lease`. Limit to one rebase attempt per day. + If DIRTY, steer the worker once to resolve conflicts. If still conflicting on the next run, label the pull request blocked and record for the daily digest. Never merge a pull request whose base branch is stale. + +2. Handle CI failures: + Inspect failing status checks. If a transient infrastructure failure occurred, rerun the failed job. If a code failure occurred, steer the worker agent to diagnose and correct it. + +3. Promote draft pull requests to ready: + If all CI checks pass on the current head commit SHA and the pull request is draft, mark it ready: + `gh pr ready <pr_number> -R devsy-org/devsy` + +4. Review thread handling: + Inspect CodeRabbit and Greptile reviews on ready pull requests. Steer the worker agent if unresolved comments or review findings remain. + +5. Auto-merge execution and gate verification: + Auto-merge runs only when the coordinator input explicitly sets `auto_merge` to true. + When all gates pass (CI green, Greptile at least 4/5, CodeRabbit pass, 0 open threads, signed commit, 0 tracker references, body under 100 words), squash merge: + `gh pr merge <pr_number> -R devsy-org/devsy --squash --delete-branch --subject "<title>" --body ""` + Then archive its workspace: `paseo workspace archive <workspace_id>`. + When auto-merge is not enabled, record ready pull requests for human review. + +6. Issue closure and post-merge verification: + After a fix pull request merges, look up the fix workspace label issue. + Keep the issue open until the failing job is confirmed green on a subsequent run on main. + Close the issue with a comment containing the verified passing run ID and head SHA. + Retain resolution fact in persistent memory: + Write to `xd://retain` with: + `{"facts": [{"fact": "devsy ci fingerprint <fingerprint>: resolved by commit <sha>", "scope": "project"}]}` + +### 3. Reconcile In-Flight Investigations + +1. For completed investigation subagents, read final analysis. +2. If root cause is verified: + Retain finding in persistent memory: + Write to `xd://retain` with: + `{"facts": [{"fact": "devsy root cause for <investigation_subject>: <summary>", "scope": "project"}]}` + Archive diagnostic workspace: `paseo workspace archive <workspace_id>`. + If fix budget allows (0 active fix pull requests), promote to fix task. + +### 4. Calculate Available Capacity + +Compute operational slots for downstream tasks: +* `slots_investigation`: calculate `max(0, 2 - active_investigations_count)`. +* `slots_fix`: calculate `max(0, 1 - active_fix_prs_count)`. diff --git a/.agents/tasks/devsy-workspace-gc/task.md b/.agents/tasks/devsy-workspace-gc/task.md new file mode 100644 index 000000000..03f5d9fc6 --- /dev/null +++ b/.agents/tasks/devsy-workspace-gc/task.md @@ -0,0 +1,81 @@ +--- +kind: task +id: devsy-workspace-gc +name: devsy-workspace-gc +target: paseo +cwd: /Users/ocean_trader/Documents/devsy/devsy +isolation: worktree +fast_mode_allowed: false +models_allowed: + - claude/claude-haiku-5-5 + - codex/gpt-6-luna + - codex/gpt-6.1-terra + - claude/claude-sonnet-5-5 + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash +--- + +# Devsy Workspace Garbage Collection + +This task identifies and archives completed, merged, or stale automation worktrees in Devsy. +Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). + +## Operational Boundaries + +* Only inspect and archive workspaces owned by this automation. +* Never archive dirty workspaces or workspaces containing uncommitted changes. +* Never archive developer workspaces or workspaces hosting active playbook runs. +* Never perform long polling. Run a single pass garbage collection check and finish. + +## Execution Procedure + +### 1. Scan Devsy Workspaces + +Query managed worktrees under the Devsy project: + +```bash +CURRENT_CWD=$(pwd) +paseo workspace ls --json | jq -r --arg current "$CURRENT_CWD" '.[] | select(.project=="devsy" and .isolation=="worktree" and .cwd != $current) | [.workspaceId, .cwd, .title] | @tsv' +``` + +### 2. Evaluate Each Workspace Candidate + +For each candidate workspace tuple [workspaceId, cwd, title]: + +1. Verify automation ownership: + The workspace title must start with `[devsy]` or its current branch must match `diag/*` or `fix/*`. + If the workspace is not explicitly owned by this automation, skip it immediately. Never archive developer or unowned worktrees. + +2. Check for uncommitted changes: + Run `git -C "$cwd" status --porcelain`. + If the worktree is dirty or contains uncommitted changes, never archive it. Record uncommitted changes for the daily digest. + +3. Check for running subagents: + Run: + ```bash + RUNNING_AGENTS=$(paseo agent ls --json | jq -r --arg cwd "$cwd" '.[] | select(.cwd==$cwd and (.status=="running" or .status=="initializing")) | .agentId') + ``` + If running agents are found, skip this workspace. + +4. Check for active playbook runs: + Inspect active playbook runs using the list_runs tool. + If the candidate workspace matches an active playbook run, or hosts a run in running, waiting_gate, or waiting status, skip this workspace immediately. Never archive a workspace hosting a playbook run waiting at a human gate. + +5. Check branch merge and pull request status: + Run: + ```bash + BRANCH=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null) + git -C "$cwd" fetch origin main --quiet + IS_MERGED=$(git -C "$cwd" merge-base --is-ancestor HEAD origin/main && echo "yes" || echo "no") + PR_STATE=$(gh pr list -R devsy-org/devsy --head "$BRANCH" --state all --json state --jq '.[0].state' 2>/dev/null) + ``` + If the pull request lookup returns an error or empty result unexpectedly, do not archive. Fail closed. + +6. Archive if completed or stale: + * If IS_MERGED is yes, or PR_STATE is MERGED or CLOSED, and worktree is clean: + `paseo workspace archive <workspaceId>` + * If diagnostic branch (`diag/*`) and subagent status is idle or closed: + If worktree is clean and zero active playbook runs exist, archive: + `paseo workspace archive <workspaceId>` + * If older than 48 hours with no uncommitted changes, no open pull request, and zero active playbook runs: + `paseo workspace archive <workspaceId>` From 1f9f2c7d6156aadc778a42e1f9e034e1c4fd184e Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 00:10:50 -0600 Subject: [PATCH 12/21] fix(tasks): resolve review findings and generalize paths and project identities --- .agents/agents/ci-investigator/agent.md | 12 ++-- .agents/agents/ci-investigator/config.json | 2 +- .agents/tasks/devsy-ci-triage/task.md | 52 +++++++++--------- .agents/tasks/devsy-daily-digest/task.md | 17 ++++-- .../tasks/devsy-daily-triage/schedule.json | 4 +- .agents/tasks/devsy-daily-triage/sync.py | 15 ++++- .agents/tasks/devsy-daily-triage/task.md | 29 ++++++---- .agents/tasks/devsy-fix-delegation/task.md | 55 +++++++++++-------- .../tasks/devsy-issue-investigation/task.md | 25 ++++++--- .agents/tasks/devsy-pr-reconciliation/task.md | 23 ++++++-- .agents/tasks/devsy-workspace-gc/task.md | 11 ++-- .../playbooks/roles/ci-investigator/role.yaml | 4 +- 12 files changed, 152 insertions(+), 97 deletions(-) diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md index 9fb72107d..58804d1f3 100644 --- a/.agents/agents/ci-investigator/agent.md +++ b/.agents/agents/ci-investigator/agent.md @@ -11,14 +11,15 @@ models_allowed: - codex/gpt-6-luna - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - - antigravity/gemini-3.8-flash + - codex/gpt-6.1-sol + - antigravity/gemini-3.8-flash-medium --- # CI Investigator Agent Profile (Paseo) This agent is specifically designed as a Paseo subagent for devsy-org/devsy. -It executes inside an isolated Paseo worktree workspace under project prj_5e6fbfb713103941. -Your role is performing read-only root cause analysis on CI failures and reported bugs in Paseo. +It executes inside an isolated Paseo worktree workspace. +Your role is performing read-only root cause analysis on CI failures and reported bugs in Devsy. ## Operational Boundaries @@ -30,8 +31,9 @@ Your role is performing read-only root cause analysis on CI failures and reporte ## Authorized Models Execution must run strictly in normal mode across these authorized models: -* Small Tier: claude/claude-haiku-5-5, codex/gpt-6-luna, antigravity/gemini-3.8-flash +* Small Tier: claude/claude-haiku-5-5, codex/gpt-6-luna, antigravity/gemini-3.8-flash-medium * Medium Tier: codex/gpt-6.1-terra, claude/claude-sonnet-5-5 +* Deep Tier: codex/gpt-6.1-sol, claude/claude-sonnet-5-5 ## Investigation Workflow @@ -64,7 +66,7 @@ Minimal behavior-preserving change adhering to devsy-pr-ready. ## Constraints -* Tool use is strictly limited to read-only commands. Never execute git commit, git push, gh pr, gh issue edit, or gh issue comment. +* Tool use is strictly limited to read-only commands. Never execute git commit, git push, gh pr create, gh pr merge, gh pr close, gh issue edit, or gh issue comment. Read-only commands (gh pr list, gh pr view) are permitted. * Never create commits or push branches. * Zero tracker references: do not include issue numbers, tracker URLs, or tracker labels. * Use plain ASCII text in report output. diff --git a/.agents/agents/ci-investigator/config.json b/.agents/agents/ci-investigator/config.json index bc7a16bd2..6774f1f97 100644 --- a/.agents/agents/ci-investigator/config.json +++ b/.agents/agents/ci-investigator/config.json @@ -11,7 +11,7 @@ "codex/gpt-6.1-terra", "claude/claude-sonnet-5-5", "codex/gpt-6.1-sol", - "antigravity/gemini-3.8-flash" + "antigravity/gemini-3.8-flash-medium" ], "read_only": true, "tools": ["read", "glob", "grep", "find", "bash"] diff --git a/.agents/tasks/devsy-ci-triage/task.md b/.agents/tasks/devsy-ci-triage/task.md index f64bd831c..976db0be5 100644 --- a/.agents/tasks/devsy-ci-triage/task.md +++ b/.agents/tasks/devsy-ci-triage/task.md @@ -3,7 +3,6 @@ kind: task id: devsy-ci-triage name: devsy-ci-triage target: paseo -cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false models_allowed: @@ -12,13 +11,13 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy CI Failure Triage This task inspects failed GitHub Actions workflow runs on origin/main, classifies failures, deduplicates issues, triggers safe reruns for transient flakes, and files structured tracking issues. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. ## Operational Boundaries @@ -43,7 +42,7 @@ gh run list -R devsy-org/devsy --branch main --created ">=$SINCE" --status failu For each failed run, inspect failed jobs: ```bash -gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --jq '.jobs[] | select(.conclusion=="failure") | {name: .name, id: .id, run_attempt: .run_attempt}' +gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --paginate --jq '.jobs[] | select(.conclusion=="failure") | {job_name: .name, job_id: .id, run_attempt: .run_attempt, failed_step: (.steps[]? | select(.conclusion=="failure") | .name)}' ``` ### 3. Extract Failure Signature with Bounded Log Extraction @@ -54,9 +53,12 @@ Fetch the trailing failure log: gh run view -R devsy-org/devsy --job <job_id> --log-failed | tail -n 150 ``` -Compute the standardized failure fingerprint: +Compute the standardized failure fingerprint using a normalized pipeline: +```bash +SIGNATURE=$(printf '%s|%s|%s|%s' "$WORKFLOW" "$JOB" "$STEP" "$TEST" | sed -E 's/\x1B\[[0-9;]*[a-zA-Z]//g; s/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9:.]+Z//g; s/0x[0-9a-fA-F]+//g' | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]') +FINGERPRINT=$(printf '%s' "$SIGNATURE" | shasum -a 256 | cut -c1-12) +``` The fingerprint is the first 12 hex characters of SHA-256 over the lowercase string `workflow|job|step|test`, after stripping ANSI escape sequences, timestamps, and hex memory addresses. - ### 4. Classify and Deduplicate Evaluate the extracted signature against these classifications: @@ -66,6 +68,7 @@ Evaluate the extracted signature against these classifications: * Classify as `upstream-asset`. * Rerun at most once. * Probe referenced provider repository using `gh api repos/<owner>/<repo>/releases/latest`. + * Ensure label exists: `gh label create ci-infra -R devsy-org/devsy 2>/dev/null || true`. * Open or update a tracking issue on devsy with label `ci-infra`. * Record provider blockage for the daily digest. * Do not open issues in provider repositories. @@ -80,39 +83,36 @@ Evaluate the extracted signature against these classifications: 3. Deduplication and regression reopening: Search existing issues: - `gh issue list -R devsy-org/devsy --state all --search "<fingerprint>"` - If an open issue matches, append run ID and head SHA using this template: - ```markdown - ### Recurrence Detected - Failure recurred on main in run <run_id> at commit <head_sha>. - devsy-fingerprint: <fingerprint> - ``` + `gh issue list -R devsy-org/devsy --state all --search "<fingerprint>" --json number,title,state` + If an open issue matches, append run ID and head SHA: + `gh issue comment <issue_number> -R devsy-org/devsy --body "### Recurrence Detected\nFailure recurred on main in run <run_id> at commit <head_sha>.\ndevsy-fingerprint: <fingerprint>"` Do not create duplicate issues. - If a closed issue matches and the failure recurs on main, reopen the issue with the recurrence template. + If a closed issue matches and the failure recurs on main, reopen the issue: + `gh issue reopen <issue_number> -R devsy-org/devsy --comment "### Recurrence Detected\nFailure recurred on main in run <run_id> at commit <head_sha>.\ndevsy-fingerprint: <fingerprint>"` Only open a new issue when zero matches exist across open and closed states: + Ensure labels exist: + `gh label create ci -R devsy-org/devsy 2>/dev/null || true` + `gh label create bug -R devsy-org/devsy 2>/dev/null || true` + Create tracking issue: ```bash gh issue create -R devsy-org/devsy \ --title "ci: <test_name> failure in <workflow_name>" \ --label "ci,bug" \ --body "$(cat <<'EOF' - ### Summary - Automated triage detected CI failure on main in run <run_id> at commit <head_sha>. - + Summary: Automated triage detected CI failure on main in run <run_id> at commit <head_sha>. devsy-fingerprint: <fingerprint> - ### Failure Signature - * Workflow: <workflow_name> - * Job: <job_name> - * Step: <step_name> + Failure Signature: + Workflow: <workflow_name> + Job: <job_name> + Step: <step_name> - ### Log Excerpt - ``` + Log Excerpt: <bounded_log_extract> - ``` - ### Next Actions + Next Actions: Triaged for root-cause investigation. - EOF +EOF )" ``` diff --git a/.agents/tasks/devsy-daily-digest/task.md b/.agents/tasks/devsy-daily-digest/task.md index 3e96c6d14..036a4b289 100644 --- a/.agents/tasks/devsy-daily-digest/task.md +++ b/.agents/tasks/devsy-daily-digest/task.md @@ -3,7 +3,6 @@ kind: task id: devsy-daily-digest name: devsy-daily-digest target: paseo -cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false models_allowed: @@ -12,13 +11,13 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy Daily Digest and Memory Consolidation This task consolidates durable triage facts into persistent memory and outputs the structured daily markdown report summarizing garbage collection, pull request gates, main branch health, and active investigations. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. ## Operational Boundaries @@ -26,6 +25,16 @@ Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). * Never retain tracker identifiers or issue numbers as permanent durable facts. * Do not perform loops or polling. Generate the report and finish. +## Standalone Live Queries + +When running standalone without prior stage state, query live environment state: +1. Active pull requests: + `gh pr list -R devsy-org/devsy --state open --author @me --json number,title,headRefName,statusCheckRollup,mergeStateStatus` +2. Main branch runs: + `gh run list -R devsy-org/devsy --branch main --limit 20 --json databaseId,status,conclusion` +3. Active agents: + `paseo agent ls --json` + ## Execution Procedure ### 1. Memory Consolidation @@ -55,5 +64,5 @@ Output the daily report adhering strictly to this markdown structure: * Issues opened or updated: <list> ## Active Investigations and Fixes -* Issue <id>: <tier> (<model>) - <status> +* Issue <id>: <tier> (<model>), status: <status> ``` diff --git a/.agents/tasks/devsy-daily-triage/schedule.json b/.agents/tasks/devsy-daily-triage/schedule.json index 633196f85..0cee94d27 100644 --- a/.agents/tasks/devsy-daily-triage/schedule.json +++ b/.agents/tasks/devsy-daily-triage/schedule.json @@ -5,14 +5,14 @@ "timezone": "UTC", "provider": "claude/claude-sonnet-5-5", "mode": "auto", - "cwd": "/Users/ocean_trader/Documents/devsy/devsy", "task": ".agents/tasks/devsy-daily-triage/task.md", "models_allowed": [ "claude/claude-haiku-5-5", "codex/gpt-6-luna", "codex/gpt-6.1-terra", "claude/claude-sonnet-5-5", - "codex/gpt-6.1-sol" + "codex/gpt-6.1-sol", + "antigravity/gemini-3.8-flash-medium" ], "fast_mode_allowed": false } diff --git a/.agents/tasks/devsy-daily-triage/sync.py b/.agents/tasks/devsy-daily-triage/sync.py index a510ca303..120f0c7ad 100755 --- a/.agents/tasks/devsy-daily-triage/sync.py +++ b/.agents/tasks/devsy-daily-triage/sync.py @@ -2,6 +2,7 @@ import argparse import json import subprocess +import os import sys from pathlib import Path @@ -15,6 +16,14 @@ def run_command(args: list[str]) -> str: sys.stderr.write(f"Command failed ({' '.join(args)}): {err_msg}\n") sys.exit(1) +def resolve_repo_root() -> str: + try: + common_dir = run_command(["git", "rev-parse", "--git-common-dir"]).strip() + return os.path.dirname(os.path.abspath(common_dir)) + except Exception: + return os.getcwd() + + def find_schedule_id(schedule_name: str) -> str | None: output = run_command(["paseo", "schedule", "ls", "--json"]) @@ -50,7 +59,7 @@ def handle_diff(config: dict, schedule_name: str, loader_prompt: str) -> None: ("timezone", config.get("timezone"), cadence.get("timezone")), ("provider", config.get("provider"), actual_provider), ("mode", config.get("mode", "auto"), target_config.get("modeId")), - ("cwd", config.get("cwd"), target_config.get("cwd")), + ("cwd", config.get("cwd") or resolve_repo_root(), target_config.get("cwd")), ("prompt", loader_prompt.strip(), daemon_data.get("prompt", "").strip()), ] @@ -92,7 +101,7 @@ def handle_apply(config: dict, schedule_name: str, loader_prompt: str) -> None: "--mode", config.get("mode", "auto"), "--cwd", - config["cwd"], + config.get("cwd") or resolve_repo_root(), "--prompt", loader_prompt, ] @@ -126,7 +135,7 @@ def handle_create(config: dict, schedule_name: str, loader_prompt: str) -> None: "--mode", config.get("mode", "auto"), "--cwd", - config["cwd"], + config.get("cwd") or resolve_repo_root(), loader_prompt, ] output = run_command(cmd) diff --git a/.agents/tasks/devsy-daily-triage/task.md b/.agents/tasks/devsy-daily-triage/task.md index 5dabae9b7..1b96794ad 100644 --- a/.agents/tasks/devsy-daily-triage/task.md +++ b/.agents/tasks/devsy-daily-triage/task.md @@ -4,8 +4,7 @@ id: devsy-daily-triage name: devsy-daily-triage schedule: "0 10 * * *" timezone: UTC -provider: claude/claude-sonnet-5-5 -cwd: /Users/ocean_trader/Documents/devsy/devsy +provider: omp/anthropic/claude-sonnet-5-5 isolation: worktree fast_mode_allowed: false models_allowed: @@ -14,14 +13,14 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy Daily Triage Coordinator You are the daily Devsy Orchestration Agent for devsy-org/devsy running in the oh-my-pi (OMP) harness. Your role is orchestration: executing the isolated daily triage subtasks in order, reconciling progress, and consolidating findings. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. ## Operational Boundaries @@ -39,28 +38,38 @@ Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). ## Orchestration Flow -Execute the isolated tasks in sequence: +Execute the isolated subtasks in sequence, passing state between phases: ### Phase 1: Workspace Garbage Collection Execute `.agents/tasks/devsy-workspace-gc/task.md`. -Scans managed Devsy worktrees, verifies automation ownership, checks for uncommitted changes or active runs, and archives completed or stale workspaces. +Scans managed Devsy worktrees, verifies automation ownership, checks for uncommitted changes or active runs, and archives completed or stale workspaces. Record count and details of archived workspaces for Phase 6. ### Phase 2: In-Flight PR Reconciliation Execute `.agents/tasks/devsy-pr-reconciliation/task.md`. -Reconciles open automation pull requests, checks branch drift and review gates, auto-merges authorized pull requests, verifies issue closure on subsequent main runs, reconciles completed investigations, and calculates operational capacity slots (`slots_investigation`, `slots_fix`). +Reconciles open automation pull requests, checks branch drift and review gates, auto-merges authorized pull requests, verifies issue closure on subsequent main runs, and reconciles completed investigations. +Output state passed forward: +* `slots_investigation`: available investigation concurrency slots, passed to Phase 4. +* `slots_fix`: available fix concurrency slots, passed to Phase 5. +* Active pull requests and gate status, passed to Phase 6. ### Phase 3: CI Failure Triage Execute `.agents/tasks/devsy-ci-triage/task.md`. Queries failed runs on origin/main from the last 24 hours, extracts failure logs, computes normalized fingerprints, classifies failures, reruns transient flakes, and creates or updates tracking issues. +Output state passed forward: +* Triage statistics (failing runs triaged, reruns triggered, issues opened or updated), passed to Phase 6. ### Phase 4: Issue Investigation Delegation Execute `.agents/tasks/devsy-issue-investigation/task.md`. -Triages open uninvestigated issues within `slots_investigation` capacity, selects model tiers (Small, Medium, Deep), creates diagnostic workspaces, and delegates to `.agents/agents/ci-investigator`. +Uses `slots_investigation` from Phase 2. Triages open uninvestigated issues within available capacity, selects model tiers (Small, Medium, Deep), creates diagnostic workspaces, and delegates to `.agents/agents/ci-investigator`. +Output state passed forward: +* Active investigations and selected model tiers, passed to Phase 6. ### Phase 5: Fix Delegation and Playbook Orchestration Execute `.agents/tasks/devsy-fix-delegation/task.md`. -If `slots_fix > 0` and a verified investigation exists, checks open pull request deduplication, creates a fix workspace, and initiates `.paseo/playbooks/devsy-fix.yaml` (or delegates to `.agents/agents/fix-worker`). +Uses `slots_fix` from Phase 2. If `slots_fix > 0` and a verified investigation exists, checks open pull request deduplication, creates a fix workspace, and initiates `.paseo/playbooks/devsy-fix.yaml` (or delegates to `.agents/agents/fix-worker`). +Output state passed forward: +* Fix status and initiated playbook runs, passed to Phase 6. ### Phase 6: Daily Digest and Memory Consolidation Execute `.agents/tasks/devsy-daily-digest/task.md`. -Consolidates durable findings into persistent memory with `xd://retain` and prints the final structured markdown digest. +Consolidates durable findings into persistent memory with `xd://retain` and emits the structured markdown digest aggregating the outcomes from Phases 1 through 5. diff --git a/.agents/tasks/devsy-fix-delegation/task.md b/.agents/tasks/devsy-fix-delegation/task.md index b31d5a5df..abc484f58 100644 --- a/.agents/tasks/devsy-fix-delegation/task.md +++ b/.agents/tasks/devsy-fix-delegation/task.md @@ -3,7 +3,6 @@ kind: task id: devsy-fix-delegation name: devsy-fix-delegation target: paseo -cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false models_allowed: @@ -12,13 +11,21 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy Fix Delegation and Playbook Orchestration This task orchestrates bug fix implementation for verified issues, enforcing open pull request deduplication, human approval gates, and PR readiness standards. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. + +## Task Inputs & Defaults + +* `slots_fix`: integer. If not supplied, compute directly from open pull requests: + `OPEN_FIX_PRS=$(gh pr list -R devsy-org/devsy --state open --author @me --json headRefName --jq '[.[] | select(.headRefName | startswith("fix/"))] | length' 2>/dev/null || echo 0)` + `slots_fix=$(( 1 - OPEN_FIX_PRS > 0 ? 1 - OPEN_FIX_PRS : 0 ))` +* `fingerprint`, `description`, `failing_step`: required strings for playbook execution. If executing standalone without explicit parameters, query the latest open issue labeled `investigated`: + `gh issue list -R devsy-org/devsy --label investigated --state open --limit 1 --json number,title,body` ## Operational Boundaries @@ -37,7 +44,7 @@ Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). Before creating a fix workspace or starting the fix pipeline, verify that no open pull request already targets this failure: ```bash -gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" +gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" --json number,title,headRefName ``` If an open pull request already exists, do not launch a duplicate fix. Record the active pull request for the daily digest and finish. @@ -52,11 +59,13 @@ The authoritative path for executing code fixes is the declarative Paseo Playboo ``` 2. Start Playbook Run: - Initiate `.paseo/playbooks/devsy-fix.yaml` in the newly created fix workspace with inputs: - * `fingerprint`: `<fingerprint>` - * `description`: `<root_cause_summary>` - * `failing_step`: `<step_name>` - + Call the `start_playbook` tool in the newly created fix workspace with: + * `playbook`: "devsy-fix" + * `name`: "<fingerprint>" + * `inputs`: + * `fingerprint`: "<fingerprint>" + * `description`: "<root_cause_summary>" + * `failing_step`: "<step_name>" ### 3. Alternative Direct Worker Subagent (Normal Mode Only) If executing via direct subagent profile: @@ -86,19 +95,19 @@ If executing via direct subagent profile: If actionable findings exist, fix them, revalidate, and amend: git commit -S --amend --no-edit 6. Push and Create Draft PR using this template: - gh pr create -R devsy-org/devsy --draft \ - --title "fix(<scope>): <short description>" \ - --body "$(cat <<'EOF' - ## Cause - <concise cause description under 30 words> - - ## Fix - <concise fix description under 30 words> - - ## Test evidence - <validation commands run and test output summary> - devsy-fingerprint: <fingerprint> - EOF - )" + gh pr create -R devsy-org/devsy --draft \ + --title "fix(<scope>): <short description>" \ + --body "$(cat <<'EOF' +## Cause +<concise cause description under 30 words> + +## Fix +<concise fix description under 30 words> + +## Test evidence +<validation commands run and test output summary> +devsy-fingerprint: <fingerprint> +EOF +)" (PR body must be strictly under 100 words total with no other sections). ``` diff --git a/.agents/tasks/devsy-issue-investigation/task.md b/.agents/tasks/devsy-issue-investigation/task.md index 83b1e372b..ea9b30373 100644 --- a/.agents/tasks/devsy-issue-investigation/task.md +++ b/.agents/tasks/devsy-issue-investigation/task.md @@ -3,7 +3,6 @@ kind: task id: devsy-issue-investigation name: devsy-issue-investigation target: paseo -cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false models_allowed: @@ -12,13 +11,19 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy Issue Investigation Delegation This task triages open issues, tags feature requests and already investigated issues, selects priority failure candidates within capacity, and delegates read-only diagnostic investigations to subagents using `.agents/agents/ci-investigator`. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. + +## Task Inputs & Defaults + +* `slots_investigation`: integer. If not supplied, compute available capacity directly from active subagents: + `ACTIVE_COUNT=$(paseo agent ls --json 2>/dev/null | jq '[.[] | select(.labels.tier=="investigation" and (.status=="running" or .status=="initializing"))] | length')` + `slots_investigation=$(( 2 - ACTIVE_COUNT > 0 ? 2 - ACTIVE_COUNT : 0 ))` ## Operational Boundaries @@ -40,9 +45,11 @@ gh issue list -R devsy-org/devsy --state open --limit 20 --json number,title,lab ### 2. Triage and Tag Review issues for preliminary classification: -* Feature requests: label with enhancement: +* Feature requests: ensure label exists and tag issue: + `gh label create enhancement -R devsy-org/devsy 2>/dev/null || true` `gh issue edit <issue_id> -R devsy-org/devsy --add-label enhancement` -* Already investigated issues: label with investigated: +* Already investigated issues: ensure label exists and tag issue: + `gh label create investigated -R devsy-org/devsy 2>/dev/null || true` `gh issue edit <issue_id> -R devsy-org/devsy --add-label investigated` ### 3. Select Candidate Issues @@ -55,7 +62,7 @@ Prioritize CI failures on main first, followed by high-impact bugs. Select the model configuration according to failure complexity: * Small Tier (single package, CLI flag or typo, simple unit assertion): - provider: `claude/claude-haiku-5-5`, `codex/gpt-6-luna`, or `antigravity/gemini-3.8-flash` + provider: `claude/claude-haiku-5-5`, `codex/gpt-6-luna`, or `antigravity/gemini-3.8-flash-medium` * Medium Tier (multi-package interaction, provider parameters, state race): provider: `codex/gpt-6.1-terra` or `claude/claude-sonnet-5-5` (standard reasoning) * Deep Tier (daemon lifecycle, container idle timeouts, k8s pod reconciliation, SSH tunneling): @@ -67,7 +74,7 @@ For each selected candidate issue: 1. Create an isolated diagnostic workspace: ```bash - paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/issue-<issue_id> --json + paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/<fingerprint> --json ``` 2. Delegate to the subagent profile defined at `.agents/agents/ci-investigator/agent.md` using configuration `.agents/agents/ci-investigator/config.json`. @@ -77,8 +84,8 @@ For each selected candidate issue: { "workspaceId": "<workspace_id>", "provider": "<selected_provider_and_model>", - "title": "[devsy] Investigate <issue_id>", - "labels": { "repo": "devsy", "tier": "investigation", "issue": "<issue_id>" }, + "title": "[devsy] Investigate <fingerprint>", + "labels": { "repo": "devsy", "tier": "investigation", "fingerprint": "<fingerprint>" }, "agentProfile": ".agents/agents/ci-investigator/agent.md", "initialPrompt": "# Investigation Brief for Issue <issue_id>\n\n## Context\nFailure fingerprint: <fingerprint>\nIssue description: <issue_description>\n\n## Objectives\n1. Identify root cause with exact file paths and line numbers.\n2. Formulate minimal reproduction command or test case.\n3. Propose minimal fix hypothesis adhering to devsy-pr-ready.\n\n## Constraints\n* Strictly read-only: do not commit, push, or edit repository files.\n* Format final report using the output template." } diff --git a/.agents/tasks/devsy-pr-reconciliation/task.md b/.agents/tasks/devsy-pr-reconciliation/task.md index 94296151d..9cf30d2ff 100644 --- a/.agents/tasks/devsy-pr-reconciliation/task.md +++ b/.agents/tasks/devsy-pr-reconciliation/task.md @@ -3,7 +3,6 @@ kind: task id: devsy-pr-reconciliation name: devsy-pr-reconciliation target: paseo -cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false models_allowed: @@ -12,13 +11,17 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy In-Flight Pull Request Reconciliation This task reconciles open pull requests created by this automation, checks review gates, verifies issue resolution, and reconciles completed investigations. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. + +## Task Inputs & Defaults + +* `auto_merge`: boolean, default `false`. Auto-merge requires explicit caller or human authorization. ## Operational Boundaries @@ -52,17 +55,25 @@ For each open automation pull request: 1. Check branch drift and merge conflicts: Inspect `mergeStateStatus`. If BEHIND, steer the worker to rebase onto origin/main, rerun local validation, and push with `--force-with-lease`. Limit to one rebase attempt per day. - If DIRTY, steer the worker once to resolve conflicts. If still conflicting on the next run, label the pull request blocked and record for the daily digest. Never merge a pull request whose base branch is stale. + If DIRTY, steer the worker once to resolve conflicts. If still conflicting on the next run, label the pull request blocked: + `gh pr edit <pr_number> -R devsy-org/devsy --add-label blocked` + Never merge a pull request whose base branch is stale. 2. Handle CI failures: - Inspect failing status checks. If a transient infrastructure failure occurred, rerun the failed job. If a code failure occurred, steer the worker agent to diagnose and correct it. + Inspect failing status checks. If a transient infrastructure failure occurred, rerun the failed job: + `gh run rerun <run_id> --failed` + If a code failure occurred, steer the worker agent to diagnose and correct it. 3. Promote draft pull requests to ready: If all CI checks pass on the current head commit SHA and the pull request is draft, mark it ready: `gh pr ready <pr_number> -R devsy-org/devsy` 4. Review thread handling: - Inspect CodeRabbit and Greptile reviews on ready pull requests. Steer the worker agent if unresolved comments or review findings remain. + Inspect CodeRabbit and Greptile reviews on ready pull requests. Check for unresolved review threads: + ```bash + gh api graphql -f query='query { repository(owner:"devsy-org", name:"devsy") { pullRequest(number:<pr_number>) { reviewThreads(first:50) { nodes { isResolved } } } } }' --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved==false)] | length' + ``` + Steer the worker agent if unresolved comments or review findings remain. 5. Auto-merge execution and gate verification: Auto-merge runs only when the coordinator input explicitly sets `auto_merge` to true. diff --git a/.agents/tasks/devsy-workspace-gc/task.md b/.agents/tasks/devsy-workspace-gc/task.md index 03f5d9fc6..1552ea9bc 100644 --- a/.agents/tasks/devsy-workspace-gc/task.md +++ b/.agents/tasks/devsy-workspace-gc/task.md @@ -3,7 +3,6 @@ kind: task id: devsy-workspace-gc name: devsy-workspace-gc target: paseo -cwd: /Users/ocean_trader/Documents/devsy/devsy isolation: worktree fast_mode_allowed: false models_allowed: @@ -12,13 +11,13 @@ models_allowed: - codex/gpt-6.1-terra - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash + - antigravity/gemini-3.8-flash-medium --- # Devsy Workspace Garbage Collection This task identifies and archives completed, merged, or stale automation worktrees in Devsy. -Target project: devsy-org/devsy (Paseo project ID: prj_5e6fbfb713103941). +Target repository: devsy-org/devsy. ## Operational Boundaries @@ -67,9 +66,9 @@ For each candidate workspace tuple [workspaceId, cwd, title]: BRANCH=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null) git -C "$cwd" fetch origin main --quiet IS_MERGED=$(git -C "$cwd" merge-base --is-ancestor HEAD origin/main && echo "yes" || echo "no") - PR_STATE=$(gh pr list -R devsy-org/devsy --head "$BRANCH" --state all --json state --jq '.[0].state' 2>/dev/null) + PR_STATE=$(gh pr list -R devsy-org/devsy --head "$BRANCH" --state all --json state --jq '.[0].state' 2>/dev/null || echo "") ``` - If the pull request lookup returns an error or empty result unexpectedly, do not archive. Fail closed. + For fix branches (`fix/*`), an unexpected PR lookup error must fail closed without archiving. For diagnostic branches (`diag/*`), an empty PR lookup is expected because diagnostic branches do not open pull requests. 6. Archive if completed or stale: * If IS_MERGED is yes, or PR_STATE is MERGED or CLOSED, and worktree is clean: @@ -77,5 +76,5 @@ For each candidate workspace tuple [workspaceId, cwd, title]: * If diagnostic branch (`diag/*`) and subagent status is idle or closed: If worktree is clean and zero active playbook runs exist, archive: `paseo workspace archive <workspaceId>` - * If older than 48 hours with no uncommitted changes, no open pull request, and zero active playbook runs: + * If worktree age exceeds 48 hours with no uncommitted changes, no open pull request, and zero active playbook runs: `paseo workspace archive <workspaceId>` diff --git a/.paseo/playbooks/roles/ci-investigator/role.yaml b/.paseo/playbooks/roles/ci-investigator/role.yaml index 7f567c92e..3a89cfac3 100644 --- a/.paseo/playbooks/roles/ci-investigator/role.yaml +++ b/.paseo/playbooks/roles/ci-investigator/role.yaml @@ -2,5 +2,5 @@ title: CI Investigator readonly: true agent: provider: antigravity - model: gemini-3.8-flash - mode: default + model: gemini-3.8-flash-medium + mode: yolo From 58d6e2b16e5d4ba125ae6f8a39cf13570aa0c46f Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:07:45 -0600 Subject: [PATCH 13/21] refactor(agents): consolidate subagent metadata into agent.md and remove duplicate config.json --- .agents/agents/ci-investigator/agent.md | 7 +++++++ .agents/agents/ci-investigator/config.json | 18 ----------------- .agents/agents/fix-worker/agent.md | 11 ++++++++++ .agents/agents/fix-worker/config.json | 20 ------------------- .agents/tasks/devsy-fix-delegation/task.md | 2 +- .../tasks/devsy-issue-investigation/task.md | 2 +- 6 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 .agents/agents/ci-investigator/config.json delete mode 100644 .agents/agents/fix-worker/config.json diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md index 58804d1f3..b9c1767ea 100644 --- a/.agents/agents/ci-investigator/agent.md +++ b/.agents/agents/ci-investigator/agent.md @@ -13,6 +13,13 @@ models_allowed: - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - antigravity/gemini-3.8-flash-medium +read_only: true +tools: + - read + - glob + - grep + - find + - bash --- # CI Investigator Agent Profile (Paseo) diff --git a/.agents/agents/ci-investigator/config.json b/.agents/agents/ci-investigator/config.json deleted file mode 100644 index 6774f1f97..000000000 --- a/.agents/agents/ci-investigator/config.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id": "ci-investigator", - "name": "ci-investigator", - "target": "paseo", - "description": "Paseo subagent profile for read-only root-cause investigation of Devsy CI failures and issues.", - "mode": "normal", - "fast_mode_allowed": false, - "models_allowed": [ - "claude/claude-haiku-5-5", - "codex/gpt-6-luna", - "codex/gpt-6.1-terra", - "claude/claude-sonnet-5-5", - "codex/gpt-6.1-sol", - "antigravity/gemini-3.8-flash-medium" - ], - "read_only": true, - "tools": ["read", "glob", "grep", "find", "bash"] -} diff --git a/.agents/agents/fix-worker/agent.md b/.agents/agents/fix-worker/agent.md index 03c6f7b86..9a0211593 100644 --- a/.agents/agents/fix-worker/agent.md +++ b/.agents/agents/fix-worker/agent.md @@ -9,6 +9,17 @@ models_allowed: - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - codex/gpt-6.1-terra +target: paseo +read_only: false +use_host_git_config: true +tools: + - read + - edit + - write + - glob + - grep + - find + - bash --- # Fix Worker Agent Profile diff --git a/.agents/agents/fix-worker/config.json b/.agents/agents/fix-worker/config.json deleted file mode 100644 index 09372b613..000000000 --- a/.agents/agents/fix-worker/config.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "id": "fix-worker", - "name": "fix-worker", - "description": "Fix implementation and PR creation subagent adhering to devsy-pr-ready.", - "mode": "normal", - "fast_mode_allowed": false, - "models_allowed": [ - "claude/claude-sonnet-5-5", - "codex/gpt-6.1-sol", - "codex/gpt-6.1-terra" - ], - "use_host_git_config": true, - "pr_rules": { - "max_words": 100, - "required_sections": ["Cause", "Fix", "Test evidence"], - "signed_commits": true, - "zero_tracker_references": true - }, - "tools": ["read", "edit", "write", "glob", "grep", "find", "bash"] -} diff --git a/.agents/tasks/devsy-fix-delegation/task.md b/.agents/tasks/devsy-fix-delegation/task.md index abc484f58..a7c421b23 100644 --- a/.agents/tasks/devsy-fix-delegation/task.md +++ b/.agents/tasks/devsy-fix-delegation/task.md @@ -70,7 +70,7 @@ The authoritative path for executing code fixes is the declarative Paseo Playboo If executing via direct subagent profile: -1. Delegate to `.agents/agents/fix-worker/agent.md` using `.agents/agents/fix-worker/config.json`. +1. Delegate to the subagent profile defined at `.agents/agents/fix-worker/agent.md`. 2. Authorized provider configurations: * `codex/gpt-6.1-sol` * `codex/gpt-6.1-terra` diff --git a/.agents/tasks/devsy-issue-investigation/task.md b/.agents/tasks/devsy-issue-investigation/task.md index ea9b30373..86d7a3ce9 100644 --- a/.agents/tasks/devsy-issue-investigation/task.md +++ b/.agents/tasks/devsy-issue-investigation/task.md @@ -77,7 +77,7 @@ For each selected candidate issue: paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/<fingerprint> --json ``` -2. Delegate to the subagent profile defined at `.agents/agents/ci-investigator/agent.md` using configuration `.agents/agents/ci-investigator/config.json`. +2. Delegate to the subagent profile defined at `.agents/agents/ci-investigator/agent.md`. 3. Format the subagent payload: ```json From 4e2385a54d25b3b488aedc5828746e95fb95cac8 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:10:42 -0600 Subject: [PATCH 14/21] refactor(agents): remove redundant authorized models sections from agent prompts --- .agents/agents/ci-investigator/agent.md | 7 ------- .agents/agents/fix-worker/agent.md | 7 ------- 2 files changed, 14 deletions(-) diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md index b9c1767ea..8c55eb2a0 100644 --- a/.agents/agents/ci-investigator/agent.md +++ b/.agents/agents/ci-investigator/agent.md @@ -35,13 +35,6 @@ Your role is performing read-only root cause analysis on CI failures and reporte * Strictly normal execution mode: fast mode is prohibited. * Concurrency and lifecycle managed by devsy-daily-triage coordinator. -## Authorized Models - -Execution must run strictly in normal mode across these authorized models: -* Small Tier: claude/claude-haiku-5-5, codex/gpt-6-luna, antigravity/gemini-3.8-flash-medium -* Medium Tier: codex/gpt-6.1-terra, claude/claude-sonnet-5-5 -* Deep Tier: codex/gpt-6.1-sol, claude/claude-sonnet-5-5 - ## Investigation Workflow 1. Check for open pull requests: diff --git a/.agents/agents/fix-worker/agent.md b/.agents/agents/fix-worker/agent.md index 9a0211593..1bc5076f0 100644 --- a/.agents/agents/fix-worker/agent.md +++ b/.agents/agents/fix-worker/agent.md @@ -33,13 +33,6 @@ Your role is implementing verified fixes and preparing pull requests adhering st * Strictly normal execution mode: fast mode is prohibited. * Concurrency and lifecycle managed by devsy-daily-triage coordinator. -## Authorized Models - -Execution must run strictly in normal mode across these authorized models: -* claude/claude-sonnet-5-5 -* codex/gpt-6.1-sol -* codex/gpt-6.1-terra - ## Implementation and Validation Workflow 1. Open PR Deduplication: From d611b34eb0313b0887973525bf4ec2cacf921117 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:21:38 -0600 Subject: [PATCH 15/21] fix(playbooks): switch ci-investigator role to 6.1 terra via oh-my-pi --- .agents/agents/ci-investigator/agent.md | 1 + .paseo/playbooks/roles/ci-investigator/role.yaml | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md index 8c55eb2a0..0328872f0 100644 --- a/.agents/agents/ci-investigator/agent.md +++ b/.agents/agents/ci-investigator/agent.md @@ -13,6 +13,7 @@ models_allowed: - claude/claude-sonnet-5-5 - codex/gpt-6.1-sol - antigravity/gemini-3.8-flash-medium + - omp/openai-codex/gpt-6.1-terra read_only: true tools: - read diff --git a/.paseo/playbooks/roles/ci-investigator/role.yaml b/.paseo/playbooks/roles/ci-investigator/role.yaml index 3a89cfac3..08c5d2603 100644 --- a/.paseo/playbooks/roles/ci-investigator/role.yaml +++ b/.paseo/playbooks/roles/ci-investigator/role.yaml @@ -1,6 +1,6 @@ title: CI Investigator readonly: true agent: - provider: antigravity - model: gemini-3.8-flash-medium - mode: yolo + provider: omp + model: openai-codex/gpt-6.1-terra + mode: full From 445f12f9c330a311b97921f4e5f165901d012fc4 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:24:11 -0600 Subject: [PATCH 16/21] chore(ci): scope PR to .paseo bug fix playbook pipeline --- .agents/agents/ci-investigator/agent.md | 73 ------- .agents/agents/fix-worker/agent.md | 91 --------- .agents/tasks/devsy-ci-triage/task.md | 122 ------------ .agents/tasks/devsy-daily-digest/task.md | 68 ------- .agents/tasks/devsy-daily-triage/loader.txt | 4 - .../tasks/devsy-daily-triage/schedule.json | 18 -- .agents/tasks/devsy-daily-triage/sync.py | 182 ------------------ .agents/tasks/devsy-daily-triage/task.md | 75 -------- .agents/tasks/devsy-fix-delegation/task.md | 113 ----------- .../tasks/devsy-issue-investigation/task.md | 92 --------- .agents/tasks/devsy-pr-reconciliation/task.md | 107 ---------- .agents/tasks/devsy-workspace-gc/task.md | 80 -------- 12 files changed, 1025 deletions(-) delete mode 100644 .agents/agents/ci-investigator/agent.md delete mode 100644 .agents/agents/fix-worker/agent.md delete mode 100644 .agents/tasks/devsy-ci-triage/task.md delete mode 100644 .agents/tasks/devsy-daily-digest/task.md delete mode 100644 .agents/tasks/devsy-daily-triage/loader.txt delete mode 100644 .agents/tasks/devsy-daily-triage/schedule.json delete mode 100755 .agents/tasks/devsy-daily-triage/sync.py delete mode 100644 .agents/tasks/devsy-daily-triage/task.md delete mode 100644 .agents/tasks/devsy-fix-delegation/task.md delete mode 100644 .agents/tasks/devsy-issue-investigation/task.md delete mode 100644 .agents/tasks/devsy-pr-reconciliation/task.md delete mode 100644 .agents/tasks/devsy-workspace-gc/task.md diff --git a/.agents/agents/ci-investigator/agent.md b/.agents/agents/ci-investigator/agent.md deleted file mode 100644 index 0328872f0..000000000 --- a/.agents/agents/ci-investigator/agent.md +++ /dev/null @@ -1,73 +0,0 @@ ---- -kind: agent -id: ci-investigator -name: ci-investigator -target: paseo -description: Declarative Paseo subagent profile for read-only root-cause analysis and investigation of Devsy CI failures and issues. -mode: normal -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium - - omp/openai-codex/gpt-6.1-terra -read_only: true -tools: - - read - - glob - - grep - - find - - bash ---- - -# CI Investigator Agent Profile (Paseo) - -This agent is specifically designed as a Paseo subagent for devsy-org/devsy. -It executes inside an isolated Paseo worktree workspace. -Your role is performing read-only root cause analysis on CI failures and reported bugs in Devsy. - -## Operational Boundaries - -* Read-only analysis only: never edit, commit, or push code. -* Do not perform long polling or loops. -* Strictly normal execution mode: fast mode is prohibited. -* Concurrency and lifecycle managed by devsy-daily-triage coordinator. - -## Investigation Workflow - -1. Check for open pull requests: - Verify whether an open pull request already addresses this failure: -```bash -gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" -``` - If an open PR exists, report outcome as already_resolved with the active PR URL and exit. -2. Locate failure signature: - Inspect failing step logs, workflow YAML definitions, and Go or TypeScript source files. -3. Identify root cause: - Trace exact file paths and line numbers causing the failure. -4. Formulate minimal reproduction: - Construct minimal test command or standalone reproduction case. -5. Formulate minimal fix hypothesis: - Propose targeted fix hypothesis adhering to devsy-pr-ready guidelines. -6. Report findings using this template: -```markdown -### Root Cause -Exact file paths and line numbers causing the failure. - -### Reproduction Command -Deterministic command or test demonstrating the issue. - -### Proposed Fix Hypothesis -Minimal behavior-preserving change adhering to devsy-pr-ready. -``` - Zero code commits or branch pushes. - -## Constraints - -* Tool use is strictly limited to read-only commands. Never execute git commit, git push, gh pr create, gh pr merge, gh pr close, gh issue edit, or gh issue comment. Read-only commands (gh pr list, gh pr view) are permitted. -* Never create commits or push branches. -* Zero tracker references: do not include issue numbers, tracker URLs, or tracker labels. -* Use plain ASCII text in report output. diff --git a/.agents/agents/fix-worker/agent.md b/.agents/agents/fix-worker/agent.md deleted file mode 100644 index 1bc5076f0..000000000 --- a/.agents/agents/fix-worker/agent.md +++ /dev/null @@ -1,91 +0,0 @@ ---- -kind: agent -id: fix-worker -name: fix-worker -description: Declarative profile for fix implementation and pull request creation adhering to devsy-pr-ready. -mode: normal -fast_mode_allowed: false -models_allowed: - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - codex/gpt-6.1-terra -target: paseo -read_only: false -use_host_git_config: true -tools: - - read - - edit - - write - - glob - - grep - - find - - bash ---- - -# Fix Worker Agent Profile - -You are the fix implementation subagent for devsy-org/devsy. -Your role is implementing verified fixes and preparing pull requests adhering strictly to devsy-pr-ready. - -## Operational Boundaries - -* Execute single focused fix per worktree workspace. -* Strictly normal execution mode: fast mode is prohibited. -* Concurrency and lifecycle managed by devsy-daily-triage coordinator. - -## Implementation and Validation Workflow - -1. Open PR Deduplication: - Check if an open pull request already targets this failure: -```bash -gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" -``` - If an open PR exists, report outcome: already_resolved and exit without opening a duplicate pull request. -2. Minimal fix: - Apply behavior preserving fix and targeted regression test. - Write self-documenting code in plain ASCII without redundant comments. -3. Local validation: -```bash -mkdir -p dist -mise run cli:format -mise run cli:lint:ci -mise run cli:test -``` -4. Commit requirements: - Use the git author identity configured on the host. Do not override or hardcode author name or email. - Execute signed conventional commit: -```bash -git commit -S -m "fix(scope): concise subject" -``` -5. CodeRabbit CLI review on committed change: -```bash -coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) -``` - If CodeRabbit reports actionable findings, apply corrections, re-run local validation, and amend: -```bash -git commit -S --amend --no-edit -``` -6. Create draft pull request using the required template: -```bash -gh pr create -R devsy-org/devsy --draft \ - --title "fix(scope): concise subject" \ - --body "$(cat <<'EOF' -## Cause -Concise cause description under 30 words. - -## Fix -Concise fix description under 30 words. - -## Test evidence -Validation commands run and test output summary. -devsy-fingerprint: <fingerprint> -EOF -)" -``` - -## Strict PR Constraints - -* PR description must be strictly under 100 words total. -* PR description must contain exactly three sections: ## Cause, ## Fix, ## Test evidence. -* All commits must be signed using the host configured git identity. -* Zero tracker references: no issue numbers, tracker URLs, or tracker labels in commit messages, branch names, PR titles, or PR descriptions. diff --git a/.agents/tasks/devsy-ci-triage/task.md b/.agents/tasks/devsy-ci-triage/task.md deleted file mode 100644 index 976db0be5..000000000 --- a/.agents/tasks/devsy-ci-triage/task.md +++ /dev/null @@ -1,122 +0,0 @@ ---- -kind: task -id: devsy-ci-triage -name: devsy-ci-triage -target: paseo -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy CI Failure Triage - -This task inspects failed GitHub Actions workflow runs on origin/main, classifies failures, deduplicates issues, triggers safe reruns for transient flakes, and files structured tracking issues. -Target repository: devsy-org/devsy. - -## Operational Boundaries - -* Target branch: origin/main. -* Use memory only for durable knowledge: normalized failure fingerprints and flake classifications. -* The live GitHub environment is the sole authority for active issues and runs. -* Do not perform long polling or loops. Execute a single triage pass and finish. - -## Execution Procedure - -### 1. Query Failed Workflow Runs on Main - -Query failed runs from the last 24 hours: - -```bash -SINCE=$(date -u -v-24H "+%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d "24 hours ago" "+%Y-%m-%dT%H:%M:%SZ") -gh run list -R devsy-org/devsy --branch main --created ">=$SINCE" --status failure --limit 50 --json databaseId,workflowName,headSha,conclusion -``` - -### 2. Inspect Failed Jobs - -For each failed run, inspect failed jobs: - -```bash -gh api repos/devsy-org/devsy/actions/runs/<run_id>/jobs --paginate --jq '.jobs[] | select(.conclusion=="failure") | {job_name: .name, job_id: .id, run_attempt: .run_attempt, failed_step: (.steps[]? | select(.conclusion=="failure") | .name)}' -``` - -### 3. Extract Failure Signature with Bounded Log Extraction - -Fetch the trailing failure log: - -```bash -gh run view -R devsy-org/devsy --job <job_id> --log-failed | tail -n 150 -``` - -Compute the standardized failure fingerprint using a normalized pipeline: -```bash -SIGNATURE=$(printf '%s|%s|%s|%s' "$WORKFLOW" "$JOB" "$STEP" "$TEST" | sed -E 's/\x1B\[[0-9;]*[a-zA-Z]//g; s/[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9:.]+Z//g; s/0x[0-9a-fA-F]+//g' | tr '[:upper:]' '[:lower:]' | tr -d '[:space:]') -FINGERPRINT=$(printf '%s' "$SIGNATURE" | shasum -a 256 | cut -c1-12) -``` -The fingerprint is the first 12 hex characters of SHA-256 over the lowercase string `workflow|job|step|test`, after stripping ANSI escape sequences, timestamps, and hex memory addresses. -### 4. Classify and Deduplicate - -Evaluate the extracted signature against these classifications: - -1. Upstream provider asset outage: - If the failing log indicates a 404 or Not Found on a release asset or `releases/latest` URL: - * Classify as `upstream-asset`. - * Rerun at most once. - * Probe referenced provider repository using `gh api repos/<owner>/<repo>/releases/latest`. - * Ensure label exists: `gh label create ci-infra -R devsy-org/devsy 2>/dev/null || true`. - * Open or update a tracking issue on devsy with label `ci-infra`. - * Record provider blockage for the daily digest. - * Do not open issues in provider repositories. - -2. Known transient infrastructure flake: - Query persistent memory: - Write to `xd://recall` with `{"query": "devsy ci failure fingerprint <fingerprint>"}`. - If recognized as a known transient infrastructure flake, check `run_attempt`. - If `run_attempt <= 2`, trigger a rerun: - `gh run rerun <run_id> --failed` - If `run_attempt > 2`, classify as persistent infrastructure failure with label `ci-infra`. - -3. Deduplication and regression reopening: - Search existing issues: - `gh issue list -R devsy-org/devsy --state all --search "<fingerprint>" --json number,title,state` - If an open issue matches, append run ID and head SHA: - `gh issue comment <issue_number> -R devsy-org/devsy --body "### Recurrence Detected\nFailure recurred on main in run <run_id> at commit <head_sha>.\ndevsy-fingerprint: <fingerprint>"` - Do not create duplicate issues. - If a closed issue matches and the failure recurs on main, reopen the issue: - `gh issue reopen <issue_number> -R devsy-org/devsy --comment "### Recurrence Detected\nFailure recurred on main in run <run_id> at commit <head_sha>.\ndevsy-fingerprint: <fingerprint>"` - Only open a new issue when zero matches exist across open and closed states: - Ensure labels exist: - `gh label create ci -R devsy-org/devsy 2>/dev/null || true` - `gh label create bug -R devsy-org/devsy 2>/dev/null || true` - Create tracking issue: - ```bash - gh issue create -R devsy-org/devsy \ - --title "ci: <test_name> failure in <workflow_name>" \ - --label "ci,bug" \ - --body "$(cat <<'EOF' - Summary: Automated triage detected CI failure on main in run <run_id> at commit <head_sha>. - devsy-fingerprint: <fingerprint> - - Failure Signature: - Workflow: <workflow_name> - Job: <job_name> - Step: <step_name> - - Log Excerpt: - <bounded_log_extract> - - Next Actions: - Triaged for root-cause investigation. -EOF - )" - ``` - -4. Memory hygiene: - When an issue closes, retain status `resolved` with the fingerprint and closing run. - Never retain issue numbers as permanent durable facts. - Before acting on any recalled fingerprint, confirm it against live `gh issue list` results. A newer fact supersedes an older one. diff --git a/.agents/tasks/devsy-daily-digest/task.md b/.agents/tasks/devsy-daily-digest/task.md deleted file mode 100644 index 036a4b289..000000000 --- a/.agents/tasks/devsy-daily-digest/task.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -kind: task -id: devsy-daily-digest -name: devsy-daily-digest -target: paseo -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy Daily Digest and Memory Consolidation - -This task consolidates durable triage facts into persistent memory and outputs the structured daily markdown report summarizing garbage collection, pull request gates, main branch health, and active investigations. -Target repository: devsy-org/devsy. - -## Operational Boundaries - -* Use memory only for durable knowledge: normalized failure fingerprints, flake classifications, and verified root causes. -* Never retain tracker identifiers or issue numbers as permanent durable facts. -* Do not perform loops or polling. Generate the report and finish. - -## Standalone Live Queries - -When running standalone without prior stage state, query live environment state: -1. Active pull requests: - `gh pr list -R devsy-org/devsy --state open --author @me --json number,title,headRefName,statusCheckRollup,mergeStateStatus` -2. Main branch runs: - `gh run list -R devsy-org/devsy --branch main --limit 20 --json databaseId,status,conclusion` -3. Active agents: - `paseo agent ls --json` - -## Execution Procedure - -### 1. Memory Consolidation - -Persist durable triage conclusions into persistent memory using the memory tool: -* New failure fingerprints: write to `xd://retain` with `{"facts": [{"fact": "devsy ci fingerprint <fingerprint>: <classification>", "scope": "project"}]}`. -* Verified root causes: write to `xd://retain` with `{"facts": [{"fact": "devsy root cause for <investigation_subject>: <summary>", "scope": "project"}]}`. -* Resolved issues: write to `xd://retain` with `{"facts": [{"fact": "devsy ci fingerprint <fingerprint>: resolved by commit <sha>", "scope": "project"}]}`. - -### 2. Format and Output Daily Digest - -Output the daily report adhering strictly to this markdown structure: - -```markdown -# Devsy Daily Triage Digest: YYYY-MM-DD - -## Workspaces Garbage Collected -* Total archived: <count> -* Details: <workspace_id> (<branch>) - -## Active PRs and Gates -* PR <number> (<head_sha>): CI <status>, Greptile <score>, CodeRabbit <status>, Gate <state> - -## CI Health on main -* Total failing runs triaged: <count> -* Reruns triggered: <count> -* Issues opened or updated: <list> - -## Active Investigations and Fixes -* Issue <id>: <tier> (<model>), status: <status> -``` diff --git a/.agents/tasks/devsy-daily-triage/loader.txt b/.agents/tasks/devsy-daily-triage/loader.txt deleted file mode 100644 index fe7123d84..000000000 --- a/.agents/tasks/devsy-daily-triage/loader.txt +++ /dev/null @@ -1,4 +0,0 @@ -Fetch origin/main. Read and execute .agents/tasks/devsy-daily-triage/task.md at origin/main. -Log the current commit SHA in the first output line. -Strictly adhere to all instructions, subagent model tiers, and PR constraints defined in that file. -If the file is missing or unreadable, abort and report error. diff --git a/.agents/tasks/devsy-daily-triage/schedule.json b/.agents/tasks/devsy-daily-triage/schedule.json deleted file mode 100644 index 0cee94d27..000000000 --- a/.agents/tasks/devsy-daily-triage/schedule.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id": "sch_devsy_daily_triage", - "name": "devsy-daily-triage", - "cron": "0 10 * * *", - "timezone": "UTC", - "provider": "claude/claude-sonnet-5-5", - "mode": "auto", - "task": ".agents/tasks/devsy-daily-triage/task.md", - "models_allowed": [ - "claude/claude-haiku-5-5", - "codex/gpt-6-luna", - "codex/gpt-6.1-terra", - "claude/claude-sonnet-5-5", - "codex/gpt-6.1-sol", - "antigravity/gemini-3.8-flash-medium" - ], - "fast_mode_allowed": false -} diff --git a/.agents/tasks/devsy-daily-triage/sync.py b/.agents/tasks/devsy-daily-triage/sync.py deleted file mode 100755 index 120f0c7ad..000000000 --- a/.agents/tasks/devsy-daily-triage/sync.py +++ /dev/null @@ -1,182 +0,0 @@ -#!/usr/bin/env python3 -import argparse -import json -import subprocess -import os -import sys -from pathlib import Path - - -def run_command(args: list[str]) -> str: - try: - result = subprocess.run(args, capture_output=True, text=True, check=True) - return result.stdout.strip() - except subprocess.CalledProcessError as exc: - err_msg = exc.stderr.strip() if exc.stderr else str(exc) - sys.stderr.write(f"Command failed ({' '.join(args)}): {err_msg}\n") - sys.exit(1) - -def resolve_repo_root() -> str: - try: - common_dir = run_command(["git", "rev-parse", "--git-common-dir"]).strip() - return os.path.dirname(os.path.abspath(common_dir)) - except Exception: - return os.getcwd() - - - -def find_schedule_id(schedule_name: str) -> str | None: - output = run_command(["paseo", "schedule", "ls", "--json"]) - schedules = json.loads(output) - matching = [s.get("id") for s in schedules if s.get("name") == schedule_name] - if len(matching) > 1: - sys.stderr.write(f"Error: Ambiguous duplicate schedules found with name '{schedule_name}': {matching}\n") - sys.exit(1) - return matching[0] if matching else None - - -def handle_diff(config: dict, schedule_name: str, loader_prompt: str) -> None: - existing_id = find_schedule_id(schedule_name) - if not existing_id: - sys.stderr.write(f"Schedule '{schedule_name}' not found in Paseo daemon.\n") - sys.exit(1) - - inspect_output = run_command(["paseo", "schedule", "inspect", existing_id, "--json"]) - daemon_data = json.loads(inspect_output) - - cadence = daemon_data.get("cadence", {}) - target_config = daemon_data.get("target", {}).get("config", {}) - - daemon_provider = target_config.get("provider", "") - daemon_model = target_config.get("model") - if daemon_model: - actual_provider = f"{daemon_provider}/{daemon_model}" - else: - actual_provider = daemon_provider - - comparisons = [ - ("cron", config.get("cron"), cadence.get("expression")), - ("timezone", config.get("timezone"), cadence.get("timezone")), - ("provider", config.get("provider"), actual_provider), - ("mode", config.get("mode", "auto"), target_config.get("modeId")), - ("cwd", config.get("cwd") or resolve_repo_root(), target_config.get("cwd")), - ("prompt", loader_prompt.strip(), daemon_data.get("prompt", "").strip()), - ] - - has_drift = False - print(f"Schedule Configuration Drift Check for '{schedule_name}' ({existing_id}):") - for field, expected, actual in comparisons: - if expected != actual: - has_drift = True - print(f" [DRIFT] {field}:") - print(f" Expected (Git): {expected}") - print(f" Actual (Daemon): {actual}") - else: - print(f" [OK] {field}: {actual}") - - if has_drift: - print("\nDrift detected. Run with --apply to synchronize Paseo daemon with Git.") - sys.exit(2) - else: - print("\nConfiguration is in sync. Zero drift.") - - -def handle_apply(config: dict, schedule_name: str, loader_prompt: str) -> None: - existing_id = find_schedule_id(schedule_name) - if not existing_id: - sys.stderr.write(f"Schedule '{schedule_name}' not found. Run --create first.\n") - sys.exit(1) - - cmd = [ - "paseo", - "schedule", - "update", - existing_id, - "--cron", - config["cron"], - "--timezone", - config["timezone"], - "--provider", - config["provider"], - "--mode", - config.get("mode", "auto"), - "--cwd", - config.get("cwd") or resolve_repo_root(), - "--prompt", - loader_prompt, - ] - run_command(cmd) - - inspect_output = run_command(["paseo", "schedule", "inspect", existing_id, "--json"]) - updated_data = json.loads(inspect_output) - cadence = updated_data.get("cadence", {}) - print(f"Updated schedule {existing_id} successfully.") - print(f"Verified daemon cron: {cadence.get('expression')} ({cadence.get('timezone')})") - - -def handle_create(config: dict, schedule_name: str, loader_prompt: str) -> None: - existing_id = find_schedule_id(schedule_name) - if existing_id: - sys.stderr.write(f"Schedule '{schedule_name}' already exists with ID {existing_id}. Use --apply to update.\n") - sys.exit(1) - - cmd = [ - "paseo", - "schedule", - "create", - "--name", - schedule_name, - "--cron", - config["cron"], - "--timezone", - config["timezone"], - "--provider", - config["provider"], - "--mode", - config.get("mode", "auto"), - "--cwd", - config.get("cwd") or resolve_repo_root(), - loader_prompt, - ] - output = run_command(cmd) - print(f"Created schedule: {output}") - - -def main() -> None: - parser = argparse.ArgumentParser(description="Synchronize Paseo schedule with Git configuration") - group = parser.add_mutually_exclusive_group(required=True) - group.add_argument("--diff", action="store_true", help="Compare Paseo daemon schedule against Git configuration") - group.add_argument("--apply", action="store_true", help="Update Paseo daemon schedule with Git configuration") - group.add_argument("--create", action="store_true", help="Register schedule in Paseo daemon for the first time") - - args = parser.parse_args() - - base_dir = Path(__file__).resolve().parent - config_file = base_dir / "schedule.json" - loader_file = base_dir / "loader.txt" - - if not config_file.exists(): - sys.stderr.write(f"Config file not found: {config_file}\n") - sys.exit(1) - if not loader_file.exists(): - sys.stderr.write(f"Loader file not found: {loader_file}\n") - sys.exit(1) - - with open(config_file, "r") as f: - config = json.load(f) - - with open(loader_file, "r") as f: - loader_prompt = f.read().strip() - - schedule_name = config.get("name", "devsy-daily-triage") - - if args.diff: - handle_diff(config, schedule_name, loader_prompt) - elif args.apply: - handle_apply(config, schedule_name, loader_prompt) - elif args.create: - handle_create(config, schedule_name, loader_prompt) - - -if __name__ == "__main__": - main() diff --git a/.agents/tasks/devsy-daily-triage/task.md b/.agents/tasks/devsy-daily-triage/task.md deleted file mode 100644 index 1b96794ad..000000000 --- a/.agents/tasks/devsy-daily-triage/task.md +++ /dev/null @@ -1,75 +0,0 @@ ---- -kind: task -id: devsy-daily-triage -name: devsy-daily-triage -schedule: "0 10 * * *" -timezone: UTC -provider: omp/anthropic/claude-sonnet-5-5 -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy Daily Triage Coordinator - -You are the daily Devsy Orchestration Agent for devsy-org/devsy running in the oh-my-pi (OMP) harness. -Your role is orchestration: executing the isolated daily triage subtasks in order, reconciling progress, and consolidating findings. -Target repository: devsy-org/devsy. - -## Operational Boundaries - -* Single-pass execution: execute each subtask in order, consolidate results, and finish. Never sleep in a loop or watch CI runs. -* Concurrency budget: - * Maximum 2 concurrent active investigations. - * Maximum 1 active fix pull request in flight. -* Strict Devsy PR Rules (devsy-pr-ready and CLAUDE.md): - * Author identity: use host configured git identity without hardcoded overrides. - * Signed conventional commits: `fix(scope): subject`. - * Zero tracker references: no issue numbers in commit messages, branch names, PR titles, or descriptions. - * PR description strictly under 100 words with three sections: `## Cause`, `## Fix`, `## Test evidence`. - * Required review gates: Greptile confidence at least 4/5, CodeRabbit success, zero unresolved threads. -* Fast mode is prohibited across all agents and subtasks. Always use standard normal mode. - -## Orchestration Flow - -Execute the isolated subtasks in sequence, passing state between phases: - -### Phase 1: Workspace Garbage Collection -Execute `.agents/tasks/devsy-workspace-gc/task.md`. -Scans managed Devsy worktrees, verifies automation ownership, checks for uncommitted changes or active runs, and archives completed or stale workspaces. Record count and details of archived workspaces for Phase 6. - -### Phase 2: In-Flight PR Reconciliation -Execute `.agents/tasks/devsy-pr-reconciliation/task.md`. -Reconciles open automation pull requests, checks branch drift and review gates, auto-merges authorized pull requests, verifies issue closure on subsequent main runs, and reconciles completed investigations. -Output state passed forward: -* `slots_investigation`: available investigation concurrency slots, passed to Phase 4. -* `slots_fix`: available fix concurrency slots, passed to Phase 5. -* Active pull requests and gate status, passed to Phase 6. - -### Phase 3: CI Failure Triage -Execute `.agents/tasks/devsy-ci-triage/task.md`. -Queries failed runs on origin/main from the last 24 hours, extracts failure logs, computes normalized fingerprints, classifies failures, reruns transient flakes, and creates or updates tracking issues. -Output state passed forward: -* Triage statistics (failing runs triaged, reruns triggered, issues opened or updated), passed to Phase 6. - -### Phase 4: Issue Investigation Delegation -Execute `.agents/tasks/devsy-issue-investigation/task.md`. -Uses `slots_investigation` from Phase 2. Triages open uninvestigated issues within available capacity, selects model tiers (Small, Medium, Deep), creates diagnostic workspaces, and delegates to `.agents/agents/ci-investigator`. -Output state passed forward: -* Active investigations and selected model tiers, passed to Phase 6. - -### Phase 5: Fix Delegation and Playbook Orchestration -Execute `.agents/tasks/devsy-fix-delegation/task.md`. -Uses `slots_fix` from Phase 2. If `slots_fix > 0` and a verified investigation exists, checks open pull request deduplication, creates a fix workspace, and initiates `.paseo/playbooks/devsy-fix.yaml` (or delegates to `.agents/agents/fix-worker`). -Output state passed forward: -* Fix status and initiated playbook runs, passed to Phase 6. - -### Phase 6: Daily Digest and Memory Consolidation -Execute `.agents/tasks/devsy-daily-digest/task.md`. -Consolidates durable findings into persistent memory with `xd://retain` and emits the structured markdown digest aggregating the outcomes from Phases 1 through 5. diff --git a/.agents/tasks/devsy-fix-delegation/task.md b/.agents/tasks/devsy-fix-delegation/task.md deleted file mode 100644 index a7c421b23..000000000 --- a/.agents/tasks/devsy-fix-delegation/task.md +++ /dev/null @@ -1,113 +0,0 @@ ---- -kind: task -id: devsy-fix-delegation -name: devsy-fix-delegation -target: paseo -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy Fix Delegation and Playbook Orchestration - -This task orchestrates bug fix implementation for verified issues, enforcing open pull request deduplication, human approval gates, and PR readiness standards. -Target repository: devsy-org/devsy. - -## Task Inputs & Defaults - -* `slots_fix`: integer. If not supplied, compute directly from open pull requests: - `OPEN_FIX_PRS=$(gh pr list -R devsy-org/devsy --state open --author @me --json headRefName --jq '[.[] | select(.headRefName | startswith("fix/"))] | length' 2>/dev/null || echo 0)` - `slots_fix=$(( 1 - OPEN_FIX_PRS > 0 ? 1 - OPEN_FIX_PRS : 0 ))` -* `fingerprint`, `description`, `failing_step`: required strings for playbook execution. If executing standalone without explicit parameters, query the latest open issue labeled `investigated`: - `gh issue list -R devsy-org/devsy --label investigated --state open --limit 1 --json number,title,body` - -## Operational Boundaries - -* Execute only if `slots_fix > 0` and a verified investigation exists. -* Strictly enforce Devsy PR rules (devsy-pr-ready and CLAUDE.md): - * Use host configured git identity without hardcoded overrides. - * Signed conventional commit: `fix(scope): subject`. - * Zero tracker references in commit messages, branch names, PR titles, or bodies. - * PR description strictly under 100 words with three sections: `## Cause`, `## Fix`, `## Test evidence`. -* Fast mode is prohibited. Subagents must run strictly in normal mode. - -## Execution Procedure - -### 1. Open Pull Request Deduplication - -Before creating a fix workspace or starting the fix pipeline, verify that no open pull request already targets this failure: - -```bash -gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" --json number,title,headRefName -``` - -If an open pull request already exists, do not launch a duplicate fix. Record the active pull request for the daily digest and finish. - -### 2. Authoritative Execution Path: Paseo Playbook - -The authoritative path for executing code fixes is the declarative Paseo Playbook at `.paseo/playbooks/devsy-fix.yaml`. This ensures that human review gates (`approve_plan`, `approve_pr`) and project-wide concurrency (`concurrency: 1`) are strictly enforced by the playbook engine. - -1. Setup fix workspace: - ```bash - paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch fix/<short_topic> --json - ``` - -2. Start Playbook Run: - Call the `start_playbook` tool in the newly created fix workspace with: - * `playbook`: "devsy-fix" - * `name`: "<fingerprint>" - * `inputs`: - * `fingerprint`: "<fingerprint>" - * `description`: "<root_cause_summary>" - * `failing_step`: "<step_name>" -### 3. Alternative Direct Worker Subagent (Normal Mode Only) - -If executing via direct subagent profile: - -1. Delegate to the subagent profile defined at `.agents/agents/fix-worker/agent.md`. -2. Authorized provider configurations: - * `codex/gpt-6.1-sol` - * `codex/gpt-6.1-terra` - * `claude/claude-sonnet-5-5` -3. Worker instructions adhering strictly to devsy-pr-ready: - ```markdown - You are fixing a verified issue in devsy-org/devsy. - Follow devsy-pr-ready strictly: - 1. Minimal behavior-preserving fix and targeted regression test. - 2. Write self-documenting code with plain ASCII; no redundant comments. - 3. Local validation: - mkdir -p dist - mise run cli:format - mise run cli:lint:ci - mise run cli:test - 4. Commit: - Signed conventional commit: git commit -S -m 'fix(<scope>): <short description>' - Author: use host configured git identity. - Zero tracker references in commit or PR. - 5. CodeRabbit CLI review on committed change: - coderabbit review --agent --committed --base-commit $(git merge-base HEAD origin/main) - If actionable findings exist, fix them, revalidate, and amend: - git commit -S --amend --no-edit - 6. Push and Create Draft PR using this template: - gh pr create -R devsy-org/devsy --draft \ - --title "fix(<scope>): <short description>" \ - --body "$(cat <<'EOF' -## Cause -<concise cause description under 30 words> - -## Fix -<concise fix description under 30 words> - -## Test evidence -<validation commands run and test output summary> -devsy-fingerprint: <fingerprint> -EOF -)" - (PR body must be strictly under 100 words total with no other sections). - ``` diff --git a/.agents/tasks/devsy-issue-investigation/task.md b/.agents/tasks/devsy-issue-investigation/task.md deleted file mode 100644 index 86d7a3ce9..000000000 --- a/.agents/tasks/devsy-issue-investigation/task.md +++ /dev/null @@ -1,92 +0,0 @@ ---- -kind: task -id: devsy-issue-investigation -name: devsy-issue-investigation -target: paseo -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy Issue Investigation Delegation - -This task triages open issues, tags feature requests and already investigated issues, selects priority failure candidates within capacity, and delegates read-only diagnostic investigations to subagents using `.agents/agents/ci-investigator`. -Target repository: devsy-org/devsy. - -## Task Inputs & Defaults - -* `slots_investigation`: integer. If not supplied, compute available capacity directly from active subagents: - `ACTIVE_COUNT=$(paseo agent ls --json 2>/dev/null | jq '[.[] | select(.labels.tier=="investigation" and (.status=="running" or .status=="initializing"))] | length')` - `slots_investigation=$(( 2 - ACTIVE_COUNT > 0 ? 2 - ACTIVE_COUNT : 0 ))` - -## Operational Boundaries - -* Concurrency limit: up to `slots_investigation` concurrent active investigations (maximum 2 total). -* Strictly read-only investigation: subagents never edit, commit, or push code. -* Strictly standard normal mode: fast mode is prohibited across all subagents. -* Target branch: origin/main. - -## Execution Procedure - -### 1. Query Open Uninvestigated Issues - -List recent open issues: - -```bash -gh issue list -R devsy-org/devsy --state open --limit 20 --json number,title,labels -``` - -### 2. Triage and Tag - -Review issues for preliminary classification: -* Feature requests: ensure label exists and tag issue: - `gh label create enhancement -R devsy-org/devsy 2>/dev/null || true` - `gh issue edit <issue_id> -R devsy-org/devsy --add-label enhancement` -* Already investigated issues: ensure label exists and tag issue: - `gh label create investigated -R devsy-org/devsy 2>/dev/null || true` - `gh issue edit <issue_id> -R devsy-org/devsy --add-label investigated` - -### 3. Select Candidate Issues - -Select up to `slots_investigation` candidate issues. -Prioritize CI failures on main first, followed by high-impact bugs. - -### 4. Select Model Tier for Investigation (Normal Mode Only) - -Select the model configuration according to failure complexity: - -* Small Tier (single package, CLI flag or typo, simple unit assertion): - provider: `claude/claude-haiku-5-5`, `codex/gpt-6-luna`, or `antigravity/gemini-3.8-flash-medium` -* Medium Tier (multi-package interaction, provider parameters, state race): - provider: `codex/gpt-6.1-terra` or `claude/claude-sonnet-5-5` (standard reasoning) -* Deep Tier (daemon lifecycle, container idle timeouts, k8s pod reconciliation, SSH tunneling): - provider: `codex/gpt-6.1-sol` or `claude/claude-sonnet-5-5` (high reasoning) - -### 5. Launch Investigation Subagent - -For each selected candidate issue: - -1. Create an isolated diagnostic workspace: - ```bash - paseo workspace create --isolation worktree --mode branch-off --base origin/main --new-branch diag/<fingerprint> --json - ``` - -2. Delegate to the subagent profile defined at `.agents/agents/ci-investigator/agent.md`. - -3. Format the subagent payload: - ```json - { - "workspaceId": "<workspace_id>", - "provider": "<selected_provider_and_model>", - "title": "[devsy] Investigate <fingerprint>", - "labels": { "repo": "devsy", "tier": "investigation", "fingerprint": "<fingerprint>" }, - "agentProfile": ".agents/agents/ci-investigator/agent.md", - "initialPrompt": "# Investigation Brief for Issue <issue_id>\n\n## Context\nFailure fingerprint: <fingerprint>\nIssue description: <issue_description>\n\n## Objectives\n1. Identify root cause with exact file paths and line numbers.\n2. Formulate minimal reproduction command or test case.\n3. Propose minimal fix hypothesis adhering to devsy-pr-ready.\n\n## Constraints\n* Strictly read-only: do not commit, push, or edit repository files.\n* Format final report using the output template." - } - ``` diff --git a/.agents/tasks/devsy-pr-reconciliation/task.md b/.agents/tasks/devsy-pr-reconciliation/task.md deleted file mode 100644 index 9cf30d2ff..000000000 --- a/.agents/tasks/devsy-pr-reconciliation/task.md +++ /dev/null @@ -1,107 +0,0 @@ ---- -kind: task -id: devsy-pr-reconciliation -name: devsy-pr-reconciliation -target: paseo -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy In-Flight Pull Request Reconciliation - -This task reconciles open pull requests created by this automation, checks review gates, verifies issue resolution, and reconciles completed investigations. -Target repository: devsy-org/devsy. - -## Task Inputs & Defaults - -* `auto_merge`: boolean, default `false`. Auto-merge requires explicit caller or human authorization. - -## Operational Boundaries - -* Concurrency budget: - * Maximum 2 concurrent active investigations. - * Maximum 1 active fix pull request in flight. -* Review gates required before merge: - * CI status checks passing. - * Greptile confidence score at least 4 out of 5. - * CodeRabbit review passing with zero unresolved threads. - * Signed conventional commit. - * Zero tracker references in commit message, branch name, title, or body. - * Description under 100 words in three exact sections. - -## Execution Procedure - -### 1. List Open Automation Pull Requests - -Query open pull requests authored by this automation: - -```bash -gh pr list -R devsy-org/devsy --state open --author @me --json number,title,headRefName,statusCheckRollup,isDraft,mergeStateStatus,mergeable -``` - -Filter for branches matching `fix/*` created by this automation. Skip any pull request not explicitly owned by this automation. - -### 2. Advance Open Pull Requests - -For each open automation pull request: - -1. Check branch drift and merge conflicts: - Inspect `mergeStateStatus`. - If BEHIND, steer the worker to rebase onto origin/main, rerun local validation, and push with `--force-with-lease`. Limit to one rebase attempt per day. - If DIRTY, steer the worker once to resolve conflicts. If still conflicting on the next run, label the pull request blocked: - `gh pr edit <pr_number> -R devsy-org/devsy --add-label blocked` - Never merge a pull request whose base branch is stale. - -2. Handle CI failures: - Inspect failing status checks. If a transient infrastructure failure occurred, rerun the failed job: - `gh run rerun <run_id> --failed` - If a code failure occurred, steer the worker agent to diagnose and correct it. - -3. Promote draft pull requests to ready: - If all CI checks pass on the current head commit SHA and the pull request is draft, mark it ready: - `gh pr ready <pr_number> -R devsy-org/devsy` - -4. Review thread handling: - Inspect CodeRabbit and Greptile reviews on ready pull requests. Check for unresolved review threads: - ```bash - gh api graphql -f query='query { repository(owner:"devsy-org", name:"devsy") { pullRequest(number:<pr_number>) { reviewThreads(first:50) { nodes { isResolved } } } } }' --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved==false)] | length' - ``` - Steer the worker agent if unresolved comments or review findings remain. - -5. Auto-merge execution and gate verification: - Auto-merge runs only when the coordinator input explicitly sets `auto_merge` to true. - When all gates pass (CI green, Greptile at least 4/5, CodeRabbit pass, 0 open threads, signed commit, 0 tracker references, body under 100 words), squash merge: - `gh pr merge <pr_number> -R devsy-org/devsy --squash --delete-branch --subject "<title>" --body ""` - Then archive its workspace: `paseo workspace archive <workspace_id>`. - When auto-merge is not enabled, record ready pull requests for human review. - -6. Issue closure and post-merge verification: - After a fix pull request merges, look up the fix workspace label issue. - Keep the issue open until the failing job is confirmed green on a subsequent run on main. - Close the issue with a comment containing the verified passing run ID and head SHA. - Retain resolution fact in persistent memory: - Write to `xd://retain` with: - `{"facts": [{"fact": "devsy ci fingerprint <fingerprint>: resolved by commit <sha>", "scope": "project"}]}` - -### 3. Reconcile In-Flight Investigations - -1. For completed investigation subagents, read final analysis. -2. If root cause is verified: - Retain finding in persistent memory: - Write to `xd://retain` with: - `{"facts": [{"fact": "devsy root cause for <investigation_subject>: <summary>", "scope": "project"}]}` - Archive diagnostic workspace: `paseo workspace archive <workspace_id>`. - If fix budget allows (0 active fix pull requests), promote to fix task. - -### 4. Calculate Available Capacity - -Compute operational slots for downstream tasks: -* `slots_investigation`: calculate `max(0, 2 - active_investigations_count)`. -* `slots_fix`: calculate `max(0, 1 - active_fix_prs_count)`. diff --git a/.agents/tasks/devsy-workspace-gc/task.md b/.agents/tasks/devsy-workspace-gc/task.md deleted file mode 100644 index 1552ea9bc..000000000 --- a/.agents/tasks/devsy-workspace-gc/task.md +++ /dev/null @@ -1,80 +0,0 @@ ---- -kind: task -id: devsy-workspace-gc -name: devsy-workspace-gc -target: paseo -isolation: worktree -fast_mode_allowed: false -models_allowed: - - claude/claude-haiku-5-5 - - codex/gpt-6-luna - - codex/gpt-6.1-terra - - claude/claude-sonnet-5-5 - - codex/gpt-6.1-sol - - antigravity/gemini-3.8-flash-medium ---- - -# Devsy Workspace Garbage Collection - -This task identifies and archives completed, merged, or stale automation worktrees in Devsy. -Target repository: devsy-org/devsy. - -## Operational Boundaries - -* Only inspect and archive workspaces owned by this automation. -* Never archive dirty workspaces or workspaces containing uncommitted changes. -* Never archive developer workspaces or workspaces hosting active playbook runs. -* Never perform long polling. Run a single pass garbage collection check and finish. - -## Execution Procedure - -### 1. Scan Devsy Workspaces - -Query managed worktrees under the Devsy project: - -```bash -CURRENT_CWD=$(pwd) -paseo workspace ls --json | jq -r --arg current "$CURRENT_CWD" '.[] | select(.project=="devsy" and .isolation=="worktree" and .cwd != $current) | [.workspaceId, .cwd, .title] | @tsv' -``` - -### 2. Evaluate Each Workspace Candidate - -For each candidate workspace tuple [workspaceId, cwd, title]: - -1. Verify automation ownership: - The workspace title must start with `[devsy]` or its current branch must match `diag/*` or `fix/*`. - If the workspace is not explicitly owned by this automation, skip it immediately. Never archive developer or unowned worktrees. - -2. Check for uncommitted changes: - Run `git -C "$cwd" status --porcelain`. - If the worktree is dirty or contains uncommitted changes, never archive it. Record uncommitted changes for the daily digest. - -3. Check for running subagents: - Run: - ```bash - RUNNING_AGENTS=$(paseo agent ls --json | jq -r --arg cwd "$cwd" '.[] | select(.cwd==$cwd and (.status=="running" or .status=="initializing")) | .agentId') - ``` - If running agents are found, skip this workspace. - -4. Check for active playbook runs: - Inspect active playbook runs using the list_runs tool. - If the candidate workspace matches an active playbook run, or hosts a run in running, waiting_gate, or waiting status, skip this workspace immediately. Never archive a workspace hosting a playbook run waiting at a human gate. - -5. Check branch merge and pull request status: - Run: - ```bash - BRANCH=$(git -C "$cwd" rev-parse --abbrev-ref HEAD 2>/dev/null) - git -C "$cwd" fetch origin main --quiet - IS_MERGED=$(git -C "$cwd" merge-base --is-ancestor HEAD origin/main && echo "yes" || echo "no") - PR_STATE=$(gh pr list -R devsy-org/devsy --head "$BRANCH" --state all --json state --jq '.[0].state' 2>/dev/null || echo "") - ``` - For fix branches (`fix/*`), an unexpected PR lookup error must fail closed without archiving. For diagnostic branches (`diag/*`), an empty PR lookup is expected because diagnostic branches do not open pull requests. - -6. Archive if completed or stale: - * If IS_MERGED is yes, or PR_STATE is MERGED or CLOSED, and worktree is clean: - `paseo workspace archive <workspaceId>` - * If diagnostic branch (`diag/*`) and subagent status is idle or closed: - If worktree is clean and zero active playbook runs exist, archive: - `paseo workspace archive <workspaceId>` - * If worktree age exceeds 48 hours with no uncommitted changes, no open pull request, and zero active playbook runs: - `paseo workspace archive <workspaceId>` From 2e3282c415b4dec8945c76e493d8c1f6cf5dc154 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:29:50 -0600 Subject: [PATCH 17/21] fix(playbooks): default agent to omp claude haiku 5.5 --- .paseo/playbooks/defaults/main.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.paseo/playbooks/defaults/main.yaml b/.paseo/playbooks/defaults/main.yaml index e150934af..9564cfbff 100644 --- a/.paseo/playbooks/defaults/main.yaml +++ b/.paseo/playbooks/defaults/main.yaml @@ -1,7 +1,7 @@ agent: - provider: claude - model: claude-sonnet-5-5 - mode: auto + provider: omp + model: anthropic/claude-haiku-5-5 + mode: full manager: provider: codex model: gpt-6.1-terra From b8e33c602ae31432261f1a871f32a2e0a8787e36 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:45:51 -0600 Subject: [PATCH 18/21] fix(playbooks): switch fix-worker role to omp gpt-6.1-terra --- .paseo/playbooks/roles/fix-worker/role.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.paseo/playbooks/roles/fix-worker/role.yaml b/.paseo/playbooks/roles/fix-worker/role.yaml index acd6fe993..f73fb3f13 100644 --- a/.paseo/playbooks/roles/fix-worker/role.yaml +++ b/.paseo/playbooks/roles/fix-worker/role.yaml @@ -1,6 +1,6 @@ title: Fix Worker readonly: false agent: - provider: codex - model: gpt-6.1-sol - mode: full-access + provider: omp + model: openai-codex/gpt-6.1-terra + mode: full From e37043142394a3a8bf3c0510d1cf866f682935eb Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:51:54 -0600 Subject: [PATCH 19/21] chore(ci): move wait_ci polling logic into mise task --- .paseo/playbooks/scripts/wait_ci.sh | 32 +------------------------ mise.toml | 37 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/.paseo/playbooks/scripts/wait_ci.sh b/.paseo/playbooks/scripts/wait_ci.sh index 931720fcd..0d3806431 100755 --- a/.paseo/playbooks/scripts/wait_ci.sh +++ b/.paseo/playbooks/scripts/wait_ci.sh @@ -1,33 +1,3 @@ #!/bin/sh set -eu - -PR="${PLAYBOOK_INPUT_PR_URL:-${1:-}}" -if [ -z "$PR" ]; then - echo '{"outcome":"failure","summary":"Missing PR URL in PLAYBOOK_INPUT_PR_URL"}' - exit 0 -fi - -CHECKS_JSON=$(gh pr checks "$PR" --json name,bucket,state 2>/dev/null || echo "") - -if [ -z "$CHECKS_JSON" ] || [ "$CHECKS_JSON" = "[]" ]; then - exit 75 -fi - -PENDING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pending")] | length') -if [ "$PENDING" -gt 0 ]; then - exit 75 -fi - -FAILURES=$(echo "$CHECKS_JSON" | jq -r '[.[] | select(.bucket == "fail" or .bucket == "cancel")] | .[].name' | tr '\n' ', ' | sed 's/,[[:space:]]*$//') -if [ -n "$FAILURES" ]; then - jq -nc --arg f "$FAILURES" '{outcome:"failure",summary:("CI status checks failed: "+$f)}' - exit 0 -fi - -PASSING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pass")] | length') -if [ "$PASSING" -eq 0 ]; then - exit 75 -fi - -jq -nc --arg count "$PASSING" '{outcome:"success",summary:("All "+$count+" necessary CI status checks have passed.")}' -exit 0 +exec mise run playbooks:wait-ci -- "$@" diff --git a/mise.toml b/mise.toml index 94780afa6..9fa7da137 100644 --- a/mise.toml +++ b/mise.toml @@ -317,3 +317,40 @@ cp dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 "$TMP_DIR/devsy-linux-amd64" gh release upload v0.0.0-10 dist/devsy-dev_linux_amd64_v1/devsy-linux-amd64 --repo devsy-org/devsy --clobber rm -rf "$TMP_DIR" ''' + +[tasks."playbooks:wait-ci"] +description = "poll GitHub PR status checks for a playbook run; exits 75 while checks are pending" +shell = "bash -c" +run = ''' +set -eu + +PR="${PLAYBOOK_INPUT_PR_URL:-${1:-}}" +if [ -z "$PR" ]; then + echo '{"outcome":"failure","summary":"Missing PR URL in PLAYBOOK_INPUT_PR_URL"}' + exit 0 +fi + +CHECKS_JSON=$(gh pr checks "$PR" --json name,bucket,state 2>/dev/null || echo "") + +if [ -z "$CHECKS_JSON" ] || [ "$CHECKS_JSON" = "[]" ]; then + exit 75 +fi + +PENDING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pending")] | length') +if [ "$PENDING" -gt 0 ]; then + exit 75 +fi + +FAILURES=$(echo "$CHECKS_JSON" | jq -r '[.[] | select(.bucket == "fail" or .bucket == "cancel")] | .[].name' | tr '\n' ', ' | sed 's/,[[:space:]]*$//') +if [ -n "$FAILURES" ]; then + jq -nc --arg f "$FAILURES" '{outcome:"failure",summary:("CI status checks failed: "+$f)}' + exit 0 +fi + +PASSING=$(echo "$CHECKS_JSON" | jq '[.[] | select(.bucket == "pass")] | length') +if [ "$PASSING" -eq 0 ]; then + exit 75 +fi + +jq -nc --arg count "$PASSING" '{outcome:"success",summary:("All "+$count+" necessary CI status checks have passed.")}' +''' From 10dc99ba6a0328c311bad10f998a37269c7e7d43 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 08:52:50 -0600 Subject: [PATCH 20/21] fix(playbooks): manager to omp claude haiku 5.5 --- .paseo/playbooks/defaults/main.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.paseo/playbooks/defaults/main.yaml b/.paseo/playbooks/defaults/main.yaml index 9564cfbff..698a94329 100644 --- a/.paseo/playbooks/defaults/main.yaml +++ b/.paseo/playbooks/defaults/main.yaml @@ -3,9 +3,9 @@ agent: model: anthropic/claude-haiku-5-5 mode: full manager: - provider: codex - model: gpt-6.1-terra - mode: full-access + provider: omp + model: anthropic/claude-haiku-5-5 + mode: full timeout: 2h role: silence: 30m From 075f708445d9228389246408bd698fabf3398081 Mon Sep 17 00:00:00 2001 From: Samuel K <skevetter@pm.me> Date: Thu, 12 Nov 2026 22:34:29 -0600 Subject: [PATCH 21/21] fix(playbooks): allow implement retries to update the open pull request and ready it before merge --- .paseo/playbooks/devsy-fix.yaml | 4 ++-- .paseo/playbooks/roles/fix-worker/instructions.md | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.paseo/playbooks/devsy-fix.yaml b/.paseo/playbooks/devsy-fix.yaml index df0414fb2..103fe9bc0 100644 --- a/.paseo/playbooks/devsy-fix.yaml +++ b/.paseo/playbooks/devsy-fix.yaml @@ -51,7 +51,7 @@ steps: needs: [approve_plan] role: name: fix-worker - prompt: "Implement approved fix for {{ inputs.fingerprint }}. Attempt {{ attempt }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}.\nIf attempt is greater than 1, apply changes to the existing branch and push with force-with-lease instead of opening a duplicate PR." + prompt: "Implement approved fix for {{ inputs.fingerprint }}. Loop {{ loop }}.\nHypothesis: {{ inputs.fix_hypothesis }}.\nRoot cause: {{ inputs.root_cause }}.\nRepro: {{ inputs.repro_command }}.\nIf loop is greater than 0, apply changes to the existing open pull request branch and push with force-with-lease instead of opening a duplicate PR." inputs: fingerprint: "{{ playbook.inputs.fingerprint }}" fix_hypothesis: "{{ steps.investigate.outputs.fix_hypothesis }}" @@ -88,7 +88,7 @@ steps: needs: [approve_pr] role: name: fix-worker - prompt: "Merge pull request {{ inputs.pr_url }}. Retrieve PR title and number using gh pr view {{ inputs.pr_url }} --json title,number. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject \"<title> (#<number>)\" --body \"\". Verify commit message is single line." + prompt: "Run gh pr ready {{ inputs.pr_url }} to mark the draft pull request ready for review. Then merge pull request {{ inputs.pr_url }}. Retrieve PR title and number using gh pr view {{ inputs.pr_url }} --json title,number. Run squash merge with one-line subject and empty body: gh pr merge {{ inputs.pr_url }} --squash --delete-branch --subject \"<title> (#<number>)\" --body \"\". Verify commit message is single line." inputs: pr_url: "{{ steps.implement.outputs.pr_url }}" outputs: diff --git a/.paseo/playbooks/roles/fix-worker/instructions.md b/.paseo/playbooks/roles/fix-worker/instructions.md index 35d84590b..37d61fe69 100644 --- a/.paseo/playbooks/roles/fix-worker/instructions.md +++ b/.paseo/playbooks/roles/fix-worker/instructions.md @@ -1,11 +1,13 @@ You are the fix implementation worker for devsy-org/devsy. Your task is implementing verified bug fixes and opening pull requests adhering strictly to devsy-pr-ready. +When the prompt asks you to merge a pull request, perform only the merge instructions in the prompt and skip the guidelines below. ## Implementation Guidelines -1. Check for open pull requests targeting this failure: +1. When the prompt reports loop 0, check for open pull requests targeting this failure: gh pr list -R devsy-org/devsy --state open --search "<fingerprint>" If an open pull request already exists, report outcome: already_resolved and exit without opening a duplicate pull request. + When the prompt reports a loop greater than 0, skip this check. Apply the changes to the existing open pull request branch, push with force-with-lease, and report that pull request as pr_url. 2. Minimal behavior-preserving changes and targeted regression tests. 3. Self-documenting code with plain ASCII text. Do not add redundant comments. 4. Run local validation: