# Final Fix Report — slug-replay cross-site consistency

## Status: COMPLETE

## Changes

### Fix 1 — `claw_forge/state/client.py` (`_decorate_resumable`)
Added `task_id=node.id,` to the `make_branch_name` call (line ~98).
The `prefer_resumable` scheduling signal was silently dead because
`branch_exists()` was queried on the old un-suffixed branch name that no
longer exists after the dispatcher started appending `-{task_id[:6]}`.

### Fix 2 — `claw_forge/git/cli.py` (`_running_task_slugs`)
- SQL changed from `SELECT category, description` to
  `SELECT id, category, description, plugin_name`.
- Tuple unpacking updated to `task_id, category, description, plugin_name`.
- `make_branch_name` call now passes `plugin_name or prefix` as the
  third positional arg and `task_id=task_id` as a keyword, mirroring the
  canonical derivation in `task_handler.py` and `cleanup.py`.

Without this fix `claw-forge worktrees prune` no longer recognised a running
task's worktree directory (which is now named with the id suffix) and could
salvage or delete a live agent's working tree.

## Tests

### `tests/git/test_cli_worktrees.py`
- `_seed_running_task` updated: table now includes `id` and `plugin_name`
  columns; slug derived with `task_id=` so the returned slug matches what
  `_running_task_slugs` computes.
- Added `TestRunningTaskSlugsConsistency.test_running_task_slugs_includes_task_id_suffix`:
  directly calls `_running_task_slugs`, asserts the returned slug ends with
  `-abc123` (first 6 chars of the seeded task_id). Would FAIL against old code.

### `tests/test_resume_preference.py`
- `test_decorate_resumable_marks_pending_with_committed_branch`: branch now
  created with `task_id="t1"` so the suffixed name matches the lookup.
- `test_decorate_resumable_skips_stale_branch`: same fix.
- Added `test_decorate_resumable_uses_task_id_suffix`: asserts the function
  marks a node resumable when the correctly-suffixed branch exists, and does
  NOT mark it resumable when only an un-suffixed branch exists. Would FAIL
  against old code.

## Test run summary
26 passed (tests/test_resume_preference.py + tests/git/test_cli_worktrees.py)
ruff: clean; mypy: 0 new errors.

## Concerns
None. The `plugin_name or prefix` fallback handles NULL `plugin_name` rows
identically to the reference derivation in `cleanup.py:437`.
