Repository navigation
fix(workflowkit): name the replacement for a config-knob ref, restore ${env.NAME} in a when: - #443
Merged
Merged
Conversation
…NAME} in a when:
Two retired-grammar expressions survived the lobster cutover inside the ONE gate every
engine runs, and each has a DIFFERENT disposition, decided by measurement rather than by
symmetry:
1. `$<knob>.<field>` inside a step. The earlier-step rule required every `$name.*` to name
an EARLIER step, and answered an entity-level knob (`$report.*`) with a message saying it
names a step that is not declared earlier, which sends the author looking for a step that
does not exist. The capability is GONE, not merely unspelled: the cutover deleted the
populator that made a knob visible to a step (`rc.report = mm(mapOf(p.Report))` in
plugin-pipeline's retired executor.go) and kept the readers, so `rc.report` is nil and a
reference that got past the gate would render LITERAL TEXT at run time. Widening the
grammar to accept it would trade a load error for a run-time emptiness, which is worse.
The gate now refuses it with a message that names the replacement: author the knob's
field VALUE where it is used. The classifier is keyed on the document (the `config:` keys
of `spec.Pipeline.Config`, never a hard-coded list) and runs at every reference site, not
just `plan:`.
2. `${env.NAME}` inside a `when:`. A genuine survivor with an obvious modern equivalent:
the org's own migration emits exactly this spelling for the retired `$env.NAME`
(plugin-migrate's documented ref rewrite), so the producer's output could not load
against the target grammar. RESTORED: the expression rewrite turns it into an `env` call,
the patcher admits `env` alongside `ref`, and Eval reads the PROCESS environment, the same
source the retired form read (plugin-pipeline's surviving `envMap()` is `os.Environ()`).
The value is typed as the lobster LITERAL the retired text substitution would have
produced, so the consumer guard runs when the variable IS true instead of being skipped
forever.
The retired `$env.NAME` spelling, whose value would have to be spliced into the expression
as text, stays refused, but now names `${env.NAME}`.
No acceptance changed: the knob message replaces an error that already fired, so the diff
adds no rejection. It changes a reason and restores one expression form.
Refs: #437
Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)
Review — PASSHead SHA: Security screen: PASS — no secrets/egress, no guardrail weakening, no scope mismatch (diff matches body), no self-modifying-security surface touched. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
github-actions Bot
pushed a commit
to opencharly/plugin-pipeline
that referenced
this pull request
Oct 21, 2026
…s, the real map, a named miss (#52) * fix(pipeline): resolve `$env.NAME` in a data string — both spellings, the real map, a named miss A pipeline DATA field naming an environment value had no resolver at HEAD, in three independent ways: the front-end's grammar matched the BARE `$env.NAME` only (so `plugin-migrate`'s `${env.NAME}` could never match), the one production `verbEnv` constructor left the map nil, and `resolveRefs` returned even a matched ref verbatim under the standalone IDENTITY resolver. The value reached a verb body as literal text — measured on eval-omarchy's seven data leaves. The LAYER is the front-end's, by measurement: `workflowkit.Lower` moves a lifted verb's body into the generated `charly.yml` as a `task:` entity and leaves only `run: <charly> ... task ...` in the `.lobster`, so the engine never sees the leaf — teaching the engine a dotted name would be a second resolver wired to nothing (R2). - refs.go: one `envRefRe` admitting `$env.NAME` AND `${env.NAME}` (the dot names the NAMESPACE; the name class stays the POSIX env charset), split from `runRefRe`. The ENVIRONMENT namespace is substituted BEFORE the resolver override, because no other layer in the chain resolves it: the plan's `${VAR}` expander is uppercase-only and never sees `env.`, and the engine's `${arg}` reads run args. Gating it behind the override is exactly how the ref survived as text. - verb_env.go: `standaloneVerbEnv` supplies `procEnv` from `os.Environ()` — the source the retired `$env.NAME` read — in a field SEPARATE from `env`, the per-run BOUND map `adeLaneHead` reads; merging them is the defect RCA 2026.252.2210 fixed, and the lock in verb_ade_head_test.go still holds it. - a MISSING name is recorded during resolution and reported as ONE named failure of the whole dispatch, prefixing any downstream error. Empty is the rejected alternative on purpose: it is a run-time emptiness in place of a load error, the trade opencharly/sdk#443 refused for the knob form. - render.go: `validate:` is handed to `bash -c`, so it is the one field where a substituted VALUE would become SCRIPT TEXT. An env ref there is REFUSED with the shell's own `${NAME}` named — bash expands a variable from the inherited environment and never re-parses its value as syntax — instead of splicing it. `plugin-migrate` needs no change, measured rather than assumed: no spelling resolved in a data string before this (`${NAME}`-uppercase is the plan expander's grammar over t.vars/t.env/-p, never the process environment), so re-pointing the emission would not have helped, and `${env.NAME}` is now both the spelling that resolves and the one the expression grammar accepts. The `corpus` leaf needs one thing more and it is filed, not half-wired here: `rc.skills` is a dead config knob (plugin-pipeline#37), so that string never reaches the grammar. This change makes the ref resolvable; #37 makes it reachable. Tests: the pre-change arm fails all five behavioural claims on the untouched tree (pasted in the PR body); four mutations (brace arm removed, procEnv removed, missing name rendered as a literal, shell refusal removed) each kill the test that asserts its property. Closes #50. Agent: charly Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated) Co-authored-by: Andreas Trawoeger <[email protected]> * test(pipeline): pin the concurrent-dispatch contract of the env resolver Round-1 review, block 2: `substituteEnvRefs` appends to `rc.missingEnv` and `invokeLiftedVerb` reads it after `run`, so a `verbEnv` shared by two dispatches would be both a data race and a cross-attribution bug (one stage's missing variable surfacing in another stage's verdict). The per-dispatch construction is what makes that impossible — `invokeLiftedVerb` builds its OWN `verbEnv` per Invoke — and this adds the test that holds it: eight dispatches in flight at once, HALF of them naming an absent variable so the miss list is touched concurrently with the resolving arm, each verdict asserted to name its OWN variable and no other. Mutation-checked: turning `missingEnv` into one package-level accumulator makes the test fail under `-race` with `WARNING: DATA RACE`, so the test can fail and fails exactly on the property it claims. Also measured for round 1's block 1, and recorded here so the numbers live with the change: the change-class bed step `pipeline-runs-lifted-file-verbs` fails at the SAME rate on the unchanged tree (1 of 30 parallel iterations on each side; 5 of 36 in two earlier 12-way waves, all on `origin/main`), with the run exiting 0, its artifacts written, and the LAST line of the plugin's forwarded stdout missing. That mechanism is filed as opencharly/charly#1013. Agent: charly Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated) Co-authored-by: Andreas Trawoeger <[email protected]> * chore(pr): re-freeze the head so the org required gate re-fires The round-2 push (9210549) created NO workflow run — neither the org-required validator nor this repo's own ci job appeared for it (gh run list shows only the 14:49Z runs at fd420e5), so the gate was never dispatched on that head. An empty commit mints a NEW head and a new pull_request/synchronize event, which is the documented re-trigger; the TREE is unchanged, so every tree key in the body holds. Agent: charly Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated) --------- Co-authored-by: Andreas Trawoeger <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
workflowkitis the ONE gate every engine runs on an authoredkind: pipelinebody beforelowering it.
opencharly/sdk#437records two expressions the retired grammar accepted andthe cutover left with no spelling, both measured on
eval-omarchy(the org's only realkind: pipelineconsumer). They are not one defect with one answer: the two answers beloware DIFFERENT on purpose, each decided by measurement, not by symmetry.
$report.*— entity knob data read from inside a stepworkflowkit/validate.go:225(theplan:walker) and:304(the one earlier-step rule behindplan:/when:/stdin:/for_each:/lanes:)${env.NAME}inside awhen:workflowkit/expr.go(the rewrite + the grammar patcher +Eval)Defect 1 is refused, and the message names the replacement
The old message was
reference $report.* names a step that is not declared earlier, whichsends the author looking for a step to declare. There is no such step, and there is nothing
left to restore. The populator that once made an entity knob readable from a step was one
line in the plugin's retired executor; the cutover deleted that file and kept the readers.
The counts below are the whole measurement (counts only — the paths are in another repo this
PR does not touch):
So at HEAD every surviving
rc.reportreference — one helper call and three direct reads —reads a map nothing assigns: it is nil, and a reference that got past the gate would render
the LITERAL TEXT (the generate verb's arm leaves its template as the authored string when
the lookup misses) rather than a value.
The reshape does duplicate the knob block into each lifted verb body, and no verb body reads
that key (0, above). Widening the grammar to accept
$<knob>.<field>would therefore be ahalf-restore with no value source — a run-time emptiness in place of a load error, which is
the worse trade.
The gate now refuses it with a message that names the replacement. Both retired namespaces —
a
config:knob, and the retired entity-env spelling whose value would have to be splicedinto the expression as text — are answered by the gate itself:
The classifier is keyed on the DOCUMENT (the
config:keys ofspec.Pipeline.Config, whoseown CUE comment names the former knobs
llm/media/report/skills/channels/gates/repo/redo/agent),never on a hard-coded list, and all five earlier-step call sites share one helper
(
checkRefNames), so the misleading step message cannot survive atstdin:/for_each:/lanes:/plan:either.What
eval-omarchymust do instead — a documented hand-fix, not a promise. Its two knobreferences are
eval-omarchy/charly.yml:1673(template: "$report.bed_template") and:1899(
report: "$report.template"). Both are string fields whose value the author already holdsin the entity, so the fix is to author that value at the point of use. The consumer's third
item, the
eval-prpin at the retiredplugin-pipeline:v2026.272.0332, is that repo's ownchange and is untouched here.
Defect 2 is restored
${env.NAME}is not an invented spelling: the org's own migration emits exactly this formfor the retired
$env.NAME(plugin-migrate's documented ref rewrite — "the ref must bebrace form to expand"), so the producer's output could not load against the target grammar.
exprcannot parse the brace form at all, so the measured failure is a PARSE error ratherthan a grammar rejection:
The restore has three parts, and each is pinned:
rewriteEnvRefsturns${env.NAME}into anenv("NAME")call before the patcher runs,because the brace form never reaches the parser otherwise;
envas a second CALL name besideref, and refuses any other arity(
env()names nothing, and a load-time refusal beats a run-time one);Evalresolves it from the PROCESS environment — the same source the retired form read,whose surviving
envMap()in the retired executor's package is built fromos.Environ().The value comes back as the lobster LITERAL the retired text substitution would have put in
its place (
true/false/null, a number, else the string), because that is what makes theconsumer's guard mean what its author wrote:
when: '!(${env.EVAL_PUBLISH} != true)'mustRUN when the variable is
true. A raw-string lookup would compare"true" != true— alwaystrue — and the stage would be skipped forever.
The widen is ONE named call, not a namespace:
env.NAME(a bare member access) is stillrefused, as is every other call, so the grammar's refusal set is unchanged except for the one
form the migration emits. An unset variable reads as empty,
os.Getenv's own contract.The diff
339 insertions(+), 27 deletions(-) across 4 files. Head
be72a159650d981d4bad3ef44e814d9075d71858. Nospecchange,no pin, no generated input, so no schema regeneration applies.
How tested
The gate this repo's
AGENTS.mdnames for a library change:go build,go vet,gofmt,go test,golangci-lintv2.13.2 (the CI pin) and the cross-compile matrix.sdkcarriesno
check-*-localbed — its CI class gate IS the gate.1. The pre-change arm for the two REFUSALS — a message control, not merely a non-zero
result. The pre-change tree is a detached worktree at
origin/main(94cd798) carryingONLY the two new test files, so each failure below is the validator's own message. Both
named-error tests fail on the old source, and the control case — a knob NAME that IS an
earlier step — passes on both sides, so the classifier is keyed on step-ness and not on the
name:
2. The same tests on the committed tree, with their
=== RUNheaders:3. The whole suite on both arms, so the "did any prior expectation move" question is
answered rather than asserted. Pre-change, with the new tests excluded — this is what the old
gate's own suite looks like:
The committed tree:
Every package passes on both sides: the diff changes a reason string and restores one
expression form, and no existing test, message or ordering for a genuine undeclared step
moved.
Disclosure — the skip. The committed-tree fence above carries
-skip '^TestLive_';llmkit's live arm is endpoint-latency dependent and issdk#436. The skip hides nothinghere: CI's exact command, without the skip, is green on this host, whose live tests reach a
local endpoint:
4. The module gates, on the committed tree.
The formatter half is
golangci-lint fmt --diff, which prints nothing on success (aformatter-class drift that plain
golangci-lint rundoes not report). Cross-compile, the twotargets this leg owes:
5. The survivor-class sweep — measured, in this package. The refusal rule is reachable
from exactly five sites, and they share one helper (so a fix at one is a fix at all five):
The expression grammar has exactly one site, because
when:is the only expression thevalidator compiles:
name that is not an earlier step, and it now separates the two retired namespaces that can
appear there: a
config:knob (no value source, so a refusal is the honest answer) andenv(whose modern form is restored). The diff adds NO rejection — the knob messagereplaces an error that already fired, and the restored expression turns a refusal into an
acceptance.
${env.inside awhen:/comparison reaches no other surface in this package, sincethe fence above is the whole of it. A
grepacross the umbrella's authored YAML finds nomatches either, so the restore is the enabling half for the consumer rather than a call
site already in tree:
and
plugin-migrate's legacy test fixture carries the same two. That fixture is assertedto SURVIVE the reshape, which is consistent with this change and outside it: the shape
assertion is about not CORRUPTING the reference, and this gate is about the reference
having no resolver:
What I did NOT run, and why. No
charlydriver: the umbrella'scharly/bin/charlyweldssdk v0.2026293.417, socharly box validatethere would exercise the OLD gate and provenothing about this change. I did not build a driver against this worktree either — that is the
go 1.26.8versusgo.workmismatch theplugin-migrateleg recorded, in a generated file.The changed path therefore ran where it can be observed honestly: the exported
ValidatePipeline,ValidateandEvalthe tests call, which are the same functions theplugin front-end calls.
Rulebook compliance
R0: loaded
/charly-internals:git-workflow,/charly-internals:strict-policy,/charly-internals:go,/charly-internals:go-qualityand this repo'sAGENTS.mdbefore thefirst tool action; its "Build / validate / test" section names the CI class gate this PR runs.
R1: every anomaly got an RCA before remediation, and one of them changed the answer. I
first wrote the knob message to say the duplicated block was usable and to offer
args:; themeasurement (the populator deleted, four readers reading a nil map, the duplicated key read by
nothing) showed that claim false, so the message was corrected to "author the value where it
is used" before the commit. The
plugin-migratefixture's survive-assertion is named under## Filed issuesas an owner elsewhere, not widened into this diff.R2: one implementation, not two. The plan walker had its own inline copy of the
earlier-step message; it now calls the same
checkRefNamesthe other four sites use, so theclassification exists once. The expression grammar keeps ONE patcher and ONE compile path, and
envis registered the same wayrefalready was.R3: no sleep, retry, suppression, fallback or magic constant. The knob set is read off the
authored document; the env value is
os.Getenvwith its own documented empty-string contract,not a default.
R4: the product was fixed, not the prose. No doc, skill or comment was edited to route
around a rejection, and the refusal names a replacement the author can act on.
R5: no legacy path, alias or shim is left. The one duplicated message loop was deleted
into the shared helper (R2); the message for a genuine undeclared step is unchanged, which is
why it still appears in the tree — that sentence is correct for its case.
R6:
git status --shortwas empty before the branch work and after the commit; onefix/branch, one commit, one push, no force-push, no bypass, no push tomain, and no editin any other repo. The pre-change arm was a detached worktree under
/tmp, never a mutationof the tree under test.
R7: the coverage fails without the change — the pre-change arm is that proof, run in a
tree carrying only the new tests, and the two refusal tests assert the MESSAGE TEXT rather
than a non-zero result. The changed path executes live: the tests call the real
ValidatePipeline/Validate/Eval, they do not reimplement them.R8: N/A — this change crosses no live service boundary and mocks nothing.
R9: N/A — this module ships no binary.
sdkis a library consumed at a pinned Go moduleversion and this PR adds no runtime OS dependency.
R10: the change class is the Go module gate, and it passed on the committed tree:
go build,go vet,gofmt -lempty,golangci-lintv2.13.2 with0 issues,golangci-lint fmt --diffempty, the full suite, and the linux/amd64 plus linux/arm64cross-compile, all pasted above.
sdkhas nocheck-*-localbed, so the CI class gate is thegate and there is no disposable bed to run.
Change classification
A behavioural bug fix in the shared workflow validator and expression grammar:
workflowkit/validate.go,workflowkit/expr.goand their two test files. No generated input,no schema, no pin —
specis untouched atv0.2026294.929, socue:gendoes not apply. Theclass is config by this repo's own taxonomy: the gate is the Go CI matrix, and
sdkcarries no runtime bed.
Filed issues
This PR closes
opencharly/sdk#437, which is the finding it fixes. No new issue was opened:the sweep found no second legitimate document refused, so there is no second defect to file.
Owners for the work this PR deliberately does not do:
opencharly/eval-omarchy#91— the consumer leg. This fix clears its two grammar blockers;its hand-fix for the two knob references and its own
eval-prpin are that repo's work.opencharly/plugin-migrate#23— the reshape's emit half for the lanes arm, which needs thisfamily of
sdkfixes released and pinned first.opencharly/plugin-pipeline#37— records that theconfig:knob populator was deleted andthe readers kept. This PR is the load-time half of that record; the run-time half (the dead
readers, and the duplicated knob block no verb body reads) is that issue's, in that repo.
One boundary is measured and recorded rather than crossed here. The same
${env.NAME}spelling in a NON-expression string (a knob value, a
vars:leaf, acache:key) is expandedby the plugin's own template resolver, not by this package, and that resolver's name class
(
[A-Za-z0-9_-]+) cannot match a dotted key. That is a second surface in repos outside thisleg's write scope; the measurement is posted on
opencharly/eval-omarchy#91for its owner.A3 — attribution evidence
Delivered system message, first line verbatim: you are an AI agent powered by DeepSeek
Harness. (The sentence is the runtime's own; quoted here without markup so no wrap splits it.)
Descriptor record from this session's own harness record
(
~/.dsh/sessions/--home-atrawog-Sync-Atrapub-mo-dsh-opencharly--/3ae3bf4f-f94e-4847-a6a2-1ccc7a7713ba/session.v4.jsonl.zstd,the first
subagent/descriptorline):DSH_*environment of the shell that ran every gate above:The harness and model names are the runtime's own —
opencharly/opencharly#538. The footer isunchanged.
Agent: charly
Assisted-by: DeepSeek Harness ollama-cloud deepseek-v4.1-flash (fully tested and validated)