Report recorded decision evidence and harden the Pi artifacts env

Refinements on top of the human decision stage (a6aff47):

- `pipelines decide` now reports the feedback the server actually stored for
  the chosen option, so a repeated (idempotent) decision shows the recorded
  evidence instead of the ignored request text. A repeated decision is covered
  by a new assertion that also checks the step output does not change.
- The decision option/feedback output keys are defined once in protocol
  (DecisionOptionKey/DecisionFeedbackKey) with a DecisionEvidence reader, and
  the store and CLI use them instead of bare string literals.
- piEnvironment drops any inherited PIPELINES_ARTIFACTS_DIR before spawning Pi,
  so the artifactsDir argument is authoritative and an ambient directory (for
  example Pipelines' own when a stage runs inside another stage) never leaks
  into a child that was given none. Covered by a test with an ambient value set.
This commit is contained in:
2026-10-16 17:25:48 +01:00
parent a6aff47117
commit 98bbc2deac
6 changed files with 63 additions and 4 deletions
+4
View File
@@ -17,6 +17,10 @@ func TestPiEnvironmentCarriesArtifactsDirectory(t *testing.T) {
}
func TestPiEnvironmentOmitsEmptyArtifactsDirectory(t *testing.T) {
// An ambient artifacts directory (for example Pipelines' own when a stage
// runs inside another stage) must not leak into a Pi child that was given
// none: the argument is authoritative.
t.Setenv(ArtifactsEnv, "/ambient/artifacts/leak")
for _, entry := range piEnvironment("/tmp/ref", "") {
if strings.HasPrefix(entry, ArtifactsEnv+"=") {
t.Fatalf("unexpected artifacts entry %q", entry)
+14 -2
View File
@@ -312,9 +312,21 @@ func (c *PiClient) Generate(ctx context.Context, config ModelConfig, prompt stri
}
// piEnvironment builds the spawned Pi process environment, including the
// per-stage artifacts directory when the runtime provided one.
// per-stage artifacts directory when the runtime provided one. Any
// PIPELINES_ARTIFACTS_DIR inherited from the process that spawns Pi is dropped
// first: the artifactsDir argument is authoritative, so an absent directory is
// never silently replaced by an ambient one (for example Pipelines' own
// PIPELINES_ARTIFACTS_DIR when a stage runs inside another stage).
func piEnvironment(reference, artifactsDir string) []string {
env := append(os.Environ(), "PI_OFFLINE=1",
inherited := os.Environ()
env := make([]string, 0, len(inherited)+4)
for _, entry := range inherited {
if strings.HasPrefix(entry, ArtifactsEnv+"=") {
continue
}
env = append(env, entry)
}
env = append(env, "PI_OFFLINE=1",
"PIPELINES_PI_POLICY="+filepath.Join(reference, "policy.json"),
"PIPELINES_PI_LEASE="+filepath.Join(reference, "lease"),
"PIPELINES_PI_STOPPED="+filepath.Join(reference, "quiescent"))