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:
@@ -21,6 +21,7 @@ import (
|
||||
"git.a-wan.net/alan/pipelines/internal/stage"
|
||||
"git.a-wan.net/alan/pipelines/internal/summarise"
|
||||
"git.a-wan.net/alan/pipelines/internal/turn"
|
||||
"git.a-wan.net/alan/pipelines/internal/workenv"
|
||||
)
|
||||
|
||||
// activeRun records an in-flight or cleanup-unconfirmed run's cancellation seam
|
||||
@@ -39,6 +40,9 @@ type runner struct {
|
||||
mu sync.Mutex
|
||||
active map[int64]activeRun
|
||||
execute func(context.Context, stage.Definition, stage.Values) (stage.Result, error)
|
||||
// dirEnv resolves the run workspace's own environment (direnv/mise) at
|
||||
// run start; nil uses workenv.Default.
|
||||
dirEnv *workenv.Resolver
|
||||
|
||||
exportRepairMu sync.Mutex
|
||||
|
||||
@@ -1573,6 +1577,9 @@ func (r *runner) runLoop(ctx context.Context, id int64, graph protocol.Graph, na
|
||||
finish("failed", "error", "stage returned an undeclared outcome")
|
||||
return
|
||||
}
|
||||
// Every process started for this run (stages, the stage service, checks,
|
||||
// captures) gets the workspace's own environment, as a terminal there would.
|
||||
ctx = r.withRunEnvironment(ctx, id, workspace)
|
||||
// Resolve the effective provider/model for every model stage once, before the
|
||||
// loop, so applying an override is an in-memory O(1) map lookup per visit and
|
||||
// never re-parses the graph or re-resolves the whole definition. A run with no
|
||||
|
||||
Reference in New Issue
Block a user