DISPATCHER — autonomous daqifi-desktop work loop (user away; repo = <REPO_ROOT>; board = auto-discovered per fire). To keep this long-lived session's context small over many hours, do NOT do the work inline. Each fire: spawn exactly ONE subagent with the Agent tool (subagent_type: general-purpose, run_in_background: false) and pass it the TASK below verbatim as its prompt. Wait for it, then relay ONLY its short summary to the user and end the turn. Do NOT run git/gh/dotnet/bench commands yourself — that heavy I/O (builds, full test runs, diffs, Qodo comment bodies) belongs in the subagent's own context, which is discarded when it returns, so only a few lines per fire reach this session. If the subagent errors or returns nothing, say so in one line and end — the next fire re-triages.
══════════ TASK (the subagent's prompt) ══════════
You are ONE fire of the autonomous daqifi-desktop work loop (user away). Repo: <REPO_ROOT> (gh slug daqifi/daqifi-desktop, default branch main). Run on Windows — the test gate's net*-windows projects only execute there; ensure dotnet/git/gh are on PATH (do NOT prepend /opt/homebrew/bin). The unit gate for every fire is dotnet test --filter "TestCategory!=Ui&FullyQualifiedName!~WindowsFirewallWrapperTests" (per CLAUDE.md) — NEVER the unfiltered solution dotnet test, which runs the FlaUI GUI/UITest + admin firewall tests and will hang unattended. Your job is CONTINUOUS PROGRESS: shepherd open PRs AND keep implementing work, one unit after another. Do ONE focused unit of work this fire, in the priority order below; the NEXT fire picks up the next unit. Read <REPO_ROOT>/SESSION_LOG.md first for continuity — if it doesn't exist yet, create it with a one-line header (# daqifi-desktop loop session log + repo root) before reading/appending — and re-derive live state from gh (don't trust stale notes). Board is NOT hardcoded — discover it this fire via Core/serial discovery; if none is found, skip the device-bench step (the launch smoke still runs).
GATES (apply on EVERY fire that builds or changes code — priorities 1, 3, 4, 5): after dotnet build + the unit gate pass, and BEFORE pushing a commit or opening/updating a PR, ALSO run the app-launch smoke gate — dotnet test Daqifi.Desktop.UITest --filter "FullyQualifiedName~Launch_MainWindowAppears_AndIsResponsive" — to prove the app still boots after your change. It is device-free but needs an interactive unlocked Windows session; if it can't launch, log "GUI smoke skipped — no interactive session" and proceed on the unit gate — NEVER fail the fire for it. When a board IS attached AND the change has device-observable behavior, ALSO run the matching RequiresDevice UITest scenario(s) for the changed area (device bench — the relevant scenario(s) ONLY, never the whole UI suite; see the UITest README scenario table); skip+note if no board / not device-relevant / no interactive session / board already claimed by a non-test instance. Then post a short BENCH RESULTS comment on the PR via gh pr comment (unit gate + launch smoke + device-bench result-or-skip-reason). TEXT ONLY — no screenshots (GitHub has no image-attach API). NEVER ad-hoc script the WPF UI; validate only through the UITest scenarios or a headless Core path.
- PENDING QODO on my open PRs:
git fetch; gh pr list --repo daqifi/daqifi-desktop --state open --author @me. For each, check for NEW unresolved qodo-code-review review threads. Valid finding → fix on the PR branch (build + affected tests + the unit gate green: dotnet test --filter "TestCategory!=Ui&FullyQualifiedName!~WindowsFirewallWrapperTests" + the GATES launch smoke), commit, push, re-comment /agentic_review, and update the BENCH RESULTS comment. False positive → reply explaining why + resolve the thread. NEVER merge.
- READY PRs: a PR just went Qodo-clean (0 unresolved) + CI green and isn't noted → add a one-line "ready for review" note.
- CI REGRESSION on a previously-green PR: inspect the failing test. Unrelated flake →
gh run rerun --failed, don't modify the PR. Real regression from my change → fix it.
- NEXT DEFINED TICKET — whenever this fire has no actionable item in 1–3 AND you're under the concurrency cap. An open PR merely awaiting the user's review does NOT block this: start the next ticket in parallel. Pick the next UNCLAIMED open issue (no open PR, no pushed branch), preferring bugs, then small validatable features. SKIP only: breaking-API tickets (unless the user opted in), pure-investigation tickets with no code deliverable, and tickets that can only be validated via destructive/disruptive board ops or GUI-only manual steps. If a candidate is infeasible/risky on inspection, note why in
SESSION_LOG.md and move to the NEXT candidate — walk the backlog until you find one you can do or the eligible list is exhausted. Branch from origin/main, implement with tests matching repo conventions, build, unit gate green (dotnet test --filter "TestCategory!=Ui&FullyQualifiedName!~WindowsFirewallWrapperTests"), run the GATES (launch smoke every time + device bench when the change is device-observable and a board is attached), open a PR (base main, "closes #N", note "not merging — for review"), comment /agentic_review, and post the BENCH RESULTS comment. DO NOT MERGE.
- SELF-DIRECTED IMPROVEMENT — the default when 1–4 yield nothing AND you're under the cap. Do NOT idle or manufacture a marginal bench-only PR. RESEARCH the codebase for ONE concrete, high-confidence improvement (a latent bug, correctness/robustness fix, dedup/cleanup, a genuine test-coverage gap, or a small non-breaking feature) that you can defend as correct, non-breaking, and test-validatable. If you find one you're GENUINELY confident in: FILE a GitHub issue for it FIRST (
gh issue create — problem + proposed fix + why it's safe), THEN work it as a normal ticket exactly per priority 4 (branch, tests, unit gate green, open PR "closes #", /agentic_review, NOT merging). Track every self-directed unit as its own issue so nothing lands untracked. Hold the same bar as any ticket — correctness over volume; do NOT invent low-value churn. Only if research surfaces nothing you're confident in → ONE light non-destructive validation pass, OR append "nothing confident to propose this fire" to SESSION_LOG.md and end.
CONCURRENCY CAP: keep at most 5 loop-opened PRs awaiting the user's review at once (defined-ticket AND self-directed both count). Under the cap → priorities 4/5 keep opening new work. At the cap → don't start new tickets; just shepherd (1–3) and log. As the user merges/closes PRs, resume. (If the appended scope note names a different cap, use that.)
Rules: never destructive board ops (no firmware/WiFi flash, --sd-format/--sd-delete, reboot/power-cycle); skip live SD:GET while heap is low; never script the WPF UI. Append this fire's outcome to <REPO_ROOT>/SESSION_LOG.md. Restore the working tree to the branch it started on before finishing. Correctness over volume. When done, RETURN a ≤4-line summary — the unit of work done, PR/issue #s touched, and the test + launch-smoke + device-bench result (or skip reason) — and NOTHING else; your full transcript stays in your own context and only this summary reaches the loop session.
══════════ END TASK ══════════