engine-adapters: clan vars --prompt-input flag unrecognised by the pinned clan CLI (answered/rotation generate fails) #186

Closed
opened 2026-07-30 05:25:07 +00:00 by ben · 5 comments
Owner

Parent / precedent

Surfaced by the #185 write-side family-1 smoke on the golden clan-lab (clan-core db4db726), 2026-07-30. Filed as its own ticket per the #184/#185 split precedent (a defect a family smoke surfaces that is out of the surfacing ticket's scope gets its own slice).

The defect

internal/clan/vars.go varsFace.Generate feeds known prompt answers to clan vars generate via a --prompt-input <file> flag:

if promptFile != "" {
    args = append(args, "--prompt-input", promptFile)
}

The pinned clan CLI (db4db726) does not recognise that flag:

$ clan vars generate node1 --regenerate --generator smoke-tls --prompt-input /tmp/ans.json
clan: error: unrecognized arguments: --prompt-input /tmp/ans.json

clan vars generate --help at this pin offers --fake-prompts (testing only) and stdin for prompt answers — there is no file-based prompt-input flag. So any answered generate — which includes the adapter's rotation path (answered[ref] && sealed → --regenerate --generator <g> with the answer file) — fails against the real pinned CLI. The headless seal (no answers → no flag) works fine; #185's smoke proved the seal through the real adapter and proved rotation scoping at the raw clan seam.

What a fix needs to decide

