Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneeszack

Relationships

#4394 forEach over objects puts truncated raw JSON in report data names

Opened by gklijs · 11/4/2026· Shipped 11/4/2026

Summary

When a workflow step uses forEach over objects, the per-iteration report data names can contain raw, truncated JSON from the loop item. For example:

report-swamp-method-summary-{"category":"Other","articles":[{"title":"xxxxxxxxxxxxxxxxxxxxxx
report-swamp-method-summary-{"category":"Other","articles":[{"title":"xxxxxxxxxxxxxxxxxxxxxx-json

These names also become directory names under .swamp/data/.

Version

swamp 20261104.025555.0-sha.dd659114, Linux (WSL2)

Reproduction

In a new repo, with a command/shell behavior named sh, run this workflow:

jobs:
  - name: main
    steps:
      - name: step-${{ self.group.category }}
        forEach:
          item: group
          in: ${{ [{"category":"Policy","articles":[{"title":"long title one"}]},{"category":"Other","articles":[{"title":"long title two"}]}] }}
        task:
          type: model_method
          modelIdOrName: sh
          methodName: execute
          inputs:
            run: echo hello
        dependsOn: []
        weight: 0
        allowFailure: false
    dependsOn: []
    weight: 0

Then list the report names:

swamp data query 'modelName == "sh" && name.startsWith("report") && version >= 0' --select name --limit 40 --json

Expected

A short, filesystem-safe suffix such as the iteration index, a hash of the item, or the expanded step name (step-Policy).

Actual

The suffix is the item's JSON, cut off at about 65 characters. Items shaped like {"key":"a",...} or plain strings get a clean suffix (-a, -x), so this only affects objects without whatever field that logic recognizes.

Impact

  • Names contain {, ", : and [, which are awkward to quote in CEL and shell and, where the datastore path is on Windows, not valid in file names.
  • Item content from the loop leaks into directory names and data names.
  • Because of the truncation, two items that share a long prefix would appear to get the same report name, so one report could overwrite the other. I haven't confirmed this; it follows from the naming I observed.
  • In one repo this produced 574 such report directories for a single behavior.

A filter such as name.startsWith("report") still matches, and lifetime GC removes them correctly.

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 2 MOREREVIEW+ 6 MOREPR_LINKED+ 2 MORESESSION_SUMMARIZED

Shipped

11/4/2026, 5:59:22 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
zack assigned zack11/4/2026, 5:19:17 PM
Editable. Press Enter to edit.

zack commented 11/4/2026, 5:59:24 PM

Thanks @gklijs for reporting this! We shipped: forEach and vary suffixes for object values without a key, name or id become a 16-hex sha256 of the object's canonical JSON instead of its raw JSON cut to 64 characters, so report and data names are filesystem-safe, leak no item content, and no longer collide when two items share a long prefix.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.