Files
Gitea-Tools/skills/llm-project-workflow/templates/recover-bad-state.md
T
sysadmin daf9910e83 feat: add BLOCKED + DIAGNOSE default rule and blocker report template (closes #552)
- Updated llm-project-workflow/SKILL.md with universal BLOCKED + DIAGNOSE rule, covered blocker classes, explicit prohibition of unsafe fallbacks, and proof section.
- Added templates/blocked-diagnose-report.md (standard template with all required fields).
- Updated workflows/work-issue.md, review-merge-pr.md, create-issue.md and templates/start-issue.md, review-pr.md, merge-pr.md, recover-bad-state.md to require and reference the rule at load.
- Updated docs/llm-workflow-runbooks.md to reinforce the rule for controller prompts and all workflows.
- All changes in isolated worktree branches/issue-552-blocked-diagnose. No root mutation. No unsafe fallbacks used.
- Tests (workflow + cleanup proofs): 26+ passed in run.
- git diff --check prgs/master...HEAD: clean.
2026-07-08 15:44:31 -04:00

2.5 KiB

Template: recover from bad state

Copy, fill the <...> fields, paste as the task prompt. Recovery is read-then- act: gather facts first, never discard unmerged work.

BLOCKED + DIAGNOSE rule (llm-project-workflow): If at any point a required step (including state recovery itself) cannot be performed, stop immediately, use the standard blocked-diagnose-report.md template, attempt only safe non-mutating recovery, and report. Do not continue or fallback.

Task: recover repo state for <situation>. Do not lose unmerged work.

Rules (llm-project-workflow):
- BLOCKED + DIAGNOSE default: if state is unclear, a required check fails, or a step would delete unmerged work or bypass a guard, STOP and emit a full blocked-diagnose-report.md using the template. Clearly state BLOCKED. Diagnose. Only non-mutating recovery.
- Never push master. Never discard commits not safely pushed to <remote>.
- Prove you are in a branches/ worktree before any recovery mutation.

Diagnose first:
1. git fetch <remote> --prune
2. git status --short; git worktree list
3. git rev-list --left-right --count <remote>/master...master   # ahead/behind
4. For any PR involved: confirm state (open/closed/merged) AND whether
   <remote>/master actually contains its commits ("closed" != "merged").
5. Check active leases, claims, and whether required skills/workflows are loaded.

If a required diagnostic or recovery step itself is unavailable (e.g. terminal broken, skill missing, guard blocks, wrong profile), emit:

## Required step
<the step>

## Observed failure
<...>

(complete the full blocked-diagnose-report.md template)

Act per case (only after clean diagnosis; if blocked, use the template and stop):
- Dirty worktree from another issue: leave it; start yours in a new worktree.
- Local master ahead of remote: confirm the extra commits live on a branch
  pushed to <remote>, THEN git reset --hard <remote>/master. Verify with
  `git branch --contains <sha>` first.
- PR closed but not merged (`merged=false`): stop normal flow and use reconcile-closed-not-merged-pr.md instead.
- Branch deleted before merge: recover commits from a local branch/reflog (or
  git fsck --lost-found), re-push, reopen the PR.
- Unauthorized untracked file: do not commit it; leave pre-existing artifacts.
- Any blocker: use blocked-diagnose-report.md template and stop.

Handoff: what was wrong, evidence, action taken, current state, what remains. If BLOCKED, include the full blocker report.