Relationships
#4596 stagecraft artifact digest breaks when artifact content holds a resolvable ${{ }} expression (interpolated on read)
Opened by kneel · 11/10/2026· Shipped 11/11/2026
Summary
Recording a @swamp/stagecraft artifact whose payload contains a RESOLVABLE ${{ }} expression as a string value succeeds, but the next status/read fails:
artifact '' version N does not match the digest the run recorded; it was changed outside the runtime
The artifact file on disk is byte-stable (identical checksum across versions), so nothing truly changed it. swamp's ${{ }} config-value interpolation appears to be applied to artifact content on READ, so stored-then-read content diverges from the write-time-hashed bytes and the digest verify fails.
Repro (minimal)
Record a plan artifact whose content embeds any resolvable expression (observed with a vault.get expression; env.* behaves the same):
record_artifact --name plan
--payload '{"summary":"x ${{ env.HOME }} y","steps":[{"description":"d","files":[]}],"testingStrategy":"t"}'
status # -> "does not match the digest the run recorded"
Remove the braces (or use a non-resolvable bare "${{ }}") and it validates:
...--payload '{"summary":"x env.HOME y",...}' status # -> clean
Isolation: a bare "${{ }}" with no resolvable expression passes; a resolvable one fails.
Impact
- Any artifact text that legitimately mentions a ${{ }} expression (e.g. a plan describing a vault-ref config step) wedges the work item's status with a false "changed outside the runtime".
- Security-adjacent: a ${{ vault.get(...) }} in artifact content is resolved on read, i.e. interpolation would render a secret value into the stored artifact. The digest guard happens to block trusting it, but interpolation is running over artifact content (which is data, not a config value).
Expected
Artifact content is stored data and should not be subject to ${{ }} interpolation; the digest recorded at write should verify unchanged on read.
Env
swamp 20261110.125620.0-sha.c7f34885; filesystem datastore; @swamp/stagecraft.
Upstream repository: https://github.com/swamp-club/swamp-extensions
Environment
- Extension:
@swamp/stagecraft@2026.11.05.3 - swamp:
20261110.125620.0-sha.c7f34885 - OS:
linux(x86_64) - Deno:
2.9.8 - Shell:
/bin/zsh
Shipped
Click a lifecycle step above to view its details.
system commented 11/10/2026, 5:33:42 PM
Classified automatically when this issue was filed.
- Source: Extensions
If you feel this classification is incorrect, add a ripple to tell us so.
skunk-ape commented 11/11/2026, 3:40:37 PM
Thanks for the report. We couldn't reproduce this yet, and need a little more detail on how the artifact was recorded.
What we tried, with @swamp/stagecraft 2026.11.05.3 on a filesystem datastore, against both swamp 20261109.213318.0-sha.e484ef8f and your exact build, 20261110.125620.0-sha.c7f34885 (compiled from that commit):
swamp behavior run @swamp/stagecraft/work-item record_artifact <item> --input name=plan --input payload=...with a plan whose summary wasx ${{ env.HOME }} y, thenstatus: both succeed. The CLI resolves the env expression when it reads the input, so the method receives, hashes and storesx /home/[REDACTED] y, and the digest verifies on read.- The same with a
vault.get(...)expression in the summary: it is not resolved in method inputs at all; it is stored and read back as literal text, andstatusis clean. - The same with the payload passed as
--input payload=@file.json: same results. - Reading a stored resource back only resolves vault references in fields a resource declares sensitive, and stagecraft's artifact resource declares none, so we found no path where artifact content is interpolated on read.
Could you share:
- The exact command (or script) that recorded the artifact.
record_artifact <item> --payload ...in the issue looks like shorthand, so we'd like to know whether this went throughswamp behavior rundirectly, a workflow step, a stagecraft dispatch, a driver or agent skill, orswamp serve. - The
statusoutput in full, and the payload you recorded (with any secret removed). - If you still have the repo: the run record's
products.artifacts.planentry (version and digest), and the stored artifact content for that version (swamp data get <item> artifact-plan --json).
kneel commented 11/11/2026, 4:53:49 PM
Thanks -- you're right that the repro as filed doesn't reproduce, and I can now say exactly why. The core finding stands, but the recipe in the original report was wrong in two ways. Retracting and correcting both:
Retraction 1: the ${{ env.HOME }} minimal repro is bogus
That minimal repro was an extrapolation, not something I actually ran. You're
correct: for env.*, the CLI resolves the expression when it reads --input,
so the method hashes and stores the resolved value and reads it back byte-stable
-> clean. The line "env.* behaves the same" is false. Disregard the env case
entirely.
Retraction 2: the vault case only fires when the vault actually resolves
The only case I actually verified failing is a vault.get(...) reference to a
secret that exists and resolves in the repo. Your test apparently used a
vault.get(...) against a vault that doesn't resolve, so it stayed literal on
both sides and passed -- which matches what you saw. The missing precondition:
the expression must reference a real, resolvable secret.
Repro that does reproduce (all via swamp behavior run, no studio/serve)
swamp vault create local_encryption repro-vault
swamp vault set repro-vault SECRET "<any-long-value>"
swamp behavior run [@swamp](/u/swamp)/stagecraft/work-item record_artifact <item> \
--input name=plan \
--input 'payload={"summary":"x ${{ vault.get(repro-vault, SECRET) }} y","steps":[{"description":"d","files":[]}],"testingStrategy":"t"}' \
--input expectedStage=plan --input expectedCycle=1 --input expectedEra=<era>
swamp behavior run [@swamp](/u/swamp)/stagecraft/work-item status <item>
# -> artifact 'plan' version N does not match the digest the run recordedIsolation, three consecutive versions on one work item, identical command path, only the payload differs:
- v(n) plain text, no expression -> status clean
- v(n+1)
...${{ vault.get(repro-vault, SECRET) }}...-> digest mismatch - v(n+2) same text, braces removed -> status clean
Answering your Q1 directly: the failing writes above went through
swamp behavior run @swamp/stagecraft/work-item record_artifact directly -- the
same path you tested. (The very first real occurrence in my work item was a
studio/serve write, but I reproduced it standalone on the plain CLI, so serve
is not required.)
On "no path where artifact content is interpolated on read"
Empirically, version v(n+1) fails its own immediate read-back, so something is
diverging the stored bytes from the write-hashed bytes for a resolvable
expression. My guess for why it was invisible in your testing: with a
non-resolving vault.get, interpolation-on-read produces no byte change, so the
digest still matches and it looks clean -- the divergence only becomes visible
when the reference resolves to a real (and here, large) value. Whether the
asymmetry is on the read side or a write-time hash/store mismatch I can't say
from the outside, but the reproducer above should let you see it.
Side note on the original impact point 2 (secret exposure): because a resolving
${{ vault.get(...) }} in artifact content does get rendered somewhere in the
round trip, this is also a path to materializing a secret into stored/returned
artifact data. The digest guard is what currently blocks trusting it.
skunk-ape commented 11/11/2026, 5:25:39 PM
Thanks, the corrected repro reproduces on current swamp and on your build. Nothing interpolates on read. Plain --input values are evaluated, so the method receives the resolved secret and hashes it. swamp then redacts that secret to *** when it stores the artifact, so the stored bytes no longer match the recorded digest. The secret value itself isn't written to stored data or output.
To record text that mentions an expression, pass the inputs with --literal-inputs (use --input-file instead of payload=@file). A work item already showing this recovers when you record that artifact again without the resolvable reference.
We'll fix the stagecraft skill to record payloads that way, and make stagecraft refuse a redacted payload with a clear message instead of wedging status.
kneel commented 11/11/2026, 5:48:49 PM
Excellent. Thanks!
skunk-ape commented 11/11/2026, 7:20:41 PM
Thanks @kneel for reporting this! We shipped: Swamp evaluates plain --input values (and @file content), so a resolvable vault.get in agent-written text reaches the method as the secret; for payloads stagecraft hashes it, swamp stores it redacted, and status then wedges on a digest mismatch. Fix in stagecraft: the skill passes --literal-inputs on every behavior run that carries written text (payloads, reasons, notes, tracker create); subagents write their result file as a swamp input file (name and payload) recorded with --literal-inputs --input-file, which works over swamp serve with no jq; and the engine reads each stored payload back and refuses one swamp changed on write, before committing its digest.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.