Archive completed tasks, add cleanup commands, self-documenting dashboard UI
CI / build (push) Has been cancelled

- Archive 79 completed framework-dev tasks from tasks/ -> tasks/complete/
- status.py: add --cleanup-done and --install-cleanup-schedule commands
- Add scripts/automaton-cleanup.sh for periodic task archiving
- Dashboard: rename 'Background' tab -> 'Agent', 'Cleanup' agent -> 'Completed Task Archiver', remove redundant group headers and pill badges, dim inactive agent placeholders
- .rules.md: add Self-Documenting UI Names rule
- New tests: test_cleanup_done.py, expanded test_app.py and test_task.py
This commit is contained in:
Lap Tran
2026-06-24 22:43:33 -04:00
parent e13513faaa
commit 4a2301b077
572 changed files with 856 additions and 101 deletions
+44
View File
@@ -0,0 +1,44 @@
# Pre-existing Fixes
## Goal
Fix 4 pre-existing issues in the enforcement layer.
## Issues
### 1. `_infer_state_from_artifacts` heuristic bug
**File**: `scripts/status.py` lines 306-309
**Problem**: `if "SPEC.md" in artifacts and "BUG_REPORT.md" not in artifacts: return "bug_find"` — this is wrong. Having SPEC.md without BUG_REPORT.md could mean the task is in research, design, implement, etc. This condition is reached after line 304 checks for both SPEC+BUG_REPORT → adversarial_bug_find, so it only fires when BUG_REPORT.md is missing. But that's most tasks! The correct behavior is that SPEC.md alone should map to `research` (which line 318-319 already does).
**Fix**: Remove lines 306-309 (the SPEC+no BUG_REPORT case). Also fix line 311 `IMPLEMENTATION.md` → `bug_find` — semantically, having only IMPLEMENTATION.md should map to `implement` completion, not `bug_find`. But since bug_find comes after implement, mapping to implement is wrong too. The safest fix: remove lines 308-311 so SPEC.md alone → research, IMPLEMENTATION alone → implement.
### 2. `cmd_validate_folder` unnecessary fallback after `.state` exists
**File**: `scripts/status.py` lines 563-566
**Problem**: After confirming `.state` exists (line 548-556 handles the no-state case), lines 563-566 fall back to `_infer_state_from_artifacts` if `_read_state` returns None. But if `.state` exists and `_read_state` returns None, that's a corrupted `.state` file — not something to silently paper over.
**Fix**: After confirming `.state` exists, if `_read_state` returns None, error out instead of falling back to inference.
### 3. `upgrade.sh` silently swallows `status.py --upgrade` failures
**File**: `scripts/upgrade.sh` line 26
**Problem**: `python3 "$STATUS_SCRIPT" --upgrade --project "$PROJECT_DIR" || true` — the `|| true` means failures are silently swallowed. With `set -euo pipefail`, this is even more dangerous because the script appears to succeed.
**Fix**: Remove `|| true`. If the upgrade fails, the script should fail. Add a clear error message.
### 4. `upgrade.sh` doesn't verify python3 is available
**File**: `scripts/upgrade.sh`
**Problem**: The script runs `python3` without checking it's installed.
**Fix**: Add a python3 availability check at the top of the script.
### 5. Pre-commit hook doesn't handle bare repos or worktrees
**File**: `scripts/upgrade.sh` lines 60-62, `scripts/git-hooks/pre-commit` line 18
**Problem**: `upgrade.sh` checks for `.git/hooks/` directory, and the pre-commit hook uses `git rev-parse --show-toplevel`. In bare repos, `.git/` doesn't exist as a directory. In worktrees, `.git` is a file, not a directory.
**Fix**:
- `upgrade.sh`: Use `git rev-parse --git-dir` to find the hooks directory instead of assuming `.git/hooks/`
- `pre-commit`: Already uses `git rev-parse --show-toplevel` which works for worktrees. No change needed there.
- `upgrade.sh`: Use `git rev-parse --git-dir` to reliably find hooks dir
## Acceptance Criteria
- [ ] `_infer_state_from_artifacts` no longer returns `bug_find` for SPEC-only tasks
- [ ] `_infer_state_from_artifacts` no longer returns `bug_find` for IMPLEMENTATION-only tasks
- [ ] `cmd_validate_folder` errors on corrupted `.state` files instead of falling back
- [ ] `upgrade.sh` fails loudly when `status.py --upgrade` fails
- [ ] `upgrade.sh` checks python3 is available before proceeding
- [ ] `upgrade.sh` uses `git rev-parse --git-dir` for hooks directory
- [ ] All 200+ existing tests pass
- [ ] New tests for each fix