Pipeline runs use the workspace's directory environment

Resolve the run workspace's environment with workenv (direnv, parent
.envrc, mise; same account rule as Claude chats) at run start and resume,
and apply it to Pi stage processes, a per-environment Pipelines-owned
OpenCode stage service (keyed by a hash of the change, reused across runs,
idle ones stopped after PIPELINES_OPENCODE_STAGE_IDLE_TIMEOUT, revived per
registration), delivery-gate checks and merges, plain-stage opencode CLI
calls and file-change capture git reads. Record the directory, .envrc
files, sources and variable names (never values) on the run detail; a
blocked .envrc becomes a run warning.
This commit is contained in:
2026-11-04 18:08:42 +00:00
parent e0d7b720f5
commit cedfc22e45
26 changed files with 1173 additions and 84 deletions
+7 -1
View File
@@ -7,6 +7,7 @@ import (
"errors"
"fmt"
"git.a-wan.net/alan/pipelines/internal/opencode"
"git.a-wan.net/alan/pipelines/internal/workenv"
"io"
"os"
"os/exec"
@@ -132,8 +133,13 @@ func (c OpenCodeClient) call(ctx context.Context, method, path string, body any)
}
cmd := opencode.CommandContext(ctx, opencode.Executable(), args...)
cmd.Dir = directory
// The run's directory environment (workenv.WithEnvironment), if any.
cmd.Env = workenv.CommandEnv(ctx, directory)
if c.ArtifactsDir != "" {
cmd.Env = append(os.Environ(), ArtifactsEnv+"="+c.ArtifactsDir)
if cmd.Env == nil {
cmd.Env = os.Environ()
}
cmd.Env = append(cmd.Env, ArtifactsEnv+"="+c.ArtifactsDir)
}
if c.connection != nil {
c.connection.PinCLI(cmd)