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
+17
View File
@@ -37,6 +37,14 @@ const (
WaitingOptionsKey = "options"
)
// Decision evidence keys. A decided human step records the operator's chosen
// option and optional feedback in its output, so the choice stays visible in
// inspect and the TUI. They are the one definition of those keys.
const (
DecisionOptionKey = "option"
DecisionFeedbackKey = "feedback"
)
// NewWaitingEvidence builds the self-contained evidence a human stage persists
// at wait time: the operator instructions and the ordered options to choose.
func NewWaitingEvidence(prompt string, options []string) map[string]any {
@@ -72,6 +80,15 @@ func WaitingOptions(output map[string]any) []string {
return nil
}
// DecisionEvidence reads the recorded choice and feedback from a decided human
// step's output, or empty strings when none were recorded. It is the read side
// of DecisionOptionKey/DecisionFeedbackKey.
func DecisionEvidence(output map[string]any) (option, feedback string) {
option, _ = output[DecisionOptionKey].(string)
feedback, _ = output[DecisionFeedbackKey].(string)
return option, feedback
}
type SessionEvidence struct {
Sequence int `json:"sequence"`
SessionID string `json:"session_id"`