Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e2dbb0a
fix(engine): settle rejected SOP artifact writes
Nov 24, 2026
91332e3
fix(deploy): apply artifact storage migration before startup
Nov 24, 2026
377db66
fix(sop): stream artifact handoffs and settle transfer failures
Nov 24, 2026
02933b9
fix(engine): load referenced artifact bodies for prompt placeholders
Nov 24, 2026
c146f08
fix(engine): poll run progress without reading artifact bodies
Nov 24, 2026
1324e74
Merge origin/main into fix/pr1301
Nov 24, 2026
0b6a443
Merge origin/main into fix/pr1301
Nov 24, 2026
437eb25
Merge origin/main into codex/fix-sop-artifact-terminal-write
Nov 24, 2026
8bca19b
fix(runners): claim tasks without sorting their payloads
Nov 24, 2026
9b9b197
Merge origin/main into codex/fix-sop-artifact-terminal-write
Nov 25, 2026
f5d7db0
Merge origin/main into codex/fix-sop-artifact-terminal-write
Nov 25, 2026
ec7cdb3
fix(web): keep large and binary deliverables out of the in-page preview
Nov 25, 2026
00e49e7
fix(runs): keep the original extension when a deliverable is downloaded
Nov 25, 2026
f5085f6
fix(web): keep the artifact download control a button
Nov 25, 2026
07590d0
fix(web): detect binary deliverables by content before previewing
Nov 25, 2026
967edee
fix(engine): retry failed node state after a MySQL deadlock
codex Nov 25, 2026
04e06a4
fix(web): avoid fetching known binary artifacts for preview
codex Nov 25, 2026
7e94be2
Merge main with SOP artifact persistence and Runner compatibility
codex Nov 25, 2026
a85d6d3
test: keep artifact installer fixture compatible with LOOP migration
codex Nov 25, 2026
975355f
fix(engine): keep auto-reject when a failed node's terminal write errors
Nov 25, 2026
4cadb27
fix: retry failed SOP state writes without losing rework diagnostics
codex Nov 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,25 @@ services:
interval: 2s
timeout: 3s
retries: 60
artifact-migration:
profiles: [platform]
# Upgrade existing volumes before the platform starts. Fresh schemas are created by the platform.
image: mysql:8.4
entrypoint: ["sh", "-ec"]
command:
- exec mysql -h mysql -u loopforge loopforge < /migrations/042_run_artifacts_content_mediumtext.sql
environment:
MYSQL_PWD: ${LOOPFORGE_DB_PASSWORD:?Run scripts/configure.sh first}
volumes:
- type: bind
source: ./migrations/042_run_artifacts_content_mediumtext.sql
target: /migrations/042_run_artifacts_content_mediumtext.sql
read_only: true
bind:
create_host_path: false
depends_on:
mysql:
condition: service_healthy
platform:
profiles: [platform]
# Published release stack: never builds. Bump the pinned tag (here and in
Expand Down Expand Up @@ -71,6 +90,8 @@ services:
depends_on:
mysql:
condition: service_healthy
artifact-migration:
condition: service_completed_successfully
healthcheck:
test: ["CMD", "python3", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/api/health', timeout=2).close()"]
interval: 3s
Expand Down
17 changes: 17 additions & 0 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,12 @@ The upstream process roles remain `-role api`, `-role worker` and `-role all`. A

Personal runners are connected from the execution-machine page with a short-lived binding code. The installer is served at `/runners/install.sh`. `AGENTFLOW_RUNNER_BINARY` can point to binaries with `{os}` and `{arch}` substitutions. Container images bundle Linux/macOS amd64/arm64 runner and gate binaries. Native source installations can build on demand with Go.

SOP deliverables support up to 20 MiB per file. Runner 0.13.0 and later transfer
declared files separately from the task completion report, so several files
can be handed off together. Installations with automatic Runner updates
enabled receive the bundled version after the platform release. Older Runners
keep their 1 MiB inline upload limit until they update.

Docker workspaces on macOS use a Linux Runner executable for Git credentials and MCP calls. The installer chooses the architecture of the installed macOS Runner, including Intel binaries running under Rosetta. For a universal Runner on Apple Silicon it installs the arm64 helpers and adds the amd64 helpers when available. Foreground starts and the command printed by `--no-start` select the native arm64 slice, including from a Rosetta shell. On Intel Macs the installer installs the amd64 helpers. By default, it places the helpers next to the host binary. A Runner-side `AGENTFLOW_RUNNER_BINARY` template with `{os}` selects the installation and runtime path. To install both helpers, use `{arch}` and give each architecture a distinct destination. The installer saves the template for upgrades and includes it in launchd and in the startup command printed by `--no-start`. Helper paths must resolve to files separate from the macOS Runner.

The installer checks the helper destinations against the staged macOS binary and installs the required Gate MCP helpers before replacing an installed Runner. When the existing Runner has a working Docker helper, an upgrade requires a compatible helper at the new Runner's configured path before replacing the binary and restarting the service. Relative templates in the installed launchd configuration use the job's working directory. The installer and updater validate the Linux executable's format, architecture, and load segments before replacing it. Custom installs keep a compatible existing helper. A Runner built from a local checkout can build its companion from that checkout. A download URL with an `{os}` placeholder can supply both binaries when used as the Runner's download source.
Expand All @@ -217,6 +223,17 @@ For an external MySQL deployment, review that migration and check column existen
| Required upgrade migrations | `009_bot_interactions_utf8mb4.sql`, `036_git_http_credentials.sql`, `041_native_sandbox_inline_assets.sql` | Follow each migration's timing and prerequisites. [Migrating existing GitHub credentials](#migrating-existing-github-credentials) |
| Optional backfills and rewrites of existing rows | `016_public_optional_repositories.sql`, `021_assistant_session_sources.sql` | Run them if the installation needs the converted rows |

Compose runs `migrations/042_run_artifacts_content_mediumtext.sql` before the
platform starts, including during `./start.sh pull`. The native development
script runs the same migration against its Compose database. It widens an existing
`run_artifacts.content` column from `TEXT` to `MEDIUMTEXT` for inline artifacts
and preserves existing data, character set, collation and nullability. Larger
files use separate chunk tables added at platform startup.
For a deployment using an external MySQL server and no Compose startup, run this
SQL file in the deployment's database upgrade step before starting the new binary.
If the Compose migration fails, review `docker compose --profile platform logs
artifact-migration`, resolve the database error and rerun the upgrade.

### Migrating existing sandboxes to inline assets

Check out the upgraded release and stop the old platform and any other processes using the database. Back up the database while MySQL remains running. For Compose installations, apply the migration with these commands.
Expand Down
23 changes: 23 additions & 0 deletions internal/domain/artifact_blob.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package domain

import (
"crypto/sha256"
"encoding/hex"
"errors"
)

const MaxSOPArtifactBytes = 20 << 20
const MaxInlineRunnerArtifactBytes = 1 << 20

var ErrArtifactTooLarge = errors.New("artifact exceeds the file size limit")

type ArtifactBlob struct {
ID string `json:"id"`
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
}

func RunnerOutputBlobID(taskID, path string) string {
sum := sha256.Sum256([]byte(taskID + "\x00" + path))
return hex.EncodeToString(sum[:])
}
1 change: 1 addition & 0 deletions internal/domain/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ type Artifact struct {
Size int64 `json:"size"`
SHA256 string `json:"sha256"`
Content string `json:"content"`
BlobID string `json:"-"`
// RepositoryDir records which run repository workspace the artifact was
// collected from (empty = run workspace root, where SOP deliverables live).
RepositoryDir string `json:"repositoryDir,omitempty"`
Expand Down
23 changes: 19 additions & 4 deletions internal/domain/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ func (r Runner) SupportsCodeBuddyBaseURL() bool {
// when checking out repositories for a native workspace. Older runners clone fully.
const RunnerVersionRepositoryCache = "0.12.0"

// RunnerVersionArtifactTransfer introduced task-scoped streaming for SOP files.
const RunnerVersionArtifactTransfer = "0.13.0"

const RunnerResultReportError = "执行结果回传失败"

func (r Runner) SupportsArtifactTransfer() bool {
return versionAtLeast(r.RunnerVersion, RunnerVersionArtifactTransfer)
}

func (r Runner) SupportsSharedPush() bool {
return versionAtLeast(r.RunnerVersion, RunnerVersionSharedPush)
}
Expand Down Expand Up @@ -567,6 +576,7 @@ type RunnerInvocation struct {
// move a missing output file found elsewhere in the workspace into
// place, as the control plane does for its own sandboxes.
ReportOutputs bool `json:"reportOutputs,omitempty"`
ArtifactTransfer bool `json:"artifactTransfer,omitempty"`
OutputFiles []string `json:"outputFiles,omitempty"`
RecoverOutputs bool `json:"recoverOutputs,omitempty"`
HumanContext string `json:"humanContext,omitempty"`
Expand Down Expand Up @@ -668,17 +678,22 @@ func (inv *RunnerInvocation) GitSSHRemotes() []string {

// RunnerInputFile is one file written into the task workspace before a run.
type RunnerInputFile struct {
Path string `json:"path"`
Content string `json:"content"`
Path string `json:"path"`
Content string `json:"content,omitempty"`
ArtifactID string `json:"artifactId,omitempty"`
SHA256 string `json:"sha256,omitempty"`
Restore bool `json:"restore,omitempty"`
}

// RunnerTaskOutputs is what a runner reports about the task workspace after
// an invocation or script.
type RunnerTaskOutputs struct {
// Files maps a workspace-relative OutputFiles path to its content. Missing
// files and non-regular files are absent; oversized ones are in TooLarge.
Files map[string]string `json:"files,omitempty"`
TooLarge []string `json:"tooLarge,omitempty"`
Files map[string]string `json:"files,omitempty"`
TooLarge []string `json:"tooLarge,omitempty"`
FileBlobs map[string]ArtifactBlob `json:"fileBlobs,omitempty"`
FileErrors map[string]string `json:"fileErrors,omitempty"`
// Patches maps a repository checkout dir ("" is the workspace root) to
// its repository-patch inventory. Unchanged checkouts are absent.
Patches map[string]string `json:"patches,omitempty"`
Expand Down
Loading
Loading