bunkerd-destroy-home-archive-deadline-kills-destroy
I diagnosed the failure against the actual deployBunker/bunker source (cloned from GitHub) and produced a verified write-up at /workspace/solution.md.
internal/agent/manager_destroy.go (DF-BUNKER-33) archives + verifies the agent home with exec.CommandContext(ctx, "tar", "czf", ...) before userdel -rf, and fails closed (status: home_retained) if the archive errors.ctx is the inbound RPC request context, so the caller's deadline propagates in.internal/cli/destroy.go hard-codes context.WithTimeout(..., 30*time.Second) (daemon request_timeout is 300 s, but the earliest deadline wins).node_modules home needs >30 s to gzip → the deadline SIGKILLs tar → signal: killed → archive error → home retained, userdel skipped, API maps to CodeInternal (500), registry row stays running, retries repeat.--force does not help (the archive gate runs before userdel and ignores force)..tar.gz files.tar -czf + tar -tzf verify → rm -rf node_modules .local .cache → re-run bunker destroy → verify home/user/registry gone. Includes a no-slim Connect/curl fallback and truncated-archive cleanup.context.WithoutCancel + configurable destroy_archive_timeout (default 30 m), write to .partial and rename only after verification, plus a --timeout on bunker destroy.signal: killed, home retained, 157 MB truncated artifact, then success after slimming) and after-fix go test/go build results.I applied and tested the durable patch in /tmp/bunkersrc (build + focused tests pass, including a new test proving an already-cancelled request context no longer aborts the archive). The write-up is self-contained and directly usable.
# Evidence - Problem class: bunkerd-destroy-home-archive-deadline-kills-destroy - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-23T07:03:03.712Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "bunkerd 0.1.4 destroy aborts with deadline_exceeded when the agent home is large (~1.4GB with node_modules): its archive-before-delete step gets `signal: killed` at the ~30s daemon deadline, home RETAINED, userdel never runs, and the destroy API returns 500 while the registry row stays running. Remedy: destroy fails on size, not corruption. (1) manually archive the home (ssh to daemon host, tar -czf /var/backups/bunker/<agent>.tar.gz -C /home <home>), (2) rm the heavy dirs from the home (node_modules/.local/.cache \u2014 the data of record is now in the archive), (3) re-run `bunker destroy` \u2014 the small remainder archives inside the deadline and userdel completes. Verified on bunker-mvp agent auger033b 2026-09-23: destroy deadline_exceeded x3 until home slimmed 1.4G->111M, then clean home+user removal.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "bunkerd-destroy-home-archive-deadline-kills-destroy", "provider": "openrouter", "solved_at": "2026-09-23T07:03:03.713Z", "version": ""}