fix(api): add structured logs for sandbox delete 500/404 paths - #3530
Open
AdaAibaby wants to merge 1 commit into
Open
fix(api): add structured logs for sandbox delete 500/404 paths#3530AdaAibaby wants to merge 1 commit into
AdaAibaby wants to merge 1 commit into
Conversation
AdaAibaby
requested review from
ValentaTomas,
dobrac and
jakubno
as code owners
August 4, 2026 06:12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3529
Problem
DeleteSandboxesSandboxIDhas three logging gaps:ErrSandboxOperationFailed→ 500 with no log or telemetry — the most common 500 cause (node unreachable, gRPC error) emits nothing to Loki and records no span error.deleteSnapshotfailure message is ambiguous —"error deleting sandbox"does not distinguish kill failure from DB failure.Debuglevel, noteamID— suppressed in production; 404 frequency per team is invisible.Changes
packages/api/internal/handlers/sandbox_kill.go:ErrSandboxOperationFailedError+sandbox_id+team_id+zap.Error+telemetry.ReportErrordeleteSnapshot != niltelemetry.ReportErroronlyErrorlog with distinct message "Failed to delete sandbox snapshot from DB"defaultunexpected errortelemetry.ReportErroronlyErrorlog addedErrSandboxNotFoundDebugInfo+team_idDebug, noteam_idInfo+team_id, message "not running and no snapshot"Why this is not a duplicate
Searched open PRs for
sandbox delete log,sandbox kill log,sandbox 500 log— no existing PR covers this.Test plan
go build ./packages/api/internal/handlers/passesgo vet ./packages/api/...passes"Failed to kill sandbox on orchestrator node"in Loki withsandbox_idandteam_id"Sandbox not found: not running and no snapshot"atInfolevel/cc @jakubno @dobrac @ValentaTomas @arkamar @tvi @tomassrnka Looking forward to your code review.