feat(temp-vc): spawn failure handling: hub chat message, last failure per hub, Sentry once per streak - #303
Merged
Merged
Conversation
…failure per hub, and Sentry once per streak A failed create sends one message in the hub channel's text chat that mentions the member alone: the area is full when Discord reports the category or guild cap, otherwise the failure has been reported. No DM, no disconnect, and the bot never deletes it. A create that succeeds and a move-into that fails is the same failure: the new channel goes through the empty-channel delete path and the message goes out only when the runtime's own occupancy map still has the member in the hub. The runtime keeps each hub's last spawn failure in memory as time and cause, read by LastSpawnFailure for the panel and cleared by the next successful spawn from that hub. A hub with no category records "no category", makes no API call and never reaches Sentry. Create failures Discord returned (the cap, 403, 429, 5xx, transport) capture once per streak per hub: the first failure captures and the next capture waits for a successful spawn. Delete failures follow the same rule for 403, 5xx and transport; a 429 is a WARN line only and Unknown Channel stays quiet cleanup. temp_vc_errors.go classifies the spawned channel paths apart from the warden classifier, whose not-found branch would page on Unknown Channel. The category cap is a 400 50035 whose body carries CHANNEL_PARENT_MAX_CHANNELS, a shape taken from Discord's docs and not yet seen from a live refusal. Refs #290
…code review The once-per-streak check-and-set was written twice, once for creates and inline for deletes. captureOncePerStreak takes the set. The classifier's field for 403, 5xx and transport is hardFault, since a 403 is no outage, and the delete path reads capturesOnDelete instead of the raw field. deleteIfStillEmpty classifies inside the switch, so a nil error is not classified. RemoveHub no longer clears failure state: the ticket did not ask for it and a re-registered hub gets a new row ID. One test added with the seam sniffer's approval: a create refused by the guild cap leaves the hub's last failure with the full cause. Refs #290
commands/temp_vc.go: revise "<@%s> your channel could not be created. The failure has been reported." to "<@%s> Cavbot could not create your channel. The error has been reported to S6." commands/temp_vc.go: revise "<@%s> this area is full. Wait for a channel to empty, then join again." to "<@%s> this category is full. Wait for a channel to empty, then join again." commands/temp_vc.go: revise SpawnFailureNoCategory "no category" to "hub channel has no category" commands/temp_vc.go: revise SpawnFailureFull "full" to "this area is full" commands/temp_vc.go, CLAUDE.md: comments and the CLAUDE.md sentence that quote the two member texts follow the new wording Review: https://claude.ai/artifact/66Yxk53o26p8YWwY6MSXHV
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.
Closes #290. Spec: #285.
What changed
A failed create sends one message in the hub channel's text chat that mentions the member alone. The area is full when Discord reports the category or guild cap. Otherwise the failure has been reported. No DM, no disconnect, and the bot never deletes the message. A create that succeeds and a move-into that fails is one failure: the new channel goes through the empty-channel delete path, and the message goes out only when the runtime's own occupancy map still has the member in the hub.
The runtime keeps each hub's last spawn failure in memory as time and
SpawnFailureCause.LastSpawnFailure(hubID)is the reader for the panel. The next successful spawn from that hub clears it. The store writes nothing for a failure. A hub with no category recordsno category, makes no API call and never reaches Sentry.Create failures Discord returned capture once per streak per hub: the cap, 403, 429, 5xx, transport. The first failure captures and the next capture waits for a successful spawn from that hub. Delete failures follow the same shape for 403, 5xx and transport. A 429 on delete is a WARN line only. Unknown Channel stays quiet cleanup.
commands/temp_vc_errors.goclassifies the spawned channel paths on its own. The warden classifier is untouched, so its not-found branch still pages on the warden paths.TempVCManagergrowsChannelMessageSendComplex. The adapter passesWithRetryOnRatelimit(false)like every other call.Two readings to confirm
For the smoke test
The category cap has no Discord error code of its own. The classifier reads a
40050035body forCHANNEL_PARENT_MAX_CHANNELSunderparent_id. That shape comes from Discord's documented form-error format, not from a live refusal. Fill a category to 50 on the test guild and check the member gets the "full" text. A failed create on a hub whose text chat the bot cannot post in is the other path worth one join.Tests
Eight new tests at the seams a seam-sniffer review approved: the fake manager, the
captureErrorseam,store.NewFake()and a pinned clock. They assert the message's channel, allowed mentions and user ID, that the cap and generic texts are two texts under one fixture, the move-into cases, the last failure read back, capture counts over a streak and after a success, and the delete classification table. No test asserts log wording or message copy.CI gate run locally: lint, tidy, race tests with coverage floors (
commands93.4%), build.Docs
CLAUDE.md's runtime section and the #278 row of
docs/temp-vc-decisions.mdrecord the delete classification and the category cap shape.