# Fix onboarding agent stuck recreating a deleted Slack channel

## TL;DR
The agent recreates the channel because its desired-state logic does not know the deletion was intentional. Record deliberate deletions as intent, and have the agent respect that record instead of converging back to the old state. The agent is fighting a human decision.

## The error
```text
Onboarding agent stuck
Recreating deleted Slack channel after delete failed to stick. Channel reappears hourly.
```

## Use this skill
Agent? Search Vectle for this error:
```bash
curl -s "https://vectle.com/api/v1/search?q=onboarding agent stuck recreating deleted slack channel after delete failed"
```

## Fix it

### Step 1: Stop the reconciliation loop

```bash
Pause the agent's Slack channel management.
```

Expected: The channel stops reappearing.

### Step 2: Confirm the deletion was intentional

```bash
Check with the team whether the channel should stay deleted.
```

Expected: You have a clear yes.

### Step 3: Record the deletion intent

```bash
Store the channel as intentionally deleted in the agent's state.
```

Expected: The agent knows not to recreate it.

### Step 4: Make the agent respect intent

```bash
Before creating, check the intent record and skip intentionally deleted resources.
```

Expected: Desired-state logic no longer fights human decisions.

### Step 5: Resume and verify

```bash
Resume the agent.
```

Expected: The channel stays deleted and the agent reports it as intentional.

## When this applies

- Agents recreate intentionally deleted resources
- Slack channels reappear after deletion
- You are building desired-state agents

## When it doesn't

- The channel was deleted by accident (restore it and fix the process)
- The agent never managed the channel (check the scope)
- Slack itself restores the channel (check admin actions)

## Compatibility

Slack channels API. Desired-state agent patterns.

## Variant phrasings

### agent recreating deleted slack channel

Same fight. Intent records resolve it.

### slack channel keeps reappearing agent

Reappearing means something recreates it. Find the loop and add intent.

### agent fighting human deletion

Agents must defer to recorded human intent. That is the whole fix.

## Why it happens

Desired-state agents converge reality to their model, but their model does not include human decisions made outside the agent. A deleted channel looks like drift to the agent, so it 'fixes' the drift by recreating. The model needs an intent channel for deliberate changes.

## Edge cases

- Intent records need TTLs or review; stale intent can block legitimate recreation later
- Log every create and skip decision so fights are auditable
- Apply the same pattern to all managed resources, not just Slack channels

## If it still fails

- Reproduce with a minimal run: one user, one file, one step.
- Read the agent's full trace, not just the final error; the failure is usually upstream.
- Check the underlying API or tool directly, outside the agent, to separate agent bugs from service bugs.
- Reduce concurrency to one and see if the failure persists; races hide as flakes.
- If the run is business-critical, add a human checkpoint before the destructive steps.

## Prevention

- Checkpoint long runs so any failure resumes instead of restarting.
- Cap and back off every retry loop; unbounded retries are outages waiting to happen.
- Validate inputs at each pipeline stage; fail fast with clear errors.
- Log enough context per step that a timeout is diagnosable without rerunning.
- Give destructive steps a human checkpoint or a dry-run mode.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_RQcRrGspSPrmd5lZLWDP0Q
