Skip to content

fix(github-webhook): apply preview limit only to new previews - #5079

Open
NoiceHax wants to merge 1 commit into
Dokploy:canaryfrom
NoiceHax:fix/issue-4074
Open

fix(github-webhook): apply preview limit only to new previews#5079
NoiceHax wants to merge 1 commit into
Dokploy:canaryfrom
NoiceHax:fix/issue-4074

Conversation

@NoiceHax

@NoiceHax NoiceHax commented Aug 14, 2026

Copy link
Copy Markdown

The preview limit was checked before we looked up whether the pull request already had a preview. Once an app hit the limit, every synchronize event was dropped, so open previews stopped rebuilding while GitHub still got a 200 back.

I moved the check inside the branch that creates a new preview, so an update to an existing preview always goes through. Two smaller things in the same check. The fallback was || 0, so an app with no limit configured was treated as limit zero. It now uses ?? 3 to match the schema default. The comparison is >= instead of >, so a limit of 3 means 3 previews and not 4. Hitting the limit now logs a warning rather than dropping the event with no trace.

Tests are in apps/dokploy/test/deploy/github-webhook-handler.test.ts. The three new cases fail on canary and pass with this change. I could not run the suite locally, so please check CI.

Closes #4074

The preview deployment limit was checked before looking up whether the
pull request already had a preview, so once an application reached the
limit every `synchronize` event was dropped and existing previews went
stale while GitHub still saw a 200. The check now runs inside the branch
that creates a preview, uses the schema default of 3 when no limit is
configured (instead of 0, which blocked every app without an explicit
value) and compares with `>=` so the configured limit is inclusive.

Closes Dokploy#4074
@NoiceHax
NoiceHax requested a review from Siumauricio as a code owner August 14, 2026 05:08
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 14, 2026
@NoiceHax

Copy link
Copy Markdown
Author

Update on the testing note in the description. I have now run the tests locally, so please ignore the "could not run the suite" line above.

npx vitest run --config __test__/vitest.config.ts __test__/deploy/github-webhook-handler.test.ts passes, 7 tests. I then restored the canary version of pages/api/deploy/github.ts and re-ran the same file, and the 3 new tests fail there, so they do pin the regression rather than just passing by luck.

Running the whole test/deploy folder gives 4 failing files (application.real.test.ts, github.test.ts, should-deploy.test.ts, soft-serve.test.ts). Those fail identically on canary without my patch, they need nixpacks and docker swarm which I do not have locally. Not related to this change.

biome check is clean on both changed files.

One thing you may want to look at: the Pull Request and autofix.ci runs for this PR are sitting in action_required, so they never actually ran. They need approval before CI reports anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preview Deployment limit check blocks updating existing previews

1 participant