Uh oh!
There was an error while loading. Please reload this page.
fix(delete): don't brick local teardown when the revoke isn't a 403 - #205
Conversation
…sn't a 403
runDelete treated the credential revoke as a hard gate: only HTTP 403 was
special-cased (ask-an-admin); every OTHER RevokeClient error returned
exitError{code:1} and short-circuited the entire offboard — helm uninstall, k3d
teardown, image prune, ~/.tracebloc wipe, and self-remove never ran. So a stale/
wrong-account active-client pointer (account-scoped 404), a backend predating the
/edge-device/<id>/revoke route (404), or a transient network/5xx blip left the
machine fully installed with no escape (--force only skips the online guard).
That contradicts the same function's online-guard, which already treats
5xx/429/network as "warn and continue — the teardown is the real gate," and its
own comment anticipating a 404 revoke.
Fix: non-403 revoke failures now warn and continue into the (offline-capable)
local teardown, mirroring the online guard. 403 still routes to ask-an-admin
(unchanged, still tested). "Revoked …" is printed only on actual success; the
warn path says the credential may still be live (revoke from the dashboard; the
orphan reaper backend#970 sweeps a never-torn-down record later).
Test: TestDelete_RevokeNon403_ContinuesTeardown (404 revoke → teardown still runs,
honest warning, no false "revoked" claim). Existing TestDelete_RevokeForbidden
(403 → ask-an-admin) unchanged. Full suite green; gofmt -s / errcheck /
ineffassign clean.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 68284b2. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Addresses @saadqbal's #205 review: - 426 revoke now fails fast with the upgrade prompt (mirrors the pre-offboard guard) instead of warn-and-continue into a teardown the backend can't process. - 401 revoke now fails fast to re-login. The --force footgun: with --force the online guard is skipped, so an expired session used to silently tear the machine down while leaving a live credential; now it aborts to sign-in. - Track whether the server-side revoke actually succeeded; the closing summary is honest on BOTH axes (revoke status x teardown status) and no longer claims the credential is revoked / the machine disconnected when the revoke failed. - Fix the now-false "credential is already revoked" comment on the teardown block. - Tests: 404 + no-namespace honest closing (the degraded+revoke-failed case the old test never reached), plus 426 and 401 revoke fail-fast. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
LukasWodka
commented
Jul 10, 2026
Thanks @saadqbal — all addressed in 426 revoke → terminal (Bugbot HIGH). The revoke branch now mirrors the pre-offboard guard: a 426 fails fast with the upgrade prompt instead of warn-and-continuing into a teardown the backend can't process. Closing summary no longer overclaims (Bugbot MED + your note). Added a 401 → terminal (your minor, but a real Test gap closed. You were right that the old 404 test never reached the degraded branch. Added:
|

Summary
tracebloc deletetreated the server-side credential revoke as a hard gate: only HTTP403was special-cased (ask-an-admin); every otherRevokeClienterror returnedexitError{code:1}and short-circuited the entire offboard — helm uninstall, k3d teardown, image prune,~/.traceblocwipe, and self-remove never ran. The machine was left fully installed with no escape (--forceonly skips the online guard).Realistic triggers, all leaving the user stuck:
404;/edge-device/<id>/revoke→404;This directly contradicts the same function's online guard 40 lines above, which treats
5xx/429/networkas "warn and continue — the teardown is the real gate," and its own comment anticipating a404from the revoke.(Found by an adversarial bug-hunt of the installer + CLI.)
Fix
Non-403 revoke failures now warn and continue into the offline-capable local teardown (removing tracebloc from this machine is the command's primary job — it can't be held hostage to a best-effort remote call).
403still routes to ask-an-admin — a genuine authorization decision — unchanged."Revoked …"prints only on actual success; the warn path is honest that the credential may still be live (revoke from the dashboard; the orphan reaper backend#970 sweeps a never-torn-down record later).Tests
TestDelete_RevokeNon403_ContinuesTeardown— a404revoke → teardown still runs, honest warning, no false "revoked" claim. ExistingTestDelete_RevokeForbidden_OffboardCopy(403 → ask-an-admin) unchanged. Fullgo test ./...green;gofmt -s/errcheck/ineffassignclean.Type
Bug fix (offboard reliability) · cli · HIGH.
Note
Medium Risk
Changes offboard control flow and credential lifecycle messaging; a failed revoke can leave a live server credential until dashboard/reaper cleanup, but 401/426 paths prevent silent teardown with stale sessions.
Overview
tracebloc deleteno longer aborts the whole offboard when server-sideRevokeClientfails with anything other than a terminal auth/upgrade case. Previously only HTTP 403 was special-cased; 404, 5xx, and network errors returned exit 1 and skipped helm uninstall, cluster teardown, data wipe, and self-remove.Non-403 failures (except 401 and 426) now warn and continue into offline-capable local teardown, aligned with the pre-offboard online guard. 403 still routes to ask-an-admin. 426 and 401 on the revoke step fail fast (no teardown)—especially important under
--force, which skips the guard—so users aren't left with a wiped machine and a still-live credential.A
revokedflag drives honest UX: success text prints only when revoke actually succeeded; the final summary is a four-way split on revoke outcome × teardown completeness (degraded), instead of always claiming the machine is disconnected.Reviewed by Cursor Bugbot for commit ec884f9. Bugbot is set up for automated code reviews on this repo. Configure here.