How the adapter feeds prompt answers headlessly at the pinned clan version, keeping the S13 Q1 "no TTY, never hang" contract:

  • stdin (the CLI's interactive channel) fed as data — but that reopens the PTY-vs-headless question; or
  • a newer clan pin that restores a file-based flag; or
  • gate answered-generate behind a capability check.

Plus: the adapter's rotation model couples "rotate" to "answered", but a script-based (non-prompting) generator needs no answer to be rotated — worth revisiting so a no-prompt rotation does not require a dummy answer at all.

Not in scope of #185

#185 is the clan-native inventory rendering layer; this is the clan vars-CLI transport. vars_test.go's scripted CLI double does not exercise the real flag, so this only shows against a real clan.

## Parent / precedent Surfaced by the **#185 write-side family-1 smoke** on the golden clan-lab (clan-core `db4db726`), 2026-07-30. Filed as its own ticket per the #184/#185 split precedent (a defect a family smoke surfaces that is out of the surfacing ticket's scope gets its own slice). ## The defect `internal/clan/vars.go` `varsFace.Generate` feeds known prompt answers to `clan vars generate` via a `--prompt-input <file>` flag: ```go if promptFile != "" { args = append(args, "--prompt-input", promptFile) } ``` The pinned clan CLI (`db4db726`) **does not recognise that flag**: ``` $ clan vars generate node1 --regenerate --generator smoke-tls --prompt-input /tmp/ans.json clan: error: unrecognized arguments: --prompt-input /tmp/ans.json ``` `clan vars generate --help` at this pin offers `--fake-prompts` (testing only) and stdin for prompt answers — there is **no** file-based prompt-input flag. So any *answered* generate — which includes the adapter's **rotation** path (`answered[ref] && sealed` → `--regenerate --generator <g>` **with** the answer file) — fails against the real pinned CLI. The headless **seal** (no answers → no flag) works fine; #185's smoke proved the seal through the real adapter and proved rotation *scoping* at the raw clan seam. ## What a fix needs to decide How the adapter feeds prompt answers headlessly at the pinned clan version, keeping the S13 Q1 "no TTY, never hang" contract: - stdin (the CLI's interactive channel) fed as data — but that reopens the PTY-vs-headless question; or - a newer clan pin that restores a file-based flag; or - gate answered-generate behind a capability check. Plus: the adapter's rotation model couples "rotate" to "answered", but a script-based (non-prompting) generator needs no answer to be rotated — worth revisiting so a no-prompt rotation does not require a dummy answer at all. ## Not in scope of #185 #185 is the clan-native inventory **rendering layer**; this is the clan **vars-CLI transport**. `vars_test.go`'s scripted CLI double does not exercise the real flag, so this only shows against a real clan.
Author
Owner

This was generated by AI during triage.

Triage

Category: bug — confirmed real defect, verified against the code.

Verification: read internal/clan/vars.go:111-131 — varsFace.Generate does append --prompt-input <file> to the clan vars generate invocation whenever an answer file is written (the answered/rotation path). This matches the issue's repro exactly. vars_test.go only exercises a scripted CLI double (comment at L15-16: "a scripted clan-CLI double that stands in for clan's per-generator secret sealing"), which is why this never showed up before a real-clan smoke (#185). No existing fix in the tree; not redundant. Checked .out-of-scope/ (does not exist yet) and the ADR index for any prior ruling on headless prompt-answer transport at this clan pin (searched for "S13", "no TTY", "never hang" across docs/adr/*.md) — no ADR settles this, so it is not a previously-rejected request either.

State: ready-for-human, not ready-for-agent — the issue body itself lays out three materially different fixes with no clear winner from the repo's existing decisions:

  1. Feed answers over stdin instead of a file — reopens the PTY-vs-headless question the S13 spike was gating on (ADR 0002, 0010 reference S13 as pre-validating headless clan driving; neither settles this specific sub-question).
  2. Pin a newer clan CLI that restores a file-based prompt flag — a dependency/pin change with its own compatibility blast radius across every other adapter call site pinned to db4db726.
  3. Gate answered-generate behind a capability check — changes the adapter's contract/error surface for callers.

Plus a separate coupling question the issue flags: whether "rotate" should require an "answered" generator at all, given script-based generators need no prompt answers.

None of these is a mechanical implementation task — each is a transport/architecture choice with downstream consequences (S13's no-TTY-never-hang contract, the clan version pin, the adapter's public contract). Per the design-to-agent system's human-decision gate, this routes to ready-for-human with the judgement call named rather than ready-for-agent.

Suggested next step for the human: pick one of the three transport options above (or the stdin-vs-capability-gate combination), and decide separately whether to decouple "rotate" from "answered" in the same pass or file it as a follow-on.

> *This was generated by AI during triage.* ## Triage **Category:** `bug` — confirmed real defect, verified against the code. **Verification:** read `internal/clan/vars.go:111-131` — `varsFace.Generate` does append `--prompt-input <file>` to the `clan vars generate` invocation whenever an answer file is written (the answered/rotation path). This matches the issue's repro exactly. `vars_test.go` only exercises a scripted CLI double (comment at L15-16: "a scripted clan-CLI double that stands in for clan's per-generator secret sealing"), which is why this never showed up before a real-clan smoke (#185). No existing fix in the tree; not redundant. Checked `.out-of-scope/` (does not exist yet) and the ADR index for any prior ruling on headless prompt-answer transport at this clan pin (searched for "S13", "no TTY", "never hang" across `docs/adr/*.md`) — no ADR settles this, so it is not a previously-rejected request either. **State: `ready-for-human`**, not `ready-for-agent` — the issue body itself lays out three materially different fixes with no clear winner from the repo's existing decisions: 1. Feed answers over stdin instead of a file — reopens the PTY-vs-headless question the S13 spike was gating on (ADR 0002, 0010 reference S13 as pre-validating headless clan driving; neither settles this specific sub-question). 2. Pin a newer clan CLI that restores a file-based prompt flag — a dependency/pin change with its own compatibility blast radius across every other adapter call site pinned to `db4db726`. 3. Gate answered-generate behind a capability check — changes the adapter's contract/error surface for callers. Plus a separate coupling question the issue flags: whether "rotate" should require an "answered" generator at all, given script-based generators need no prompt answers. None of these is a mechanical implementation task — each is a transport/architecture choice with downstream consequences (S13's no-TTY-never-hang contract, the clan version pin, the adapter's public contract). Per the design-to-agent system's human-decision gate, this routes to `ready-for-human` with the judgement call named rather than `ready-for-agent`. **Suggested next step for the human:** pick one of the three transport options above (or the stdin-vs-capability-gate combination), and decide separately whether to decouple "rotate" from "answered" in the same pass or file it as a follow-on.
Author
Owner

Ben's ruling (2026-07-30) — stdin.

The adapter feeds prompt answers to clan vars generate via stdin as data, at the current pin (db4db726). No pin bump for this; capability-gating rejected — answered generate/rotation must actually work headlessly.

Guardrails (the S13 Q1 "no TTY, never hang" contract holds):

  • never attach a TTY — stdin is a closed-after-write pipe carrying the answers, nothing interactive;
  • a hard timeout on the subprocess so a CLI that unexpectedly waits for more input fails loud instead of hanging;
  • no answers → stdin closed immediately (the already-working headless seal path is untouched).

The follow-on (rotation coupled to "answered", forcing a dummy answer for no-prompt generators): decouple it as part of this fix — a --regenerate of a non-prompting generator needs no answer fed. Shape of that decoupling is agent-decided.

A newer clan pin with a file-based flag can be weighed later on its own merits — out of scope here.

**Ben's ruling (2026-07-30) — stdin.** The adapter feeds prompt answers to `clan vars generate` **via stdin as data**, at the current pin (`db4db726`). No pin bump for this; capability-gating rejected — answered generate/rotation must actually work headlessly. Guardrails (the S13 Q1 "no TTY, never hang" contract holds): - never attach a TTY — stdin is a closed-after-write pipe carrying the answers, nothing interactive; - a hard timeout on the subprocess so a CLI that unexpectedly waits for more input fails loud instead of hanging; - no answers → stdin closed immediately (the already-working headless seal path is untouched). The follow-on (rotation coupled to "answered", forcing a dummy answer for no-prompt generators): decouple it as part of this fix — a `--regenerate` of a non-prompting generator needs no answer fed. Shape of that decoupling is agent-decided. A newer clan pin with a file-based flag can be weighed later on its own merits — out of scope here.
Author
Owner

Taken by Ben's local session (2026-07-30) — implementing the stdin ruling here, alongside the #175 smoke run. Label parked no-triage so the swarm doesn't double-work it.

Taken by Ben's local session (2026-07-30) — implementing the stdin ruling here, alongside the #175 smoke run. Label parked `no-triage` so the swarm doesn't double-work it.
Author
Owner

Blocked — Ben's 16:31 ruling rests on a premise the pinned clan source contradicts (source-verified)

A Sandcastle iteration read the pinned clan-core source (db4db726) to implement the stdin transport and found the ruling's mechanism is not how the pinned CLI works. Recording the evidence and the decision needed; routing to ready-for-human. The ask-human thread for this issue got no reply in the window, so this is the durable record (a later ask resumes that thread).

What the source actually shows (files fetched from git.clan.lol at rev db4db726f0c16fe7d1c97adf020811f705d2ef81)

  1. clan vars generate has no stdin path for prompt answers, and no --prompt-input. clan_cli/vars/generate.py registers only machines, --generator/-g, --regenerate/-r, --no-sandbox, --fake-prompts. Prompt answers flow through clan_lib/vars/prompt.py ask() → get_input(), which uses raw-terminal termios mode: fd = sys.stdin.fileno(); termios.tcgetattr(fd); tty.setraw(fd) then char-by-char sys.stdin.read(1). On a pipe, tcgetattr raises termios.error: (25, 'Inappropriate ioctl for device') — clan crashes, it does not read the answer. So "feed clan vars generate a stdin pipe carrying the answers" is impossible at this pin (it trades a hang for a crash, and the secret is never generated).

  2. The pin's real stdin-as-data path is a different command: clan vars set <node> <generator>/<prompt>. clan_cli/vars/set.py → clan_lib/vars/set.py set_via_stdin:

    if sys.stdin.isatty():
        new_value = ask(var.id, PromptType.MULTILINE_HIDDEN, None, [machine_name]).encode("utf-8")
    else:
        new_value = sys.stdin.buffer.read()   # <-- reads the value from a PIPE, never a TTY
    set_var(machine, var, new_value, flake)
    

    This matches every guardrail in the ruling (pipe, no TTY, closed-after-write; a hard subprocess timeout still applies). A persisted prompt's value is stored as a var generator/promptname (generator.py get_previous_value reads _secret_store.get(self.key, prompt.name)), so clan vars set writes exactly what a later clan vars generate reuses.

  3. Prompt-driven rotation still can't run headless at this pin. generate_command sets auto_accept_prompts = not args.regenerate → with --regenerate it is False, so _default_prompt_func takes the else: ask() branch (TTY) even when a value is stored. Non-prompting rotation (--regenerate --generator g, generator has no prompts) never reaches ask() and runs fine on a closed pipe — that is exactly the smoke-tls case #185 proved.

  • Add Stdin to Invocation (data via an EOF-closed pipe, never a TTY) + a hard subprocess timeout in ExecCLI.
  • Feed each supplied prompt answer via clan vars set <node> <generator>/<prompt> on a closed stdin pipe, then clan vars generate seals headlessly reusing the set value. Drop the broken --prompt-input flag.
  • Decouple rotation: a --regenerate of a non-prompting generator feeds no answer/stdin (no dummy). A value-less answer is a pure rotation selector.

The decision needed (why this is ready-for-human, not a silent reinterpretation)

Two things changed under the ruling's feet: (a) the transport command pivots from clan vars generate to clan vars set (the ruling named the wrong subcommand because the ticket body's "generate feeds answers via stdin" is false in source); and (b) prompt-driven rotation is genuinely infeasible headless at this pin, which collides with the ruling's "answered generate/rotation must actually work headlessly / no capability-gating."

