Skip to content

feat(pipeline)!: the workflow front-end cutover — lifted verb providers, the retired executor, and the resume + schedule legs - #32

Merged
github-actions[bot] merged 11 commits into
mainfrom
feat/workflow-ir-w6a
Oct 4, 2026
Merged

github-actions[bot] merged 11 commits into
mainfrom
feat/workflow-ir-w6a

Conversation

@aitrawog

@aitrawog aitrawog commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The workflow front-end cutover for kind:pipeline — leg 6 of opencharly/charly#758
(Part of #758; that issue stays open, this is one leg of the wave).

kind:pipeline stops being a home-grown grammar with its own executor and becomes a
lobster-syntax front-end that lowers to the workflow provider class, while the seven
stage kinds that used to be private to runStage become ordinary verb: providers
reachable from any plan
. The in-process executor is deleted.

What changed, and why

1. The seven stage kinds are lifted into verb: providers (!). Before, agent,
probe, ade, generate, emit, media and gate existed only as kind: pipeline
stages: no plan anywhere else could reach them. They are now declared in NewMeta as
{Class: "verb", Word: <word>, InputDef: "#Pipeline<Word>Input"} (plugin.go) and routed by
Invoke's OpRun arm, so a <word>: <input> step reaches them from any plan — a task, a
candy plan, or a pipeline step. The bodies moved, they were not rewritten (R3): runStage,
render.go, media.go, ade.go, probes.go, agent.go and emit.go keep only what the
verb no longer owns. The new verb_env.go is the single verbEnv the standalone dispatch
path constructs; refs.go is the ref grammar the bodies share.

2. The in-process executor is retired, and run lowers instead. executor.go (−817),
batch.go (−121) and plan_refs.go (−33), with their tests, are deleted (R5 — the old
path is gone in this same PR). charly pipeline run <entity> now resolves the authored
entity, validates it (workflowkit.ValidatePipeline), lowers it to the
(workflow.lobster, charly.yml) pair with workflowkit.Lower, and dispatches workflow-run
to the workflow provider class. Execution is the engine's — plugin-lobster today, a
future github-actions engine unchanged.

3. The resume leg. charly pipeline resume <name> [--approve yes|no|--response-json|--cancel].
The front-end records the paused gate handle beside the lowered pair (genDirOf +
recordPending), so resume <name> finds the paused run without being handed a token —
writer and reader agree on one path, which is what the bed asserts by asserting the file.

4. The schedule leg. charly pipeline schedule apply|list|remove|run-now — the front-end
half of the systemd-timer surface (the units themselves are the engine's).

5. The staged-verb schema contract. schema/pipeline.cue declares the per-verb input
shapes under namespaced defs (#Pipeline<Word>Input), and params/cue_types_gen.go is the
regenerated source (cue exp gengotypes, pinned to cuelang.org/go v0.16.1).

6. Tests added (all new files): cli_workflow_test.go (+274) drives the CLI legs;
verb_reach_test.go (+220) is the anti-reregression lock that each lifted word is declared
with its frozen input def and routed rather than falling through to the pipeline CLI;
verb_input_defs_test.go (+104) pins the input shapes; verb_ade_head_test.go (+76) locks the
ade fallback's head lookup (see R1 below).

7. The R10 bed — charly.yml is new on this branch (+578): check-pipeline-local, a
disposable: true bed that composes the plugin and witnesses the front-end end to end.

8. Docs — AGENTS.md (+22/−8) and README.md (+34/−16) restate the front-end's new
shape; the candy entity's own charly.yml (+35/−17) follows it.

Requires github.com/opencharly/sdk v0.2026276.255 and github.com/opencharly/spec v0.2026277.1407 — both released tags, both merged before this branch.

File accounting (54 files, +3331/−2674): 13 added, 8 deleted, 33 modified. The counts
above are the measured git diff --numstat --diff-filter=ADM -M origin/main...HEAD values;
nothing is estimated.

What this unblocks

opencharly/plugin-lobster#1 is BLOCKED on exactly this: its schedule witness was produced
against an unmerged sibling worktree, and the two offered exits were a maintainer sign-off
or a run against a merged driver. This PR is that driver. On merge + tag, plugin-lobster
re-runs both of its beds with --dev-plugin plugin-pipeline=<checkout@merged-tag>, so the
driver source is a merged commit — no sign-off needed.

How tested

All three legs below were run on the final committed tree,
e88585782442b2ecc56b892064b24bc9db930e3f (R10 — never from an edited state).

1. The repo's own ci.yml legs, verbatim

$ cd candy/plugin-pipeline && gofmt -l .
(no output — clean)

$ go vet ./...
(no output; rc=0)

$ go test -count=1 ./...
ok  	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline	8.410s
?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/cmd/serve	[no test files]
?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/params	[no test files]

The generated-params reproducibility leg, exactly as ci.yml runs it (rm -rf /tmp/cuegenpkg && mkdir -p /tmp/cuegenpkg, prepend package params, cue exp gengotypes .,
then diff against the committed file with line 1 dropped):

$ rm -rf /tmp/cuegenpkg && mkdir -p /tmp/cuegenpkg
$ echo 'package params' > /tmp/cuegenpkg/pipeline.cue
$ cat candy/plugin-pipeline/schema/pipeline.cue >> /tmp/cuegenpkg/pipeline.cue
$ cd /tmp/cuegenpkg && cue exp gengotypes .
$ diff <(sed '1,1d' /tmp/cuegenpkg/cue_types_params_gen.go) \
       <(sed '1,1d' candy/plugin-pipeline/params/cue_types_gen.go)
REPRODUCIBLE — no diff

$ /tmp/wfir/cuebin/cue version
cue version v0.16.1

(the pinned cue the workflow installs — go install cuelang.org/go/cmd/[email protected] — not the
host's (devel) build, so this is the CI leg itself and not an approximation of it)

2. charly box validate at the repo root

$ /home/atrawog/Sync/Atrapub/lo/claude/opencharly/.worktrees/workflow-ir/charly-witness/bin/charly box validate
charly box validate: OK — checked 3 candies, 1 deploy, 7 distros, 7 builders; 0 warnings, 0 errors

3. The R10 bed — charly check run check-pipeline-local

$ charly check run check-pipeline-local
charly check run check-pipeline-local: [deploy-add] START (charly deploy add; log: .check/check-pipeline-local/2026.277.2048/deploy-add.log)
charly check run check-pipeline-local: [deploy-add] PASS after 3.713s [allowlisted=1] (log: .check/check-pipeline-local/2026.277.2048/deploy-add.log)
charly check run check-pipeline-local: [bring-up-members] START
charly check run check-pipeline-local: [bring-up-members] PASS after 1ms
charly check run check-pipeline-local: [check-live] START (charly check live; log: .check/check-pipeline-local/2026.277.2048/check-live.log)
charly check run check-pipeline-local: [check-live] PASS after 35.741s [allowlisted=1] (log: .check/check-pipeline-local/2026.277.2048/check-live.log)
charly check run check-pipeline-local: [update] START (charly update; log: .check/check-pipeline-local/2026.277.2048/update.log)
charly check run check-pipeline-local: [update] PASS after 2.565s [allowlisted=1] (log: .check/check-pipeline-local/2026.277.2048/update.log)
charly check run check-pipeline-local: [cleanup] START (charly remove; log: .check/check-pipeline-local/2026.277.2048/cleanup.log)
charly check run check-pipeline-local: [cleanup] PASS after 17.445s [allowlisted=1] (log: .check/check-pipeline-local/2026.277.2048/cleanup.log)
charly check run check-pipeline-local: [cleanup-members] START
charly check run check-pipeline-local: [cleanup-members] PASS after 0s
charly check run check-pipeline-local: PASS (steps=6)

summary.yml (.check/check-pipeline-local/2026.277.2048/summary.yml):

total_seconds: 59
ok: true

and the check log's own tally:

15 steps: 15 passed, 0 failed, 0 skipped

The 15 witnessed steps, in order:

 1  pipeline-validate-mixed-grammar
 2  pipeline-validate-rejects-two-arms
 3  pipeline-lower-writes-pair
 4  pipeline-lowered-task-carries-verb-sugar
 5  pipeline-run-rejects-malformed-args
 6  pipeline-run-rejects-bad-mode
 7  pipeline-run-accepts-dispatch-flags
 8  pipeline-runs-builtin-verb-step
 9  pipeline-runs-lifted-file-verbs
10  pipeline-resume-approval-yes
11  pipeline-resume-approval-no
12  pipeline-resume-input-json
13  pipeline-resume-requires-an-entity
14  pipeline-schedule-apply-list-remove
15  pipeline-schedule-named-errors

Steps 9–15 are the ones this leg adds. Steps 10–15 are the live witness for the resume and
schedule legs this PR is actually about
— before this leg the bed had zero witness for
either, and the only evidence for schedule.go's systemd side was a run whose driver was not in
any merged tree.

The lifted verbs, and exactly which of them the bed executes live. The verdict on the
previous head asked for this to be stated precisely instead of blanket-claimed. Seven verb
bodies were lifted out of the old stage dispatch; the bed's coverage of them is:

lifted verb executed live in the bed? where
gate yes — a real condition, the true arm (step 8's fixture is condition: "true"); the false arm is asserted by verb_reach_test.go as gate : condition false: 1 == 2, a unit test, not a live run step 8
generate yes — renders hello ${who} with its typed var into rendered.txt step 9
emit yes — validates {name: rendered} against a literal CUE source (#Record: {name: string}) and serializes emitted.yml step 9
probe yes — reads the emitted artifact off disk, plus a negative control: a second fixture probes a path that does not exist and must carry the run to status=error, so a probe that returned pass unconditionally could not satisfy the step step 9
agent no — needs a live LLM endpoint —
ade no — needs a rendered host bed —
media no — needs /tmp/pr-<n> capture artifacts —

generate and emit write files, which is exactly why verb_reach_test.go pins routing
only for them (a body unit test would need a workdir), so the bed is where their bodies are
proven alive: generate renders its inline template with the typed var into the absolute out,
and emit validates and serializes. Both were dead before this lift.

agent, ade and media are not bed-executed. Their bodies need, respectively, a live LLM
endpoint, a rendered host bed, and the /tmp/pr-<n> capture artifacts a real PR lane leaves
behind — none of which a disposable local bed can honestly manufacture, and faking any of them
would violate "live or skip — never fake a live service". They are covered by
verb_reach_test.go's routing lock (each word reaches its body and fails inside it, never
with "unknown verb") plus their own unit tests. That lock is a routing proof, not a live proof,
and this body does not claim it as one.

Rulebook compliance

  • R0 — skills first. /charly-internals:git-workflow before any git/PR action;
    /charly-pipeline:pipeline, /charly-internals:plugin, /charly-internals:go before the
    code change; /charly-check:check for the bed.
  • R1 — RCA every anomaly. Two load-gate failures surfaced while authoring step 9 and were
    root-caused, not worked around: a step-level verb key is not an execution arm ("no
    execution arm — set exactly one of run/pipeline/…/plan/…"), and inside plan: the step
    still needs an intent keyword ("plan[0] has no intent keyword
    (run/check/agent-run/agent-check/include)"). Step 9 carries that as a comment so the
    next reader does not re-derive it.
  • R1 (second anomaly, fixed in this commit) — the ade fallback's head came from a dead
    resolver.
    verb_ade.go passed rc.resolveRefs("$env.PR_HEAD_SHA") to the external
    check-run fallback, under a comment asserting the resolver is wired back to the run context's
    env map. Measured, that is false: standaloneVerbEnv (verb_env.go:65) is the only
    production verbEnv constructor in the package and wires resolve to the identity function
    (refs.go:33 short-circuits to it), so refs.go's $env.X grammar is dead on that path and
    resolveRefs returns the literal $env.PR_HEAD_SHA — which the fallback would render as
    --var PR_HEAD_SHA=$env.PR_HEAD_SHA, a string that looks like a head and is carried into the
    bed's evidence as one. The head is now a map read of the run context (adeLaneHead()),
    exactly the lookup the retired in-process executor performed
    (origin/main:executor.go:268, an operator pin winning), and the false comment is replaced by
    one that states the trap and the consequence: a standalone dispatch carries no per-run map,
    so the read yields "" — a missing run context, which is honest.
    verb_ade_head_test.go locks it: the bound map wins; the standalone env yields "" even with
    PR_HEAD_SHA set in the process env (the process-global the concurrent lanes raced, RCA
    2026.252.2210); the identity-resolver premise the rationale rests on is asserted so it cannot
    rot silently; and the call site is locked structurally, because driving it behaviourally
    would need a real charly on PATH and a unit test must never stand a stub in for that
    boundary. Proved to bite, not just to pass: re-introducing
    rc.resolveRefs("$env.PR_HEAD_SHA") at the call site makes it FAIL
    (verb_ade_head_test.go:68 and :71), and restoring the file makes it pass again.
  • R3 — no duplication. The lifted bodies moved; each has exactly one caller. verb_env.go
    is the one verbEnv the standalone path builds. emit's schema machinery stays in emit.go
    and is shared with the internal ledger dump.
  • R4 — no workarounds. The bed was invoked with no scope-shrinking flag — no
    --no-rebuild, no --keep, no --dry-run on the bed itself — so it ran the full assembled
    disposable: true lifecycle: build → check box → fleet add → check live → charly update → teardown. One step's fixture passes --dry-run to the CLI it is testing
    (pipeline-run-accepts-dispatch-flags asserts that charly pipeline run … --dry-run prints
    dry-run OK); that is the flag under test, not a bypass of the gate, and the run's other 14
    steps execute for real. No flag was passed that the operator did not name.
  • R5 — delete legacy completely. executor.go, batch.go, plan_refs.go and their tests
    are deleted in this PR; the cutover removes the old path in the same phase. The old
    stages:/skip_when: grammar is a hard load error, pointing at the migration.
  • R6 — git safety. No force-push, no hook bypass, no direct push to main. git status
    was read before every commit.
  • R7 — prove the gate. The gates above ran on the final committed tree and their output is
    pasted verbatim.
  • R10 — fresh disposable proof. Bed run .check/check-pipeline-local/2026.277.2048/ on
    e885857: ok: true, 15 passed, 0 failed, 0 skipped. The run's only warning is the
    dev/worktree-binary notice, emitted once per step and allowlisted with its reason stated in
    summary.yml (allowlisted: 4, warnings: 0, errors: 0); no other warning was emitted. No
    R10 class exemption is claimed: this is a candy/Go-module change and it ran the full assembled
    bed.
  • A1 — the body is the changelog. Every file's count above is the measured --numstat
    value; tag-on-merge writes this body to CHANGELOG/<calver>.md at merge.

Change classification

Change class candy/ Go module + repo config + R10 bed. Breaking (!): the kind:pipeline authoring grammar cut over and the in-process executor removed.
Verification gate The org-wide charly/pr-validator (required check validate / validate), the repo's own ci.yml job, and the assembled disposable: true bed check-pipeline-local (15/15).
Attribution tier fully tested and validated — the full gate passed on the final tree, and the changed paths a disposable local bed can execute were executed live: the lowering (steps 3–4), the builtin-verb dispatch (step 8), the lifted gate (step 8) and generate/emit/probe (step 9) bodies, resume (steps 10–13) and schedule (steps 14–15). The lifted agent, ade and media bodies are not bed-executed — no live LLM, no rendered host bed, no /tmp/pr-<n> capture artifacts — and carry the routing lock plus their own unit tests only; see the coverage table above.

Relates to opencharly/charly#758 (the wave — stays open), opencharly/spec#192 (the IR that
nothing produced or consumed; this front-end is the producer), and
opencharly/plugin-lobster#1 (the engine that consumes the lowered pair — its block 3 is the
merged-driver exit this PR supplies).

Agent: workflow-ir · session 7e17b5cf-c349-4032-8da5-2e4e03612780
Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)

aitrawog and others added 10 commits October 3, 2026 11:33
…contract)

Add #AgentInput/#ProbeInput/#AdeInput/#GenerateInput/#EmitInput/#MediaInput/
#GateInput to schema/pipeline.cue: the input shape each stage verb accepts once
it is lifted out of the pipeline executor into an ordinary `verb:` provider.
Declared now so the lifted providers and the migrator's frozen key spellings
have a single source. Purely additive — no existing def changes and the old
stage path keeps working.

#MediaInput.assemble stays a required field (no Go reader consults it, but the
retired grammar declared it); dir/files are declared here because the Go reader
consults them though the retired #MediaStage did not.

Regenerate params/cue_types_gen.go via the CI cue:gen procedure and add
verb_input_defs_test.go, which freezes each def's top-level field set (reusing
topLevelFields) so a renamed/moved key cannot silently break every migrated plan.
The seven per-verb input defs were declared here under the bare
`#<Word>Input` names the plugin skill documents. That convention is
unsafe for this plugin, and silently so.

plugin_loader compiles EVERY loaded plugin's served schema into ONE CUE
instance (it appends each served schema to the same value), and CUE
UNIFIES two same-named defs instead of erroring. A plugin's def names
therefore share ONE GLOBAL namespace with every OTHER plugin's. The load
gate's base++plugin splice detects a collision with the BASE only; a
plugin-vs-plugin collision is not detected at all.

plugin-agent is a RELEASED plugin declaring
`{Class: "kind", Word: "agent", InputDef: "#AgentInput"}` with an
incompatible shape (`command: [string, ...string]` + `prompt_via`), so a
bare `#AgentInput` declared here would have unified with it and rejected
EVERY `agent: {prompt: ...}` step in any project loading both plugins --
with no error at this seam and nothing pointing at the cause. The other
six bare names are free today; they are prefixed for the same reason.

Rename all seven to `#Pipeline<Word>Input` and regenerate the params.
TestVerbInputDefsArePrefixed is the guard: it fails if a def loses the
prefix, or if the un-prefixed spelling reappears in the schema -- the
property TestVerbInputDefsFrozenFields structurally cannot check, since
the collision it guards against comes from a different plugin.

The loader-side class fix (namespace the defs per plugin, or reject a
plugin-vs-plugin collision loudly instead of unifying) is tracked as
opencharly/charly#770, where the collision is measured live against the
real load gate and the real validator -- it turns out to break BOTH
plugins, not just the later one, with each input failing on the other
plugin's field and naming neither. Until that lands, every new def added
here takes the same prefix, and the schema header records why.
… routed verb: capability

The seven workflow stage kinds (agent, probe, ade, generate, emit, media, gate)
are now ordinary `verb:` capabilities, reachable from ANY charly plan through the
`<word>: <input>` sugar — not only from a kind:pipeline entity's `stages:`. The
stage BODY is the same code in both placements (R3: one implementation, no
duplicate copy).

* verb_env.go — the lifted-verb contract. Every handler is
  `runVerb<Word>(in params.Pipeline<Word>Input, e *verbEnv) (map[string]any, error)`
  and the CALLER owns the status/message/trigger bookkeeping (failOnVerb). The
  plan path and the standalone dispatch both go through it.
* verb_<word>.go x7 — the bodies MOVED out of executor.go / render.go / emit.go /
  media.go / ade.go / agent.go. runStage's seven arms now DELEGATE to them and
  keep only the StageResult bookkeeping; the pre-switch skip_when block stays
  exactly where it was, and the inline `command` kind is deliberately NOT lifted.
* plugin.go — the seven capabilities in NewMeta (InputDef only, no Primary: the
  lifted verbs are map-input verbs, no scalar sugar) and the OpRun word split —
  "" / "pipeline" is the CLI, each lifted word routes to its handler, an unknown
  word is a NAMED error (never a fall-through to the CLI).
* charly.yml — the plugin's providers list carries the seven words; the candy
  description states the stage bodies are reachable as verbs.
* verb_reach_test.go — TestLiftedVerbsAreReachable: for all seven words, both the
  capability DECLARATION (Describe) and the ROUTING (Invoke(OpRun, Reserved=<word>))
  are asserted. gate/probe pin the verdict (deterministic bodies); agent/ade/
  generate/emit/media assert ROUTING only — their happy paths need infrastructure
  a unit test must not require (a live LLM, a rendered host bed, /tmp capture
  artifacts), so the assertion is that the failure is a BODY error, never a
  routing error. An explicit unknown-word subtest pins the routing-error shape.

Behaviour preservation. The plan path hands each body the ORIGINAL authored stage
map (verbEnv.raw), because a raw -> typed -> raw round trip is LOSSY:
encoding/json's omitempty is inert for STRUCT-typed fields, so `llm:` / `cache:` /
`redo:` would always reappear as zero objects — stageLLM() returns nil only when
the key is ABSENT, so every stage would acquire a non-nil zero llm override it
does not have today, and readAgentCache would see an empty cache block. The
standalone path materialises the typed input instead (mapOf), which is exactly
why readAgentCache now treats a cache block whose path AND key are both empty as
ABSENT (the zero struct a standalone dispatch materialises) — a half-specified
block still errors as before. `$env` / `@stage` / `$pr` refs resolve through the
live run's own resolver on the plan path (resolveOverride) and are left verbatim
on the standalone path (the caller's plan owns ref resolution).

## How tested

    $ TMPDIR=/tmp/cs gofmt -l .
    (empty)
    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go build ./...
    (no output)
    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go vet ./...
    (no output)
    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go test ./... -count=1
    ok  	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline	7.007s
    ?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/cmd/serve	[no test files]
    ?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/params	[no test files]

The 26 pre-existing direct runStage/runPlanL test calls (generate x many, emit,
gate, media, agent, plus the plan runs) are UNCHANGED and green — that is the
behaviour-preservation evidence for the delegation, since they assert the stages'
Outputs/Message/error through the delegated path.

    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go test ./... -run 'TestLiftedVerbsAreReachable|TestVerbInputDefs' -v -count=1

  TestVerbInputDefsFrozenFields / TestVerbInputDefsArePrefixed pass UNCHANGED (the
  schema and the generated params are untouched: no field was added or renamed).

  TestLiftedVerbsAreReachable passes: capabilities-declared, gate-pass,
  gate-fail, probe-unknown-verb, agent, ade, generate, emit, media,
  unknown-word-is-rejected. The routed verdicts are:

    verb:gate     → status=pass message=""
    verb:gate     → status=fail message="gate : condition false: 1 == 2"
    verb:probe    → status=fail message="probe no_such_probe failed: unknown probe no_such_probe"
    verb:agent    → status=fail message="LLM: Post \"http://127.0.0.1:1/chat/completions\": dial tcp 127.0.0.1:1: connect: connection refused"
    verb:ade      → status=fail message="ade: bed entity \"no-such-bed\" not found under <worktree>"
    verb:generate → status=pass message=""
    verb:emit     → status=fail message="emit: schema def #NoSuchDef is not in the plugin schema ..."
    verb:media    → status=fail message="media: source missing /tmp/pr-unknown.png"

The test BITES — verified by temporarily renaming the `case "media":` arm:

    verb_reach_test.go:116: verb:media NOT ROUTED — Invoke returned the routing error: pipeline: unsupported word "media"
    --- FAIL: TestLiftedVerbsAreReachable/media (0.00s)

The arm was restored and the test re-run green.

## Rulebook compliance

R0 (skills loaded before the first edit), R3 (one body per kind — the arms
delegate, no second copy; ONE failOnVerb bookkeeper), R4 (no workaround: the
standalone/plan split is the declared contract, not a substitution), R5 (the old
inline arms are deleted in the same change, not left beside the new bodies), R7
(the gate output above is pasted from the final tree), schema discipline (D6: no
change under schema/ or params/, no regeneration; the frozen-field tests pass
unchanged).

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*
*Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)*
…re readAgentCache

Revision of fe9b548 (the lifted-verb cutover), on the coordinator's review. Two
changes, one of them a defect MY PREVIOUS COMMIT introduced; the previous
compensation for it is WITHDRAWN, not kept alongside.

FIX 1 — invokeLiftedVerb now carries the wire's own plugin_input map.
The standalone dispatch built verbEnv from the TYPED input only, so stageRaw fell
back to mapOf(in) — and a typed round trip CANNOT express absence: encoding/json's
omitempty is inert for struct-typed fields, so #PipelineAgentInput always emits
`llm` / `cache` / `redo` / `skills` as ZERO objects. readAgentCache type-asserts
raw["cache"] to a map and branches on its LENGTH, so the fabricated `{path:"",
key:""}` block was non-empty and a bare `agent:` step failed with "agent cache:
path + key required". invokeLiftedVerb now unmarshals that same plugin_input JSON
into a map[string]any and assigns it to e.raw, so stageRaw returns the AUTHORED map
verbatim on BOTH paths — a key the author did not write does not exist. A dispatch
that carries no plugin_input at all authors nothing: e.raw is the EMPTY map, not a
zero-struct reconstruction (the same rule, applied to the empty case). stageRaw
itself and the handler signature are unchanged.

FIX 2 — readAgentCache restored byte-for-byte from d7592c3.
My previous commit had loosened readAgentCache to treat a cache block whose path
AND key are both empty as absent. That was the wrong seam: readAgentCache is a
SHARED function the PLAN path also calls, so it changed the semantics of every
caller to serve a new one, and it would have silently accepted a genuinely
half-authored `cache:` block on the plan path. Both guards it added are now
UNREACHABLE once FIX 1 lands (a standalone dispatch carries no `cache` key at all,
so the pre-existing `len(spec) == 0` check already misses), so they are DELETED
rather than left as dead code. No caller reaches readAgentCache with rc == nil in
the plan path (every plan runCtx is non-nil) and the standalone path cannot reach
it with a spec at all — verified by the reach test's agent subtest, which now
lands on the LLM BODY error, never on the cache guard.

NEW TEST — TestStandaloneStageRawPreservesAbsence (verb_reach_test.go).
Builds the env exactly as invokeLiftedVerb does (it CALLS invokeLiftedVerb, the
same function Invoke's OpRun arm calls, so the test cannot drift from the dispatch
path it locks) from `{"plugin_input":{"prompt":"say hi"}}` — no llm, cache, redo or
skills — and asserts stageRaw contains NONE of those keys, that the authored
`prompt` survives verbatim, and that an empty dispatch yields an empty map.

## How tested

    $ gofmt -l .
    (empty)
    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go build ./...
    (no output)
    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go vet ./...
    (no output)
    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go test ./... -count=1
    ok  	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline	21.781s
    ?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/cmd/serve	[no test files]
    ?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/params	[no test files]

    $ TMPDIR=/tmp/cs GOTMPDIR=~/.cache/go-tmp go test ./... -run \
        'TestLiftedVerbsAreReachable|TestVerbInputDefs|TestStandaloneStageRawPreservesAbsence' -v -count=1
    --- PASS: TestVerbInputDefsFrozenFields (0.00s)   [schema/params untouched]
    --- PASS: TestVerbInputDefsArePrefixed (0.00s)
    --- PASS: TestLiftedVerbsAreReachable (1.33s)
        --- PASS: TestLiftedVerbsAreReachable/capabilities-declared
        --- PASS: TestLiftedVerbsAreReachable/gate-pass
        --- PASS: TestLiftedVerbsAreReachable/gate-fail
        --- PASS: TestLiftedVerbsAreReachable/probe-unknown-verb
        --- PASS: TestLiftedVerbsAreReachable/agent
            verb_reach_test.go:137: verb:agent routed → status=fail message="LLM: Post \"http://127.0.0.1:1/chat/completions\": dial tcp 127.0.0.1:1: connect: connection refused"
        --- PASS: TestLiftedVerbsAreReachable/ade
        --- PASS: TestLiftedVerbsAreReachable/generate
        --- PASS: TestLiftedVerbsAreReachable/emit
        --- PASS: TestLiftedVerbsAreReachable/media
        --- PASS: TestLiftedVerbsAreReachable/unknown-word-is-rejected
    --- PASS: TestStandaloneStageRawPreservesAbsence (0.00s)
    PASS
    ok  	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline	1.340s

The agent subtest is the FIX 1 acceptance: it is a BODY error (the LLM dial to the
dead 127.0.0.1:1 endpoint), never the routing error and never "agent cache: path +
key required" — the fabricated cache block is gone.

TEST BITES (proved by temporarily reverting FIX 1, running, then restoring):

    $ go test ./... -run 'TestStandaloneStageRawPreservesAbsence' -v -count=1
    --- FAIL: TestStandaloneStageRawPreservesAbsence (0.00s)
        verb_reach_test.go:200: stageRaw fabricated the ABSENT "llm" block (map[string]interface {}{"params":..., "stream_options":...}); absence must survive the typed decode
        verb_reach_test.go:200: stageRaw fabricated the ABSENT "cache" block (map[string]interface {}{"key":"", "path":""}); absence must survive the typed decode
        verb_reach_test.go:200: stageRaw fabricated the ABSENT "redo" block (map[string]interface {}{}); absence must survive the typed decode
        verb_reach_test.go:200: stageRaw fabricated the ABSENT "skills" block (map[string]interface {}{"corpus":""}); absence must survive the typed decode
        verb_reach_test.go:218: an empty dispatch produced map[string]interface {}{"cache":..., "llm":..., "prompt":"", "redo":..., "skills":...}, want an empty map
    FAIL

AGENT.GO DIFF PROOF (acceptance criterion 1) — d7592c3..HEAD is ONE hunk, the
runAgentStage removal; readAgentCache is byte-for-byte identical:

    $ git diff d7592c3..HEAD -- candy/plugin-pipeline/agent.go
    diff --git a/candy/plugin-pipeline/agent.go b/candy/plugin-pipeline/agent.go
    index 31cd49b..0b15674 100644
    --- a/candy/plugin-pipeline/agent.go
    +++ b/candy/plugin-pipeline/agent.go
    @@ -127,83 +127,10 @@ func skillCorpus(rc *runCtx) string {

That is the whole diff: the hunk deletes runAgentStage's doc comment + body (moved
to verb_agent.go) and adds the two-line pointer comment before redoError. There is
no second hunk, so NO line of readAgentCache (its doc comment included) is touched.

## Rulebook compliance

* R3 (one implementation): the bodies are MOVED, not copied; readAgentCache has
  ONE definition and ONE meaning for every caller.
* R1 (RCA): the standalone `agent:` failure and the shared-function seam are both
  root-caused above, not patched at the call site.
* D6 honoured: schema/ and params/ are untouched — the frozen-def tests pass.
* No PR, no push: local commit only (worker scope boundary).

## Change classification

Change class: plugin behaviour (bug fix on the lifted-verb path introduced by
fe9b548). Verification gate: unit tests + build + vet on the final tree; the
changed runtime path (Invoke OpRun → invokeLiftedVerb → body) is executed live by
TestLiftedVerbsAreReachable. Attribution tier: analysed on a live system (the
agent body's live path is asserted to its LLM dial; no bed run was available in
this scope).

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*
*Assisted-by: Claude Code deepseek-v4.1-flash:cloud (analysed on a live system)*
…ow engine, add the R10 bed

The hard cutover of the workflow FRONT-END (workflow-ir wave, leg w6a). The
home-grown `kind:pipeline` grammar (a stage list / #*Stage / the in-process
executor) is DELETED; the authored entity is now `spec.Pipeline` (`steps:`),
validated by sdk/workflowkit.ValidatePipeline, lowered by
sdk/workflowkit.Lower to the (workflow.lobster, charly.yml) pair, and dispatched
to the `workflow` PROVIDER CLASS as OpWorkflowRun. The engine owns execution,
control flow, redo and iteration — this plugin no longer runs a step itself.

WHAT IS GONE (no dual-mode path survives):
- executor.go (runStage/the plan walk), batch.go (--prs/--lanes), plan_refs.go,
  the stage ledger + `skip_when`/`evalCond` control flow, and the old
  #PipelineInput/#*Stage CUE grammar. schema/pipeline.cue now declares ONLY the
  per-verb input shapes of the retained stage bodies; params/cue_types_gen.go
  regenerates from it (the ci.yml reproducibility gate passes).
- the ledger/batch/AND-grammar/publish-gate/plan-refs/fail-hard test files, and
  every test/docs/check reference to the retired surfaces.

WHAT REPLACES IT:
- cli.go's run leg: resolve -> ValidatePipeline -> Lower -> write
  (workflow.lobster, charly.yml) -> InvokeProvider("workflow", <engine>,
  OpWorkflowRun). `--dry-run` stops after the lowering.
- the seven stage kinds survive as ordinary `verb:` providers
  (verb:agent/probe/ade/generate/emit/media/gate), each reachable from any plan.

DEFECT FOUND AND FIXED ON THE WAY — the front-end skipped the loader's step-sugar
desugar. The authored plan grammar is the loader's `<word>: <input>` plugin-verb
sugar (`- run: <label>` + `gate: {…}`), which the loader REWRITES into the
internal plugin/plugin_input envelope spec.Step carries. This resolver read the
entity with a plain struct decode, and yaml.v3 silently DROPS an unknown sugar
key — so a builtin-verb plan step lowered to an EMPTY step (`- {}`) and the
generated task ran nothing. Live-caught lowering the mixed-grammar fixture.
entity.go now runs the loader's own rewrite (`loaderkit.DesugarSteps`, the SDK's
canonical implementation) over every nested `plan:` of the entity body, stopping
at a resource member exactly as loaderkit's walk does, so the front-end reads the
entity as the host loader does (R3) and a mistyped step is a NAMED error instead
of a silent empty step.

