Make Pipelines Docker-only with OpenCode and Pi

Install current verified harness releases inside Docker, preserve persistent accounts and settings, and provide separate interactive and pipeline model defaults with terminal onboarding and fuzzy pickers.

Add Docker-aware authoring transport, Pi stage execution, bounded workflow controls, reliable final-result readback and usage settlement, and finite short-lived CLI pipe draining. Keep dated installation evidence and packaged authoring guidance consistent.

Verified with a real Docker installation, both harness stages and interactive authors, the built-in plan/implement/review starter, independent host race/vet checks, installer tests, and packaged skill tests. Generated release receipts stay ignored in clean checkouts.
This commit is contained in:
2026-10-11 23:00:25 +01:00
parent c42a19f7d3
commit 05ae530442
131 changed files with 9297 additions and 355 deletions
+263 -2
View File
@@ -128,8 +128,11 @@ uses a mock OpenCode editor that submits with the real CLI, then verifies automa
reload to version 2 without another submission prompt. Another mock editor only
saves changes and still requires confirmation. A real local V2 no-inference
create/wait/delete contract succeeded; the reported remote planner `/wait` failure
could not be reproduced here. Safe CLI failure classification/exit-code reporting
was executed with a failing subprocess fixture.
could not be reproduced here. Later dated evidence (2026-10-10) did confirm the
CLI-side V2 `.../wait` request timeout after about six minutes (HTTP 499) on a long
stage; current source therefore settles V2 sessions with bounded
`/api/session/active` polling instead. Safe CLI failure classification/exit-code
reporting was executed with a failing subprocess fixture.
New-pipeline picker checks cover both editor choices, fuzzy/Tab navigation,
cancel-without-creating, retained source/server/create-only metadata and template
@@ -144,3 +147,261 @@ dimensions, and local spinner animation across pending views without extra RPCs.
Actual sample-data renders can be exported with `PIPELINES_TUI_PREVIEW_DIR=PATH
go test -run TestSoftThemeRenderPreviews ./internal/tui` for Home, New and pipeline
views in both themes. Compiled CLI/TUI PTY integration passed with the new styling.
## 2026-10-11 picker, resolver and installer coverage
These items describe current source and its offline/structural regression tests
unless they explicitly name an executed live result; the independent live run for
this change is still pending.
- `resolve-releases` performs one bounded
`GET /repos/{owner}/{repo}/git/matching-refs/tags/v2` request, which the GitHub
REST docs describe as a complete array with no pagination parameters. Offline
fixtures cover a 100+ ref response, the explicit `MAX_REFS`/`MAX_BODY` caps,
ignored prerelease/build tags, malformed refs and a missing newest-tag digest
failing closed with no older-tag fallback. The `tags/list` cross-check and all
pagination (`per_page`/`page`/`Link`) claims are removed.
- `internal/harness` picker tests check that text cursor blinks and unrelated
messages preserve the selected index while a real filter change resets it, that
reduced ANSI output keeps the selected row readable (caret/bold, no colliding
background) while TrueColor keeps the adaptive background, and that
40x16/80x24/120x36 layouts stay within the measured height with the
step/heading and selected row visible, including a long no-match query.
- The compiled picker PTY check is opt-in (`PIPELINES_HARNESS_PTY_DIR`); it now
waits through blink intervals and asserts the exact saved and arrow-scrolled
model. It was not executed as part of this documentation change.
- `setup-docker.py` accepts OpenCode's actual `opencode v2.0.26` probe token and
compares source identity only for a full install; model/login-only
reconfiguration compares the verified release image identity, so a changed
source no longer forces a reconfigure rebuild while a dirty install still
always invokes the Docker build. The image now includes python3.
- Python fixtures bind temporary `HOME`/`USERPROFILE` directories, so the
installer/configure suites pass under the container default `/home/pipelines`
without weakening `host_workspaces` guards (which still reject `/`, `/data`,
`/workspace`, `/home/pipelines` and `home == repository`).
- Still not tested here: a real Docker rebuild/reconfigure against live
registries, a real 40x16/80x24/120x36 terminal capture of the compiled picker,
phone delivery, and real model inference.
## 2026-10-11 retained-run fixture isolation and final-validation envelope
Root-reported runtime evidence supplied for this change (not re-executed by the
authoring stages): the existing seeded-profile regression
`go test ./tmp/preview-verification -run TestServerCLIFixtureDoesNotInheritUserDockerProfile -count=1`
failed because the child `internal/server` integration test inherited the
caller's real Docker-linked `PIPELINES_HARNESS_CONFIG`, so the CLI `debug` prefix
failed closed ("refusing to redirect") against the test's ephemeral httptest
endpoint. Root's four preview tests for the bounded transcript helpers pass,
Root's full host race run showed no race warning and only this fixture failure,
and `go vet ./...` passed. Current source isolates the server CLI fixture with
the existing missing-temp-file
`t.Setenv("PIPELINES_HARNESS_CONFIG", filepath.Join(t.TempDir(), "harnesses.json"))`
pattern, leaving the production fail-closed redirect guard in
`internal/harness/prefix.go` and its regressions unchanged and keeping the
real-profile isolation regression meaningful rather than removed.
Current-source behavior, not a deployment: independent re-execution of the full
`go build`/`go vet`/`go test` matrix (Docker-only race results stay Docker-only)
and the final installed-host Docker install verification are **still pending**;
no installed/running server state is claimed here.
## 2026-10-11 run13 interruption, Docker race limitation and state separation
Four states are kept explicitly separate and must not be conflated:
1. **Current source** (this checkout, not deployed): the retained maintenance
changes are present here — `internal/stage/diagnostics.go`
`BoundTranscript`/`transcriptBound = 32<<10` turns an oversized transcript into
a valid, bounded JSON envelope with credential redaction applied before any head
is taken and a rune-safe 8 KiB preview; `internal/stage/evidence.go` scopes
session evidence as `latest_bounded_evidence` using the single bounded
`finalAssistantReadback` (never the recent-20 all-message fetch);
`internal/server/evidence.go` reads at most the 3 most recent session-bearing
steps; `settleV2Usage` in `internal/stage/agent.go` issues exactly one
2s-bounded session-aggregate read after an unbudgeted V2 agent stage and leaves
missing/invalid usage unknown; and the isolated server CLI fixture uses the
missing-temp-file `t.Setenv("PIPELINES_HARNESS_CONFIG", …)` pattern with the
production fail-closed redirect guard in `internal/harness/prefix.go` unchanged.
Pi JSONL is never parsed as one JSON object and native V1 keeps its existing
path.
2. **Host verification evidence independently recorded by Root**: after the
fixture fix, Root ran the full `go test -race -count=1 ./...` (no race warning,
only the fixture failure before the fix) and `go vet ./...`; after the three
harness-neutral evidence labels and Step wording changes Root re-ran the
affected `tui`/`author`/`cli` race and vet checks, the Python suite (80) and the
opt-in compiled picker PTY check (4). These are Root-recorded host results; this
authoring change did not re-execute them.
3. **Deployed old image**: the running Docker image predates these source changes,
so the deployed server does not include them.
4. **Pending final install**: the final install and installed authoring/provider
verification remain **pending**. An updated skill/client or source checkout is
not deployment evidence.
Docker race limitation (confirmed): the Docker runtime is built with
`CGO_ENABLED=0` (`Dockerfile`) and has **no C compiler** (the Alpine runtime stage
installs no GCC/musl-dev), so `go test -race` cannot run there. In-Docker reviewers
must use ordinary `go build`/`go test`/`go vet`; race coverage comes from the
independently executed host `-race` runs above. Race checks must not be attempted
in Docker and no compiler may be installed or searched for.
Run13 interruption (dated evidence, not a fix): the previous reviewer ran
`find /` looking for GCC; the tool timeout left a process in disk sleep, Docker
could not stop the container, and an approved Desktop restart recovered run13 as
interrupted (`executing=false`, every step `agent_active=false`) with **no
automatic replay**. Docker startup recovery already sets running steps to
`interrupted` with `agent_active=0`. This is an environment/interruption
observation only: no general cancellation fix is inferred and process termination
is unchanged.
## 2026-10-11 short-lived CLI inherited-pipe cancellation (current source)
**Current source** (this checkout, not deployed) adds one shared, dependency-free
constructor in `internal/opencode`: `CommandContext(ctx, executable, args...)`
sets the single finite `os/exec.Cmd.WaitDelay` constant
`ShortLivedWaitDelay = 250ms` and is the only place that value is defined. It is
reused by all three short-lived, context-controlled CLI call sites — the
`internal/stage` `OpenCodeClient.call()` API/agent path (including
`Interrupt`), `opencode.Detect()`'s `--help` probe and the native
`Connection.Messages()` export fallback. It bounds **draining of inherited
output pipes only**: after the child exits, os/exec waits at most the grace for
descendants that still hold the inherited stdout/stderr pipes, then closes them
and reports `exec.ErrWaitDelay`. It does not terminate, signal or confirm cleanup
of descendants.
Existing identities and bounds are preserved: `context.Canceled` and
`context.DeadlineExceeded` are returned unchanged when the context is done,
`exec.ErrWaitDelay` survives on the sanitized `openCodeError` cause and on the
`Detect`/`Messages` errors, request (≤64 KiB), response (≤1 MiB), 8 KiB stderr and
`boundedBuffer`/`boundedOutput` drain-with-overflow behavior are unchanged, error
text stays free of provider bodies/prompts/credentials/CLI logs, and a failed
interrupt still leaves the session active and joins `ErrStageCleanup` with no
replay. A successful parent exit whose partial stdout is still held open by a
descendant is never parsed as a successful result. No new module dependency is
added.
**Dated synthetic reproduction** (`tmp/interrupt-verification`, synthetic
real-subprocess diagnostics, not provider evidence): Root waited for the
descendant itself to start before cancelling public
`OpenCodeClient{Backend:"v2"}.Interrupt`. Two Docker/Linux returns took
**3996ms/3995ms** despite `context.Canceled`
(`tmp/interrupt-verification/descendant-started.jsonl`); the stronger host
reproduction took **4003ms/4000ms**
(`tmp/interrupt-verification/reproduction.log`). These observed the previous
behavior and motivated the shared finite grace.
**Added regression coverage** (source-level/mocked; `internal/stage` and
`internal/opencode`, using real `os/exec` fixtures with start-marker barriers,
bounded watchdogs and naturally terminating owned children): cancel after a
descendant starts; deadline error identity; successful parent exit with
descendant-held pipes → `exec.ErrWaitDelay` with no success text; ordinary
help/API/export output, non-zero exit and redaction; and a failed interrupt that
retains cleanup-unconfirmed active ownership and performs no replay.
**Tested vs not deployed**: this describes current source. The running Docker
image predates these changes, so the fix is **not deployed**. Descendant
termination, confirmed remote interruption and any fix for the run13 Docker disk
sleep are explicitly **not claimed**. Docker race remains unavailable (the
runtime has no C compiler), so in-Docker reviewers use ordinary
`go build`/`go test`/`go vet` and host `-race` runs stay host-only.
## 2026-10-11 FINAL INSTALLED verification (friend-ready preview)
This is the dated receipt for the friend-ready preview runtime, recorded by Root
from `tmp/friend-final-verification` (authoritative `summary.json` plus the
installed PNG captures). It supersedes the phase-specific "pending final install"
statements in the earlier dated sections above; those observations stay as history
and are not deleted.
A normal interactive `./install` with both GoDeepseek flags —
```sh
./install --model opencode-go/deepseek-v4.1-flash \
--harness-model opencode-go/deepseek-v4.1-flash
```
— exited **0**. The installer resolved the current OpenCode/Pi releases **live**,
built from the **fresh dirty source**, and produced actual image
**`sha256:1810ab50f3ea3991e7f3548c79250e65a114bb1821eac52efd872b91cf7c3136`**
with **OpenCode 2.0.26 / Pi 1.1.0 / Node 24.18.1**. The install made a **real
tool-free provider validation** and a **real ntfy authenticated publish**, then
confirmed **server + host health**, **home/workspace entry** and the **saved
authoritative endpoint preserved**. Pre-install **database/home backup integrity
was `ok`**.
Post-install preservation checks **all passed**: original definitions 1–4, run
history 1–16, host/container default Pi and both models/profiles, the logical
endpoint, service URLs/timezone/ports/models, the Pi credential hash, the OpenCode
connected accounts and the ntfy token. Neither the original repository commit/push
nor any credential/data cleanup was performed.
Installed host-CLI authoring was actually used with **both** Docker harnesses:
separate retained drafts, each changing **only the worker prompt**, performed a real
shell CLI `ping` → `pong` and `validate` → `validated` through the generated Linux
`/usr/local/bin/pipelines` plus scoped transport aliases that preserved the original
logical `8081` endpoint and draft metadata. Root independently inspected the native
OpenCode completed shell tool outputs and the Pi retained JSONL `toolResults` and
validated both drafts; there was **no submit/run/publication** of the authoring
drafts.
Docker-proxy submit on **verification-only definition 5** → **published v2**; a
second stale v1 draft was **rejected as conflict**, and the original definitions
stayed untouched. **Run17** (definition 5 v2) **succeeded in 7 seconds**: OpenCode
then Pi reported the exact `pipelines-docker-verified` markers, both went
**inactive**, and OpenCode's **exactly one completed read of the marker file** was
verified from the **retained native history, not the latest-assistant preview**.
Unbudgeted reported usage was recorded best-effort and known here: OpenCode
**4011 tokens / $0.00029769599999999996** and Pi **1071 tokens / $0.000142002**;
unknown usage remains allowed by design. `GET /api/session/active` was empty after
the sessions exited.
Installed-UI captures under `tmp/friend-final-verification` (`installed-pi-*`,
`pi-signin-*`, `installed-pi-models-*`): actual run17 at **80x30** and **120x36**
showed neutral Pi evidence and the green both-stage graph; the actual installed Pi
auth handoff/method menu at **80x30** and **100x36** was viewed, canceled and exited
0 with **no sign-in**; the actual installed Pi model wizard at **80x30** viewed the
saved current model, filtered, confirmed the first with Enter and the second with
Esc (exit 1, expected cancel) using **copied preferences only**, while the **actual
production preferences were preserved**.
Root's independent checks: full host `go test -race -count=1 ./...` and
`go vet ./...` **exit 0**; Python suite **80 tests, exit 0, 1 optional PTY**;
Node policy **exit 0**; the isolated developer lifecycle fixture **exit 0 with no
inference/deploy**; author package tests **exit 0**. Earlier independent reviewer
runs performed the ordinary Docker full build/vet/tests and focused subprocess
regressions (ordinary build/vet/test only — **no Docker race, no GCC search, no
global `find`**).
Explicitly **UNVERIFIED** for this install: fresh OAuth/provider login completion,
phone delivery, other real providers, the D-disk-sleep fix and active lease expiry.
Authentication menus and existing-credential inference are **not fresh sign-in
proof**. The shared finite `WaitDelay` stronger synthetic PUBLIC `Interrupt`
child-start barrier (host **252/252 ms**, Docker **250/251 ms**, `context canceled`
true, bounded true vs ~4 s before) is a synthetic diagnostic and is **not proof of
descendant termination, remote cleanup or a Docker VM disk fix**. Archive
extraction, build-identity and compile verification remain **pending** until Root
executes it and are **not claimed** here.
## 2026-10-11 generated release receipt ignore (source-hygiene regression)
Current source adds two root-anchored `.gitignore` rules for the installer's
machine-local generated artifacts: `/.pipelines-releases.json` (the receipt path
from `setup-docker.py` `release_receipt_path()`) and `/.pipelines-releases-*` (the
`tempfile.mkstemp` `prefix=".pipelines-releases-"` in `record_release_receipt()`).
No installer/runtime code changed, and the pre-existing receipt and every other
file are retained.
Controlled isolated Git fixture (offline, credential-free, no network, Docker,
provider or model call): a new `scripts/test_build_metadata.py` case copies the
repository's actual `.gitignore` into a temp dir, `git init`s it, commits one
tracked source file, then writes a representative `.pipelines-releases.json` and a
`.pipelines-releases-abc123` temporary file. `git status --porcelain
--untracked-files=normal` is empty and the existing `build_metadata.docker_args`
helper returns `PIPELINES_DIRTY=false` with a version lacking `-dirty`; after
editing the tracked source the status is non-empty and `docker_args` returns
`PIPELINES_DIRTY=true` with a `-dirty` version. This shows the generated receipt no
longer dirties a clean checkout while dirty source still rebuilds.
This controlled fixture is **not** the actual new-account install/provider login
recorded in the 2026-10-11 FINAL INSTALLED section above, which this change does
not re-run. It is docs-and-ignore only, with no rendered UI and no live install or
provider evidence.