Skip to content

fix(api): fix addon invocation completion and rate limit UX#113

Merged
ericfitz merged 1 commit intomainfrom
fix/addon-invocation-quotas
Jan 24, 2026
Merged

fix(api): fix addon invocation completion and rate limit UX#113
ericfitz merged 1 commit intomainfrom
fix/addon-invocation-quotas

Conversation

@ericfitz
Copy link
Owner

Summary

Fixes addon invocation issues where users get 429 errors because invocations never complete:

  • Auto-complete invocations by default - Webhooks no longer need to call back unless they opt-in with X-TMI-Callback: async header
  • Increase default max active invocations from 1 to 3 concurrent
  • Enhanced 429 response with blocking invocation details (IDs, expiry times, retry-after)
  • Auto-infer server base URL for callback URLs if not explicitly configured

Changes

File Change
internal/config/config.go Add BaseURL field with GetBaseURL() auto-inference
api/addon_invocation_worker.go Use configured base URL, implement X-TMI-Callback auto-complete
api/addon_invocation_quota_store.go Change DefaultMaxActiveInvocations from 1 to 3
api/addon_invocation_store.go Add ListActiveForUser interface and Redis implementation
api/addon_rate_limiter.go Enhanced 429 response with blocking_invocations array
api/request_utils.go Add Retry-After header for 429 responses
cmd/server/main.go Wire up base URL to addon invocation worker
docs/developer/addons/addon-development-guide.md Document callback modes

Behavior Changes

  1. Invocations auto-complete by default - When webhook returns 2xx without X-TMI-Callback: async, invocation is marked completed
  2. 3 concurrent invocations allowed (was 1)
  3. 429 responses include helpful details:
    • blocking_invocations[] with invocation IDs, addon IDs, status, expiry times
    • retry_after seconds until oldest invocation times out
    • Retry-After HTTP header per RFC 6585
  4. Base URL auto-inferred from interface, port, and tls_enabled if not set

Test plan

  • make lint - 0 issues
  • make build-server - SUCCESS
  • make test-unit - All passed
  • Manual test: invoke addon, verify auto-complete
  • Manual test: invoke 3+ addons, verify 429 with details

🤖 Generated with Claude Code

- Auto-complete invocations by default (opt-in to async with X-TMI-Callback header)
- Increase default max active invocations from 1 to 3
- Add detailed 429 response with blocking invocation info and Retry-After header
- Auto-infer server base URL for callback URLs if not configured
- Update addon and webhook documentation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@dosubot dosubot bot added the bug Something isn't working label Jan 23, 2026
@ericfitz ericfitz merged commit df41a38 into main Jan 24, 2026
7 checks passed
@ericfitz ericfitz deleted the fix/addon-invocation-quotas branch January 24, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant