Merge lane-go: titles, verdicts, human stage, line result format, stale-client guard

Integrates nine commits of reviewed work from the lane-go branch after the
automated resolver failed on this merge five times (each attempt dying on the
malformed-result defect whose fix is contained in this same merge).

Integration decisions:
- Search: kept main's shipped design (Store.Search + SearchResponse.Results) and
  dropped lane-go's parallel, older attempt (an unused Message.Matches field, an
  absent runs.search, and two partial TUI plumbing blocks). lane-go itself did not
  compile: protocol.SearchMatch was undefined and model.go referenced searchNav,
  requestSearch and applyRunNav, which exist nowhere. Those partial TUI blocks are
  removed; the queued TUI omni-search item will implement the surface properly on
  main's design.
- Both sides' additions are kept where they are independent: run titles and
  provenance, the human decision stage and its CLI/TUI surface, the derived stage
  verdict, the stale-client guard, the line-oriented result format, and main's
  search command.
- The search key's help label is now "/ omni search"; the two tests asserting the
  old label are updated rather than the label reverted.
- docs/cli.md and the packaged operations reference carry both sides' text.

Verified: go build ./... , go vet ./... and the full go test ./... suite pass.
This commit is contained in:
2026-10-16 22:21:43 +01:00
669 changed files with 7205 additions and 276 deletions
+18 -7
View File
@@ -2,10 +2,15 @@
Debug from **retained evidence**, never from an agent's summary. Open the run with
`CLI_PREFIX inspect RUN_ID --json` and read the exact stage outputs, outcomes,
diagnostics, file changes and artifacts. Identify evidence-supported causes and say
what remains unknown. Never fix a run's symptom by editing the project by hand: fix
the pipeline definition or the Pipelines/harness service, or record the failure and
continue.
diagnostics, file changes and artifacts. Each completed step also carries a
`verdict`: the chosen option (`outcome → target`), a one-line reason with its
provenance (`model`, `fallback` or `absent`), and the recorded artifacts the reason
refers to. In the TUI, selecting a stage shows that verdict at the top of the
stage's result, above its output and evidence. Treat the reason as a claim to check
against the step's output, never as evidence in itself. Identify evidence-supported
causes and say what remains unknown. Never fix a run's symptom by editing the
project by hand: fix the pipeline definition or the Pipelines/harness service, or
record the failure and continue.
Each playbook is *symptom → how to confirm → what to do*.
@@ -82,12 +87,18 @@ Each playbook is *symptom → how to confirm → what to do*.
- **Symptom** `inspect --json` or `ping --json` is missing fields this skill
describes, or a flag is rejected as unknown.
- **Confirm** `ping --json` for the server build identity and `version --json` for the
client. An older server omits `build`; an older client may not send newer fields.
- **Confirm** The client now reports this itself. A server response carrying a
top-level field this client does not model prints a one-time
`server sent unrecognized top-level field(s) ...` notice; a same-protocol build
mismatch prints one `warning:` naming both builds on stderr; and a server
speaking a newer protocol fails the command non-zero. `ping --json` shows the
server build identity and `version --json` the client; `ping`/`connection`
also print the client/server relationship. An older server omits `build`.
- **Do** Treat it as a version mismatch, not a run failure. State both versions and
the mismatch. **Do not infer** that a source fix or an updated skill is deployed.
Use only flags the installed help shows; do not restart or reinstall a service to
"fix" it without the operator (`references/operations.md`).
"fix" it without the operator (`references/operations.md`). Rebuild or reinstall
the CLI so it matches the server; never hand-edit an installed binary.
## A server restart killing in-flight runs
+42 -1
View File
@@ -105,6 +105,46 @@ Use this block for intentional file/command restrictions; prose is not a runtime
permission policy. Keep ordinary workflows language-neutral and unrestricted
within their run directory unless the user asks for a narrower scope.
## Human (decision) stages
A `type=human` stage pauses its run until a person chooses one of its outgoing
options. It has no model, agent, tools or configs: it needs a nonempty `prompt`
block (the operator instructions) and at least one non-`error` `edges` outcome.
Its outcomes are exactly its non-error edges, so a draft can express choices such
as `deploy`, `revise` or `abort`; the mandatory error edge is a failure route,
not a choice. It validates, renders, exports and imports like every other type.
````markdown
# stage gate
```output
The operator's decision evidence.
```
```prompt
Review the screenshots and artifacts above, then choose where the run goes.
```
```edges
deploy -> publish
revise -> worker
abort -> #failure
error -> #failure
```
````
When a run reaches a human stage its step becomes `waiting`, the run reports it is
waiting on a person, and nothing later runs. Decide from the TUI (open the run,
press `c`, pick an option, optionally type feedback, Enter) or the CLI:
`pipelines decide <run-id> [stage] --option KEY [--feedback TEXT]`. The decision
and feedback are recorded as the step's evidence (the feedback stays in the step
output, never an error diagnostic) and the run resumes along that
edge. The wait is persisted, so it survives a server restart. An unknown option is
refused with the valid list; a decision to a stage that is not waiting is refused;
a repeated decision for an already-decided visit does not double-apply. Cancel and
retry keep working while waiting and after a decision, and a human stage is never
killed by a stage timeout or `max_visits` (the shared run budget still applies).
Malformed final JSON has bounded recovery even with `retries=0`; it never changes
verdict/evidence. Recovery tries a deterministic local pass first (append missing
closing delimiters, drop one trailing comma, or insert the single comma/colon the
@@ -139,7 +179,8 @@ are not approved. Warn explicitly before adding/changing schedules.
## Notifications
Stage hooks use the global phone connection, never store credentials. Optional
fenced `notify` block: `on=success,failure`, `artifacts=markdown`.
fenced `notify` block: `on=success,failure` (add `waiting` to fire when a human
stage parks the run), `artifacts=markdown`.
Read this skill's `references/notifications.md` for the minimal terminal-path
recipe and optional native publisher format. Prefer hooks for ordinary success/error
alerts; a request to notify is not a request for a new delivery stage. Do not scan
+27 -4
View File
@@ -30,10 +30,10 @@ parallel/distributed task engine or a guarantee that model reports are correct.
fails another's concurrent run. An active session left over by a restart with no
owning active run is an orphan and still refuses new work until interrupted.
Reusing that active run's request key reattaches idempotently.
There are no parallel branches or built-in human approval stages. Optional
worktrees, full backup/restore, automatic database sync and independent
verifier stage types are future ideas, not existing capabilities. Do not
invent them in definitions.
`type=human` decision stages exist and pause the run (see `references/format.md`);
there are no parallel branches. Optional worktrees, full backup/restore,
automatic database sync and independent verifier stage types are future ideas,
not existing capabilities. Do not invent them in definitions.
- Services are native or Docker-based. With an existing Docker installation do not
start a competing native server. Server APIs are unauthenticated: trusted networks
only; never recommend public exposure. Tool scope is not a universal OS sandbox.
@@ -86,11 +86,34 @@ Use the authoritative `CLI_PREFIX` from the prompt:
`truncated`/`scanned_steps`/`scanned_bytes`/`cap`/`scan_bound_bytes`. Targets are
stable: `pipeline:<id>`, `pipeline:<id>:v<version>`, `run:<id>`,
`run:<id>:<sequence>`, `run:<id>:<sequence>:<field>`, or an artifact URL.
- `CLI_PREFIX runs --json`: run history (optional `--pipeline NAME` scope). Each run
carries a bounded, single-line `title` saying what it was for, set explicitly with
`CLI_PREFIX run ... --title "..."` or generated from its prompt by the shared
summariser on the configured default harness. It is never empty: when generation is
unavailable or times out the server derives the prompt's first line, and
`title_source` (`model`, `fallback`, or `explicit`) plus `title_model` record how it
was produced, so a diagnosis can tell them apart. Human `runs` and `inspect` show the
title beside the pipeline name and version, so two runs of one pipeline are
distinguishable; `CLI_PREFIX title RUN_ID "..."` renames a run after the fact
without changing its input or steps. The stored prompt is unchanged, and
listing/renaming never calls a model.
- `CLI_PREFIX inspect RUN_ID --json`: selected run, visits and retained evidence.
Exact stage outputs are authoritative; a transcript over the 32 KiB retained
bound is a valid, credential-redacted preview envelope (with preserved stage
limits, failure/format diagnostics and the retained session pointer), not the
complete tool history.
- `CLI_PREFIX decide RUN_ID [STAGE] --option KEY [--feedback TEXT] [--json]`: answer
a run that is `waiting` on a `type=human` stage. The status and the stage's
instructions/options are visible in `runs` and `inspect --json` (and the TUI
picker); the stage is inferred from the run's current stage unless named. The
choice and feedback are recorded as the step's evidence (its output and derived
verdict; the feedback is never an error diagnostic) and the run resumes along
`edges[KEY]`. An unknown option is
refused with the valid list; a stage that is not waiting is refused; a repeated
decision for an already-decided visit does not double-apply. The wait is persisted,
so `decide` still works after a server restart. `cancel` and `retry` keep working
while waiting and after a decision; a human stage is never killed by a stage
timeout or `max_visits` (the shared 30-step run budget still applies).
- `CLI_PREFIX run ... --json --wait --wait-timeout DURATION`: `--wait` polls until
terminal and `--wait-timeout` bounds only the client wait after admission,
independent of per-request `--timeout`. A reached wait limit leaves the admitted run