Implement Redis-orchestrated Stripe webhook pipeline with Jules worker and optional AI routing#356
Merged
Merged
Conversation
Copilot created this pull request from a session on behalf of
LVT-ENG
June 3, 2026 03:59
View session
Member
|
Entendido. Para que tengas visibilidad absoluta de tus cobros a partir de este momento, el protocolo es el siguiente:
|
Member
|
Yes |
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.
This PR replaces the minimal
/api/webhookhandling with a fully wired, production-style orchestration: Stripe-verified ingestion, fast HTTP acknowledgment, Redis-backed state management, and asynchronous processing via Jules. It also formalizes decision/execution separation and optional AI enrichment through provider routing.Webhook ingestion and fast-ack path
api/webhook.pyand wiredapi/index.pyto delegate/api/webhook.stripe.Webhook.construct_event) and explicit 400s for invalid payload/signature.event_id) before enqueue, then persist+enqueue and immediate 200 response.Redis-backed orchestration primitives
EventStore(api/services/event_store.py) for canonical event state (received/queued/retrying/completed/dead_letter), attempts, trace metadata, and TTL.QueueService(api/services/queue_service.py) for main queue, retry scheduling (ZSET + exponential backoff), and DLQ flow.api/services/redis_lock.py) with safe token-based release script.Jules worker, decision engine, execution engine
api/orchestrators/jules_worker.pyas independent async worker process.Decisionmodel +decide_event_flow(...)(api/models/decision.py,api/orchestrators/decision_engine.py) to standardize action selection by event type/state/context.execute_event_flow(...)(api/orchestrators/execution_engine.py) to keep execution separate from decisioning.api/handlers/stripe_handlers.py) for:payment_intent.succeededpayment_intent.payment_failedcheckout.session.completedcharge.refundedAI provider abstraction and safe routing
api/providers/ai/base.py) and router (api/providers/ai/router.py).GoogleAIStudioProviderandManusAIProviderwith timeout handling and bounded retries.Configuration and runtime wiring
api/config.py(Stripe/Redis/retries/locks/AI/provider selection).api/utils/logging.py) includingevent_id,event_type,trace_id..env.examplewith all required operational vars.api/requirements.txt) and rootrequirements.txt.app.pyentrypoint and package__init__.pyfiles for clean module imports.Hardening pass (staff-level corrections)
ExceptionType: message) for triage.