Repository navigation
feat(kit): a step's process environment carries the host's values as DATA - #475
Merged
Merged
Conversation
…DATA The kit has one channel for a host's resolved values: ExpandOpVars substitutes them into a step's command TEXT, and the shell then PARSES that text. A value that is data therefore becomes source — a `$(…)` inside a value EXECUTES — and a value carrying a space arrives as two words. The environment is the other channel. A value delivered as an environment variable is data, because the shell never re-parses the result of an expansion: the command verb applies the env as a shell-QUOTED export, so the value arrives as one word whatever it contains. The seam is an OPTIONAL interface, not a new method on the public PlanContext — that interface's implementors live outside this repository, so a new method would break every consumer of the kit. A host that does not implement it keeps exactly today's behaviour: nothing is exported, no verdict changes. The step's own `env:` wins on a name collision (the author speaking last about their own step), the map is COPIED rather than merged in place (the walk's `expanded := *c` shares the Op's Env map, so an in-place merge would leak one run's values into the next), and a name the shell cannot export is NOT exported but DISCLOSED — a value that vanishes silently reads exactly like a host that never supplied it. Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)
Review — PASSWhat the diff doesThe PR adds a second, non-textual delivery channel for a host's resolved values:
Checks applied
Non-blocking observations
No blocking findings. Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
This was referenced Oct 24, 2026
github-actions Bot
pushed a commit
to opencharly/plugin-task
that referenced
this pull request
Oct 24, 2026
…nt as DATA (#47) A task's `params:` are substituted into a plan step's TEXT, and the shell then PARSES that text. A value that is DATA therefore becomes SOURCE: a `$(…)` inside a value EXECUTES. The text channel cannot fix that — the value has to arrive by a route the shell does not re-parse. The environment is that route. A value delivered as an environment variable is DATA, because the shell never re-parses the result of an expansion, and the command verb applies the step's env as a shell-QUOTED export, so the value arrives as ONE word whatever it contains. This change opens that channel: the task's RESOLVED values — its `vars`, its `env`, its resolved `params` and `TASK_DIR` — are handed to the SDK as `kit.RunnerConfig.StepEnv`, and the SDK's `kit.MergeStepEnv` merges them into every step's environment. Three rules bound the channel, and each is a rule the SDK's own merge already owns, so the plugin adds no second implementation of any of them: - the step's OWN `env:` WINS a name collision — the author spoke last about their own step, and the task's value is a default; - a name the shell cannot export (outside `[A-Za-z_][A-Za-z0-9_]*`) is REJECTED and RETURNED, and the SDK renders it as a NOTE on the step's message ("not exported (not a valid shell identifier): …") — disclosed, never dropped silently; - a piped stdin is not a resolved value, so it is NOT exported. The map is CLONED before `captureStdin` mutates it, because the command verb renders an exported value into the command TEXT, and a NUL byte (a piped binary stream carries one) would make the exec un-runnable ("fork/exec /usr/bin/sh: invalid argument"). The stream keeps its own channel: `TASK_STDIN` / `TASK_STDIN_FILE` stay reachable through the text expansion they have always had. A lowercase param is a second, independent win: the expander's grammar is uppercase-only, so a lowercase param was previously unreachable from a step at all. The environment is what makes it reachable BY NAME. The evidence is a live arm, not a unit test alone. `scripts/gate-task.sh` grew arm 1c: a task whose param carries `$(touch <marker>)` runs against a real charly binary, and the arm asserts BOTH outcomes — the value arrives VERBATIM in the step's environment, AND the marker file does not exist. The silent outcome is the failure this channel exists to remove, so it is asserted too. `candy/plugin-task/stepenv_test.go` covers the same contract at unit level: the export, the collision rule, the disclosure of a non-exportable name, and the stdin exclusion. The pin bump also made ONE line of this repo's coherence control stale: its header comment read "Measured at charly v2026.267.2313 (pinning sdk v0.2026266.1111 against this module's v0.2026276.1822)", and "this module's v0.2026276.1822" named the pin this module no longer carries. The measurement is history and stays; the false present-tense claim does not, so the clause now reads "against a module pinning sdk v0.2026276.1822 - the pin this module carried at the time of that measurement". The control's self-test fixtures keep their versions on purpose: they are SYNTHETIC (a leading pair, a lagging pair, an absent pin) and do not read this module's live pins, so they still prove the comparator can pass and can fail. Producer-first: the DATA channel is an SDK capability (`kit.StepEnvExporter`, `kit.RunnerConfig.StepEnv`, `kit.MergeStepEnv`, `opencharly/sdk#475`, released as `sdk v0.2026297.1851`), and this module's `require` therefore rises to it. This repo's own coherence control (`scripts/check-coherence.sh`, run by the `coherence` CI job on every PR) asserts that charly's `sdk`/`spec` pins LEAD this module's requires, so the producer leg had to land first — and it has: `opencharly/charly#1062` merged as `87f6302456f9c821877e719cbe90615368cd85bc` with the tag `v2026.297.1957`, and charly's `main` now pins `sdk v0.2026297.1851` / `spec v0.2026296.1036`. The live gate below was run against that branch (`CHARLY_REF=feat/sdk-pin-1851`) and against `main`, which is the configuration that ships. The tier is `analysed on a live system`, not `fully tested and validated`: this repo's own gate (build, test, vet, gofmt, the linter, `charly box validate`) and its live gate (a real charly binary with this candy compiled in, driving the changed path) both ran on the committed tree, and the changed path ran live — but the FULL assembled bed is charly's, and by the producer-first order it cannot run on this head until this change carries a tag that charly can pin. Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (analysed on a live system)
This was referenced Oct 24, 2026
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
A host's resolved values could reach a command only as shell SOURCE. The kit had exactly one channel for them:
kit.ExpandOpVarssubstitutes a value into the step's command TEXT, and the shell then parses that text. A value that is DATA therefore becomes SOURCE — a$(…)inside a value EXECUTES, and a value carrying a space arrives as two words. This is the seam opencharly/plugin-task#34 names, and the mechanism belongs in the kit, where the plan walk lives.The fix: a second channel, into the step's PROCESS ENVIRONMENT. A host hands the walk the values a step's environment should carry (
kit.RunnerConfig.StepEnv); the walk merges them into the step'senv:, and the command verb applies them as a shell-QUOTED export — so the value arrives as ONE WORD, whatever it contains. The two channels are not equivalent in kind, and that difference is the whole point:kit.ExpandOpVars)$(…)runs,;splits, a space splitsThe consumer is already shipped; this change is the missing producer. The
commandplugin's verb reads the step'senv:and renders it as shell exports — the version charly builds against is v0.2026277.738, and its source is pasted in How tested below. The kit fillsop.Env; the verb exports it. One implementation each, and the consumer needs no change for the channel to work.The seam is optional, and a host that does not implement it changes nothing.
kit.StepEnvExporteris a separate OPTIONAL interface, not a method on the publickit.PlanContext— that interface's implementors live outside this repository, so a new method on it would break every consumer of the kit. A host that does not implement the seam exports nothing, and every verdict is unchanged.A name the shell cannot export is disclosed, not dropped.
export HOST_PORT:6379=…is a shell SYNTAX ERROR that would fail the whole step, so such a name is not exported — and the name is named in the step's message, because a value that vanishes silently reads exactly like a host that never supplied it. That is a NOTE, never a verdict: the step itself still runs.The diff is four files —
kit/stepenv.go(the channel),kit/planrun.go(the walk merges it),kit/runner.go(the host's seam),kit/stepenv_test.go(the coverage). Head9070ab4d9af6980d422a466f2cf2b9d9db2939c5— 4 files changed, 302 insertions(+), 0 deletions(-).How tested
The changed path, executed live in a real process. The driver lives OUTSIDE this repository and imports the sdk through a
replace, so it exercises the committed tree and not a copy of it:Its verb is the
commandplugin's SHAPE: it renders the step'senv:as shell exports exactly as the shipped verb does — sorted keys,export NAME=<spec/shellquote.ShellQuote(value)>— and runs the step's command in a REALsh -cprocess. The value under test carries shell metacharacters, and the two arms differ only in which channel delivers it:Both arms ran in the same process, in the same run, with the same value. On the data channel the child received the value VERBATIM and the
$(…)inside it never ran. On the text channel — the kit's existing expansion, unchanged by this PR — the shell re-parsed the substituted value, the$(touch …)EXECUTED (the marker exists), and what the command printed was the substitution's output with${HOME}expanded. That is the defect the new channel removes, shown next to its removal.The same live proof against the tree with the channel removed — it fails loudly, so the proof discriminates:
The coverage fails without the change. The same mutation, against the unit suite — the three arms that assert the delivery go red, and the tree is restored afterwards:
The module gate, on this committed tree (
9070ab4d9af6980d422a466f2cf2b9d9db2939c5) — this repo's gate set is its ownAGENTS.mdand its CI workflow (gofmt,go vet,golangci-lintv2.13.2,go test, and the cross-compile matrix), and every arm ran here with zero failures and zero warnings:golangci-lintruns here under the toolchain the repo declares (go 1.26.8), which is the same toolchain CI builds fromgo.mod; the host's own default Go is newer and cannot decode this module's export data, so the toolchain is pinned for the run rather than left to the host's default. That host limitation is itself filed, on #466.The consumer, as shipped. The
commandplugin's verb — the version charly builds against,github.com/opencharly/plugin-command/candy/plugin-command v0.2026277.738— already reads the step'senv:and renders it as shell exports, quoting every value:That is the consumer side of the channel, already in production: the kit's job is to put a host's values into
op.Env, and the verb's job is to export them. The live driver above reproduces this renderer exactly (same sorted keys, samespec/shellquote.ShellQuote), so the process the proof measured is the process production runs.Rulebook compliance
/charly-internals:plugin,/charly-internals:go,/charly-internals:install-plan,/charly-internals:git-workflow,/charly-internals:root-cause-analyzer,/charly-internals:strict-policyand/charly-internals:go-qualitywere loaded before the change was written, and this repo's ownAGENTS.mdwas read first.kit.MergeStepEnv, the disclosure iskit.StepEnvRejectionNote, and the walk calls both. The shell rendering of the env stays where it already lives — thecommandplugin'senvExports— and is NOT copied into the kit: the kit fillsop.Envand the verb exports it.git statuswas stated before the commit, and it was empty. The work lives in the session worktree at.worktrees/pin-1059/sdkon branchfeat/step-env-data-channel, branched off freshorigin/main306d3d15c28f91d0a88a1bd2913007751f3fa36b. No other session's branch, worktree or file was touched, and no submodule was edited.sh -cprocess with its output retained. A test that cannot fail would be invalid, and both proofs above go red on the mutation.sh), not a mock of one.replace, and the tree was clean when it ran.golangci-lintv2.13.2, and the cross-compile matrix), run on the committed tree above, with zero failures and zero warnings. The sdk declares nodisposable: truebed, so no R10 target is affected by this change.Change classification
Go source change in the sdk's
kitpackage — the plan walk's delivery of a host's resolved values to a command step. No schema change, no wire-type change, no capability change, no OCI-label change. The new exported surface is four names plus one config field:kit.StepEnvExporter,kit.MergeStepEnv,kit.StepEnvRejectionNote,(*kit.Runner).StepEnv, andkit.RunnerConfig.StepEnv.kit.PlanContextis untouched, so no implementor outside this repository has to change.The gate that owns this class is the module gate, run on the committed tree above.
On the attribution tier.
fully tested and validated: the change-class gate passed on the final tree with zero failures and zero warnings — includinggolangci-lintv2.13.2 under the toolchain the repo declares — and the changed path executed live in a real process, with the output retained, in both the holding and the failing direction.The consumer leg is not in this diff. opencharly/plugin-task#34 owns the task verb's side: it builds the task's merged env and hands it to the runner. This change gives that verb a channel to hand it over; the verb's own leg is a separate PR in that repo, and it may not require a change to the sdk's own API.
Filed issues
HOST:web:8080,HOST_PORT:8080) is not the shell's, so a resolved peer value has no spelling the new channel can export. The naming contract between the check side and the kit is the decision, and the issue names the pair of owners.Both are genuinely separable from this change: the tree is correct and this PR's claim is true without them, and neither is touched by the diff.
Closes #473.
Agent: charly
Assisted-by: Claude Code minimax/minimax-m3.1-flash:cloud (fully tested and validated)