Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions cloudflare-gastown/docs/local-debug-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ grep "container\|startAgent\|eviction" /tmp/gastown-wrangler.log | tail -20
### Drain Flag Clearing

The TownDO's `_draining` flag is cleared by whichever happens first:

- **Heartbeat instance ID change** (~30s): each container has a UUID. When a new container's heartbeat arrives with a different ID, the drain clears.
- **Nonce handshake**: the new container calls `/container-ready` with the drain nonce.
- **Hard timeout** (7 min): safety net if no heartbeat or handshake arrives.
Expand Down Expand Up @@ -276,28 +277,33 @@ docker kill $(docker ps -q) 2>/dev/null
### Drain Stuck "Waiting for N agents"

Agents show as `running` but aren't doing work. Common causes:

- **`fetchPendingNudges` hanging**: should be skipped during drain (check `_draining` flag)
- **`server.heartbeat` clearing idle timer**: these events should be in `IDLE_TIMER_IGNORE_EVENTS`
- **Agent in `starting` status**: `session.prompt()` blocking. Status is set to `running` before the prompt now.

### Drain Flag Persists After Restart

The drain banner stays visible after the container restarted. Causes:

- **No heartbeats arriving**: container failed to start, no agents registered
- **`_containerInstanceId` not persisted**: should be in `ctx.storage`
- Fallback: wait for the 7-minute hard timeout

### Git Credential Errors

Container starts but agents fail at `git clone`:

```
Error checking if container is ready: Invalid username
```

This means the git token is stale/expired. Refresh credentials in the town settings.

### Accumulating Escalation Beads

Triage/escalation beads pile up with `rig_id=NULL`. These are by design:

- `type=escalation` beads surface for human attention (merge conflicts, rework)
- `type=issue` triage beads are handled by `maybeDispatchTriageAgent`
- GUPP force-stop beads are created by the patrol system for stuck agents
Expand Down
11 changes: 11 additions & 0 deletions cloudflare-gastown/src/dos/town/review-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,17 @@ export function agentDone(sql: SqlStorage, agentId: string, input: AgentDoneInpu
return;
}

// PR-fixup beads skip the review queue. The polecat pushed fixup commits
// to an existing PR branch — no separate review is needed.
if (hookedBead?.labels.includes('gt:pr-fixup')) {
console.log(
`[review-queue] agentDone: pr-fixup bead ${agent.current_hook_bead_id} — closing directly (skip review)`
);
closeBead(sql, agent.current_hook_bead_id, agentId);
unhookBead(sql, agentId);
return;
}

if (agent.role === 'refinery') {
// The refinery handles merging (direct strategy) or PR creation (pr strategy)
// itself. When it calls gt_done:
Expand Down