NEW R10 BED — check-pipeline-local (charly.yml, root): a disposable kind:local bed
whose steps run `${CHARLY_BIN} pipeline …` host-side in a mktemp project.
Minimum coverage per the brief: a mixed-grammar fixture (lobster shell arm + flow
key + single-step verb sugar) validates; a two-arm fixture is rejected with the
NAMED exec-arm error; the lowering writes BOTH halves; the generated charly.yml
carries the authored verb sugar (never `- {}`) and flat-imports the project
manifest; and the whole pipeline runs through the engine. The bed is committed
UNRUN (see the report) — its steps 1-4 were dry-run through a dispatch shim.

NEW TEST — cli_workflow_test.go drives the real runCLI entrypoint (no executor
needed for validate / --dry-run) and locks all four behaviours above.

Gate (module root candy/plugin-pipeline/): go build rc=0, gofmt -l EMPTY,
go vet rc=0, go test ./... ok, and the ci.yml CUE reproducibility check OK.
The run leg built spec.WorkflowRunRequest{Pipeline, GenDir} and nothing else, so
the engine's TWO dispatch inputs were unreachable through the CLI:

- plugin-lobster/run.go reads in.Args into the engine's LOBSTER_ARG_* /
  LOBSTER_ARGS_JSON env, and in.Mode into interactive: in.Mode != "tool" &&
  stdinIsTTY() (the human/tool envelope).
- workflowkit/lower.go emits -p NAME="$NAME" for every declared arg, so an arg
  the front-end never passed reached the engine as an EMPTY value — a pipeline
  with a required arg was unrunnable.

The run leg now parses and validates both flags (via the existing flagAfter
helper) before anything else happens, and puts them on the request:

- --args-json <json-object> decodes into the envelope's TYPED field,
  map[string]string (not any). A malformed document, a non-string member, or a
  JSON null is a NAMED error — pipeline run <name>: --args-json: …, exit 1 —
  never a silently-empty arg.
- --mode human|tool; any other value is an error naming BOTH accepted values.
  Absent leaves Mode EMPTY on purpose: the engine owns its default, and a
  front-end default would silently override it.
- The flag parse runs BEFORE --dry-run's early return (which is otherwise
  unchanged and still stops before dispatch), so a malformed flag is loud in
  every mode rather than silently accepted by the path that does not consume it.

The request build is ONE helper (workflowRunParams) — the exact ParamsJson bytes
handed to InvokeProvider — so the CLI cannot drift from the envelope it
documents, and a focused unit test locks the plumbing with no faked engine
boundary (the args map + mode are asserted on the marshalled payload, the
flagless envelope omits both, and every malformed form fails with the named
error and exit 1). Verified the lock BITES: with the request reverted to
{Pipeline, GenDir} the test fails on: the dispatched ParamsJson must carry "args".

Live out-of-process proof through the rebuilt plugin binary:

  $ pipelinebin-w6b run mixed-plan --args-json {"n":3} --dry-run
  pipeline: pipeline run mixed-plan: --args-json: json: cannot unmarshal number
  into Go struct field .n of type string (…)                     rc=1
  $ pipelinebin-w6b run mixed-plan --mode banana --dry-run
  pipeline: pipeline run mixed-plan: --mode "banana": accepted values are human, tool
                                                                 rc=1
  $ pipelinebin-w6b run mixed-plan --args-json {"who":"world"} --mode tool --dry-run
  pipeline mixed-plan: dry-run OK — lowered 2 steps to <gen> (…)  rc=0
  $ pipelinebin-w6b run mixed-plan --args-json {"who":"world"} --mode tool
  pipeline: pipeline run mixed-plan: no host executor — …         rc=1

The last proves the flags parsed cleanly and reached the dispatch point; the
executor is host-side, so the engine boundary itself is exercised by the R10 bed.

The R10 witness bed (charly.yml, check-pipeline-local:) gains THREE steps for the
revision's surface, in both directions — a malformed --args-json (rc 1, stderr
names the flag), an unsupported --mode (rc 1, stderr names both accepted values),
and a well-formed pair accepted (rc 0, dry-run OK, still stopping before
dispatch). Dry-run host-side through a shim: rc 1 / rc 1 / rc 0 with every
declared matcher hitting. The bed is still marked UNRUN here.

README's run bullet documents both flags.
… gate

The CLI served `run|validate|agent|probe` and had no way to ANSWER a gate, so
`lobster-approval-resume` (the bed that drives `#WorkflowResumeRequest.approve`)
had no driver and could not run. This is that driver.

- `resume <entity> [--token T | --id I] [--approve yes|no] [--response-json J] [--cancel]`
  builds `spec.WorkflowResumeRequest` and dispatches `workflow-resume`.
- `--approve` parses into the TRI-STATE pointer: `yes` → &true, `no` → &false, ABSENT →
  nil. Supplying no decision is therefore distinguishable from rejecting, which is the
  whole point of spec#195 — and the engine refuses the silent case by name instead of
  cancelling the gate.
- `run` now CAPTURES the engine's reply (it was discarded), prints the status, and
  records a paused gate's token in the run's gen dir. `resume <name>` with no explicit
  handle reads it, so the name-addressed form works across processes — the `run` that
  paused has already exited.
- `genDirOf` is the one definition of the gen dir; `run` and `resume` must not disagree
  about it.

NOTE: does not yet compile against the module's pinned `spec` — the tri-state is unmerged,
and pin discipline forbids pinning it early. Verified against spec#195's branch through an
out-of-tree workspace (build/vet/gofmt/test all green).

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*
…eg needs

The scheduler has two halves and this lands the front-end half, which is the only
half this repo owns. `charly pipeline schedule apply|list|remove|run-now <name>`
dispatches `workflow-schedule` to the entity's engine (default `lobster`), exactly
as `run` and `resume` dispatch `workflow-run`/`workflow-resume` — one shape, one
error contract, one place the engine name is resolved.

`apply` is self-contained, and that is the load-bearing decision. It loads the
AUTHORED entity, projects its `triggers:` into the IR's own `#WorkflowTrigger`
list, writes `.opencharly/pipelines/<name>/schedule.json`, and only then
dispatches. The engine's `scheduleApply` (plugin-lobster, schedule.go) reads
exactly that file and errors by name when it is absent. The alternative — having
the engine re-derive an authored trigger from the generated `(workflow.lobster,
charly.yml)` pair — cannot work: that pair carries no triggers at all, and a
descriptor written at lowering time would schedule the triggers of the LAST run,
so `apply` after a trigger edit would install units for a cron the operator had
already changed. Two schemas, so the writer and the reader are one contract:
`scheduleDescriptor` is written here in the shape the engine parses.

`list` is the one op that names no pipeline: it answers from the unit directory,
so it lowers nothing and loads nothing.

The pin: `spec v0.2026276.1337` → `v0.2026277.1407` (spec#195, merged). NOT
incidental to this leg — the branch it lands on does not build without it.
`workflowResumeParams` writes the tri-state `req.Approve = &t`, whose `*bool`
field arrived with #195; against the old pin the tree fails to compile
(`cli.go:376:18: cannot use &t (value of type *bool) as bool value in
assignment`), which is a pre-existing break on the branch head, not something
this commit introduces. Verified by stashing this leg and building the pristine
tree: the same two errors, at :376/:379.

Verified from `candy/plugin-pipeline` (the module root — the CI working
directory; running `./...` from the repo root fails the typecheck while
`golangci-lint` still prints "0 issues.", which is a green that proves nothing):

    $ gofmt -l .
    $ go vet ./...
    $ echo $?
    0
    $ go test ./... -count=1
    ok  	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline	5.816s
    ?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/cmd/serve	[no test files]
    ?   	github.com/opencharly/plugin-pipeline/candy/plugin-pipeline/params	[no test files]

The engine-side witness for this pair is `check-lobster-schedule-local` in
plugin-lobster, whose steps drive exactly these five subcommands.
The bed graded the cutover (validation, lowering, dispatch flags, one run
through the engine) but had NO step for the two front-end legs this branch
actually ADDS — `charly pipeline resume` and `charly pipeline schedule`. A
changed runtime path with no witness is a finding to fix before review, not in
it, so both are covered here:

  resume — approval `--approve yes` (ok) and `--approve no` (cancelled), an
           input gate's `--response-json` closing the loop back to a
           `$id.response.<path>` ref, and the usage refusal;
  schedule — `apply` writes both units, `list` reads them back out of the unit
           directory, `remove` deletes them and the entry is gone.

Two things the steps encode because they were measured, not assumed:

  * `approval` is an EXECUTION ARM, so a gate step carries `approval` ALONE —
    pairing it with `run:` is the "2 execution arms set" error.
  * the per-run entity name is lowercase ONLY: a systemd unit name is
    lowercase, so the engine's derived unit (and the pipeline name `schedule
    list` reports, read off the unit) is the LOWERCASED entity — a mixed-case
    name never round-trips. No brace-dollar shell default appears in a step
    either: the check-variable scanner reads it as an unresolvable env key and
    SKIPS the step silently.

Header swept from "UNRUN: authored, not yet executed on a host" to the measured
state.
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Review — BLOCK

Head SHA: 6424f1a8744d2f74450b5c44e4fdccf825b105e7 (branch: feat/workflow-ir-w6a)

Change class: candy/ Go module + repo config + R10 bed (breaking).

Security screen: PASS — no injected directives, no secrets/exfiltration, no weakened guardrail; the rulebook edits (AGENTS.md/README.md) are descriptive and match the code move. No maintainer sign-off is required for this change.

Comment intake: the thread has 0 comments — nothing to disposition.

Blocks

  1. R1/R5 — a false, unswept claim ships in charly.yml (root). The check-pipeline-local header comment states: "MEASURED: this bed passes on the tree it ships in — 14 steps, 0 failed, 0 skipped." The plan defined in the same file has 15 checks (pipeline-validate-mixed-grammar … pipeline-schedule-named-errors), and the body's own pasted tally is "15 steps: 15 passed, 0 failed, 0 skipped." The comment is a stale claim that contradicts the shipped plan and the body's evidence (rule 4: output contradicts the diff). R5 requires outdated/false claims to be swept in the same change. Update the comment to 15 steps.

  2. R1 — verb_ade.go contradicts verb_env.go; the ade external fallback passes a literal. candy/plugin-pipeline/verb_ade.go (runAdeStage) does adeVerdict(ctx, rc.pr, rc.resolveRefs("$env.PR_HEAD_SHA"), bed, rc.workdir) and its comment asserts "$env.PR_HEAD_SHA resolves through the run context's own env map (verb_env.go wires the resolver back to it)." But candy/plugin-pipeline/verb_env.go's standaloneVerbEnv wires resolve to the identity function (resolve: func(s string) string { return s }), and that is the only production verbEnv constructor in the diff. So in the dispatch path rc.resolveRefs("$env.PR_HEAD_SHA") returns the literal string "$env.PR_HEAD_SHA" — the head is never resolved, exactly the --var PR_HEAD_SHA= class the code says it fixes. Either resolve the head from the env map (as the old rc.env["PR_HEAD_SHA"] did) or correct the comment; as shipped, code and comment contradict each other and the fallback is wrong. (The regression test that used to lock this, TestAdeVerdictUsesTheLaneHeadNotTheProcessEnv, was deleted in this PR, so nothing now catches it.)

  3. A3 — the tier's blanket claim overstates live coverage of the lifted verbs. The body's tier justification says "the changed paths (the lowering, the lifted verbs, resume, schedule) were executed live in steps 3–15 of the bed." The bed executes the gate verb live (step 8's plan: step) and generate/emit live (step 9), but the agent, probe, ade and media verb bodies never run in the bed — only the routing unit test touches them (and for agent/ade/media that test is explicitly "routing only", failing fast with no workdir/LLM/bed). The body must either add live bed coverage for those four lifted verbs or narrow the claim (and, if the ceiling drops, the Assisted-by: tier) to what actually ran.

Verdict: BLOCK


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

…, verb coverage)

Block 1 (R1/R5) — charly.yml's MEASURED header claimed "14 steps" while the
plan defined in the same file has 15 checks. Corrected to 15.

Block 2 (R1) — verb_ade.go handed the external check-run fallback
rc.resolveRefs("$env.PR_HEAD_SHA") under a comment asserting the resolver is
wired back to the run context's env map. It is not: standaloneVerbEnv is the
only production verbEnv constructor and wires resolve to the IDENTITY function,
so resolveRefs returns the LITERAL `$env.PR_HEAD_SHA` and the fallback would
render `--var PR_HEAD_SHA=$env.PR_HEAD_SHA`. The head is now a MAP READ of the
run context (adeLaneHead), as the retired executor's rc.env["PR_HEAD_SHA"] was,
and the false comment is replaced with one that states the trap and the
empty-standalone-env consequence.

Block 3 (A3) — the tier justification blanket-claimed live coverage of the
lifted verbs. Step 9 now also runs `probe` live, with a NEGATIVE CONTROL: a
second fixture probes a path that does not exist and the run must reach
status=error, so a probe returning pass unconditionally could not satisfy it.
The body now states per verb which are bed-executed (gate, generate, emit,
probe) and that agent/ade/media are NOT, with the reason.
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Review — PASS

Head SHA: e88585782442b2ecc56b892064b24bc9db930e3f (branch: feat/workflow-ir-w6a)

Change class: candy/ Go module + repo config + R10 bed (breaking cutover).

Security screen: PASS — no directives aimed at the validator, no secrets/egress, no weakened guardrail (AGENTS.md/README.md edits are descriptive and match the code move; no CI/branch-protection/rulebook-landing edits). No maintainer sign-off required.

Comment intake (1):

  • @github-actions[bot] #5983931912 (prior BLOCK at 6424f1a). All three findings re-derived against the CURRENT head and each is resolved: (1) charly.yml's header now reads "15 steps", matching the plan's 15 checks and the body's tally — stale-superseded; (2) runAdeStage now takes the head from rc.adeLaneHead() (a map read of env["PR_HEAD_SHA"], verb_ade.go), the false "resolver is wired back" comment is gone, and verb_ade_head_test.go locks the accessor, the process-env non-read, and the call site structurally — stale-superseded; (3) the body now carries a per-verb live/no coverage table, adds a live probe witness (step 9, with a negative control), and explicitly declines to present the routing lock as live proof — the claim is narrowed to what actually ran, so the tier is scoped and not inflated — verified-non-blocking.

Checklist: All applicable rules PASS or NA (SDD source+generated pair consistent; ADE description/plan present on the changed candy; hard-cutover deletions complete; disposable check-pipeline-local bed internally consistent with the plan; placement CORRECT — all capability stays in the candy, SDK used only as mechanism/wire).

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) October 4, 2026 21:04
@github-actions
github-actions Bot merged commit 3d2aee8 into main Oct 4, 2026
2 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Oct 4, 2026
atrawog pushed a commit to opencharly/plugin-lobster that referenced this pull request Oct 4, 2026
…ds' drivers are released

The header's MEASURED STATE and DRIVER SURFACES blocks were written against
`e29a519`, when opencharly/plugin-pipeline#32 (the `resume` + `schedule`
front-end, and the merged driver both beds drive) was still an unmerged
sibling. It merged as `3d2aee88` and `tag-on-merge` published `v2026.277.2104`
(alias `candy/plugin-pipeline/v0.2026277.2104`), so the block's two central
claims are now FALSE:

  * "Two driver surfaces are NOT in plugin-pipeline's released tree yet" — both
    are released in that tag. `charly pipeline`'s subcommand set is
    `run|validate|agent|probe|resume|schedule` (candy/plugin-pipeline/cli.go:52
    in the merged tree), and the `workflow-schedule` ops apply|list|remove|run-now
    are reached from cli.go:176.
  * "plugin-pipeline's released CLI serves only run|validate|agent|probe
    (cli.go:35-46)" — it serves six, and that line range no longer carries the
    subcommand list.

Both beds were re-run against a build whose plugin-pipeline source is that
MERGED tag (`--dev-plugin plugin-pipeline=<[email protected]>`), so
nothing in either witness rests on an unmerged sibling, and the block that
required exactly that witness is satisfied without a sign-off. The two run
dirs and their totals are recorded in the new MEASURED STATE.

Also corrected: the stale claim that `#CandyRef` has no local-path form is
irrelevant to why plugin-pipeline is not composed here. It is not composed
because the front-end is reached HOST-SIDE (`${CHARLY_BIN} pipeline …`), never
as a bed-composed candy — a ref would add a candy the bed never invokes.

Comments only. No entity, step, or plan changed; the bed's own semantics are
untouched.

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*
*Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)*
github-actions Bot pushed a commit to opencharly/plugin-lobster that referenced this pull request Oct 5, 2026
…e, gates, scheduler, CLI (supersedes #2) (#3)

* feat(plugin-lobster): the lobster file schema + generated params

schema/lobster.cue: a faithful CUE transcription of UPSTREAM lobster 2026.9.16
(openclaw/lobster @ 74db267) — WorkflowFile, the step/parallel/branch/retry shapes,
the approval + input gates with their upstream aliases, and the cost_limit /
_meta.cost payloads from cost_tracker.ts. Every field name, alias, enum member and
numeric bound is transcribed from src/workflows/types.ts + src/workflows/load.ts,
never invented; the cross-field rules load.ts enforces are documented here and
implemented in Go.

params/cue_types_gen.go: generated by `cue exp gengotypes` (the plugin-pipeline
procedure), verified reproducible; ci.yml gains the same reproducibility gate.

* feat(plugin-lobster): the native lobster engine — run, resume, gates, scheduler, CLI

Adds the engine behind `workflow:lobster`, a transcription of upstream
`@clawdbot/lobster`'s semantics so a `.lobster` file means the same thing here as
there, plus the two capabilities charly adds (systemd-user-timer scheduling and
the `charly lobster` import/export/doctor CLI).

engine.go     the run loop: step dispatch, retry, on_error, `when`, the run result
shell.go      upstream's shell contract (`/bin/sh -lc`, own process group, timeout kills
              the group, `LOBSTER_SHELL` override) — transcribed from src/shell.ts