Please confirm:

  1. Pivot generate-stdin → clan vars set as above? (Recommended — it's the only pin-accurate stdin-as-data path and satisfies every guardrail.)
  2. Prompt-driven rotation: (a) refuse it with a typed, legible error (no hang/crash) and defer real prompt-rotation to the newer-pin bump you set aside; or (b) allocate a PTY for just that one case (reverses "never a TTY").

Once (1)+(2) are ruled, the change is mechanical and this re-arms to ready-for-agent.

## Blocked — Ben's 16:31 ruling rests on a premise the pinned clan source contradicts (source-verified) A Sandcastle iteration read the pinned clan-core source (`db4db726`) to implement the stdin transport and found the ruling's mechanism is **not how the pinned CLI works**. Recording the evidence and the decision needed; routing to `ready-for-human`. The `ask-human` thread for this issue got no reply in the window, so this is the durable record (a later ask resumes that thread). ### What the source actually shows (files fetched from `git.clan.lol` at rev `db4db726f0c16fe7d1c97adf020811f705d2ef81`) 1. **`clan vars generate` has no stdin path for prompt answers, and no `--prompt-input`.** `clan_cli/vars/generate.py` registers only `machines`, `--generator/-g`, `--regenerate/-r`, `--no-sandbox`, `--fake-prompts`. Prompt answers flow through `clan_lib/vars/prompt.py` `ask()` → `get_input()`, which uses **raw-terminal termios mode**: `fd = sys.stdin.fileno(); termios.tcgetattr(fd); tty.setraw(fd)` then char-by-char `sys.stdin.read(1)`. On a **pipe**, `tcgetattr` raises `termios.error: (25, 'Inappropriate ioctl for device')` — clan **crashes**, it does not read the answer. So "feed `clan vars generate` a stdin pipe carrying the answers" is impossible at this pin (it trades a hang for a crash, and the secret is never generated). 2. **The pin's real stdin-as-data path is a different command: `clan vars set <node> <generator>/<prompt>`.** `clan_cli/vars/set.py` → `clan_lib/vars/set.py` `set_via_stdin`: ```python if sys.stdin.isatty(): new_value = ask(var.id, PromptType.MULTILINE_HIDDEN, None, [machine_name]).encode("utf-8") else: new_value = sys.stdin.buffer.read() # <-- reads the value from a PIPE, never a TTY set_var(machine, var, new_value, flake) ``` This matches **every guardrail in the ruling** (pipe, no TTY, closed-after-write; a hard subprocess timeout still applies). A persisted prompt's value is stored as a var `generator/promptname` (`generator.py get_previous_value` reads `_secret_store.get(self.key, prompt.name)`), so `clan vars set` writes exactly what a later `clan vars generate` reuses. 3. **Prompt-driven *rotation* still can't run headless at this pin.** `generate_command` sets `auto_accept_prompts = not args.regenerate` → with `--regenerate` it is **False**, so `_default_prompt_func` takes the `else: ask()` branch (TTY) **even when a value is stored**. Non-prompting rotation (`--regenerate --generator g`, generator has no prompts) never reaches `ask()` and runs fine on a closed pipe — that is exactly the `smoke-tls` case #185 proved. ### Recommended plan (honors the ruling's intent + guardrails) - Add `Stdin` to `Invocation` (data via an EOF-closed pipe, never a TTY) + a hard subprocess timeout in `ExecCLI`. - Feed each supplied prompt answer via **`clan vars set <node> <generator>/<prompt>`** on a closed stdin pipe, then `clan vars generate` seals headlessly reusing the set value. **Drop the broken `--prompt-input` flag.** - **Decouple rotation:** a `--regenerate` of a non-prompting generator feeds no answer/stdin (no dummy). A value-less answer is a pure rotation selector. ### The decision needed (why this is `ready-for-human`, not a silent reinterpretation) Two things changed under the ruling's feet: (a) the transport command pivots from `clan vars generate` to **`clan vars set`** (the ruling named the wrong subcommand because the ticket body's "generate feeds answers via stdin" is false in source); and (b) **prompt-driven rotation is genuinely infeasible headless at this pin**, which collides with the ruling's "answered generate/rotation must actually work headlessly / no capability-gating." Please confirm: 1. **Pivot `generate`-stdin → `clan vars set` as above?** (Recommended — it's the only pin-accurate stdin-as-data path and satisfies every guardrail.) 2. **Prompt-driven rotation:** (a) refuse it with a typed, legible error (no hang/crash) and defer real prompt-rotation to the newer-pin bump you set aside; or (b) allocate a PTY for just that one case (reverses "never a TTY"). Once (1)+(2) are ruled, the change is mechanical and this re-arms to `ready-for-agent`.
Author
Owner

Done (Ben's stdin ruling, implemented same-day) — landed as 4394d55, lab-proven by the #175 family-1 smoke's vars leg (7-leg PASS run, 2026-07-30).

Ground truth at the pin (lab-probed, recorded in docs/spike-findings/smoke-clan-175.md): --prompt-input never existed; prompt answers land via clan vars set <node> <gen>/<prompt> reading stdin as data (set_via_stdin); a plain generate auto-accepts persisted answers and re-runs a generator whose answer changed (staleness = the prompting rotation); --regenerate re-asks interactively (headless termios crash, loud, ~1s) so it is never driven for a prompting generator.

Implementation: Invocation grew a data-only Stdin (closed-after-write pipe, never a TTY, never logged, hard answerFeedTimeout); rotation decoupled from "answered" (a valueless answer naming a sealed non-prompting secret drives a scoped --regenerate with no stdin; a valueless PROMPTING rotation is a typed FailMissingVar refusal); every generate scoped per-generator (a node-wide bulk would crash on undeclared prompting generators). Constraint recorded: prompting generators declare persist = true.

Smoke evidence: answered seal → Get revealed derived:<answer>; prompting rotation off a fresh answer churned ONLY itself; valueless non-prompting rotation churned ONLY itself (S13 Q3).

Done (Ben's stdin ruling, implemented same-day) — landed as `4394d55`, **lab-proven** by the #175 family-1 smoke's vars leg (7-leg PASS run, 2026-07-30). Ground truth at the pin (lab-probed, recorded in `docs/spike-findings/smoke-clan-175.md`): `--prompt-input` never existed; prompt answers land via `clan vars set <node> <gen>/<prompt>` reading **stdin as data** (`set_via_stdin`); a plain generate **auto-accepts** persisted answers and re-runs a generator whose answer changed (staleness = the prompting rotation); `--regenerate` re-asks interactively (headless termios crash, loud, ~1s) so it is never driven for a prompting generator. Implementation: `Invocation` grew a data-only `Stdin` (closed-after-write pipe, never a TTY, never logged, hard `answerFeedTimeout`); rotation decoupled from "answered" (a valueless answer naming a sealed non-prompting secret drives a scoped `--regenerate` with no stdin; a valueless PROMPTING rotation is a typed `FailMissingVar` refusal); every generate scoped per-generator (a node-wide bulk would crash on undeclared prompting generators). Constraint recorded: prompting generators declare `persist = true`. Smoke evidence: answered seal → `Get` revealed `derived:<answer>`; prompting rotation off a fresh answer churned ONLY itself; valueless non-prompting rotation churned ONLY itself (S13 Q3).
ben closed this issue 2026-07-30 17:45:09 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#186
No description provided.