feat(#29): async NanaBanana webhook processing with DLQ & polling fal… - #187
Merged
Darkvader-ship-it merged 2 commits intoAug 31, 2026
Merged
Conversation
…& polling fallback
- lib/generation-job-store.ts: persistent file-based job store (generationJobs +
generationDlq sidecars); jobs keyed by txHash for client polling; full CRUD
by txHash/taskId/id; automatic pruning (4h completed, 24h pending, 7d DLQ)
- lib/forge-nanobanana.ts: extract submitGenerateTask(); add
submitForgeImageTaskViaNanobananaApi() (returns taskId immediately, no poll);
add nanobananaAsyncWebhookEnabled() helper (requires NANOBANANA_WEBHOOK_SECRET
+ NANOBANANA_CALLBACK_URL)
- app/api/webhooks/nanobanana/route.ts: full implementation replacing stub;
HMAC-SHA256 signature verification against NANOBANANA_WEBHOOK_SECRET;
DLQ entries on sig failure / parse error / task failure; background pipeline
continuation (lore → IPFS → mint) after successful webhook delivery
- app/api/jobs/[txHash]/route.ts: new client polling endpoint; returns job
status (pending/processing/webhook_received/completed/failed) + result
- app/api/forge-agent/route.ts: when async webhook mode active + txHash known,
submits image task asynchronously and returns {async:true, jobId, txHash};
falls back to synchronous runForgePipeline on overload or unconfigured mode;
also fixes pre-existing typos (static const, randomUUId, catc, WWA-Authenticate)
- app/forge/page.tsx: initiateAgentForge() detects async:true response and
polls /api/jobs/[txHash] every 3.5s (4-min client timeout) until completed
or failed; sync path unchanged for fallback
Closes PHASE-STELLAR#29
|
@Peace-001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
…lback
lib/generation-job-store.ts: persistent file-based job store (generationJobs + generationDlq sidecars); jobs keyed by txHash for client polling; full CRUD by txHash/taskId/id; automatic pruning (4h completed, 24h pending, 7d DLQ)
lib/forge-nanobanana.ts: extract submitGenerateTask(); add submitForgeImageTaskViaNanobananaApi() (returns taskId immediately, no poll); add nanobananaAsyncWebhookEnabled() helper (requires NANOBANANA_WEBHOOK_SECRET
app/api/webhooks/nanobanana/route.ts: full implementation replacing stub; HMAC-SHA256 signature verification against NANOBANANA_WEBHOOK_SECRET; DLQ entries on sig failure / parse error / task failure; background pipeline continuation (lore → IPFS → mint) after successful webhook delivery
app/api/jobs/[txHash]/route.ts: new client polling endpoint; returns job status (pending/processing/webhook_received/completed/failed) + result
app/api/forge-agent/route.ts: when async webhook mode active + txHash known, submits image task asynchronously and returns {async:true, jobId, txHash}; falls back to synchronous runForgePipeline on overload or unconfigured mode; also fixes pre-existing typos (static const, randomUUId, catc, WWA-Authenticate)
app/forge/page.tsx: initiateAgentForge() detects async:true response and polls /api/jobs/[txHash] every 3.5s (4-min client timeout) until completed or failed; sync path unchanged for fallback
Closes #29