Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
feat: add bounded issue-to-PR workflows#29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
20ea435
feat: add bounded issue-to-PR workflows
claude 0bdcf83
feat(github): report the issue validation verdict back on the issue
claude 415a5e3
fix(server): bind issue publication to checkout identity, verified sn…
RedStar071 60c0551
fix: require a GitHub remote host and claim issue deliveries durably
RedStar071 c5fad65
fix(server): create one durable delivery-claim store in the productio…
RedStar071 f22f6e3
fix: publish byte-exact snapshots and wire arbitrated durable deliver…
RedStar071 3181920
fix(server): arbitrate fallback delivery claims through a splitter
RedStar071 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { redactSecrets } from '@agent-zero/shared'; | ||
| import { defineHandler } from 'nitro'; | ||
| import type { EventHandlerWithFetch } from 'nitro/h3'; | ||
| import { githubTokenFromEnvironment, ingestWebhook } from '../../../src/router.js'; | ||
| import { json, messageOf } from '../../utils/respond.js'; | ||
| import { deliveryClaimStore, taskStore } from '../../utils/store.js'; | ||
| /** | ||
| * The production GitHub webhook entry point at `POST /webhooks/github`. | ||
| * | ||
| * This route only adapts transport: it maps headers and body onto the webhook contract and | ||
| * injects the deployment's durable stores. Signature verification, policy checks, delivery | ||
| * claims, and everything that can execute repository work stay behind `ingestWebhook`, and the | ||
| * durable `deliveryClaimStore` is what lets a redelivered issue event observe the recorded | ||
| * outcome across restarts and other instances instead of starting a duplicate run. Without a | ||
| * configured secret or checkout the route fails closed and ingests nothing. | ||
| */ | ||
| const route: EventHandlerWithFetch = defineHandler(async (event) => { | ||
| try { | ||
| const secret = process.env.GITHUB_WEBHOOK_SECRET; | ||
| if (!secret) return json(503, { error: 'GITHUB_WEBHOOK_SECRET is not configured' }); | ||
| const checkoutPath = process.env.AGENT_ZERO_CHECKOUT_PATH; | ||
| if (!checkoutPath) return json(503, { error: 'AGENT_ZERO_CHECKOUT_PATH is not configured' }); | ||
| const delivery = event.req.headers.get('x-github-delivery'); | ||
| const outcome = await ingestWebhook( | ||
| { | ||
| event: event.req.headers.get('x-github-event') ?? '', | ||
| body: await event.req.text(), | ||
| signature: event.req.headers.get('x-hub-signature-256') ?? undefined, | ||
| ...(delivery ? { delivery } : {}), | ||
| }, | ||
| { | ||
| secret, | ||
| checkoutPath, | ||
| store: taskStore, | ||
| deliveryClaims: deliveryClaimStore, | ||
| github: { token: githubTokenFromEnvironment() }, | ||
| }, | ||
| ); | ||
| // The response never carries the run's evidence or result; GitHub's delivery log only needs | ||
| // the disposition, and everything else is reachable through the authenticated control plane. | ||
| if (outcome.status === 'rejected') return json(400, { status: 'rejected' }); | ||
| if (outcome.status === 'ignored') | ||
| return json(200, { status: 'ignored', reason: outcome.reason }); | ||
| return json(200, { status: 'accepted', taskId: outcome.result.id }); | ||
| } catch (error) { | ||
| return json(500, { error: redactSecrets(messageOf(error)) }); | ||
| } | ||
| }); | ||
| export default route; |
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
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
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Uh oh!
There was an error while loading. Please reload this page.