Containers: jobs, HTTP services, and workers
Containers run a prebuilt OCI image when an app needs native tools, a long job, an HTTP server, or a continuous process. Functions remain the entry point for app Data, Files policies, integrations, and other platform capabilities.
Availability and client versions
Container compute is available on compute-enabled installations where the operator supplies eligible compute hosts, turns on the container-compute feature flag for the app owner or organisation, and configures funding.
Use schema 3 and the paired SDK 2.9.0 for the APIs below. The container CLI commands and container-frontend bundling need public CLI 3.22.0 or newer (current pinned release 3.22.1), which the normal installer installs. Earlier CLIs can't perform these compute workflows.
Check that containers are available
An installation runs containers only when its operator has set them up. Ask it directly; this needs no sign-in, and the CLI doesn't show it:
curl -s https://api.<base-domain>/v1/installationAn installation that runs containers answers with a capabilities.compute object whose jobs, services, workers and containerFrontend are true. Without compute the compute field is missing. Such an installation fails validation, dev sessions and deploys of every manifest that declares containers with COMPUTE_NOT_OFFERED ("This installation doesn't offer containers"; retrying won't help), and its MCP server lists no container tools.
On an installation that runs containers, validation, dev sessions, deploys and new jobs also check two things, and fail with COMPUTE_NOT_ENABLED when either is missing:
- the
container-computefeature flag for the app owner or their organisation, which a platform administrator turns on ("Container compute is not enabled for this account"); - funding for the app's payer (see Funding and usage). Payer administrators can check it with
opencloud compute settings.
An app manifest cannot enable an unavailable capability, select a payer, grant billing consent, or increase an operator limit.
Choose a workload
| Kind | Use it for | Lifetime and billing |
|---|---|---|
job | Media conversion, imports, batch processing | One execution with a deadline; billed while its process runs |
service | An HTTP application, API, SSE or WebSocket endpoint | Scales within declared bounds; every running instance is billed, including idle minimum instances |
worker | Polling, long-running consumers, continuous coordination | Fixed desired replicas; billed continuously while running, even when idle |
Function queues execute declared Functions. They are a separate API from container jobs. A service can scale down, so put continuous work in a worker rather than relying on an HTTP instance to stay alive. Workers must checkpoint durable progress and tolerate restart. Multiple replicas need application-level coordination.
Each running copy of a container is an instance; the dashboard, the CLI and the logs name it by its instanceId.
Images and isolation
Build and push a Linux amd64 CPU image before validation. OpenCloud does not build Dockerfiles. Validation resolves the image to an immutable digest and retains it in the installation's compute registry; changing an upstream tag does not change an existing validated revision. A new image needs a new validation and release. Images are limited to 5 GiB compressed and 10 GiB unpacked, subject to lower installation limits.
Private registries
A public image needs nothing else. For an image in a private registry, create an app-bound registry connection once and name it in each container that uses it. Public CLI 3.22.0 or newer (v3.22.1 pinned) has containers registry list|create|remove; create reads the password from --password-stdin, never from an argument:
printf '%s' "$REGISTRY_PASSWORD" | opencloud containers registry create "$APP_ID" \
--name team-registry --host registry.example.com --username ci-bot \
--password-stdin --idempotency-key registry-create-001Put the returned id in the container's registryConnection:
containers:
- name: report
kind: job
image: registry.example.com/team/report:1
registryConnection: 3b8e3f9a-6f4e-4d8a-9a6e-2c1d5b7e9f10
job: {}The image reference must start with exactly the connection's host; otherwise validation fails with COMPUTE_IMAGE_ACCESS_DENIED. Revoking a connection blocks new resolution without removing image digests already retained. A registry hostname does not grant access to an internal network destination.
Inside the sandbox
Every process requires the runsc sandbox. There is no fallback to ordinary container isolation. Every image runs as user and group 1000, whatever its USER says. Its root filesystem is read-only, and it may run at most 256 processes and keep 4,096 files open. Only two places are writable:
/work, the container's scratch space (resources.scratchGiB, at most 65,536 files and folders), owned by user1000. It starts empty apart from the read-only/work/input.jsonand/work/inputs/, which a job uses (see Input and output files)./tmp, a 128 MiB in-memory folder.
Install everything into the image when you build it, not at startup. Point tools that write to the home directory at a writable place, for example with env: { HOME: /tmp }. A job's staged inputs, outputs and temporary working files must all fit its scratch allocation.
OpenCloud sets these environment variables in every container:
| Variable | Value |
|---|---|
PORT | The service's service.port (services only) |
OPENCLOUD_CONTAINER_INSTANCE_ID | This copy's ID, as logs and the dashboard show it |
OPENCLOUD_EXECUTION_ID | The job's execution ID, as containers.get, onComplete and containers execution name it (jobs only) |
OPENCLOUD_EXECUTION_ATTEMPT | This attempt's number, from 1 (jobs only) |
OPENCLOUD_CONTAINER_GATEWAY_URL | The HTTPS address for calls to the Functions and metrics the manifest permits |
OPENCLOUD_CONTAINER_CAPABILITY_FILE | /opencloud/capability, this copy's current credential for those calls |
NODE_EXTRA_CA_CERTS | /opencloud/ca.pem, the certificate authority of that address |
The container runtime client uses the last three for you.
To stop a copy, OpenCloud sends SIGTERM once and kills the process 10 seconds later if it is still running. Checkpoint as you go: what a copy may still do after the signal depends on why it stopped (see When a copy stops).
There are no GPUs, privileged containers, host mounts, Docker sockets, SSH or interactive exec, persistent volumes, arbitrary inbound ports, or general container-to-container networking. The internet-http egress policy permits DNS and public HTTP/HTTPS on ports 80/443 under transfer and throughput limits. none disables all external network access, including DNS: the container names no resolver, so lookups fail. Private networks, metadata services and platform databases are not application destinations. Narrow declared platform capabilities remain separate from general network access.
The examples below are complete manifests. Replace the example app ID, the registry.example.com images and the example registryConnection with your own app, prebuilt images and connection (leave registryConnection out for a public image), and provide the referenced frontend and Function files. The example registry is a placeholder, not an image that these docs claim has been published.
Declare a job
schemaVersion: 3
appId: 6f9619ff-8b86-4e6e-a62a-889950f42d3e
runtime:
sdk:
version: 2.9.0
frontend:
directory: frontend
files:
access: user
maxUploadBytes: 52428800
functions:
- name: start-report
entrypoint: functions/start-report/index.ts
access: user
containers:
- name: report
kind: job
image: registry.example.com/team/report:1
registryConnection: 3b8e3f9a-6f4e-4d8a-9a6e-2c1d5b7e9f10 # private registry only
command: [node, /app/job.mjs]
resources:
cpu: 2
memoryGiB: 4
scratchGiB: 5
egress: none
startupTimeoutSeconds: 120
job:
timeoutSeconds: 900
queueTimeoutSeconds: 3600
concurrency: 2
maxAttempts: 1
inputs:
maxFiles: 4
maxTotalGiB: 2
outputs:
directory: /work/output
maxFiles: 4
maxTotalGiB: 1Submit through a declared Function's containers.run capability, or through the app management interface. The browser calls that Function rather than a container management endpoint. See the SDK examples.
A submission captures the workload revision, environment, development session when applicable, selected input content generations, and one stable idempotency key. Its JSON input is limited to 64 KiB. It cannot override the image, command, resources, secrets or permissions. Repeating the same key and input returns the same execution; changing the input with that key is a conflict. Keys are kept per caller: per Function and user, or per CLI login.
Acceptance is not process completion. Read the execution until it reaches a final state. The queue deadline starts at acceptance. The execution timeout starts at the first actual process start and remains the original deadline across attempts and retry waits. phaseDeadline is the deadline that applies now: the queue deadline until the process starts, then the execution deadline, and the collection deadline while outputs are published.
Job states
| State | Meaning |
|---|---|
queued | Accepted and waiting to start; waitReason says why |
preparing | A host was chosen and is fetching the image and the input files |
starting | The process is being started |
running | The process runs |
retry_wait | An attempt exited with a code listed in retryExitCodes; the next attempt waits 5 seconds, then 10, 20 and 40 |
collecting | The process exited with 0 and its outputs are being published; a job without outputs skips this |
cancelling | Cancellation was requested; waiting for the process to stop |
succeeded | Final. The process exited with 0 and its outputs are published |
failed | Final. error says why, for example COMPUTE_EXIT_NONZERO with details.exitCode |
timed_out | Final. COMPUTE_TIMEOUT after timeoutSeconds, or COMPUTE_QUEUE_TIMEOUT when it never started before queueTimeoutSeconds |
cancelled | Final. COMPUTE_CANCELLED, or COMPUTE_RELEASE_REPLACED when a newer release replaced its own before it started |
outcome_unknown | Final. The process may have run, but there is no trustworthy result (COMPUTE_OUTCOME_UNKNOWN) |
While a job is queued or in retry_wait, waitReason gives the latest reason it hasn't started, or null when there is none yet or it is about to start:
waitReason | The job waits because |
|---|---|
no_capacity | Hosts are up, but none has room right now |
host_unavailable | No host is available: each is down, unreachable or under maintenance |
capacity_limit | The payer's limit on running containers is reached |
budget | The payer's spending limit is reached |
concurrency | All of the job's concurrency slots are in use. A run frees its slot when it ends, and the next waiting job starts within about a second |
paused | The job's workload is paused |
previous_attempt | Its previous attempt's copy is still stopping |
app_busy | Another platform operation, such as a deploy, holds the app for a moment |
platform_error | A temporary platform problem; OpenCloud keeps trying |
A job that waits past its queue deadline ends timed_out with COMPUTE_QUEUE_TIMEOUT.
Default maxAttempts: 1 does not rerun a process. Additional attempts require declared retryExitCodes, remaining attempts and time, and a confirmed failed attempt. A retry starts within about a second of its wait ending, once the previous attempt's copy has stopped, and then needs its own few seconds to prepare. timeoutSeconds counts from the first attempt's start and covers every attempt and wait: three attempts of a job that runs for a few seconds need about 30 seconds of waits and preparation on top of their run time. An uncertain outcome is outcome_unknown: inspect and reconcile it; do not submit a replacement merely because a response or worker was lost. Cancelling a job that is waiting for a host ends it at once. Once a host has taken it, the job is cancelling until its process has stopped (SIGTERM, then a kill 10 seconds later), and then cancelled. Until then its process may still call its Functions, to record where it stopped (see When a copy stops).
Input and output files
Select opaque managed File IDs with inputFileIds. Existing Files access still applies; selecting a file does not grant general Files or Data access to the container. Inputs are pinned to their content generation. Replacement or loss of permission can invalidate the input, even when replacement bytes are equal.
Inside the image:
/work/input.jsoncontains the submitted JSON value ({}when there is none)./work/inputs/<fileId>contains each selected input. Inputs are read-only./work/inputs/index.jsoncontains{ "files": [...] }, withfileId,contentGeneration,sizeBytes,sha256, the absolutepath, and availablenameandcontentTypemetadata. It contains no transfer credentials, and its list is empty when the job has no input files.- The output directory doesn't exist yet: create it (for example with
mkdir -p /work/output), even when the job may write nothing, and write output files below it. A job that exits without creating it fails withCOMPUTE_OUTPUT_DIRECTORY_MISSING; an empty directory means the job has no outputs. Symlinks, hard links and other special files, paths longer than 240 characters, folders more than 16 levels deep and more than 4,096 entries are invalid (COMPUTE_OUTPUT_INVALID). Keep within the declared file count and bytes.
After a successful process exit, Files collects and atomically publishes the bounded output set. The execution returns outputFileIds only after publication; a job that doesn't succeed publishes nothing. Collection recovery reuses the stopped process's outputs; it does not run the job again.
Each output becomes a managed File named after its own file name: /work/output/report.csv becomes report.csv, and a file in a subfolder keeps only its own name. A job can't choose an output's content type: OpenCloud takes it from the file name's extension for common data formats (.png, .jpg or .jpeg, .gif, .webp, .pdf, .csv, .tsv, .txt, .log, .md, .json, .jsonl or .ndjson, .zip, .gz, .tar, .xlsx, .docx, .mp3, .wav, .mp4). Any other file, including .html, .svg, .xml and .js, is application/octet-stream. Downloads are always attachments, so a browser saves the file rather than opening it. Outputs follow the app's files.access:
- With
user, they belong to the user the job was started for, who can download them in the browser withopencloud.files.download(), ordownloadStream()for large files. Nobody else sees them. - With
app, they are app files that the app's signed-in members share.
A job you start from the CLI or the dashboard is started for you. With files.access: user you own its outputs, and it can take only your own files as inputs. That holds in a dev session too: you are not one of the session's synthetic users, so a job you start there gets FILE_INPUT_UNAVAILABLE for their uploads. With files.access: app it can take any of the app's files in that environment. The SDK page covers jobs that Functions start, with a worked example from upload to download.
At most 16 inputs and 16 outputs, and 10 GiB total in each direction, may be declared, in whole GiB. When a job is started, its selected inputs and its whole outputs.maxTotalGiB are reserved in its scratch space, so together they must fit resources.scratchGiB; otherwise starting it fails with FILE_TRANSFER_INVALID. The rest of the scratch space is all the room left for temporary files. Nothing checks that room in advance, and a job that runs out of it fails with COMPUTE_SCRATCH_EXHAUSTED. SDK 2.9 adds a separate resumable upload API for large job inputs. It does not raise the ordinary Files upload limit or the Function queue's 128 MiB aggregate file-delegation limit.
Optional job.onComplete names a declared access: system Function. It runs once the job reaches any final state (succeeded, failed, timed out or cancelled, a job cancelled before it started included), with this input:
{
"eventId": "compute.job.completed:6f3c3c0e-0b1e-4c8e-9a51-6f0b1f4b7d2a",
"executionId": "6f3c3c0e-0b1e-4c8e-9a51-6f0b1f4b7d2a",
"workloadName": "report",
"revisionId": "0d7c8d6e-5f0a-4d2b-8e7c-3a9b1c2d4e5f",
"state": "succeeded",
"attempts": 1,
"error": null,
"outputFileIds": ["1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed"]
}state is the final state, attempts the number of process attempts, error the job's error (null when it succeeded) and outputFileIds the published outputs. eventId stays the same on every delivery attempt; use it to ignore a repeat. Validate the input in your onComplete Function with @opencloud/server:
import { defineFunction, schema } from "@opencloud/server";
export default defineFunction({
input: schema.object({
eventId: schema.string(),
executionId: schema.uuid(),
workloadName: schema.string(),
revisionId: schema.uuid(),
state: schema.enum([
"succeeded",
"failed",
"timed_out",
"cancelled",
"outcome_unknown",
]),
attempts: schema.number({ integer: true, min: 0 }),
error: schema.nullable(schema.record()),
outputFileIds: schema.array(schema.uuid()),
}),
handler: async ({ input, data }) => {
// Record completion idempotently using input.eventId.
return { ok: true, executionId: input.executionId };
},
});Delivery has its own completionDelivery object on the execution projection and up to five attempts, independent of the compute result and output publication:
{
"state": "delivered",
"attempts": 1,
"lastAttemptAt": "2026-11-22T01:02:03.000Z",
"nextAttemptAt": null,
"error": null
}A failed notification does not turn a successful execution into a failed job or authorize another run. Check both statuses: completionDelivery.state is not_configured when the workload declares no onComplete, pending when the notification has not yet been confirmed delivered (including while the job still runs, and between attempts, when nextAttemptAt says when the next one is), delivered when the Function accepted it, failed when delivery gave up (error says why, usually COMPUTE_COMPLETION_FAILED), and revoked when the job's authority ended, or compute was turned off, before delivery: the submitter lost Edit, the login or session they started it from ended, or the app was suspended or archived. An attempt that fails waits before the next one (5 seconds, then twice as long each time) and never holds up other jobs' notifications.
Declare an HTTP service
This manifest uses a service as the app frontend. The image must listen on 0.0.0.0:8080 and return a successful readiness response at /ready.
schemaVersion: 3
appId: 6f9619ff-8b86-4e6e-a62a-889950f42d3e
runtime:
sdk:
version: 2.9.0
frontend:
container: web
containers:
- name: web
kind: service
image: registry.example.com/team/web:1
resources:
cpu: 1
memoryGiB: 2
scratchGiB: 1
egress: none
service:
port: 8080
concurrency: 20
requestTimeoutSeconds: 60
drainTimeoutSeconds: 30
scaling:
minInstances: 0
maxInstances: 5
startupProbe:
path: /ready
timeoutSeconds: 2
readinessProbe:
path: /ready
timeoutSeconds: 2frontend.container is exclusive with frontend.directory, frontend.spa and frontend.build. It receives / and otherwise unmatched application paths after platform endpoints and explicit routes. This does not permit a general / override in routes. A release goes live only once the service answers its health check; see Health checks for the path it uses.
To keep a static frontend and route only an API to a service, use frontend: { directory: frontend } and add both routes below. They are a fragment to apply to a manifest declaring the web service:
routes:
- id: api-root
path: /api
container: web
methods: [GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS]
- id: api-path
path: /api/*path
container: web
methods: [GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS]The wildcard matches one or more segments, so /api needs its own route. Optional catch-all forms such as /api{/*path} are unsupported. Existing route precedence and protected namespaces still apply. Container routes inherit app admission; they cannot use an asset's access: public exception on a private app. Static aliases retain GET/HEAD only. A container route lists its methods; there is no default.
A route forwards the whole path and query unchanged: /api/search?q=lamp reaches the container as /api/search?q=lamp, not /search. Serve the API under the same prefix. A container frontend receives the full path too.
The gateway supports HTTP/1.1, streamed responses, SSE and WebSocket upgrades. Open streams occupy concurrency slots. The original request deadline includes queue wait and cold start; it is not reset after routing or upgrade. At the deadline a WebSocket is closed with code 1001 and reason COMPUTE_REQUEST_TIMEOUT, so a client can reconnect; revoked access closes it with 1008 and COMPUTE_AUTHORITY_REVOKED. A streamed response is cut short. Bodies are bounded to 32 MiB, and headers to 32 KiB and 100 fields. Use Files for larger content. A disconnect, deadline or upstream failure never automatically replays a request whose effects might have started.
A Function that calls a service with containers.request sends it at most 4 MiB and holds the answer, up to 32 MiB, in its own 150 MB of memory, so leave room for what it does with the answer. The answer reaches the Function at a few MB a second (testers measured 0.6 to 5 MB/s): give a call that may return more than about 5 MiB timeoutMs: 120_000 rather than the default 20 seconds (see the SDK).
Startup and readiness probes are required, with timeout 1–5 seconds (default 2). Each probe is a GET of its path on service.port, and an answer in the 2xx range within the timeout passes. The startup probe repeats until it passes; a copy that hasn't passed within startupTimeoutSeconds of its container starting is stopped and shows as failed with COMPUTE_STARTUP_TIMEOUT, even if it exits cleanly on the stop. Probes run every 5 seconds, so the stop comes up to about 5 seconds after the deadline, and takes up to 10 more if the container ignores SIGTERM. Two passing readiness probes in a row put a copy into traffic and three failing ones take it out again; a readiness failure doesn't restart it. Optional livenessProbe replaces a copy after three failures in a row.
A service starts another copy, up to maxInstances, when its open requests pass about 70% of concurrency per copy, and stops extra copies once demand has stayed lower for a minute. With minInstances: 0 it stops its last copy after five minutes without requests (state idle). The next request starts a copy and is held while the copy starts, for up to 30 seconds, or requestTimeoutSeconds if that is shorter; testers measured cold starts of 15 to 20 seconds. A request still waiting then gets 503 COMPUTE_STARTING_PENDING while the copy keeps starting: show that state and retry. When no copy can start because no compute host is available (down, unreachable or under maintenance), or every host is full, it gets 503 COMPUTE_HOST_UNAVAILABLE or COMPUTE_NO_CAPACITY instead: retryable, with billingDisposition: "none", since the outage is the platform's. A paused service answers 503 COMPUTE_SERVICE_UNAVAILABLE at once, with a message saying it is paused (usually whether by its owner or after a failure; containers get always says why), retryScope: "none" and billingDisposition: "none": retrying won't help until it is resumed, and the refused request costs nothing. A browser opening a page of the service (a GET or HEAD that asks for HTML, such as a visitor of a container frontend) gets any of these refusals as a small plain HTML page with the same status, a sentence for visitors (try again in a moment, or later) and the code and request ID, without OpenCloud branding. The message above, written for you, stays in the JSON body, which every other request gets.
Health checks
When a container serves the app's health path (health.path), as a container frontend does, a deploy, rollback or restore sends one GET of it through the gateway to the new copies once they are ready, and switches to the new release only on a 2xx answer. A restart checks its new copies the same way, and the hourly check checks the live release (it never wakes a service that scaled to zero).
Until the switch, a new copy's Function calls are refused with COMPUTE_NOT_LIVE (see Deploys, dev syncs and restarts), so a page that calls a Function can't pass the check. That is why health.path: /, which is also the default, checks the service's readinessProbe.path instead of /. Any other health.path is requested as written: point it at a path that answers 2xx without calling a Function, such as the readiness path. A check that gets any other answer fails the deploy with COMPUTE_READINESS_FAILED, whose message names the path checked and the status it got, and the current release keeps serving.
Services that keep state in memory
A service can run more than one copy at a time: when its load grows, while a deploy or dev sync replaces it, and while it restarts. Each request, and each WebSocket connection, goes to the least busy ready copy; there are no sticky sessions. State kept in one copy's memory, such as the clients of a WebSocket broadcast, is therefore not shared with the other copies, and it is lost when the copy is replaced.
- Keep shared state in the app's data through a declared system Function, and load it when a copy starts.
- For an in-memory broadcast, set
maxInstances: 1. Deploys, dev syncs and restarts still run a second copy for a short time. - Make clients reconnect. A copy that is being replaced takes no new connections and closes the ones still open when its drain time (
drainTimeoutSeconds) ends, with close code 1001 and reasonCOMPUTE_SERVICE_UNAVAILABLE. The request deadline above closes a connection with 1001 andCOMPUTE_REQUEST_TIMEOUT.
A request still under way when its copy stops serving (the service is paused, opencloud app dev stop ends its session, its drain time ends, or its host is gone) gets 503 COMPUTE_SERVICE_UNAVAILABLE if no answer had started, with a message saying why and retryable: false: the request reached the app and may have had its effects, so it is never sent again. Send it again yourself only if that is safe. Its origin is policy when a pause, a stopped dev session, a new release or the end of a drain stopped the copy, platform when its host could no longer vouch for it, and unknown otherwise. An answer already under way is cut off.
OpenCloud credentials and internal identity headers are stripped before forwarding. Platform-named cookies (oc_*, __Host-oc_*, __Secure-oc_*, opencloud_* and opencloud-*) are stripped in both directions, and Domain= attributes on Set-Cookie responses are stripped so app cookies stay host-only. App-owned credentials remain untrusted application input. A container receives no user Data token; use a declared Function for authorized platform operations rather than treating a header as database authority.
Every inbound x-opencloud-* header is removed too. The platform then adds one of its own, x-opencloud-compute-context: base64url-encoded JSON that describes the request, with protocolVersion (1), requestId, appId, environment (production or development), developmentSessionId (null in production), workloadName, instanceId (the copy serving it), caller ({ kind, userId, functionName }, where kind is user, function or anonymous), method, uri, issuedAt and expiresAt (the request's deadline). It is information for logs and diagnostics, not a credential: don't grant access because of it or forward it, and use a declared Function for anything that needs authority.
Declare a worker
schemaVersion: 3
appId: 6f9619ff-8b86-4e6e-a62a-889950f42d3e
runtime:
sdk:
version: 2.9.0
frontend:
directory: frontend
functions:
- name: checkpoint
entrypoint: functions/checkpoint/index.ts
access: system
observability:
metrics:
- name: backlog_depth
type: gauge
unit: items
containers:
- name: poller
kind: worker
image: registry.example.com/team/poller:1
registryConnection: 3b8e3f9a-6f4e-4d8a-9a6e-2c1d5b7e9f10 # private registry only
command: [node, /app/worker.mjs]
resources:
cpu: 1
memoryGiB: 2
scratchGiB: 1
egress: internet-http
permissions:
functions: [checkpoint]
metrics: [backlog_depth]
worker:
replicas: 1
maxReplicas: 3
restart: alwaysWorkers have no public port. They keep the desired replica count and restart with bounded backoff while eligible: after 1, 2, 4 and 8 seconds, plus up to several seconds to place and start the copy. Five failed exits or failed starts within ten minutes of the first of them pause the workload as crash_loop; fix the cause before explicitly resuming. A resume, a restart and a new release each start that count again from zero. An exit 0 is a clean stop, not a failure: the copy shows as stopped, the next one starts a few seconds later, and clean exits never count toward a crash loop, so they never pause the workload. A worker that keeps exiting 0 at once therefore restarts over and over, and each run is billed: use a job for work that finishes. Scaling to zero stops replicas. A temporary scale override must fit maxReplicas and resets on the next deployment. Two copies of one replica never run at once, so a restart or a new release leaves a short gap without that worker (see Deploys, dev syncs and restarts).
The container runtime client can invoke only named system Functions and record only named metrics permitted by the manifest. System Functions keep user: null; their Data policies must explicitly permit auth.is_system(). Give external effects and checkpoints stable keys. No general Function, Files, database, billing, or owner token is exposed to the process.
A worker for the manifest above might look like this, where fetchBatch is the worker's own code. It checkpoints every batch, so a stop loses at most the batch in progress (see When a copy stops):
import { createContainerClient } from "@opencloud/container";
const opencloud = createContainerClient();
let stopping = false;
process.on("SIGTERM", () => { stopping = true; }); // 10 seconds to finish
while (!stopping) {
const batch = await fetchBatch();
await opencloud.invokeFunction(
"checkpoint",
{ batchId: batch.id, completed: batch.items.length },
{ idempotencyKey: `checkpoint:${batch.id}` },
);
await opencloud.recordMetric("backlog_depth", batch.remaining, {
idempotencyKey: `backlog:${batch.id}`,
});
if (batch.remaining === 0) await new Promise((resolve) => setTimeout(resolve, 5_000));
}Read a recorded metric back like any custom metric, by the name the Agent Feed shows: custom.backlog_depth. metrics returns its production series, one value per step (60 seconds by default): a gauge's latest value, or the sum of a counter's increments in that step. --aggregation sum, avg, max and min combine dimension values. rate gives a counter's increments per second, and a gauge's change per second from one step to the next (negative when it falls). Development points stay out of it. A name without custom. is always one of the platform's own series, even when the app declares a metric of that name.
opencloud metrics "$APP_ID" --metric custom.backlog_depthDeploys, dev syncs and restarts
Every deploy, rollback and dev sync starts new copies of all the app's services and workers, even when only the frontend or a Function changed.
Services keep serving. The new release's copies start first, while the current release still serves: as many as the service runs now, at least one and at most its new maxInstances, where there is room and funding. Once they are ready, traffic switches to them. The old copies take no new requests and finish their open ones within drainTimeoutSeconds. Even a service with maxInstances: 1 therefore runs two copies for a short time, and its WebSocket clients reconnect once per deploy. Every service gets a new copy, even one with minInstances: 0, which goes back to zero after five minutes without requests, counted from the switch. If a new copy fails, or isn't ready within five minutes plus its startupTimeoutSeconds, or the release's health check fails, the deploy fails with DEPLOYMENT_COMPENSATED (a rollback with ROLLBACK_COMPENSATED) and the container's cause, such as COMPUTE_STARTUP_TIMEOUT, COMPUTE_EXIT_NONZERO with its exit code or COMPUTE_READINESS_FAILED with the path and status, and the current release keeps serving. A host without room only delays the start until then. From the switch on, the old copies' Function calls are refused with COMPUTE_RELEASE_REPLACED, so their open requests finish without them.
Until the switch, a new copy's Function and metric calls get 503 COMPUTE_NOT_LIVE: its release isn't live yet. Start serving, and answering probes, before you load state through a Function, and retry COMPUTE_NOT_LIVE with the same idempotency key (see the runtime client).
Workers are stopped, then started. A worker's new copies start after the switch, once its old copies have stopped. Expect a short gap without a running worker; testers saw about 10 seconds. The old copies can't checkpoint on SIGTERM: their Function calls are refused with COMPUTE_RELEASE_REPLACED from the switch on, so checkpoint as you go (see When a copy stops).
Jobs keep their release. A job that has started finishes on the release it was accepted for: it keeps running and being funded until it ends, publishes its outputs and gets its onComplete. Its calls to Functions, and its onComplete, run that release's Functions, not the new release's, against the app's current data, so a deploy that changes tables a running job's Functions use can make those calls fail. While an earlier release's running job drains, containers list and containers get show only the current revision's instances; follow the draining job through containers execution or containers executions. Until those jobs finish and their onComplete is delivered, deleting their deployment answers 409 DEPLOYMENT_STILL_IN_USE naming the jobs: delete it once they finish, or after you cancel them. On installations with standard releases, a job still waiting to start when a newer release replaces its own, including one placed on a host but not started yet, ends cancelled with COMPUTE_RELEASE_REPLACED; start it again to run it on the current release. Installations with APP_ONLINE_DEPLOYMENTS_ENABLED enabled keep compatible waiting jobs on their submitted release across an online update.
A manual pause survives deploys, promotes, rollbacks and restores. A paused service or worker gets no new copy and no health check, and only resume starts the new release. A paused job workload keeps the waiting jobs that were submitted under its current release queued (waitReason: paused), lets running ones finish, and refuses new ones with COMPUTE_REVISION_UNAVAILABLE, whose message says the workload is paused and to resume it (containers resume, with the workload's current generation) to start jobs again. Waiting jobs of a release that a newer one replaced still end, paused or not: cancelled with COMPUTE_RELEASE_REPLACED, except where an online update kept them on their submitted release as above. A new release also ends the pauses OpenCloud made itself: a crash loop, a release that couldn't be prepared, and the stops for archiving, deleting or restoring the app. A worker's replica override from containers scale resets on every deploy; pause the worker to keep it stopped.
Restarts. restart starts each service copy's replacement beside it. The old copy keeps serving until its replacement is ready, then drains; without room or funding for both, the old copy drains first. A worker's copies are stopped, then started.
Changing a secret that a container uses replaces its copies the way a deploy does, within a few seconds. A service's copies keep the old value and keep serving while copies with the new value start beside them; once those are ready, traffic switches and the old copies drain. If a new copy fails, because the new value breaks it say, the old copies keep serving, the failure shows as the workload's reason, and nothing retries it until you change the secret again or restart the service. A worker's copies are stopped, then started with the new value. A running job finishes with the value it started with. A job still waiting to start, or waiting to try again, starts with the new value; it keeps its release, input and files, and only the secret's value is the current one. New jobs get the new value too (in the second or so before it is ready, starting one answers a retryable COMPUTE_REVISION_UNAVAILABLE). Removing a secret instead stops every copy that uses it at once, and requests to the service get a retryable 503 COMPUTE_SERVICE_UNAVAILABLE until a copy can start: right away for an optional secret, and once you set it again for a required one. A waiting job that uses a removed secret ends failed with COMPUTE_REVISION_UNAVAILABLE, and its message names the secret: set it again, then start the job again.
A copy that OpenCloud stopped on purpose (scale-down, a deploy or restart, a pause, revoked access, the spending limit or a cancellation) shows as stopped, and so does an exit 0 nobody asked for: the service or worker starts a new copy, and clean exits never count toward a crash loop. Running out of memory or scratch, a timeout, failed liveness probes, a failed preparation and a non-zero exit nobody asked for show as failed, and the copy's error in containers get, like its failed event, says why: COMPUTE_OUT_OF_MEMORY, COMPUTE_SCRATCH_EXHAUSTED, COMPUTE_STARTUP_TIMEOUT, COMPUTE_LIVENESS_FAILED, the preparation's own code, COMPUTE_EXIT_NONZERO with details.exitCode (and signal when the runtime reports one), or COMPUTE_STARTUP_FAILED for a process that never started or a command that couldn't run (exit 126 or 127: it isn't executable, or isn't in the image). A service or worker copy that ended with its host (the host restarted, or is down or unreachable) shows failed with COMPUTE_WORKER_LOST, origin platform, whatever exit the runtime recorded, and doesn't count toward a crash loop; the workload starts another copy once a host is available. A workload's counts.failed counts its current release's copies that failed or were lost in the last 10 minutes, plus lost copies whose stop their host hasn't confirmed. It is the recent failures, not the crash-loop count: a resume or a restart leaves it as it is, so it can read 5 just after you resume a crash loop and 10 when five more failures pause the workload again. A new release starts it from zero. Older failures stay in containers events and, for a job, in its executions.
Verification checks workers. Production verification (opencloud app verify) and dev verification require each declared worker to have a running copy, unless it is paused or set to no replicas. Dev verification checks them before its browser tests, so a worker that crash loops or can't start fails it with the worker's own reason, not as a test waiting for what the worker does. They wait up to the worker's startup timeout, and at least 30 seconds, for a copy to be placed (a deploy first stops the old copy), and for a placed copy until its own startup deadline. Then they fail with the worker's own reason: a crash loop, a preparation failure, COMPUTE_EXIT_NONZERO with its exit code, or COMPUTE_STARTUP_TIMEOUT. A worker still waiting for room or for a host that is down, or whose copy another change to the app (a deploy or a backup) holds up, isn't your app's failure: production verification reports "Worker <name> hasn't started yet: …" with the code, such as COMPUTE_NO_CAPACITY, and tries again. A worker that a policy keeps from starting (revoked access, containers not enabled for the account, its transfer allowance, or its instance or spending limit) fails as "Worker <name> can't start: …" with that code; trying again won't help until that changes. Dev verification classifies both as infrastructure, and only the app's own failures as application. Nothing rolls back automatically.
When a copy stops
OpenCloud sends a stopping copy SIGTERM once and kills the process 10 seconds later if it is still running. Checkpoint as you go, through a Function, so a stop loses at most the work since the last checkpoint; when the signal arrives, finish the current step and close connections. From the signal on, the copy's only network access is its Function and metric calls, and every call gets an answer at once. What it may still do depends on why it stopped:
- A restart, scale-down, pause, host maintenance or changed secret keeps its release (a changed secret's new configuration replaces the copy). Its Function calls still work until it exits or its 10 seconds end, so a final checkpoint can land. A service copy draining for one of these may call them while it finishes its open requests. Its metrics are refused from the stop on.
- A cancelled job may still call its Functions the same way, so it can record where it stopped. It still ends
cancelled, and publishes no outputs. - A deploy, rollback or dev sync replaced its release. Its calls are refused with 409
COMPUTE_RELEASE_REPLACEDfrom the switch on, before the signal arrives; the new release's copies carry on from the last checkpoint. - Revoked access, a removed secret, the spending limit, a timeout, failed liveness probes or stopping the whole app end its authority: its calls are refused with 403
COMPUTE_AUTHORITY_REVOKED.
After its 10 seconds, every call is refused with COMPUTE_AUTHORITY_REVOKED.
Develop and verify
A dev session runs the app's containers for real, in its own scope with its own files, logs and synthetic users. opencloud app dev start and each opencloud app dev sync start the session's services and workers. Its workers keep running, and its services scale as in production, using the payer's compute until the session stops or expires after 24 hours. Stop it with opencloud app dev stop when you're done.
- The raw
previewUrladmits requests to container routes without sign-in while the session runs, so you can try a route withcurl, POST requests included.opencloud app dev requestsends only GET and HEAD. Pages opened throughbrowserPreviewUrlreach the routes too. - Each browser test in dev verification runs in a sandbox of its own. The sandbox starts its own copies of the app's services and workers, using the payer's compute, waits until its services are ready, and stops them after the test. Tests that run in parallel need room for several copies at once.
- Verification requires every declared Function to have been called on the current revision. A container's call and a finished job's
onCompletecount, like a test oropencloud app dev invoke, but only on the revision that was current when they happened. After a sync, let the worker run again, or call its Functions withopencloud app dev invoke, before you verify. - Dev verification checks workers as production verification does (see above).
- Read the session's logs with
opencloud app dev logs "$APP_DIR", for example--surface container --workload reportor--surface function. Productionopencloud logsnever includes them, nor the lines of verification sandboxes. - A session's compute cost shows while it runs:
opencloud app dev containers list "$APP_DIR"gives each workload's usage for the session's current revision, andopencloud app dev containers executions "$APP_DIR"each job's. Once the session stops (app dev stop, a promote, or its 24 hours running out), no command reads that session's cost: the CLI needs the folder's dev state, which the stop removes, and the session's services and workers no longer show. Payer administrators still see it incompute usage, added up with all other development compute. Read a session's cost before you stop it. - A dev session never receives production secret values. A container's reference to a
requiredoroptionalsecret sets no environment variable at all in development, and ageneratedsecret gets a value made for that session only (it starts withdev_). Treat such a variable as possibly unset: give development a fallback, or skip what needs the real value until the app runs in production. opencloud app dev promotedeploys the session's draft and, once the release is live and verified, stops the session itself (its output saysdevStopped: true, and its containers stop) and removes the folder's dev state (localStateRemoved: true). Start the next change withopencloud app dev start. Read the session's compute cost before you promote (see above).- A promoted draft stays deployed even when the release fails and OpenCloud undoes it (after a failed first release the app shows
failed); then promote doesn't stop the session. The session keeps running, its Functions, container calls and file calls included, but the draft takes no more changes:app dev syncandapp dev startfail withDEV_DRAFT_CLOSED, naming the way out. Runopencloud app dev stop "$APP_DIR", which stops that session and clears the folder's dev state, thenopencloud app dev start "$APP_DIR", which starts a new session from a new draft of your files.
Read the session's data
To see what a worker or job stored, read a table through the session's data API:
opencloud app dev request "$APP_DIR" \
'/rest/v1/news_items?select=title,published_at&order=published_at.desc&limit=5'The path is /rest/v1/<table> with PostgREST's query syntax (select, order, limit, and filters such as status=eq.down), GET or HEAD only, and the CLI shows at most 64 KiB of the answer. The request is signed out, so it returns only the rows your RLS policies let signed-out callers read, such as a for select using (true) policy that names no role. Other rows don't appear, so a table without such a policy answers an empty list. For rows only signed-in users may read, open browserPreviewUrl, where the app runs as synthetic user A, or call an access: user Function with opencloud app dev invoke, which runs as synthetic user A too. opencloud app dev data writes rows as synthetic user A; it doesn't read.
Test a job with input files
A job you start with opencloud app dev containers run is started for you, not for a synthetic user (see Input and output files), and no CLI command uploads a file as a synthetic user. With files.access: user, opencloud app dev containers run --input-file therefore can't take a file uploaded in the session: it gets FILE_INPUT_UNAVAILABLE. Test such jobs through the app's own page instead:
- open
browserPreviewUrl, upload a file as synthetic user A and let the page's Function start the job; or - write a dev verification browser test that uploads a file through the page and waits for the result; each test's sandbox runs its own job copies.
With files.access: app, opencloud app dev containers run --input-file can take a file uploaded in the session's preview, by its File ID.
Use a private app from a script
On a deployed app, your CLI login can manage the app but not use it: it can't read or change the app's data or files, or call its Functions. Such a request answers 403 OWNER_ACTION_BROWSER_ONLY, whose details.suggestedFix names the app's dashboard page and the access-token request below. That is deliberate. A credential that can build and deploy an app, like the CLI's or an Agent's, doesn't get the owner's access to the data people keep in it.
To call a private app's container routes, read its data or call its Functions from a script, use an app access token instead of making the app public:
Request a token, for example for one day. The command prints an approval link that works for 15 minutes:
bashopencloud app access-token request "$APP_ID" --name "route check" \ --expires-in-days 1The app's owner opens the link in a browser signed in to OpenCloud and approves it. The page then shows the token, once.
Keep the token in an environment variable and send it as a bearer token to the deployed app's address:
bashprintf 'Authorization: Bearer %s\n' "$OPENCLOUD_APP_TOKEN" | \ curl --fail-with-body --header @- "$APP_URL/api/search?q=lamp"The edge accepts the token on container routes, WebSocket upgrades included, and admits the request as the owner. It removes the token before the request reaches the container.
When you're done, revoke the token on the app's Access screen in the dashboard. Your CLI login can request a token but not list or revoke one.
The same token uses the app's runtime API as the owner, under the app's RLS policies and Files rules. A worker app without routes can check what its worker stored by reading the table:
printf 'Authorization: Bearer %s\n' "$OPENCLOUD_APP_TOKEN" | \
curl --fail-with-body --header @- \
"$APP_URL/rest/v1/news_items?select=title,published_at&order=published_at.desc&limit=5"/rest/v1/<table> also takes POST, PATCH and DELETE to change rows as the owner. POST $APP_URL/functions/v1/<name> with a JSON body calls a user or public Function (a system Function refuses the call), and GET $APP_URL/_opencloud/files/<fileId> downloads a managed file the owner may read; with files.access: user that means only the owner's own files, such as the outputs of jobs the owner started.
Tokens work only on the deployed app's address. A dev session refuses them; use its previewUrl there.
Defaults and limits
| Field | Default | Allowed values or bound |
|---|---|---|
| Containers per app | None | At most 10 distinct names |
resources.cpu | 1 | 1, 2, 4, 8 whole vCPU |
resources.memoryGiB | 2 | 1, 2, 4, 8, 16, 32 |
resources.scratchGiB | 1 | 1, 2, 5, 10, 20 |
startupTimeoutSeconds | 120 | 1–300 |
job.timeoutSeconds | 900 | 1–86,400 from first start |
job.queueTimeoutSeconds | 86,400 | 1–86,400 from acceptance |
job.concurrency / maxAttempts | 1 / 1 | 1–20 / 1–5 |
job.retryExitCodes | [] | Distinct codes 1–255; no automatic uncertain replay |
job.inputs | None: no input files | maxFiles 1–16, maxTotalGiB 1–10 |
job.outputs | None: no outputs | directory below /work, outside /work/inputs; maxFiles 1–16; maxTotalGiB 1–10 and at most scratchGiB |
service.port | 8080 | 1024–65535 |
service.concurrency | 20 | 1–100 per instance |
service.requestTimeoutSeconds | 60 | 1–3600, including wait |
service.drainTimeoutSeconds | 30 | 0–300 |
service.scaling | min 0, max 5 | min 0–20, max 1–20; min ≤ max |
service.startupProbe, readinessProbe | Required | path; timeoutSeconds 1–5, default 2 |
worker.replicas | 1 | 0–20, at most maxReplicas |
worker.maxReplicas | Greater of 1 and replicas | 1–20 |
egress | internet-http | internet-http or none |
| Function / metric permissions | Empty | Declared system Functions / declared metrics only |
Sizes are whole numbers: CPU, memory and scratch take only the listed values, and every GiB field takes whole GiB. Limits are ceilings, not reserved host capacity. Operator and payer policy can lower them. Environment keys are uppercase; PORT, OPENCLOUD_* and SUPABASE_* are reserved. Reference an existing uppercase manifest secret with, for example, secrets: { REMOTE_TOKEN: API_TOKEN }, after declaring API_TOKEN at the top level as required, generated or optional. Supply a required value through normal secret entry, never in the image, manifest env, source, command line or logs.
A private image names its registry connection in registryConnection; see Private registries.
Funding and usage
Compute starts only with explicit operator funding or an authorized payer's consent to an available immutable price version. An app owner credential does not grant payer administration. Paid modes must be configured and verified by the installation before it offers checkout; unsupported modes fail closed. This release offers operator funding only: a platform administrator gives the payer an allowance and a monthly limit, and paid checkout answers COMPUTE_BILLING_UNAVAILABLE.
The organisation administrator manages the organisation's compute funding. Compute billing is separate from the organisation's per-person subscription.
Prices are configurable, not fixed by this guide. Review the displayed currency, rates, one-second quantum and minimum, tax treatment, and monthly/daily net spending limits before consenting. The active price version is retained with usage; changing a price does not reprice old work.
The meter charges allocated vCPU-seconds, GiB-memory-seconds and GiB-scratch-seconds while a process runs. Low CPU utilization does not reduce the allocation charge. A two-vCPU, four-GiB memory, five-GiB scratch instance running for ten whole seconds records 20, 40 and 50 respective units, regardless of how busy it was. Queue wait and pre-start image/input preparation have no runtime allocation charge. Output collection after a confirmed stop does not extend process runtime. Application failures retain confirmed usage.
Usage shows gross estimated cost, applied credit and net estimated cost as exact decimal strings, with price and period identities. pendingEvidenceCount, observedAt and lastSettledAt explain incompleteness. Missing usage is unknown, not zero. CPU/memory/scratch/network observations are diagnostics, not the billing meter. These charges are separate from AI-provider estimates, ordinary storage usage and subscription pricing.
Where to read usage:
opencloud usage <app-id>includescompute: the app's production compute across all its releases, once it has run containers.containers listandcontainers getshow each workload's usage for its current revision only, and each execution shows its own.- Development compute shows in the dev session's workloads while the session runs (see Develop and verify) and, for payer administrators, in
compute usage, which reports production and development separately, every development session added up.
A 0 quantity with null costs means that nothing has settled for that scope yet. Running copies report usage every 60 seconds, and pendingEvidenceCount counts the copies and jobs whose usage is still coming in.
An always-on workload, such as a worker or a service's minimum copies, runs every second of the month. containers get shows one copy's cost per hour as hourlyEstimate.perInstanceHourMinor, in the currency's minor unit (cents for usd), when the payer has a price. Payer administrators can work it out from the rates in compute prices (or the price in compute settings). For a 30-day month (2,592,000 seconds):
monthly = 2,592,000 × copies × (cpu × vcpu_second
+ memoryGiB × gib_memory_second
+ scratchGiB × gib_scratch_second)That is perInstanceHourMinor × 720 × copies, in minor units. A service with minInstances: 0 costs nothing while it has no copy.
Development executions use isolated revisions, files, logs and identities but consume real compute and the same payer's compute budget. Required production secret values are not copied into development. Stopping or expiring a session revokes its compute authority. Never replace a failed dev operation with a production operation.
Operate and diagnose
Public CLI 3.22.0 or newer (v3.22.1 pinned) provides these commands:
opencloud containers list "$APP_ID"
opencloud containers get "$APP_ID" report
opencloud containers run "$APP_ID" report --input '{"format":"csv"}' \
--input-file "$FILE_ID" --idempotency-key report-request-001
opencloud containers execution "$APP_ID" "$EXECUTION_ID"
opencloud containers events "$APP_ID" report
opencloud containers cancel "$APP_ID" "$EXECUTION_ID" \
--idempotency-key report-cancel-001
# Take GENERATION from the latest workload read; do not guess it.
opencloud containers pause "$APP_ID" poller --generation "$GENERATION" \
--idempotency-key poller-pause-001
# Read again and update GENERATION before another control mutation.
opencloud containers get "$APP_ID" poller
opencloud containers scale "$APP_ID" poller --generation "$GENERATION" \
--replicas 2 --idempotency-key poller-scale-001resume and restart also require the observed control generation. A conflict requires a fresh read and a deliberate new decision. restart applies to a service or worker, not a job. Read paged executions with containers executions. After an uncertain mutation, keep the same key and inspect retained state; never use a new key just to get past the uncertainty.
pause, resume, restart and scale answer with workloadName, the new generation and acceptedAt. The change is already saved when the command answers, so there is no operation to follow with operation get. Watch its effect in containers get (paused, state, counts, the instances) and in containers events, and give the returned generation to the next control command. containers get lists the copies of the current release that still hold their place on a host and those that stopped and were cleaned up in the last hour, however long they ran; older ones remain in containers events.
containers events lists a workload's timeline, newest first. A job starts with queued when it is accepted. Each copy starts with preparing (pulling the image and staging inputs). A job's copy then shows running from the moment its process started, even when it ran for only a second. A job's outcome is one event from the execution itself, with the reason in error: succeeded, failed, timed_out, cancelled or outcome_unknown (an exit carries details.exitCode). An attempt that exits with one of its retryExitCodes shows as retry_wait, with that exit, before the next attempt. A job's copy adds its own failed event only for a failed preparation the job will try again. Services and workers show each copy's states as Control sees them (running, ready, stopping, stopped, failed and so on), and crash_loop when the workload pauses.
Development uses the same commands under app dev containers with the local source directory in place of the app ID. The CLI takes the exact session from the workspace's saved dev state:
opencloud app dev containers list "$APP_DIR"
opencloud app dev containers run "$APP_DIR" report --input '{"format":"csv"}' \
--idempotency-key dev-report-request-001
opencloud app dev containers execution "$APP_DIR" "$EXECUTION_ID"
opencloud app dev logs "$APP_DIR" --surface container --workload reportFull MCP exposes production and development container tools on compute-enabled installations. The focused /build surface exposes only development compute tools, with an explicit appId and sessionId. Mutating tools require a stable idempotencyKey; generation checks and uncertain-outcome rules are unchanged. Payer consent and registry secret entry are not MCP compute operations.
In the dashboard, Containers links workload state, desired/actual counts, instances, execution timelines, Logs and Usage. Read safe errors by code, origin, phase, retry scope and billing disposition (see Errors). Keep the request ID and execution/instance IDs when asking for help; never paste credentials or input file contents into diagnostics.
Logs, resources and the Agent Feed
For normalized logs and the opt-in Agent Feed v2:
opencloud logs "$APP_ID" --page --surface container --workload report \
--execution "$EXECUTION_ID"
opencloud agent-feed "$APP_ID" --contract-version 2Each page entry names one of five surfaces: container (the app's containers), function (its Functions, including the ones its containers call), http (requests at the edge), ai (the AI gateway) or platform (OpenCloud's own lines about the app). --surface selects one, in upper or lower case; containers selects container, and functions or the older runtime select function. Any other name is refused with 400 LOG_SURFACE_UNKNOWN, whose details list the names and aliases.
opencloud logs reads production lines only: it leaves out every line a dev session or its verification sandboxes wrote. opencloud app dev logs reads only that session's own lines, with the same surfaces and filters.
Container log lines carry compute fields, among them workloadName, executionId, instanceId, generation, sourceSequence and stream. A process's standard output becomes info lines and its standard error error lines, whatever they say; many servers, uvicorn for one, write ordinary messages to standard error. Unlike Function logs, container stdout and stderr logs are not automatically redacted for app secret values—never print secrets or credentials to standard output or standard error. Customer lines never become platform incidents. Pages list the newest line first, and lines that share a timestamp keep their copy's order across pages, newest first like the rest. Logs have bounded retention and explicit gap, dropped-line, truncation and freshness fields. Preserve the original filters and time range when following a cursor. A gap, dropped lines or a stale observation mean partial coverage, not a healthy empty result. A page's computeObservation covers only the container lines its range and filters select. It lists the gaps in that range and says partial and truncated when the range has a gap or lines still awaiting delivery. It also says partial when the range runs past observedAt and that observation is more than 15 seconds old. A read of another surface doesn't carry it.
Resource samples give each counter (CPU, memory, peak memory, scratch and network) its own measurement time; after a process exits, a sample can combine older CPU and memory readings with a newer scratch reading. Use each counter's time rather than the sample's observedAt. A null counter is unknown. These samples and the app's own metrics never decide the charge.
Feed v2 also lists compute's own alerts, each with a title that names its condition and a state that says whether it holds now. Two are conditions that come and go, each listed as one entry: "Container observations are incomplete" (compute:observation_gap:…) fires once a running copy's resource samples or logs have been missing, more than 15 seconds late or dropped for five minutes (a shorter gap is never listed), and "Container service has remained unready" (compute:service_unready:…) once a service copy has been unready for a minute. Each is firing while it holds, then ok for 15 minutes after it cleared, and then leaves the list. lastTransitionAt says when it started or cleared, and observedAt when OpenCloud last checked it while it held, or found it cleared.
Feed v1 remains the default; v2 adds compute events and independent control, logs, resources and usage freshness. Both read a container's metrics and evaluate rules over them the same way, with the same states, values and breaches; v1 has no container source, so it names those points function (the app's own server-side code), where v2 says container. An unavailable source is not healthy: treat it as partial or unknown, never as zero. An app with nothing running reports control, resources and usage as available, since there is nothing to observe; usage is reported once a minute, so it stays available for 150 seconds after a report. compute.instances.ready counts copies doing their work against compute.instances.desired: services ready for traffic and workers running (a worker never reports ready). In both versions the jobs.* signals count Function queue jobs only; container jobs show in v2's compute.jobs.* signals.
Compute billing from the CLI
Payer administrators (see Funding and usage) can read compute billing from public CLI 3.22.0 or newer (v3.22.1 pinned) with their own account login (opencloud login): compute settings, compute prices and compute usage --from <ISO> --to <ISO> (a usage range is at most 31 days), under the same payer check as the dashboard. Enabling compute, changing spending limits, consenting to a price and setting up payment happen only in the dashboard, under Usage & limits; the CLI has no commands for them. App credentials (--token), Agent credentials and MCP connections can't read or change payer billing.
Errors
Every compute refusal has the same body:
{
"statusCode": 503,
"code": "COMPUTE_NO_CAPACITY",
"message": "Every available compute host is full right now. Retry shortly.",
"requestId": "4f1c2b0e-8d5a-4c41-9a7e-2b6f0d3c9e11",
"details": {
"category": "capacity",
"origin": "platform",
"phase": "admission",
"retryScope": "unstarted_preparation",
"retryable": true,
"billingDisposition": "none",
"workloadName": "report"
}
}The API, CLI and MCP return it as it is, and a job that ends unsuccessfully, like a service or worker copy that failed, keeps it in error. details.retryable says whether repeating the same request with the same idempotency key can help; it never starts another job attempt. retryAfterSeconds, when present, says when to try again. Optional fields name the workloadName, executionId, instanceId and attempt, and a job or copy whose own process decided the outcome carries its exitCode (and signal when the runtime reports one). Other platform errors, such as the Files errors below, have the same top-level fields without the compute details. A request refused as malformed answers 400 invalid_request: its message names up to three wrong fields and why, and details.fields lists each as { field, code, message }, never repeating the value sent.
In a Function, a refused containers.* call throws an OpenCloudError with this code and HTTP status. Its details is the whole body above, so the compute fields are in error.details.details, and its own retryable is true for every 429 and 5xx answer. The container client's ContainerError has code, status, requestId, retryable, the platform's message, and its scalar details (such as upstreamStatus); see the runtime client.
Availability, funding and capacity:
| Code | HTTP | retryable | Meaning and next step |
|---|---|---|---|
COMPUTE_RUNTIME_UNAVAILABLE | 503 | Yes | A host's sandbox or policy is unavailable |
COMPUTE_NOT_OFFERED | 422 | No | This installation doesn't offer containers: remove them, and a container frontend, from opencloud.yaml to use the app here |
COMPUTE_NOT_ENABLED | 403 | No | Containers aren't turned on for the app owner or their organisation, or the payer has no funding |
COMPUTE_BILLING_UNAVAILABLE | 503 | No | The payer's billing mode isn't available; this release has no paid modes |
COMPUTE_PAYMENT_REQUIRED | 402 | No | The payer must set up funding first |
COMPUTE_BUDGET_EXCEEDED | 429 | No | The payer's spending limit is reached; wait for the limit or period to change |
COMPUTE_CAPACITY_EXCEEDED | 429 | Yes | The payer's limit on running containers is reached |
COMPUTE_QUEUE_FULL | 429 | Yes | The payer already has 1,000 unfinished jobs |
COMPUTE_NO_CAPACITY | 503 | Yes | Hosts are up, but none has room now. Accepted jobs wait (no_capacity) |
COMPUTE_HOST_UNAVAILABLE | 503 | Yes | No host is available: down, unreachable or under maintenance. Accepted jobs wait |
Starting and managing work:
| Code | HTTP | retryable | Meaning and next step |
|---|---|---|---|
COMPUTE_INVALID_DEFINITION | 422 | No | Fix the manifest field it names |
COMPUTE_NOT_FOUND | 404 | No | No workload or execution that this caller may see |
COMPUTE_CANCEL_PRODUCER_ONLY | 403 | No | Only the Function that started an execution can cancel it; start and cancel in one Function |
COMPUTE_REVISION_UNAVAILABLE | 409 | No (Yes after a secret change) | The release is no longer eligible, or the job's workload is paused (the message says so: resume it to start jobs again). Retryable in the second or so after a secret the job uses changed, before its configuration with the new value is ready |
COMPUTE_REVISION_CONFLICT | 409 | No | The workload changed: read it again for its current generation |
COMPUTE_IDEMPOTENCY_CONFLICT | 409 | No | The key was used before for a different request |
COMPUTE_IMAGE_NOT_FOUND, COMPUTE_IMAGE_ACCESS_DENIED, COMPUTE_IMAGE_TOO_LARGE, COMPUTE_UNSUPPORTED_IMAGE | 422 | No | Fix the image reference or registry connection, or rebuild the image for Linux amd64 |
COMPUTE_IMAGE_PULL_FAILED | 503 | Yes | The registry couldn't be reached |
COMPUTE_STARTUP_FAILED | 422 | No | The command or its startup probe failed; read the logs. With details.exitCode 126 or 127 the command isn't executable, or isn't in the image: check command and the image's entrypoint |
COMPUTE_STARTUP_TIMEOUT | 504 | No | Not ready within startupTimeoutSeconds; check the port and probe path |
COMPUTE_READINESS_FAILED | 503 | No | The release's health check got an answer outside 2xx; the message names the path and status. Before the switch a new copy's Function calls are refused, so serve the health path without one |
Job outcomes, in the execution's error:
| Code | HTTP | retryable | Meaning and next step |
|---|---|---|---|
COMPUTE_EXIT_NONZERO | 422 | No | The process exited unsuccessfully, with details.exitCode |
COMPUTE_STARTUP_FAILED | 422 | No | The process never started, or its command couldn't run (details.exitCode 126 or 127): check command and the image's entrypoint |
COMPUTE_OUT_OF_MEMORY, COMPUTE_SCRATCH_EXHAUSTED | 422 | No | Use less, or declare a larger allocation |
COMPUTE_TIMEOUT | 408 | No | The job reached timeoutSeconds |
COMPUTE_QUEUE_TIMEOUT | 408 | No | The job never started before queueTimeoutSeconds |
COMPUTE_CANCELLED | 409 | No | The job was cancelled |
COMPUTE_RELEASE_REPLACED | 409 | No | A newer release replaced the job's own before it started; start it again |
COMPUTE_INPUT_UNAVAILABLE | 409 | No | An input was deleted, replaced or became unauthorized before it was copied |
COMPUTE_INPUT_TRANSFER_FAILED | 503 | Yes | Copying an input failed |
COMPUTE_OUTPUT_INVALID | 422 | No | The outputs broke the declared limits or rules |
COMPUTE_OUTPUT_DIRECTORY_MISSING | 422 | No | The job declares outputs but never created its output directory; create it even when it writes nothing |
COMPUTE_OUTPUT_COLLECTION_FAILED | 503 | Yes | Publishing the outputs failed; only the publishing is retried, never the process |
COMPUTE_COMPLETION_FAILED | 502 | Yes | onComplete delivery failed; the job's result stands |
COMPUTE_OUTCOME_UNKNOWN, COMPUTE_WORKER_LOST | 409, 503 | No | No trustworthy result; check the app's state before you start the work again |
COMPUTE_AUTHORITY_REVOKED | 403 | No | Its authority ended while it waited or ran: the app, the dev session, a secret it uses removed while it ran, or the access of the person who started it |
COMPUTE_REVISION_UNAVAILABLE | 409 | No | A secret the job uses was removed while it waited to start; the message names it. Set it again, then start the job again |
COMPUTE_LEASE_EXPIRED | 409 | No | Its funding couldn't be renewed |
COMPUTE_EGRESS_LIMIT | 429 | No | The payer's daily transfer allowance is used up |
Service requests, through a route or containers.request:
| Code | HTTP | retryable | Meaning and next step |
|---|---|---|---|
COMPUTE_STARTING_PENDING | 503 | Yes | A cold start took longer than the request may wait. When no host is available, or every host is full, the request gets COMPUTE_HOST_UNAVAILABLE or COMPUTE_NO_CAPACITY instead, with nothing billed |
COMPUTE_SERVICE_UNAVAILABLE | 503 | No when paused or when its copy stopped mid-request; Yes when no copy was ready in time, or after a removed secret | The service has no ready copy, or is paused: then the message says so, retryScope is none and no usage is claimed; resume it first. A request whose copy stopped serving while it was under way gets it too, with the reason in the message: not repeated, since it may have had its effects. Retryable, with retryAfterSeconds, when no copy became ready before the request's admission deadline. Retryable when a secret its copies used was removed and they stopped: a copy starts again once it can run without it, or with it set again |
COMPUTE_CONCURRENCY_EXCEEDED | 429 | Yes | Every copy's concurrency is in use and the request couldn't wait any longer |
COMPUTE_REQUEST_TOO_LARGE, COMPUTE_REQUEST_HEADERS_TOO_LARGE | 413, 431 | No | Send less; use Files for large content. containers.request refuses a body over 4 MiB with COMPUTE_REQUEST_TOO_LARGE before sending it |
COMPUTE_REQUEST_TIMEOUT | 504 | No | The request passed requestTimeoutSeconds |
COMPUTE_UPSTREAM_FAILED | 502 | No | The connection to the copy failed or it answered with invalid HTTP. For containers.request, also a response over 32 MiB (then origin is app and the message names the limit), or one whose connection broke part way (the message says how many bytes arrived) |
COMPUTE_PROTOCOL_UNSUPPORTED | 422 | No | Use HTTP/1.1, SSE or WebSocket |
Calls from a container to OPENCLOUD_CONTAINER_GATEWAY_URL:
| Code | HTTP | retryable | Meaning and next step |
|---|---|---|---|
COMPUTE_CAPABILITY_INVALID | 401 | No | The credential is missing, malformed or old: read the capability file again for every call |
COMPUTE_NOT_LIVE | 503 | Yes | This copy's release isn't live yet; retry with the same key |
COMPUTE_AUTHORITY_REVOKED | 403 | No | The Function or metric isn't in the container's permissions, or this copy may no longer call: its stop ended its calls (see When a copy stops), or the app's access ended |
COMPUTE_RELEASE_REPLACED | 409 | No | A deploy, rollback or dev sync replaced this copy's release, and the copy is stopping: checkpoint as you go, and the new release's copies carry on |
COMPUTE_NOT_FOUND | 404 | No | A wrong path or method; only the two documented calls exist |
COMPUTE_LEASE_EXPIRED | 409 | No | The copy's funding ended, and it is stopping |
COMPUTE_CONCURRENCY_EXCEEDED | 429 | Yes | More than 8 calls at once from one copy |
COMPUTE_METRIC_INVALID | 422 | No | A metric the container may not record, an undeclared dimension value, a negative counter increment, or a malformed measurement such as a value that isn't a finite number (details.field names the field, such as measurements.0.value) |
COMPUTE_METRIC_LIMIT | 429 | Yes | The app recorded more than 1,200 measurements this minute, or keeps 100,000 already |
COMPUTE_FUNCTION_FAILED | 502 | No | The Function answered with an error status (details.upstreamStatus); its logs say why. Once the failure is confirmed the same key keeps getting this answer |
COMPUTE_OUTCOME_UNKNOWN | 409 | No | An earlier call with this key is still running, or its outcome is unknown |
COMPUTE_IDEMPOTENCY_CONFLICT | 409 | No | The key was used before with a different input |
COMPUTE_RUNTIME_UNAVAILABLE | 503 | Yes | The host couldn't reach the platform, or got no answer within 30 seconds; the Function may still finish |
Files, when a job is started:
| Code | HTTP | Meaning and next step |
|---|---|---|
AUTH_REQUIRED | 401 | With files.access: user, a job with input files or outputs needs a signed-in user |
FILE_INPUT_UNAVAILABLE | 403 | A selected file isn't in this app and environment, isn't ready, was deleted, or belongs to another user |
FILE_TRANSFER_INVALID | 400 | Too many files, or the inputs and reserved outputs exceed the declared limits or the scratch space |
FILE_DELEGATION_INVALID | 403 | The Function can't hand files to a job. A queue consumer that was handed files through its queue gets this for every containers call |
FILES_DISABLED | 409 | The job uses files, but the release declares no files |