refs.go       `${arg}` then `$id.path` refs, the per-step value walk, `when` via
              workflowkit.Eval (ONE expression grammar, shared with the front-end)
lobster.go    the workflow-file loader + cross-field validation (the ported load.ts rules)
gate.go       the approval and input gates: state, tokens, identity policy, JSON-Schema
              validation of a response (cuelang.org/go/encoding/jsonschema)
state.go      $LOBSTER_STATE_DIR state, the upstream-wire-compatible resume token, the
              short approval id, and the non-replayable consumed tombstone
batch.go      parallel (wait all|any) and for_each
pipeline.go   the deterministic pipeline stdlib over real gjson paths
cost.go       `_meta.cost` accounting and `cost_limit`
schedule.go   cron -> OnCalendar -> systemd user timer/service via sdk/deploykit
run.go        the op envelope: run/resume/emit, and the reply projection
cli.go        `charly lobster import|export|doctor`
tty.go        the TTY probe the interactive gate needs

The engine is handed the LOWERED pair and never lowers: it loads
<gen-dir>/workflow.lobster, which the front-end writes. Two seams are stated where
they bite rather than worked around: the approval reply is a LOSSY projection (the
pinned IR's `#WorkflowApproval` has no home for `items`/`preview`/`approval_id` or
the approver identity), and `workflowkit.lobsterDrop` drops `triggers`, so the
scheduler reads the IR's own trigger list from `<gen-dir>/schedule.json` and refuses
`apply` with a message naming that file.

engine_test.go covers the engine against the REAL shell and a temp-dir state store.
Writing it found and fixed six defects in the transcribed code:
  - `$id.json.path` resolved to nothing: the walk re-entered the `json` segment
  - a for_each body's `$item` stayed literal: sub-steps resolved against the run's
    result map instead of the loop scope
  - the input gate never fired: `isInputStep` was handed the typed struct
  - `exec` rebuilt its command from unquoted fields, so a JSON argument reached the
    shell unquoted and brace-expanded into eight words
  - a pipeline's value was an earlier stage's text, so a trailing `where`/`pick` was
    invisible to `$id.json`
  - a step timeout was reported without naming the step

go test ./... passes; go vet clean; gofmt clean.

* test(plugin-lobster): the scheduler and import-CLI surfaces

schedule_test.go covers the scheduler's decidable half — the unit-name
mapping, the cron-conversion next-run, the content-idempotent unit
writer, the OnCalendar reader, the front-end schedule.json descriptor,
and three hard-error paths of `apply` (no descriptor, no
`triggers.schedule`, an unparseable cron) plus the marker a completed
run leaves. The systemd side of `apply` is a live boundary and stays
with the bed.

cli_test.go pins the import face: `engine: lobster` pinned, lobster's
`name` re-shaped into the authored `description` (with the explicit
description and the filename fallback), every step and every other
workflow key carried through unchanged, and a workflow the loader
rejects never emitted as an entity.

cliImport takes the output writer as a parameter so the emitted YAML is
assertable; runCLI keeps passing os.Stdout.

* feat(plugin-lobster): the redo back-edge (charly-only LOOP-GUARD)

Implement the redo conditional back-edge in the native lobster engine,
preserving the retired plugin-pipeline executor's semantics:

- schema: a charly-only `redo` step key (#LobsterRedo: triggers/max/
  escalate_after/on_fail), regenerated into params.
- engine: a failed shell step that prints "LOOP-GUARD-TRIGGER: <name>" on its
  stderr carries that trigger out to runSteps, which re-enters the mapped
  earlier step; escalate-then-max LOOP-GUARD bounds; a trigger that maps to
  no step is a named spec defect (never a silent swallow).
- state: the per-target budget persists across a resume (resumeState.RedoCount
  is this plugin's own state, optional and backward-compatible).
- docs: AGENTS.md pointed at a nonexistent executor.go (R1); it is engine.go.

Tests drive the REAL runSteps through the engine's shell seam (a real child
process writing the sentinel to its own stderr), covering sentinel parsing,
the back-edge, fail-hard without a sentinel, both guards, the per-step max
override (the float64-defect regression), an unresolvable target, redo-absent
behaviour, and the budget's resume round-trip.

* fix(plugin-lobster): scope ST1005 off and repair the two real findings

The module's lint gate (the config and the CI step, both copied from
plugin-task during repo setup) was red on 112 staticcheck findings. None
had ever fired: the branch has never been pushed, and golangci-lint's
default `max-same-issues: 3` collapses findings that share an issue text,
so every local run showed only 3 of the 110 ST1005 hits and looked
almost-clean.

Two of the findings are real and are fixed in code:
- engine.go: WriteString(fmt.Sprintf(...)) -> fmt.Fprintf(&b, ...) (QF1012)
- state.go: an empty `if decode(...) {}` branch -> the `_ =` form already
  used on the line above, with the reason kept as a comment (SA9003)

The other 110 are ST1005 (error strings must not be capitalized), and they
are deliberately NOT reworded: this module's error text is a product
surface. lobster.go is a port of upstream lobster's load.ts and its own
header records the rule — the strings are upstream's, verbatim, and "a
reworded one is a different product" — and those strings are 68 of the
110. The remainder carry the messages of the engine moved from
plugin-pipeline, whose CI never ran a linter at all; rewording them during
the move would be a behavioural change smuggled into a move. The module's
own tests assert the capitalized form (engine_test.go:
strings.Contains(err.Error(), "Unknown command: frobnicate")), so
lowercasing would be a product change plus a test break, not a lint fix.
charly's root config records that a module MAY keep its own closer config;
this is that case. The staticcheck `checks` list spells golangci-lint's
six default exclusions out explicitly because setting `checks` REPLACES
the defaults — omitting them would re-enable ST1000/ST1003/ST1016/ST1020/
ST1021/ST1022 and fail CI on findings the defaults suppress.

Verified with the same-issue dedup DISABLED (the run that catches a wrong
`checks` list): `golangci-lint run --max-same-issues=0
--max-issues-per-linter=0 ./...` -> 0 issues. gofmt clean, go vet clean,
go test ok (1.2s), and the CI params-reproducibility diff is byte-identical.

