Skip to content

fix(vcs): skip GitHub resources whose installation has no owner instead of failing the webhook - #14119

Merged
ChiragAgg5k merged 4 commits into
mainfrom
fix/vcs-push-owner-login
Oct 5, 2026
Merged

ChiragAgg5k merged 4 commits into
mainfrom
fix/vcs-push-owner-login

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

A GitHub push or pull-request webhook returns 500 when GET /app/installations/{id} comes back without account.login. GitHub::getOwnerName() threw a plain Exception, createGitDeployments collected it as an error for that linked resource, and after the loop the whole event failed with general_unknown. Without an owner, Appwrite can't post comments or commit statuses for that installation, and its token can't clone the repository either.

  • packages/vcs: GitHub::getOwnerName() now throws a typed Utopia\VCS\Exception\OwnerNotFound when GitHub answers 404 for the installation. It extends \Exception, so existing callers behave the same. Adapter::call() does not throw on HTTP errors, so the status is checked explicitly. A rate limit (403/429), a 5xx, or a 200 without account.login still throws the plain Exception, and the webhook still fails so GitHub redelivers it.
  • createGitDeployments catches OwnerNotFound per repository and skips that resource. It records build.skipped / build.skipped.reason = owner not found on the span and logs a warning, the same way it handles the existing skip reasons (resource not found, branch, path). The other linked resources in the push are unaffected and the webhook returns 200.

The payload's repository.owner is not used as a substitute owner. The external-contributor authorize flow passes the fork's owner (head.repo.owner.login) into createGitDeployments, so comments and statuses would go to the wrong repository.

Sentry: CLOUD-29EK, CLOUD-35FH, CLOUD-3AM7 (Owner name retrieval response is missing account login.).

Test Plan

  • Unit tests in packages/vcs/tests/GitHubTest.php fake the installation response by overriding call(). A 404 throws OwnerNotFound; 403, 429 and 502 throw an exception that is not OwnerNotFound; a 200 with a login returns it. The 404 case fails against main, and the transient cases fail against this PR's first commit, which treated every missing login as OwnerNotFound.
  • There is no E2E for the webhook skip itself. Reaching it needs an installation that has been removed while its tokens are still cached, which the E2E suite can't produce.
  • composer lint, PHPStan and Rector on the changed files, bin/monorepo check vcs, and the vcs unit suite (125 tests).

Related PRs and Issues

  • Replaces appwrite-labs/cloud#6277, which worked around this in cloud.

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

Related: #14124

…er instead of failing the webhook

When GET /app/installations/{id} has no account.login, getOwnerName threw a plain Exception that createGitDeployments collected and turned into a 500 for the whole push, even though nothing can be built or reported for that installation. GitHub now throws a typed OwnerNotFound and the deployment loop skips that resource like the other skip reasons.
@ghost

ghost commented Oct 5, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

Introduces a typed OwnerNotFound exception for GitHub installation owner lookup failures. Deployment processing catches it per linked resource, records a skip, and logs a warning instead of failing the webhook. An E2E test checks the exception for an unknown installation.

Verdict New comments Fixed Still open
🛑 Changes requested 0 0 0
📂 Walkthrough · 4
File Change
packages/vcs/src/Adapter/Git/GitHub.php Throws OwnerNotFound when the installation response lacks account.login.
packages/vcs/src/Exception/OwnerNotFound.php Adds the typed exception.
packages/vcs/tests/E2E/GitHubTest.php Tests lookup of an unknown GitHub installation.
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php Handles OwnerNotFound as a logged resource skip.

Reviewed 2a8fa6d · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Tier B · 1 blocking finding to address. Summary

Comment thread packages/vcs/src/Adapter/Git/GitHub.php Resolved
Comment thread packages/vcs/tests/E2E/GitHubTest.php Resolved
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/vcs-push-owner-login (after).

Metric Before After Change
🚀 Requests/sec 207.31 210.59 ⚪ +1.6%
⏱️ Latency P50 82.81 ms 82.32 ms ⚪ -0.6%
⏱️ Latency P95 198.96 ms 189.39 ms ⚪ -4.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 82.32 189.39 13,338 210.59 -9.56
Account 162.01 305.84 702 11.65 -28.64
TablesDB 80.01 147.02 7,254 117.11 +1.48
Storage 73.81 156.52 3,510 58.12 -7.51
Functions 117.16 228.14 1,872 31.68 -26.48

Top API waits (after)

API request Max wait (ms)
account.name.update 468.45
account.prefs.update 414.65
functions.variables.update 361.07
tablesdb.rows.get 358.38
tablesdb.rows.update 335.68

Adapter::call() does not throw on HTTP errors, so a rate-limited or failed installation lookup also lacked account.login and was being skipped as if permanent. Only a 404 now raises OwnerNotFound; every other failure keeps failing the webhook so GitHub redelivers it. The regression test moves from a live GitHub E2E call to unit tests over a faked response.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ChiragAgg5k
ChiragAgg5k merged commit 85350ae into main Oct 5, 2026
59 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/vcs-push-owner-login branch October 5, 2026 08:57
@ChiragAgg5k ChiragAgg5k self-assigned this Oct 5, 2026
abnegate added a commit that referenced this pull request Oct 5, 2026
Merges main a2cca78 (#14009, #14106, #14117, #14115, #14119, #14114,
#14101, #14125, #14129, #14127) so cloud#5410 can require a train head
that contains main at or after 0ed7232.

Conflicts: none.

Database 8.0 port: none needed. Main's new code only uses Document
getAttribute/setAttribute and Query::equal/lessThan/orderAsc/limit
(Tasks/Interval.php), all unchanged in database 8.0; no removed
Database::* constants, config collections, or model magic reads.
composer.json and composer.lock are untouched by main, so the train's
database and migration pins stay as they are.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants