[4/6][rollout] feat: harbor execution backend v2 - #286
Merged
Conversation
mathewjhan
force-pushed
the
mathew/harbor-backend-v2
branch
from
August 6, 2026 22:29
7598f86 to
e62f900
Compare
mathewjhan
force-pushed
the
mathew/harbor-backend-v2
branch
from
August 6, 2026 22:31
e62f900 to
9ce689b
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
mathewjhan
force-pushed
the
mathew/harbor-backend-v2
branch
from
August 6, 2026 22:31
9ce689b to
16307d5
Compare
JoyboyBrian
approved these changes
Aug 6, 2026
mathewjhan
added a commit
that referenced
this pull request
Aug 6, 2026
…ncel endpoints (#287) Part of splitting #272 into reviewable pieces (5/6). Builds on #286 (backend capabilities). ## What this adds Three server-level behaviors that let a trainer manage load and track rollouts over plain HTTP: - **Admission control on `POST /rollout`**: when the backend's queue is at `max_queue_depth`, the server answers `429` with a `Retry-After` header instead of accepting work it cannot start. Accepted rollouts return `202`, which states what actually happens: the rollout is queued and runs after the response is sent. - **`GET /rollout/{id}/status`**: reports `queued`, `running`, or `grading` for live rollouts, and `success` / `failure` / `cancelled` (with reward and error message) for recently finished ones, retained for a fixed window. Anything else returns `unknown`. A trainer polls this as a liveness signal instead of trusting a blind timeout. - **`POST /rollout/cancel`**: takes exactly one selector — `{"ids": [...]}`, `{"prefix": "tenant-a::"}`, or `{"all": true}` — and returns a disposition per rollout (`cancelled_queued`, `cancelled_running`, `not_found`). Prefix cancellation is what a controller uses to stop everything belonging to one adapter when it is deregistered. Cancelling an already-finished rollout returns `not_found`, so the call is safe to repeat. ## Example ```bash curl -X POST $SERVER/rollout -d '{"rollout_id": "tenant-a::r1", ...}' # -> 202 (or 429 + Retry-After: 5 when the queue is full) curl $SERVER/rollout/tenant-a::r1/status # -> {"rollout_id": "tenant-a::r1", "status": "running"} curl -X POST $SERVER/rollout/cancel -d '{"prefix": "tenant-a::"}' # -> {"dispositions": {"tenant-a::r1": "cancelled_running"}} ``` Co-authored-by: Cursor <cursoragent@cursor.com>
|
Docs PR opened: https://github.com/osmosis-ai/docs/pull/68 Documented the new HarborBackendV2 execution backend, covering task modes, native agents, prewarming, cancellation, status, and admission control. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of splitting #272 into reviewable pieces (4/6). Builds on #284 (container contract) and #285 (packaging).
What this adds
HarborBackendV2: runs each rollout as a Harbor trial. The agent can be either a user workflow (packaged into a wheel and installed in the container at trial start) or a registered native Harbor agent (terminus-2,mini-swe-agent,oracle) with the rollout endpoint injected into its environment.How a rollout flows through it:
tasks.py): template mode uses one task directory for every rollout; dataset mode routes bymetadata["harbor_task_id"]to a folder undertasks_dir(path escapes rejected);metadata["harbor_task"]fetches a task from a local path, git checkout, or registry package, with per-ref locks so concurrent rollouts download once.tests/and a grader exists, atest.shis generated that installs and runs the grader. The ground-truth label is staged only intotests/, which Harbor uploads at verification time — the agent phase cannot read it.patch_dockerfile_with_sdkappends a block to the task's Dockerfile that installs a staticuvbinary and creates/opt/osmosis/venvwith the bundle's dependencies pre-installed. Per-trial installs then only add the user's own code (--no-deps), which cuts container startup from minutes to seconds. The patch is deterministic, so identical tasks keep identical image content hashes and share builds.harness_agent.py): the installed agent uploads the wheel, installs it into the venv, backfills an empty prompt from the task'sinstruction.md, runs the agent script, and returns the result through the trial's agent metadata.diagnostics.py), native-agent ATIF parsing with secret redaction, artifact relocation,prewarm()/prewarm_lifespan()to build task images before serving traffic,cancel_rollouts(ids | prefix | all),rollout_status()with terminal outcomes retained in aTtlCache([1/6][rollout] feat: add TtlCache utility #283), and admission control viamax_queue_depth.Example
A trainer then POSTs rollouts with
metadata={"harbor_task_id": "task-0042"}; each one runs in its own sandbox and reports back through the callbacks.