* fix(plugin-lobster): add the missing CLI + serve entrypoints

The plugin declared `workflow:lobster` and `command:lobster` and described a
`charly lobster import|export|doctor` CLI, but exported NEITHER entrypoint a
plugin is reached by — so both faces were declared and dead.

A plugin is reached by one of exactly two routes, and both name the same
function:

  - EXTERNAL (the default for a NEW plugin, per /charly-internals:plugin):
    charly connects it by word at runtime, host-building ./cmd/serve and
    speaking go-plugin gRPC over it. There was no main package anywhere in
    this repo, so there was no binary for the host to launch.
  - COMPILED IN: sdk/cmd/charly-lib-gen emits
    `{Provider: X.NewProvider, Meta: X.NewMeta, CLI: X.CliMain}` per listed
    plugin, so the absent exported CliMain is a COMPILE ERROR on that leg.

Add CliMain — forwarding to the SAME runCLI that Invoke(OpRun) already drives,
so the two routes cannot drift — and cmd/serve/main.go, mirroring plugin-task
and plugin-example-command. Unlike plugin-task's CliMain this one works in BOTH
placements: lobster's CLI reads a file and writes a directory, so it needs no
host project and dropping the executor is safe.

The candy's own `lobster-capabilities-declared` probe could not catch this: it
greps plugin.go for the capability STRING, which was present the whole time. Add
`lobster-entrypoint-reachable`, which asserts the entrypoint exists and binds
CliMain. It bites: with cmd/serve/main.go moved aside the probe exits 1, and 0
once restored.

Verified at this head: go build/vet clean, gofmt -l empty, go test ok (1.073s),
and the built binary drives the CLI end to end — `import demo.lobster` emits the
kind: pipeline entity, exit 0.

* test(plugin-lobster): the two missing R10 beds (engine semantics + scheduler)

The repo had discover: and nothing else, so the lobster leg had no R10 witness at
all. Adds check-lobster-local (the engine's refs/when, args, retry, on_error,
timeout, parallel, for_each, composition, approval+input gates, the pipeline
stdlib, and the import/export round trip, with an upstream-lobster parity step
that is live-or-skip) and check-lobster-schedule-local (apply, idempotency, list,
run-now, a real timer fire, a pending approval, and full teardown).

Both are authored, UNRUN and unvalidatable today: charly box validate at this
root fails on the candy's `workflow:lobster` word because the workflow provider
class is not in the pinned spec — the opencharly/charly#762 gate. They run the
moment that lands.

* test(plugin-lobster): author lobster-input-resume now that the lowering translates the gate's key

The bed OMITTED the input-gate step, and the reason was real: the authored grammar
spells the gate's schema `response_schema` while the engine's typed input is
`responseSchema`, and the engine treats a step as a gate only when that field is set
(lobster.go:158-160 isTypedInputStep ⇔ ResponseSchema != nil). The lowering passed the
authoring spelling through untouched, so the schema was silently dropped on the way in
and an authored `input:` step was not a gate at all — there was no shape that could
pass.

