Skip to content

Fix build timeout overrides and duration reporting - #13582

Merged
loks0n merged 15 commits into
mainfrom
codex/fix-build-timeout-reporting
Sep 14, 2026
Merged

loks0n merged 15 commits into
mainfrom
codex/fix-build-timeout-reporting

Conversation

@loks0n

@loks0n loks0n commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Build submission always read the global timeout, so downstream editions could not apply a project-specific budget. Require a numeric timeout on each createFromUpload, createFromRef, createFromUrl, and createFromVcs call. The service stores no timeout. The submitted value governs the job, ephemeral API key, and source-download token.

HTTP actions pass the configured build budget through shared redeployment helpers. Queued template builds pass the timeout already in their message. The existing VCS tenant-validation hook may return a tenant budget; otherwise webhook creation uses the operator setting. CE receives no plan object.

Completed jobs also capped buildDuration at the global timeout. Persist the orchestrator exit callback's durationSeconds and preserve it through the artifact/completion join, including zero-runtime failures. Older callbacks retain an uncapped elapsed-time fallback. A 1,341.36-second worker now records 1,342 seconds instead of 900, and delayed callbacks do not inflate measured runtime. Output-upload failures finalize immediately, with nullable duration left unknown if exit has not arrived. A late exit fills duration and publishes usage once without repeating finalization; if exit is lost, the build remains failed and unknown compute is not billed. Build usage consumes that same measurement. CE gains no plan or billing-entitlement dependency.

Test Plan

  • Existing CE deployment suite passes: 14 tests / 23 assertions. Its fixture supplies the required creation-call argument.
  • The existing Functions deployment E2E checks a deliberate three-second workload against its externally measured submission-to-ready interval and cleans up its fixture. Sites and Realtime permit valid zero-duration builds without synchronization sleeps.
  • Targeted PHPStan and Pint passed; diff checks pass. CI passed on 51b91bb3a22ecd467875eb86639226fea20be397, including Functions, Sites, Realtime and Migrations. Greptile reviewed this head at 5/5.
  • No staging drill was run. Before rollout, run a build longer than 900 seconds with an overridden budget and verify the job deadline, reported duration, and usage.

Related PRs and Issues

Companion Cloud PR: https://github.com/appwrite-labs/cloud/pull/5744. It supplies the owning organization's timeout and pins this commit. Merge CE first; update the downstream pin if the merge changes the commit SHA.

Checklist

  • Read the contributing guidelines and repository instructions.
  • No API metadata changes requiring regenerated specs or examples.

@github-actions

github-actions Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → codex/fix-build-timeout-reporting (after).

Metric Before After Change
🚀 Requests/sec 186.99 188.01 ⚪ +0.5%
⏱️ Latency P50 91.78 ms 91.36 ms ⚪ -0.5%
⏱️ Latency P95 222.58 ms 216.49 ms ⚪ -2.7%
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 91.36 216.49 11,799 188.01 -6.09
Account 182.89 325.33 621 10.3 -15.76
TablesDB 87.65 166.98 6,417 104.52 +1.37
Storage 86.29 186.78 3,105 52.42 -1.5
Functions 133.6 269.23 1,656 28.83 -3.41

Top API waits (after)

API request Max wait (ms)
functions.create 687.43
account.name.update 555.83
account.prefs.update 480.21
tablesdb.rows.create 417.94
storage.files.create 411.25

@loks0n
loks0n force-pushed the codex/fix-build-timeout-reporting branch from ec1d696 to 93108fe Compare September 9, 2026 15:05
@loks0n
loks0n marked this pull request as ready for review September 9, 2026 15:05
@greptile-apps

greptile-apps Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no outstanding or newly introduced actionable issue remains at the current head.

Summary

  • Adds request-scoped build-timeout wiring across function, site, template, duplicate, upload, VCS, and webhook deployment paths.
  • Persists valid orchestrator exit durations and coordinates late or out-of-order callbacks without duplicate finalization or usage publication.
  • Preserves an elapsed-time fallback for legacy callbacks while preventing callback delay from inflating completed-build duration.
  • Updates deployment and E2E fixtures for the required timeout argument, duration behavior, and resource cleanup.
  • The sole remaining finding from the prior review was correctly withdrawn after PHPUnit semantics were verified.

Reviews (14) · Last reviewed commit: "test: check reported build duration agai..."

@loks0n
loks0n force-pushed the codex/fix-build-timeout-reporting branch from 811e60e to 6b323da Compare September 14, 2026 10:45
@loks0n
loks0n force-pushed the codex/fix-build-timeout-reporting branch from 6b323da to 2b147bf Compare September 14, 2026 11:28
@loks0n

loks0n commented Sep 14, 2026

Copy link
Copy Markdown
Member Author

@greptileai please re-review the current head. The sole remaining finding was withdrawn in discussion_r4005831648 after verifying PHPUnit argument semantics; please refresh the summary to reflect that review.

@loks0n
loks0n merged commit 978aff9 into main Sep 14, 2026
54 checks passed
@ChiragAgg5k ChiragAgg5k mentioned this pull request Sep 15, 2026
1 of 2 tasks
NancyWei123 pushed a commit to NancyWei123/appwrite that referenced this pull request Sep 30, 2026
When a build's exit callback carries no measured duration, Jobs::duration()
falls back to wall clock since buildStartedAt. appwrite#13582 removed the clamp
from appwrite#13430 so measured durations past the timeout (termination grace) are
kept, but that also left the fallback unbounded: an exit reported seven
weeks after its build started was billed as 50 days of build compute.

The build's timeout now travels in the job's meta and comes back on its
exit callback. The fallback is capped at that timeout plus the 300s of
headroom Deployments already grants the build's credentials, or at
_APP_COMPUTE_BUILD_TIMEOUT for jobs submitted before this change.
Measured durations are unchanged.

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.

1 participant