Relationships
#3574 Worker writes drop writeResource/createFileWriter overrides (tags, lifetime, garbageCollection)
Opened by kagarmoe · 10/17/2026· Shipped 10/19/2026
Summary
A method running on a worker loses the options it passes to writeResource and createFileWriter (tags, lifetime, garbageCollection, and for files contentType). The data is saved with the spec's defaults instead, and nothing reports it. The same method keeps the options when it runs locally.
Where (origin/main ab2d51aa)
src/worker/remote_method_context.ts,createRemoteWriters:writeResource(specName, name, data, _overrides)ignores_overridesand callsclient.writeResource({ specName, name, data }).createFileWriter(specName, name, _overrides)also ignores its options and callsclient.openWriter({ specName, name }).
src/worker/data_plane_client.ts: thePOST /data/resourcebody type is{ specName, name, data }.src/serve/data_plane.ts,#writeResource: reads only{ specName, name, data }and callswriteResource(body.specName, body.name, body.data)with no overrides.
The local writer (createResourceWriter in src/domain/models/data_writer.ts) takes overrides?: ResourceWriteOverrides (lifetime, garbageCollection, tags, from src/domain/models/model.ts).
Observed
@swamp/agent-runner's run writes runResult with tags provider, exitCode and model. On three agent-dispatch runs executed on workers (swamp worker connect, Linux and WSL), the stored records carry only the system tags (type, specName, modelName, source, workflow*, job, step, initiatedBy) plus definition tags. None of the method's tags is there. A workflow that selects or asserts on those tags can't tell which model ran.
Proposed fix
- The worker sends the options with the write:
POST /data/resourcetakes{ specName, name, data, overrides? }, andopenWritertakes the file-writer overrides. data_plane.tsvalidatesoverrideswith the same schema used locally (tags as a string record; lifetime and garbageCollection via their existing schemas) and passes them to thewriteResourcereturned bycreateResourceWriter. That writer already guards reserved tags, so a worker gets no more power than a local run.- It works across versions: an older serve ignores the extra field, and an older worker sends none.
- Tests:
- A
remote_method_contexttest that the overrides reach the request body. - A
data_planetest that tags and lifetime passed by a worker end up on the saved record. - A test that a worker can't set a reserved tag.
- A
Environment
swamp 20261016.021405.0-sha.b46b8895; serve on Linux (WSL Ubuntu), workers on Linux and macOS.
Shipped
Click a lifecycle step above to view its details.
stack72 commented 10/19/2026, 4:03:01 PM
Thanks @kagarmoe for reporting this! We shipped: Worker-run methods lose writeResource/createFileWriter overrides because the worker discards them, the data-plane request bodies have no field for them, and serve never passes them to the writer. Carry an optional overrides field on POST /data/resource and POST /data/writers, validate it at serve before lease bookkeeping with schemas built from the existing lifetime/GC schemas, and pass it to the same createResourceWriter/createFileWriterFactory writers a local run uses, so tag precedence and reserved-tag protection match local runs.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.
Sign in to post a ripple.