The sdk leg fixes exactly that (`sdk/workflowkit` mapLobsterInputKey renames the key
into the generated file's `input` object), so the step is AUTHORED here. It asserts the
gate halts the run with nothing after it having run, the LOWERED file carries
`responseSchema:` (the artifact that proves the translation ran — gen dir
plugin-pipeline cli.go:72 `projectDir()/.opencharly/pipelines/<name>`), a schema-valid
`--response-json` resume completes it with `$ask.json.branch` resolving to the answer,
and a type-invalid response is refused so the run never advances. The refusal half
asserts the EFFECT (no marker), not an exit code: the engine answers an error with a
NIL error, so the CLI still exits 0.

The header comment is rewritten from "omitted" to the reason it was omitted, kept
because that reason is what makes the assertion worth having.

`schedule-approval-pending` stays OMITTED, and correctly: `schedule list` projects only
the unit files it finds (schedule.go:192-232, Pipeline/Timer/OnCalendar/Active/NextRun)
and carries no pending-approval surface, so the listing the plan describes cannot be
asserted against the tree.

* feat(lobster)!: take the resume decision from the tri-state `approve`

spec's `#WorkflowResumeRequest.approve` is now `*bool` (opencharly/spec#195), so the
engine can finally tell a REJECTION from silence. This adapts the engine to it.

The defect this removes was structural. `resumeWorkflow` read the decision by WHICH
field the caller happened to set, and its `default` arm turned "an approval decision"
out of anything that was neither a response nor a cancel — so a resume carrying NO
decision at all was silently read as a rejection and CANCELLED the gate. Silence could
destroy a pending approval.

- `run.go` — the switch gains an explicit `case in.Approve != nil:`; the catch-all is
  gone, so a decision-less request leaves `Approved` nil and `applyResume` refuses it
  by name.
- `state.go` — `HasApproved bool` + `Approved bool` collapse into `Approved *bool`
  (R3). The pair was a hand-rolled tri-state, and it existed only because the wire
  could not carry one; keeping both beside the real thing would be two sources of
  truth for one decision.
- `engine.go` — `!r.HasApproved` → `r.Approved == nil`, `!r.Approved` → `!*r.Approved`,
  `r.HasApproved` → `r.Approved != nil`.
- `engine_test.go` — the five decision sites take `boolPtr(true|false)`, plus the
  helper that names the three states.

NOTE: this does NOT yet compile against the module's pinned `spec` — the pin still
points at a ref without the tri-state, which is correct: pin discipline forbids pinning
an unmerged ref. The bump lands once spec#195 merges and tags. Verified meanwhile against
the PR branch through an out-of-tree workspace (build/vet/gofmt/test all green).

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*

* test(plugin-lobster): pin the tri-state resume decision through the real resume entry

TestApprovalGateResumeWithoutADecisionIsRefusedNotCancelled drives `resumeWorkflow` —
the entry the `workflow:lobster` op binds, reached host-side as OpWorkflowResume —
through all three wire states of `#WorkflowResumeRequest.approve *bool`, plus the
separate ABORT arm:

  - approve: true   → the run proceeds past the gate (`ok`, output `done`)
  - approve: false  → an explicit REJECTION cancels the run
  - approve absent  → REFUSED BY NAME, and the SAME token still carries a live gate, so
    a follow-up approve:true completes the run
  - cancel: true    → the ABORT arm cancels

The absent case is load-bearing, and it is exactly what the old engine got wrong: with
a plain `bool` on the wire a decision-less request arrived as the zero value `false`,
the catch-all `default:` arm assigned it to `state.Approved`, and the pending gate was
silently CANCELLED and destroyed. A resume that names no decision must never destroy a
gate, so sub-assertion 3 also pins the survival: the refusal returns BEFORE the state is
consumed, and a later real answer on that same token still completes the run.

Can-fail proof. With run.go's switch temporarily restored to the old catch-all
`default:` (a scratch edit, never committed; the restore verified byte-identical to HEAD
by `git diff --exit-code -- run.go`), sub-assertion 3 fails with
`status = "cancelled", want error` while the other three still pass. Restored, all four
pass. Both runs are captured on the same head.

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*

* test(plugin-lobster): drive the resume tri-state through the lobster-approval-resume bed

The engine's resume decision is TRI-STATE on the wire (`approve *bool`), and the bed only
exercised two of the three states. It now drives the third — the envelope that carries NO
decision — and pins the behaviour the change exists to produce: a decision-less resume is
REFUSED, never silently read as `approve: false` and cancelled.

  - `gate-absent` (new fixture): run to the gate, save the recorded resume handle, then
    `pipeline resume gate-absent --token …` with NO `--approve` flag. The reply must be
    `status=error` and must NOT be `status=cancelled`; nothing after the gate may run; and
    the SAME token with `--approve yes` must still complete the run — a refusal that had
    consumed the gate would pass the status check and still lose the pending approval.
  - `--mode tool` on the three `pipeline run` dispatches. This is a determinism fix, not
    cosmetics: the engine's gate is interactive when stdin is a CHARACTER device, and
    /dev/null is one. A check runner (or any harness handing the step /dev/null) therefore
    took the interactive branch, prompted on the terminal, read EOF and answered
    `status=error` instead of saving the gate — the bed passed or failed on the runner's
    stdin. The wire path a resume answers is by definition non-interactive, and `--mode tool`
    is that dispatch.

The NAMED refusal text ('Workflow resume requires --approve yes|no for approval requests')
is not asserted here: this front-end answers the engine's error-status reply without
surfacing its text, and the bed's own rule is to assert on the CLI's output and on what the
run leaves behind. The exact text is pinned in engine_test.go, in
TestApprovalGateResumeWithoutADecisionIsRefusedNotCancelled.

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*

* test(plugin-lobster): make a failing bed step show WHY it failed

Every step in check-lobster-local captures a command's stdout/stderr into the step's
tempdir and then deletes the tempdir, so a red step reached the runner as a bare exit
code: `FAIL ... exit=1, want 0 (stderr: )`. The runner could not tell a plugin-resolution
failure from an assertion mismatch, and the diagnosis was destroyed with the dir.

The tail of each step now dumps the captures to the step's stderr AND keeps the tempdir
when `rc != 0`, and removes it as before when the step passes. No assertion is touched:
the block reads `$rc` and never writes it, so every exit status is byte-identical.

Measured on the re-run (calver 2026.277.1250, same 13 steps: 7 passed, 6 failed) the six
failures now name their cause in the runner's own log:
  - lobster-args-env   - engine status=error
  - lobster-for-each   - status=ok, loop body got no values
  - lobster-input-resume - `which branch?` / `Enter JSON response:` - the run took the
                          INTERACTIVE branch, so no pending gate was recorded and the
                          resume answered `no pending gate recorded in ...`
  - lobster-pipeline-stdlib - status=ok, wrong payload
  - lobster-import-export - the stdout matcher's subject is redirected away
  - lobster-export-unknown-is-named-error - exit=0, want 1

The seventh failure in the old-engine scratch run is lobster-approval-resume, which is
the intended can-fail proof, not a bed defect.

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*

* fix(plugin-lobster): make every check-lobster-local step tell the truth

The engine-semantics bed went 7/13 red on the real engine. Six of the failures
were the bed or the engine lying about what the engine does; this fixes all six
without weakening a single assertion.

Engine (two real defects):

* `cliExport` swallowed TOTAL absence: a pipeline that was never lowered has no
  `(workflow.lobster, charly.yml)` pair to export, and the per-file `continue`
  turned that into exit 0 with no output — a caller who typo'd the name believed
  the export succeeded. It now COUNTS what it copied and refuses by name
  (exit 1, `lobster export: no lowered files for "<name>" in <dir> …`) when the
  count is zero. `cli.go:188-205`; pinned by the new
  `TestCLIExportRefusesAnUnloweredPipeline` / `TestCLIExportRequiresAPipelineArgument`.

* `stdinIsTTY` tested fd 0 for "is a character device", the tempting port of
  Node's `process.stdin.isTTY`. `/dev/null` IS a character device, so a check
  runner that hands a step `/dev/null` was taken for a human at a keyboard: the
  input gate PROMPTED a terminal that is not there, read EOF, errored the run,
  and never wrote the resume handle — which is exactly why the input-resume step
  could not reach its gate. It is now `term.IsTerminal(int(f.Fd()))` on a named
  file (`isTerminal`), pinned by `tty_test.go` against `/dev/null`, a pipe, and
  nil. `golang.org/x/term` moves to the direct require block.

Bed (four assertions that described the engine wrongly — assertion text kept,
`source:` citations added):

* `lobster-args-env` — `$id` substitution and `${arg}` substitution are RAW TEXT
  (refs.go:344-346), and a quoted shell string is not a place raw text can carry
  a `"`. Split into the two arms the engine actually offers: a metacharacter-free
  value through the `${arg}` template, and a quote-bearing value through the
  injected `LOBSTER_ARG_<NORMALIZED>` env var (engine.go:1166-1183), where the
  shell owns the quoting.
* `lobster-for-each` — `item_var`/`index_var` are SCOPED STEP RESULTS, i.e. refs
  (batch.go:202-203), so a bare `$it` in a shell string is literal text; read them
  as `$it.json`/`$ix.json`. The loop's own array is handed over through `stdin:`
  (refs.go:191-203 writes a string ref verbatim) instead of being spliced into a
  quoted shell string, which used to strip its JSON quotes. The ordered 5-item
  result with `batch_size: 2` is asserted exactly.
* `lobster-input-resume` — a RESUMED answer is recorded as `Response`, never as
  `JSON` (engine.go:768-769), so the ref is `$ask.response.branch`; the
  authoritative spelling is engine_test.go:556. The gate stays strict: the
  schema-invalid arm must still never advance.
* `lobster-import-export` — the step's `stdout:` matcher is asserted on the STEP's
  stream, so the captured `pipeline nightly: valid (2 steps)` is echoed back after
  it is captured.

`lobster-pipeline-stdlib` is the sixth: the measured `$shape.stdout` IS strict
JSON already (pipeline.go:124-125 renders via `renderItemsJSON`,
pipeline.go:607-608 `json.MarshalIndent`); it only LOOKED like YAML because the
fixture spliced it into a quoted shell string. The assertion is unchanged; only
the delivery is (the same `stdin:` ref delivery as the for_each fix).

* docs(plugin-lobster): make the input-resume step's description match its assertion

The `lobster-input-resume` step's `check:` text still claimed "`$id.json`
resolves the answer", which contradicts both the engine and the step's own
assertion. `applyResume`'s input arm records a resumed answer as
`Response`/`HasResp` and never sets `JSON`/`HasJSON` (engine.go:765-770), and
`getValueByPath` returns nil for `json` when `!r.HasJSON` (refs.go:213-232), so
the reachable ref is `$id.response.*` — the spelling the assertion already
uses (engine_test.go:556). Prose only: no assertion, fixture, or engine change.

* chore(deps): adopt the released spec v0.2026277.1407 (the tri-state approve wire)

The engine reads the resume decision from a *bool, so the module does not
compile against the pre-tri-state spec v0.2026276.0:

	./run.go:119:21: invalid operation: in.Approve != nil (mismatched types bool and untyped nil)
	./run.go:120:20: cannot use in.Approve (variable of type bool) as *bool value in assignment

spec#195 is merged (9bf0e3f) and tagged v0.2026277.1407; this pins it.

* fix(bed): the schedule bed skipped every step on an unresolvable check-variable ref

The step computed its unit directory as a braced shell default:

    u="${XDG_CONFIG_HOME:-$HOME/.config}/systemd/user"

That is not shell syntax here. charly's check-variable grammar
(sdk/kit/checkvars_expand.go:17) parses a brace-dollar UPPERCASE name, optionally
with an ":arg", as an ENV-MAP KEY -- never as a shell default. So the reference
resolved to the key "XDG_CONFIG_HOME:-$HOME/.config", the key was absent, and the
expander left the ref visible and reported it UNRESOLVED, which the check runner
turns into a skip:

    SKIP  check `schedule apply` writes AND enables the .service + .timer units ...
          [schedule-apply]  unresolved variables: XDG_CONFIG_HOME:-$HOME/.config
    ...
    6 steps: 0 passed, 0 failed, 6 skipped

The whole bed reported ok: true while proving NOTHING -- the worst kind of green,
and exactly the failure a skip is supposed to make visible.

Fix: compute the unit directory brace-free, in shell, in the SAME order
schedule.go:341-350 resolves it (a non-empty XDG_CONFIG_HOME, else $HOME/.config).
A brace-free $X is invisible to that regex, so the expander no longer sees it.
The `if` form (rather than `[ -n ... ] && ...`) is deliberate: the latter returns 1
when the variable is empty and would abort a `set -e` script.

The explanatory comment is written without any brace-dollar literal for the same
reason -- the expander scans the whole command string, comments included, so an
illustrative example in a comment would have reintroduced the very skip it
documents. Verified after the edit: the only brace-dollar refs left in charly.yml
are the 46 resolvable ${CHARLY_BIN} and four lowercase names, which the regex
cannot match, and the file still parses as YAML.

* fix(plugin-lobster): the three findings this repo owns, and the two loader rules stated truthfully

Fixes, from the validator BLOCK on ecf69bf — all four blocks:

B14(a)/B18 — proven-dead code, in files this PR edits:

  * pipeline.go renderTable: `cols` was appended and never read, `seen` existed only
    to populate it, and `_ = cols` suppressed the evidence. Deleted all three.
  * engine.go: executeStep returned a stepKind its only caller discarded
    (`exec, ... := ...` then `_ = exec`). The return is gone, so the discard and the
    binding go with it.
  * batch.go runForEach: `batchSize` was computed, clamped, and discarded. It is
    unreachable anyway — the loader already rejects a batch_size below 1
    (lobster.go). The variable is gone; the comment now says plainly that the hint is
    accepted, validated, and deliberately not used to pace an ordered loop.
  * refs.go stepResult: `Attempts` was never assigned anywhere and never read;
    `DurationMs` was written by attemptStep and read by neither envelope() nor
    MarshalJSON. Both fields are gone, with the two writes and the now-unused
    `started` timers in attemptStep.

None of this was visible to the lint gate, because `_ = x` is exactly what suppresses
it. The gate is green either way; the diff is smaller and honest.

B5/R1 — a comment in this PR's own bed contradicted this PR's own code. The
check-lobster-local `lobster-approval-resume` step claimed `--mode tool` is required
because the gate goes interactive on a character device "and also /dev/null — a check
runner's usual stdin". tty.go implements, and tty_test.go pins, the opposite:
stdinIsTTY() is isatty(0), so /dev/null is correctly NOT a terminal. The stated
reason was false. `--mode tool` is required for the ENVELOPE — the step asserts on
`status=error` / `status=cancelled`, which human mode renders as prose. The comment
now says that, and names run.go:60 as the interactive condition.

A1/T3 — the Summary claimed two loader rules lobster.go does not implement.

  * "no approval inside parallel": validateForEach rejected a gate on a for_each
    body, but validateParallel never looked at a branch's approval/input. A branch is
    an exec arm — runBranch builds its LobsterStep from run/command/pipeline and
    carries no Approval field — so the key was silently DROPPED and the run sailed
    past a gate the author had declared. Now rejected by name, mirroring for_each,
    and pinned by two new cases in TestLoaderRejectsBrokenWorkflows.

  * "refs must point at earlier steps": NOT implemented, and the Summary no longer
    claims it. Upstream's handling is two-tier and the code already reproduces it —
    a stdin/for_each operand that is entirely `$id.path` resolves strictly and ERRORS
    on an unknown id (resolveInputValue), while a ref inside a templated string
    leaves an unknown id literal (resolveStepRefs). A blanket "every `$id.` must name
    an earlier step" check is deliberately not applied, because a for_each body
    legitimately refers to the synthetic `item`/`index` scope, which is not a step id
    at all. The Summary now states both tiers and the reason.

Tests: gofmt clean, go vet rc=0, go test ok — 55 test functions, 76 `=== RUN` lines
(two new rejection cases), 0 FAIL, 0 SKIP.

B12/A2 — the missing R10 witness (block 1), which turned out to be TWO defects, one of
them in THIS bed. `check-lobster-schedule-local` first failed outside this repo (the
front-end `schedule` word does not resolve in a dev-tree binary — a charly dev build
deliberately drops the installed plugin dir); a witness built from BOTH unmerged worktrees
through charly#788's sanctioned `--dev-plugin` removed that cause. The bed then ran for
real and exposed:

  * EVERY step invoked `${CHARLY_BIN} pipeline schedule apply`, but `${CHARLY_BIN}` is a
    check-variable EXPANSION — sdk/kit/checkvars_charlybin.go stamps the resolver Env map;
    it is NOT exported into the step process environment. `apply` is a CHILD process, so it
    never saw it, and resolveCharlyBin (run.go:295) fell through to
    exec.LookPath("charly") -> /usr/bin/charly, the INSTALLED binary. The generated .service
    therefore exec'd an installed charly that knows no `kind:pipeline`, and every scheduled
    run died with `pipeline entity "nightly" not found` before it could write the marker.
    Every step now exports CHARLY_BIN, so the unit execs the binary UNDER TEST — without
    which this bed witnesses nothing.

  * `schedule-fires` polls `while [ "$i" -lt 150 ]` and carried no `timeout:`, so the probe
    was killed at 2m0.171s — "probe killed by never-hang ceiling" — and the step failed.
    `timeout: 300s` added there, and to `schedule-run-now`, which likewise starts the unit
    and waits on it (per the check contract, `timeout:` is mandatory past the ~120s ceiling).

Tests: gofmt clean, go vet rc=0, go test ok — 55 test functions, 76 `=== RUN` lines
(two new rejection cases), 0 FAIL, 0 SKIP.

* docs(bed): sweep the header to the measured state (validator block 1)

The header asserted, in the present tense, that both beds were UNRUN, that
`charly box validate` "FAILS on this repo's own candy and always has", and that
"every engine step here is UNRUN until #762". None of that is the measured state:

  * both beds ran and PASSED on this head (B2 13/13, B3 6/6);
  * `charly box validate` PASSES here (3 candies, 2 deploys, 7 distros,
    7 builders; 0 warnings, 0 errors);
  * the "workflow" provider class is in the pinned spec as of v0.2026276.0
    (charly#778 MERGED, charly v2026.277.0930) — #762 is unrelated and open.

Restated as the two closed gates plus the still-true facts: the host must carry
BOTH faces, the dev-plugin override that supplies them is charly#788 (MERGED,
released v2026.277.1528), and the resume/schedule front-end subcommands are the
W6 leg.

* docs(charly.yml): the driver surfaces are no longer planned — both beds' drivers are released

The header's MEASURED STATE and DRIVER SURFACES blocks were written against
`e29a519`, when opencharly/plugin-pipeline#32 (the `resume` + `schedule`
front-end, and the merged driver both beds drive) was still an unmerged
sibling. It merged as `3d2aee88` and `tag-on-merge` published `v2026.277.2104`
(alias `candy/plugin-pipeline/v0.2026277.2104`), so the block's two central
claims are now FALSE:

  * "Two driver surfaces are NOT in plugin-pipeline's released tree yet" — both
    are released in that tag. `charly pipeline`'s subcommand set is
    `run|validate|agent|probe|resume|schedule` (candy/plugin-pipeline/cli.go:52
    in the merged tree), and the `workflow-schedule` ops apply|list|remove|run-now
    are reached from cli.go:176.
  * "plugin-pipeline's released CLI serves only run|validate|agent|probe
    (cli.go:35-46)" — it serves six, and that line range no longer carries the
    subcommand list.

Both beds were re-run against a build whose plugin-pipeline source is that
MERGED tag (`--dev-plugin plugin-pipeline=<[email protected]>`), so
nothing in either witness rests on an unmerged sibling, and the block that
required exactly that witness is satisfied without a sign-off. The two run
dirs and their totals are recorded in the new MEASURED STATE.

Also corrected: the stale claim that `#CandyRef` has no local-path form is
irrelevant to why plugin-pipeline is not composed here. It is not composed
because the front-end is reached HOST-SIDE (`${CHARLY_BIN} pipeline …`), never
as a bed-composed candy — a ref would add a candy the bed never invokes.

