Skip to content
UHPUHPDeveloper Guide
Independent developer guide. Not affiliated with HarnessRouter or the official UHP project.

UHP Environments

Environments let many sessions reuse one built project without turning the session workspace into shared mutable state.

Page reviewed 4 Oct 2026 Source and review policy

Protocol: 2026-09-28Capability: environments

An Environment is a project’s files plus installed dependencies, built once and reused by sessions. The server mounts the selected version read-only at a fixed path beside the session’s writable working directory.

The separation is deliberate: project state is reusable; task artifacts still come from the session workspace.

  1. Create an Environment.
  2. Add/import project files.
  3. Build a version; the server installs declared dependencies.
  4. Let a successful build become active, or explicitly activate an earlier ready version to roll back.
  5. Attach it to a harness or select it for one task.
  6. A new session reads the active version through the read-only mount; an already-running turn keeps its starting version.

Build records expose status, stage and log information. Versions are immutable once built; activating another version provides rollback without rewriting an existing build.

The following workflow is derived from the versioned endpoint contract, checked 4 October 2026; it is not a live server test.

ObservationCheck nextMeaning
Discovery omits or disables environmentsStop Environment-specific requestsThe server has not advertised this optional surface.
Source upload succeeds but a task says environment_not_readyStart a build, then inspect its build recordUploading source does not install dependencies or publish a ready version.
A build is still runningRead builds/{version} status, stage and logBuild acceptance is not completion; one build runs per Environment at a time.
A new build fails while an older version was activeInspect the active version separately from latestVersionA failed build does not replace the previously usable version.
A package check returns 404Use documented build/registry checksPackage checking is optional; its absence does not disable Environments.
Source edits are not visible to a taskCompare source, active build and turn versionEdits require a new build; existing turns retain their starting version.

Use an Environment when several sessions need the same project and dependency set. Use the session workspace for generated files and per-task edits. Putting private per-session output into shared project state crosses the intended ownership boundary.

Plan a rollout and rollback without losing task provenance

Section titled “Plan a rollout and rollback without losing task provenance”

Suppose several sessions share a built project. Uploading a changed dependency file changes the source, not the version a task reads. Record the Environment ID, active version and build outcome before asking users to retry.

  1. Build the changed source and inspect the build record to a terminal outcome.
  2. Compare version (active) with latestVersion (newest attempted), especially after failure.
  3. Let a new turn read the active version; do not assume an already-running turn changes underneath you.
  4. For rollback, activate an earlier ready version rather than editing a published layer in place.
  5. Preserve the response’s metadata.environment and relevant version evidence alongside the task result.
SymptomInterpretation to check
One running task sees older filesIts starting version may correctly remain pinned
Source looks updated but all new tasks see old filesThe source may not have been successfully built/activated
Latest build failed while tasks still runAn older active version can remain usable
Task writes fail under the project mountRead-only enforcement may be working; write outputs to the session workspace

The Environments contract supplies the version/activation semantics. The operational checklist here keeps source edits, build acceptance and task-visible state distinct.

Harness and session objects use an ordinary environment field.

For a task, the patched UHP 2026-09-28 contract uses:

{
"metadata": {
"environment": "henv_..."
}
}

That task value overrides the harness default.

The current tasks.md request-field table still shows a top-level environment field. PR #331 explicitly removed that request property, and the changelog, JSON Schema, conformance EN-05/EN-07 and HarnessRouter gateway all use metadata.environment.

This guide therefore treats the table row as stale documentation. A top-level environment is accepted only under the protocol’s unknown-field rule and is ignored by the patched reference implementation.

A session MUST NOT be able to write into its Environment mount. Sessions sharing one Environment can read the same project bytes but do not share their writable working directories.

The current package is 2026.9.28.post3. Environment checks are capability-gated Full checks; current source includes EN-01 through EN-09.

Use the HTTP API map for the complete Environment endpoint family and security for build privileges, read-only mounts and path confinement.