Skip to content

Declare OPEN_RUNTIMES_CODE_PATH on runtime containers - #253

Merged
loks0n merged 4 commits into
mainfrom
feat/runtime-code-path-env
Sep 1, 2026
Merged

Declare OPEN_RUNTIMES_CODE_PATH on runtime containers#253
loks0n merged 4 commits into
mainfrom
feat/runtime-code-path-env

Conversation

@loks0n

@loks0n loks0n commented Sep 1, 2026

Copy link
Copy Markdown
Member

What

  • Sets OPEN_RUNTIMES_CODE_PATH=/tmp/<sourceFile> on non-v2 runtime containers, derived from the same $sourceFile variable used to build the /tmp source mount.
  • Known archive formats keep their identity in the mounted name — .tarcode.tar, .sqfscode.sqfs, .erofscode.erofs — instead of everything non-tar being mislabeled code.tar.gz. Anything else keeps the legacy code.tar.gz name, which client commands reference regardless of the real format (zip sources, build artifacts stored as <uniqid>.gz).

Why

The open-runtimes start helper (extract.sh) extracts the archive named by OPEN_RUNTIMES_CODE_PATH directly into the function path. With the executor declaring it, orchestrators (e.g. Appwrite) can drop the cp /tmp/code.* /mnt/code/ prefix from their runtime entrypoints instead of duplicating the executor's internal archive naming. Squashfs sources previously only extracted because extract.sh sniffs magic bytes; their mounted name is now truthful.

Counterpart: appwrite/appwrite#13440

🤖 Generated with Claude Code

Set the env from the same $sourceFile used to build the /tmp mount, so
the start helper (extract.sh) extracts the archive in place and callers
no longer need a cp into /mnt/code in their runtime entrypoint.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR aligns non-v2 runtime container metadata with the mounted source archive path.

  • Preserves dedicated filenames for tar, SquashFS, and EROFS sources while retaining the legacy code.tar.gz fallback.
  • Declares OPEN_RUNTIMES_CODE_PATH for non-v2 runtimes when a source archive is present.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/Executor/Runner/Docker.php Updates source archive naming and exposes the corresponding mounted path to non-v2 runtime containers; no eligible follow-up defect was established.

Reviews (4): Last reviewed commit: "fix(runner): only known archive formats ..." | Re-trigger Greptile

loks0n and others added 3 commits September 1, 2026 18:12
The old naming special-cased .tar and mislabeled everything else as
code.tar.gz — including squashfs sources, which only worked because
extract.sh sniffs magic bytes. Keep the source's full extension chain
(code.tar.gz, code.tar, code.sqfs, code.erofs, ...) so the mounted name,
and the OPEN_RUNTIMES_CODE_PATH derived from it, stay truthful.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Stored build artifacts are named <uniqid>.gz (pathinfo drops the .tar),
so deriving the mount name from the source basename produced code.gz and
broke legacy cp-based entrypoints expecting /tmp/code.tar.gz.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The mounted name is a client contract — build commands reference
/tmp/code.tar.gz whatever the real format (zip sources, <uniqid>.gz
build artifacts). Keep identity only for tar, sqfs, and erofs sources.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@loks0n
loks0n merged commit 3379d31 into main Sep 1, 2026
7 checks passed
loks0n added a commit to appwrite/appwrite that referenced this pull request Sep 1, 2026
Ships OPEN_RUNTIMES_CODE_PATH on runtime containers
(open-runtimes/executor#253), which the entrypoints now rely on.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
loks0n added a commit to appwrite/appwrite that referenced this pull request Sep 1, 2026
* fix(builds): cap the billed build duration at the build timeout

Jobs::duration() measures wall clock from buildStartedAt, which the first
log callback stamps — so a build that never streamed a line falls back to
the deployment's creation time and measures its whole queue wait. That
value is what Usage\Build::publish() bills, at memory x duration x cpus,
and it is billed for 'failed' exactly as for 'ready'.

The executor backend could not produce this: it measured microtime()
around the build's own execution, so queue wait was structurally
unbillable. Since builds moved to the jobs-service the mean billed
duration of a *failed* build has gone 111s (Jun) -> 157s (Jul) -> 491s
(Aug) while successful builds held at ~52s, and failed builds are now 57%
of all billed build compute fleet-wide.

One production project shows the shape plainly: 2,286 of its 2,311 failed
August builds have buildStartedAt NULL, empty buildLogs, "exit code -1",
and durations at 904-912s. On s-2vcpu-2gb that is ~1.0 GB-hour billed per
build that never ran — 1,869 of its 1,878 billed GB-hours for the month.

Clamp to _APP_COMPUTE_BUILD_TIMEOUT, the same ceiling Deployments hands
the jobs-service as timeoutSeconds: no job outlives it, so nothing past it
can have been build time. Guarded so a 0 or negative value leaves the
measurement alone rather than zeroing every build.

This is a ceiling, not the whole fix — a starved build still bills the
full timeout. Billing 0 when buildStartedAt is NULL, and the build fan-out
that starves them, are follow-ups.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* test(builds): drop the build duration cap test

Removed at request; the cap in Jobs::duration() is unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* chore(compute): drop the cp into /mnt/code from runtime entrypoints

The executor now declares OPEN_RUNTIMES_CODE_PATH on runtime containers
(open-runtimes/executor#253), so the start helper extracts the archive
straight from the /tmp mount and the copy is dead weight on cold starts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* chore: bump openruntimes/executor to 0.29.0

Ships OPEN_RUNTIMES_CODE_PATH on runtime containers
(open-runtimes/executor#253), which the entrypoints now rely on.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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