Comments only. No entity, step, or plan changed; the bed's own semantics are
untouched.

*Agent: `workflow-ir` · session `7e17b5cf-c349-4032-8da5-2e4e03612780`*
*Assisted-by: Claude Code deepseek-v4.1-flash:cloud (fully tested and validated)*

* test(plugin-lobster): cover the cost ceiling and `doctor` — the two changed paths with no proof

The validator's B12 block: `cost.go`'s `costTracker.checkLimit` (called from
`runSteps`) and `cli.go`'s `cliDoctor` are changed behaviour, and nothing in
`engine_test.go`/`cli_test.go` exercises either — no bed step emits `_meta.cost`
or runs `charly lobster doctor` either.

cost_test.go pins the read of `_meta.cost` (model, both token counts, dollars, the
per-step ledger and the run total), the negative control (a step with no cost
block contributes no entry and no dollars), each `action` at the boundary (`stop`
fails naming both figures, `warn` prints and continues, an empty action defaults
to `warn`, a total exactly AT the cap is not over it) and the tracker's one piece
of state (`warn` latches to a single line, `stop` deliberately does not latch).

cli_doctor_test.go drives `doctor` through the environment only — `CHARLY_BIN`
and `LOBSTER_STATE_DIR` — and pins both branches of each: an unresolvable
`CHARLY_BIN` warns AND still exits 0, an existing state dir reads `present` while
a missing one reads `not created yet`, and the `pipeline stages:` line equals
`newRegistry().names()` exactly.

Both are in-process; no live boundary is crossed, so nothing is skipped, stubbed
or faked. The systemd line in `doctor` is deliberately not asserted — it comes
from a real `systemctl --user` query, so its value is a property of the host, not
of this code.

Both bite: mutating `if action == "stop"` fails
TestCostCheckLimitActions/over_the_cap_with_stop_fails and
TestCostWarnIsLatchedAndStopIsNot; deleting `cliDoctor`'s WARNING block fails
TestCLIDoctorWarnsWhenCharlyIsNotResolvable.

* fix(plugin-lobster)!: drop the two inert resume-state fields (validator block 2 on e7f3ef2)

`resumeState` declared `InputKind` (`json:"inputKind,omitempty"`) and
`SupersededStateKey` (`json:"supersededResumeStateKeys,omitempty")`. Neither was
ever assigned nor read: `grep -rn 'InputKind\|SupersededStateKey' candy/plugin-lobster/`
matched the two declaration lines and nothing else, and neither could reach a save,
because every `saveGateState` call constructs a fresh `resumeState` literal
(`gate.go:88`, `gate.go:294`) rather than carrying a loaded one forward. They were
live-looking dead state carrying two upstream-shaped JSON keys this plugin never
produces.

Removed rather than documented: R5 asks that a cutover leave nothing legacy behind,
and a field kept "for compatibility" with a writer that does not exist is the same
class as the `cols`/`seen`/`batchSize`/`Attempts`/`DurationMs` the earlier review
flagged and the previous head removed. If real upstream interop ever needs them,
that is a change with a caller, and it lands then with one.

No behaviour changes: the state a gate persists is byte-identical apart from the
two omitted keys, and the fields were never in the wire request (they are not
`json:"-"`, but nothing reads them). The state round-trip those gates depend on is
already covered — `redo_test.go`'s `TestRedoCountSurvivesResume` does a real
`save`/`load` round-trip, and `engine_test.go` loads a gate's state at six sites.

* fix(bed): drop the no-op upstream-parity step, and align the tree with the body on #775

Two validator findings on cc50e95, both real, both fixed here.

1. R1(B5) — the committed `charly.yml` header said `opencharly/charly#775 (issue,
   still OPEN)` while the PR body said #775 is CLOSED. The issue is CLOSED
   (COMPLETED 2026-10-04T19:54:53Z, resolved by opencharly/charly#788); the header
   was stale. It now reads CLOSED.

   The same header's MEASURED STATE block was stale in the same way for the same
   reason: it named run directories, and a run dir written into this file describes
   a tree that cannot contain the line doing the describing — so it went stale the
   moment a comment above it moved. It now names NO run dir and NO SHA. It states
   only what is invariant under a comment-only edit of itself (the step counts and
   their result), and the per-head run dirs and summaries live in the PR body, which
   is the artifact that CAN name a commit.

2. B12 — `lobster-upstream-parity` could not fail. `exit_status: 3` makes exit 3 the
   step's EXPECTED code, i.e. a pass, and the command set `rc=3` unconditionally and
   exited 3 on BOTH branches, each of which only printed a `SKIPPED — …` line. The
   branch for `lobster` being PRESENT skipped too, because openclaw/lobster is not
   vendored here and its CLI invocation was never established. So the step never
   invoked upstream lobster, asserted nothing, and laundered a permanent skip into
   one of the bed's "passed" steps — the same lie-by-skip class as the schedule
   bed's own defect (fixed in e29a519), and the pathology charly's own bed header
   warns about ("a bed that reports SKIP where it meant to prove something").

   The step is REMOVED (R5), with the reason recorded in its place. The engine bed
   is now 12 steps, every one of which can FAIL; none is a declared skip. The bed
   description and the file header say so.

   What is NOT removed is the claim it was standing in for: the upstream parity is
   simply NOT ASSERTED by this repo's beds, and README.md's "also runs under upstream
   lobster" is restated as the interface property the lowering is designed for — not
   a tested result. Restoring the check needs an upstream lobster whose invocation
   this repo can source, which is a change with a real interface to test.

This commit changes no Go file (README.md and charly.yml only), so the witness binary
is unchanged from cc50e95; both beds are re-run on this head regardless, because the
engine bed's step set changed and its previous evidence does not cover it.

* fix(lobster): cover the workflow-emit op; stop the committed manifest naming a run and a SHA

The three findings of the `4f4e58e` verdict, all in ONE commit.

1. B12 — `workflow-emit` shipped with no test that would fail without it. The op
   (`emitWorkflow`, run.go) and its dispatch arm (`ops.OpWorkflowEmit`, plugin.go) had
   zero coverage across every test file, and neither R10 bed drives it, so one of the
   plugin's four advertised ops — including its `github-actions` and unknown-format
   refusals — was unproven. `emit_test.go` drives the REAL provider dispatch
   (`NewProvider().Invoke` with an `OpWorkflowEmit` envelope), so one test covers both
   the plugin.go arm and the copy/refusal logic in run.go: the happy path for every
   advertised format (an entry per format, byte-identical to the lowered source), the
   empty-`out_dir` default, and each refusal (no pipeline, no format, `github-actions`
   designed-but-not-built, unknown format, and a requested file the lowering never
   produced). A further test pins `engineCapability().EmitFormats` to the set the op
   actually accepts, because that list is what the front-end reads to refuse a format
   before it dispatches. 104 `=== RUN` lines now, from 95.

2. R1/B5 — the committed `charly.yml` contradicted the invariant its own header states.
   The header says the file "names NO run directory and NO commit SHA"; the file named
   run dir `.check/check-lobster-schedule-local/2026.277.1733` and SHA `3d2aee88`. The
   named run dir was also not the run the PR body cites for that bed, so it was stale as
   well as self-contradicting. Both tokens are removed. The `plugin-pipeline` release is
   now named by its TAG (`v2026.277.2104`) — stable under a comment-only edit of this
   file, unlike a SHA — and the schedule-bed comment states its two requirements without
   pointing at one run. The header's invariant is KEPT, not weakened: it is what removed
   the earlier staleness loop.

3. R1 — the `2026-10-05` header block referred to "the two runs above" after that block
   had stopped naming runs; reworded to "both bed runs described above".

Also R1, found in the same pass: `.gitignore` did not cover `.check/`. This repo runs its
two beds FROM ITS OWN ROOT — that is what makes it a project — so a bed run leaves an
untracked `.check/` tree. charly's own `.gitignore` and the umbrella's both ignore it,
with the same rationale (per-run generated state, never version-controlled source), so
this repo is the one that had drifted. One entry with that reason.

`charly.yml`'s diff is comment-only (0 non-comment lines) and `emit_test.go` is a test, so
no non-test Go file changes and the plugin binary is unchanged from `4f4e58e`. Both R10
beds are re-run on this head regardless, because the tree changed and R10 requires proof
from the final committed tree; the body carries their new run dirs.

* fix(lobster): drop the inert engine clock, and un-invert the bed's [FAIL] diagnostic

Two findings from the verdict on `043a702`, both in this branch's own new code.

**B14(a)/B18 — `engine.now` was an inert field.** `engine.go` declared
`now func() time.Time` under a comment claiming a test can pin the clock the state
records use; `newEngine` assigned it `time.Now` and `testEngine` assigned a fixed
clock — but nothing ever **read** it. Every state timestamp is stamped with the
package-level `time.Now()` in `state.go` (`save`, `markConsumed`,
`createApprovalIndex`), and `stateStore` never receives the engine's clock, so the
injection was dead and the comment asserted a capability that did not exist. The
gate's own first-listed remedy is removal, which is also the precedent this branch
already set for the identical class (`cc50e95` removed the two inert `resumeState`
fields), so the field, its comment and both assignments are removed. Nothing else
changes and every gate stays green — which is itself the proof that the field was
dead rather than merely unobserved.

**R1/B5 — the closing engine-bed step's diagnostic was inverted.** In `charly.yml`
the `lobster-export-unknown-is-named-error` step declares `exit_status: 1`, which
makes a **non-zero** exit its PASSING case, yet its command reused the sibling
steps' `if [ "$rc" -ne 0 ]` shape. So on **every passing run** the step printed a
false `[FAIL]` and kept its scratch directory, while the cleanup branch was
reachable only on the unexpected success — the step's own output contradicted the
verdict it carried. The comparison is now inverted: a **zero** exit (the export of
a never-lowered pipeline reporting SUCCESS) is the failure, exiting `2` rather than
the expected `1`, and the passing path removes the scratch dir. Both branches were
proved by running the exact body with the exit code injected: `rc=1` → exit 1, no
`[FAIL]`, scratch removed; `rc=0` → exit 2, `[FAIL]` printed, scratch kept.

**Both classes were swept across the whole module and both beds**, not just the
named instances. `now` is the only field in the module that is never read as
`.field` — every other zero-reference hit is either json-serialized (so the encoder
reads it) or generated from CUE. And this step is the only one of the twelve
`[FAIL]` blocks in the manifest whose `exit_status` is non-zero: the eleven
`exit_status: 0` steps use the `rc≠0 == FAIL` shape correctly, and the schedule
bed's six steps all use the `rc=0` / `exit_status: 0` convention consistently.

* fix(plugin-lobster): consume the generated params shapes instead of duplicating them

The engine hand-wrote types mirroring the CUE-sourced params shapes, leaving the
generated result-side types unreferenced. Delete the one true duplicate
(approvalRequest), use params.LobsterApprovalRequest / LobsterApprovalIdentity /
LobsterApprovalObject directly, and EMBED the generated shapes in the small
engine-only wrappers the documented json:"-" exception allows where the engine
needs a field upstream does not carry. Decode the cost _meta through
params.LobsterCostMeta and project it through a helper whose parameter and by-step
local NAME the generated cost shapes. Honour the declared step condition: in
evaluateWhen, and rewrite lobster.cue's use-map so every claim names a live consumer.

---------

Co-authored-by: workflow-ir <[email protected]>
Co-authored-by: atrawog <[email protected]>
Co-authored-by: workflow-ir <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant