SKILL.md
$27
-
Autonomous residual handoff (only when step 3 reported one or more residual downstream-resolver findings; skip when it reported Residual actionable work: none.)
Do not prompt the user. This step embraces the autopilot contract: residuals must become durable before DONE, but the agent never stops to ask.
-
Load references/tracker-defer.md in non-interactive mode. Pass the residual actionable findings from step 3's summary (or the run artifact when the summary was truncated).
-
Collect the structured return: { filed: [...], failed: [...], no_sink: [...] }.
-
Compose a ## Residual Review Findings markdown section from the structured return:
- For each item in
filed: a bullet with severity, file:line, title, and a link to the tracker ticket URL.
- For each item in
failed: a bullet with severity, file:line, title, and the failure reason (e.g.,Defer failed: gh returned 401 — tracker unavailable).
- For each item in
no_sink: a bullet with severity, file:line, and title inlined verbatim so the PR body or fallback file is the durable record.
-
Detect the current branch's open PR without prompting:
gh pr view --json number,url,body,state
-
If an open PR exists, update it directly with gh; do not load any confirmation-driven PR update skill. Append or replace the ## Residual Review Findings section in the current PR body, write the new body to an OS temp file, then run:
gh pr edit PR_NUMBER --body-file BODY_FILE
-
If no open PR exists, create a tracked fallback file at docs/residual-review-findings/<branch-or-head-sha>.md containing the composed section and the source PR-review run context. Stage only that file, commit it with docs(review): record residual review findings, and push the current branch. If an upstream exists, run git push. If no upstream exists, resolve a writable remote dynamically: prefer origin when present, otherwise use git remote and choose the first configured remote. Then run git push --set-upstream <remote> HEAD. This is the durable no-PR sink. Do not output DONE until either the existing PR body has been updated or this fallback file commit has been pushed. If both paths fail, stop and report the failed commands; do not silently proceed.
Never block DONE on tracker filing failures once residuals have been durably recorded. A no_sink outcome is success only when the findings are present in the PR body or in the pushed fallback file.
-
Invoke the ce-test-browser skill with mode:pipeline.
-
Invoke the ce-commit-push-pr skill.
This commits any remaining changes, pushes the branch, and opens a pull request. If step 5 already opened a PR (check with gh pr view --json number,url,state 2>/dev/null), skip PR creation but still commit and push any uncommitted changes.
-
CI watch and autofix loop (only when an open PR exists for the current branch)
Detect the PR; if none exists or gh is unavailable, skip this step entirely and proceed to step 9.
gh pr view --json number,url,state
For up to 3 fix iterations, repeat:
-
Wait for CI to complete:
gh pr checks --watch
If the command exits 0, all checks passed. Break out of the loop and proceed to step 9.
If it exits non-zero, one or more checks failed. Continue to (2).
-
Identify failing checks and pull their failure logs. Use gh pr checks --json name,state,conclusion,workflow,link to enumerate failures, then for each failing check read the run logs:
gh run view <run-id> --log-failed
where <run-id> is parsed from the check's details URL or workflow run.
-
Read the failure logs, identify the root cause, and apply a fix in the working tree. Do NOT weaken, skip, or mock the failing assertion to make it pass — repair the actual issue. If the failure is a flaky test that has no fix path, document that as the residual outcome below rather than retrying without a code change.
-
Stage only the files you changed, commit, and push:
git add <changed-files>
git commit -m "fix(ci): <one-line summary of the failure repaired>"
git push
-
Return to iteration (1) with the next attempt counter.
GATE: STOP iterating after 3 failed attempts. If CI is still red after 3 fix cycles:
-
Compose a ## CI Failures Unresolved markdown section listing each remaining failing check, the failure summary, and the run/check URL.
-
Append or replace this section in the PR body, write the new body to an OS temp file, then run:
gh pr edit PR_NUMBER --body-file BODY_FILE
-
Do NOT continue looping. The autopilot contract is "make residuals durable, then exit." Proceed to step 9.
-
Output <promise>DONE</promise> when complete
Start with step 1 now. Remember: plan FIRST, then work. Never skip the plan.