Skip to content

Write-time recompute tag: record compute used + output size on result objects, so retention can be decided by rule #1076

Open

Description

@scttfrdmn

Idea (from the owner, 2026-10-17): when spawn writes a result object to S3, tag it with what it would cost to regenerate (compute used, output size), e.g. "regenerable for $X in Y hours". Then an object can be tiered or deleted by rule, without asking the researcher. This is the data-side analogue of the TTL reaper, and it addresses the open "leave no trace" question: nothing reaps the auto-created spawn-results-* buckets today.

No issue, doc or code for this existed before; searched spore-host org issues, all repos' docs and code.

What exists today

  • Only one writer tags objects: pkg/staging/staging.go:176 (scheduler params, Project/Component/ScheduleID). Task results, queue results and pipeline handoffs go to spawn-results-<account>-<region>/… with no tags.
  • Two kinds of write path, and they differ on tagging:
    • Go uploads (pkg/agent/queue_runner.go:407, via feature/s3/transfermanager): UploadObjectInput.Tagging exists, so the tag can go on the same request.
    • The generated task wrapper (pkg/taskproto/flush.go, wrapper.go) uses aws s3 cp, which has no --tagging option (checked against the installed CLI v2). Those need s3api put-object --tagging per object, or a PutObjectTagging pass after upload.
  • The inputs to the number exist on the instance. spored tracks total compute seconds and the hourly rate (spawn:price-per-hour, plus spot price), and the wrapper knows each task's runtime and output size.

Constraints the design has to meet

  1. Lifecycle rules can't compare numbers. S3 lifecycle filters match prefix, object size and exact key=value tags, nothing like "cost < $5". So "regenerable for $X" can't drive a rule directly. Either the writer also records a class that rules match on (e.g. spawn:regen-class=cheap|moderate|expensive, with thresholds defined in one place), or a scheduled sweeper evaluates the numeric tags. The class is probably both simpler and auditable.
  2. "Regenerable" must be true, not assumed. Deleting by rule is irreversible. An object is regenerable only if its inputs still exist (and aren't themselves regen-deletable) and what produced it is pinned: spawn/spored version, AMI, container digest, command/spec. Otherwise the tag is a promise nobody checked. The tag set (or a sidecar manifest it points to) should carry that provenance, and a deletion rule should require it.
  3. Dollar figures follow the pricing honesty rule. The rate must say where it came from (live vs static, the static table's date). Windows rates are currently a Linux lower bound (spawn launch --os windows without --ami silently launches Amazon Linux, and previews it as Windows #884, truffle#185), so a Windows-computed object would understate its regen cost unless labelled. Spot runs should use the spot rate actually paid.
  4. Tag budget. S3 allows 10 tags per object (key ≤128, value ≤256 chars). Keep the write-time set small: class, cost, hours, bytes, a provenance pointer. Put detail in a manifest object.
  5. Opt-out per run. The researcher's "never auto-delete this" must win over any rule, e.g. a spawn:retain=true tag that every rule excludes.

Rough shape

  • A small shared package computes the tag set from compute seconds, rate and source, bytes, and provenance. It's used by spored's Go uploader directly and emitted by the wrapper generator as s3api / PutObjectTagging calls.
  • A lifecycle configuration on spawn-results-*, created with the bucket: transition regen-class=cheap to cheaper storage after N days, expire after M, and never touch untagged objects or retain=true.
  • spawn surface: show an object's regen class/cost in collect-results, and a dry-run spawn results retention report before any rule is enabled. Report first, arm later, same discipline as the reaper sweeps.

Refs: "leave no trace" (who reaps the reapers, spawn-results-*), #884, truffle#185.

Activity

  1. scttfrdmn commented on Oct 17, 2026

    @scttfrdmn
    ContributorAuthor

    Checked against the AWS docs (2026-10-17):

    • Lifecycle filters (intro-lifecycle-filters): prefix, object tags, and ObjectSizeGreaterThan/ObjectSizeLessThan, combined with AND. "Each tag must match both the key and value exactly." No other comparison exists, so constraint 1 (a written class, not a number a rule compares) stands. Note the default minimum object size for transitions (objects under 128 KB aren't transitioned unless the rule allows it). Many task outputs are small, so a tiering rule may need that allowance, or only expire them.
    • Tag limits (object-tagging): 10 per object, key ≤128, value ≤256 (UTF-16 positions). Settable at PUT Object and Initiate Multipart Upload (x-amz-tagging), so the transfermanager path can tag large outputs on the same request.

    Two things on that page fit this design:

    • S3 object annotations are AWS's answer for "structured data larger than 256 characters per value, [or] more than 10 metadata entries". That's a natural home for the provenance record in constraint 2 (inputs, spawn/AMI/image digest, spec), instead of a separate sidecar object. Worth evaluating against a sidecar manifest: annotations travel with the object, whereas a sidecar can be orphaned or deleted on its own.
    • s3:ObjectTagging:Put events: if the class is ever assigned after the write (the aws s3 cp wrapper path), a notification can trigger the classification or audit instead of a periodic scan.
  2. added this to the Later milestone on Oct 19, 2026
  3. modified the milestones: Later, Post-1.0 on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions