Repository navigation
improvement(media): record a hosted-key auth failure when fal refuses Sim's account - #9593
Merged
Merged
Conversation
… Sim's account Mothership's generate_audio and generate_video call fal on Sim's hosted keys outside the tool executor, so a refused account (revoked key, or a lock for an exhausted balance) only reached logs. The submit path now records a Sim/HostedKey Failed point with reason auth on a 401, 402 or 403, the same series the hosted-key dashboard already plots for executor tools, so an alarm on that reason covers fal too.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
Contributor
[Low impact] The PR appears safe to merge; no blocking issues remain. SummaryRecords hosted fal submit failures for 401, 402, and 403 responses in the existing
Reviews (2) · Last reviewed commit: "improvement(media): label fal auth failu..." · Reviewed by Greptile |
…use the shared env-flags mock getFalApiKey now returns the env var its key came from, so a refused key in the numbered pool is named on the metric. The metrics module reads isHosted on each call instead of copying it at import, and the test sets it through the central env-flags mock under fake timers.
Collaborator
Author
Collaborator
Author
|
@cubic-dev-ai review this PR |
Contributor
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
This branch was successfully deployed
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.
Summary
Mothership's
generate_audioandgenerate_videocall fal throughrunFalQueueon Sim's hosted keys (getFalApiKey). They don't go through the tool executor, so they never wrote theSim/HostedKeyseries the executor tools write. If fal refused the account (a revoked key, or a lock for an exhausted balance), every generation failed, and the only trace was an ERROR log line nothing alerts on.Now, when the submit gets a 401, 402 or 403, it records one
Failedpoint withProvider=falai,Tool=<generate_audio|generate_video>andReason=auth. That is the same metric and reason the executor records throughclassifyHostedKeyFailure. The existing hosted-key dashboard picks it up, and one alarm onReason = 'auth'would cover fal as well as every executor hosted key.A 422 or any other input rejection records nothing, so a bad prompt can't look like an account problem. The request and the error message are unchanged.
Type of Change
Testing
lib/media/falai-hosted-key-metrics.test.tsdrivesrunFalQueueagainst a stubbed fal submit and captures whatPutMetricDatasends. Only the CloudWatch SDK is mocked; the real metrics buffer and flush run.Failedpoint withReason=auth.bun run --cwd apps/sim test lib/mediapasses (66 tests). Biome,check:test-patterns,check:comment-hygieneandcheck:explicit-anypass.Checklist