Skip to content

feat: marketplace snapshot build, boot check and submit for /release (abilityai/trinity-enterprise#1094) - #4234

Merged
obasilakis merged 4 commits into
devfrom
feature/1094-marketplace-release
Nov 4, 2026
Merged

obasilakis merged 4 commits into
devfrom
feature/1094-marketplace-release

Conversation

@obasilakis

@obasilakis obasilakis commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • A Packer build no longer submits. mp-status.sh, mp-build.sh, boot-check.sh and mp-submit.sh make the flow runnable from the machine cutting a release.
  • boot-check.sh boots a throwaway droplet from the snapshot and tests it through sign-in and creating a running agent, then destroys it. mp-submit.sh refuses a snapshot without its pass record.
  • The submission gate in packer/digitalocean/README.md is now the boot check plus operator confirmation. This replaces the team-member QA from the 2026-09-10 ruling on feat: DigitalOcean Marketplace 1-Click Droplet listing for Trinity (vendor application + Packer snapshot, AI Agents category) #2281.
  • The default build region moves to sfo2, because s-1vcpu-1gb is no longer offered in nyc3.

Changes

  • packer/digitalocean/scripts/: new mp-lib.sh, mp-status.sh, mp-build.sh, boot-check.sh; mp-submit.sh takes a snapshot ID and keeps the listing's other software entries, adding PostgreSQL when it is missing and setting Caddy from the pass record
  • packer/digitalocean/trinity.pkr.hcl: submit post-processor removed, run_tag added, region default changed
  • tests/unit/test_ent1094_marketplace_release.py: runs the scripts against fake doctl, curl, ssh, packer and git
  • Requirements, feature flow, learnings fragment, /cso --diff report

Test Plan

  • cd tests && pytest unit/test_ent1094_marketplace_release.py unit/test_2281_marketplace_build_standard.py -v -p no:randomly: 100 passed
  • packer validate on the template
  • Live boot-check.sh on a v1.0.0 snapshot, including the second-droplet port probe: pass, droplets destroyed. That snapshot has since been submitted, so the final script has not run live. Its restart check, stale-pass removal, signal handling, time limits and range parsing are unit-tested only.
  • Live mp-status.sh against the Vendor Portal
  • Real mp-build.sh run: not run
  • Real PATCH, from an earlier copy of mp-submit.sh: softwareIncluded applied, and version stayed 0.9.5 with no version field sent
  • Real PATCH with the version field: not run; the listing is in review

Not covered

  • Chat with an agent, which needs a model credential.
  • Whether sending version moves the listing version is unverified until the next real submit.
  • A first boot that hangs never arms the 45-minute shutdown, because it runs from runcmd. systemd-run in bootcmd wedged boot on stock Ubuntu 24.04, with and without --no-block, against a runcmd control.

Part of abilityai/trinity-enterprise#1094. The issue stays open: its criterion "The DO listing serves the current release" needs a real publish. The matching /release skill change is a separate trinity-dev PR; merge this one first.

🤖 Generated with Claude Code

…release

A Packer build no longer submits. Four scripts in packer/digitalocean/scripts
make the flow runnable from the machine cutting the release:

- mp-status.sh reads the listing: clear, queued, rejected or unknown, API failure
- mp-build.sh builds with a fixed SSH key and a per-run droplet tag
- boot-check.sh boots a throwaway droplet and tests it through agent creation
- mp-submit.sh takes a snapshot ID and requires a boot-check pass record

The submission gate is now the boot check plus operator confirmation. The default
build region moves to sfo2 because s-1vcpu-1gb is no longer offered in nyc3.

Part of Abilityai/trinity-enterprise#1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@obasilakis

Copy link
Copy Markdown
Contributor Author

Companion skill change is in the private dev-tooling repo; merge this PR first.

The hosted stack bundles PostgreSQL. mp-submit.sh adds it when the listing lacks
it, reading the major version from docker-compose.hosted.yml.

Part of Abilityai/trinity-enterprise#1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@dolho

dolho commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

/review report at 5665ab3

Verdict: no blocking findings. The scripts read correctly and fail closed. The main items to address are three tests that pass for the wrong reason (I1) and one policy decision that needs an owner's OK (I2).

Scope: clean. Part of abilityai/trinity-enterprise#1094, which correctly stays open until a real publish.

Criterion from the PR Status
A Packer build never submits Done: trinity.pkr.hcl has only the manifest post-processor
Boot check on a real droplet, destroyed on exit Done: PR reports a live run, before the cleanup and token-check changes
Submit refuses a snapshot without a pass record, or a listing that isn't clear Done: mp-submit.sh:23, :32, both mutation-tested
mp-build.sh real run Unverifiable from the diff: PR states not run, including the sfo2 default and run_tag reaching a real droplet
mp-submit.sh real PATCH Unverifiable from the diff: PR states not run

Execution coverage

Both test files pass: 64 passed on Python 3.13. I also removed each check in turn and re-ran test_ent1094_marketplace_release.py.

Path Result
boot-check.sh droplet checks (first boot, TLS, DB, source marker, images, firewall, ports) Red when removed
boot-check.sh :120 marketplace header, :121 title, :161 port-probe control Survived: see I1
mp-submit.sh pass record, status gate, PATCH failure, record removal Red when removed
mp-submit.sh:41 listing read, :46 postgres parse, mp-build.sh:77 snapshot ID check Survived: no test reaches them (I6)
Default-region test Source-text pin of the literal sfo2; it can't show that size is offered there

Other survivors (for example :97, :124, :133) are harmless, because the next check catches the same failure.

Informational

I1. Three boot-check.sh tests pass for the wrong reason (confidence 10, reproduced)

  • Header and title: the fake curl rule "203.0.113.7/" matches every later call to that host, not only the page fetch. With the X-DO-MARKETPLACE and <title> checks deleted, those two cases still exit 1, at FAIL: HTTPS and localhost disagree on setup state.
  • Port-probe control: test_a_dead_network_never_reads_as_closed_ports says 443 is the positive control, but removing the host rule fails at the first page fetch on :119. It never reaches :161, so deleting that check stays green.

The scripts look right by reading. What's missing is the protection against regressions, and the header is a Marketplace requirement. Fix: match the fake rule on the exact URL, assert on the expected FAIL message in each case, and make the dead-network case start failing only after the page checks.

I2. The submission gate no longer has a human using the product (needs an owner's decision)

The README's "A human boots a droplet from the snapshot and uses it first" becomes the boot check plus operator confirmation. That reverses the 2026-09-10 ruling on #2281, and the boot check doesn't cover chat with an agent. The PR states the change but doesn't say who approved it, and a bad submission locks the listing until review clears. An owner should confirm this explicitly on the PR.

I3. A leaked droplet keeps billing (confidence 8)

shutdown -P +45 powers the droplet off but doesn't destroy it, and DigitalOcean bills powered-off droplets. After a closed laptop or kill -9, nothing removes trinity-boot-check-* droplets or the trinity-build-* droplet mp-build.sh says it leaves. Suggest having mp-status.sh or mp-build.sh warn about droplets carrying those tag prefixes, since a run's tag is unique per run.

I4. New software entries drop licenseLink (confidence 6; real PATCH not run)

The removed payload sent licenseLink for Trinity. The new Trinity fallback entry and the PostgreSQL entry omit it, and the test fixture has none either. If the Vendor Portal requires it, the first real submit fails with a 400. That failure is loud and keeps the pass record, so the cost is one retry on release day. Worth checking before then.

I5. The listing's PostgreSQL version can drift (confidence 8)

mp-submit.sh:44-45 reads the version from the current checkout, not the tag the snapshot was built from. The first use can't be from the v1.0.0 checkout, because these scripts aren't in that tag. An existing PostgreSQL entry is also never moved, and test_an_existing_postgresql_entry_is_kept_once pins that, so a major upgrade leaves the listing stale.

I6. Smaller items

  • mp_api at mp-lib.sh:12 has no --max-time, so a stalled Vendor Portal hangs the release run. (confidence 9)
  • The mp-submit.sh:41 and :46 and mp-build.sh:77 checks have no test. Without :46, an empty version would be sent, and the README says a blank string clears a field. (confidence 9)
  • boot-check.sh:165 treats curl exit 28 as closed, so a port that accepts the connection and then stays silent passes. Checking %{time_connect} would tell them apart. (confidence 6)

Low confidence

  • boot-check.sh:37 strips spaces and splits on commas. If doctl prints several regions separated by spaces, they would merge into one invalid region. I didn't check doctl's output format. (5)
  • The tag regex accepts v1.0.0-rc1, and mp-submit.sh doesn't refuse a prerelease, so only operator confirmation stops an RC reaching the listing. It may be deliberate. (5)

Checked and clean

  • Credentials: token, password and JWT go through stdin or environment by reading, and tests assert they stay out of argv. I didn't mutation-test those assertions. -K - config injection is guarded for the JWT on :146.
  • Cleanup: reap_tag treats a failed list as not gone, and a failed delete exits non-zero.
  • First-boot checks: the things boot-check.sh relies on exist: firstboot-failed (001-trinity), tls-status (start.sh:648), the TRINITY-FW chain (docker-firewall.sh:62), config/agent-templates/test-echo.
  • User data: #cloud-config with only runcmd doesn't write the user-supplied password file firstboot reads, so /setup stays claimable, by reading firstboot.sh.
  • Public-repo rules: no real app ID, IP or token in the scripts or tests.
  • Consumers: nothing else reads the removed DIGITALOCEAN_API_TOKEN or TRINITY_SUBMIT_REASON. packer/aws/scripts/mp-submit.sh is separate and untouched.

No status-needs-fix label: nothing here is a critical.

…al calls

A port that accepts the connection and then stays silent is now reported as
reachable. Only a timeout with no connection counts as closed. Vendor Portal
calls stop after 60 seconds, so a stalled portal can't hang a release run.

The header, title and 443 control tests now fail for the reason they name,
because the fake curl's page rule no longer answers for every URL on the host.
New tests cover the listing read, the PostgreSQL version parse and the snapshot
ID check. Each guard was removed in turn and its test went red.

Part of Abilityai/trinity-enterprise#1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@obasilakis

Copy link
Copy Markdown
Contributor Author

Thanks. Status of the review at d6144d0f3:

Fixed

  • I1: the fake curl page rule now matches its exact URL, and each case asserts its own FAIL message. The dead-network case fails only after the page checks. Removing the header, title or 443 check now turns its test red.
  • I6, timeout: mp_api has --max-time 60.
  • I6, untested checks: the listing read, the PostgreSQL parse and the snapshot ID check now have tests. Removing each one turns its test red.
  • I6, port probe: a curl timeout counts as closed only when time_connect is zero. Real curl gave 0.000267 for a silent listener and 0.000000 for a dropped address, both exit 28.

No change

  • I3: Step 1 of the /release skill change in the companion PR warns on droplets named or tagged trinity-build-* and trinity-boot-check-*. A leaked droplet can bill until the next release, which I'm accepting.
  • I4: the three entries on the live listing have no licenseLink either, so the new entries match that shape. This is confirmed on read only. A rejected PATCH is a loud 400 that keeps the pass record.
  • Low-confidence items: Packer sets one region, so a snapshot has one region unless someone transfers it. Multi-region output is untested. The operator confirmation covers an RC tag.

Not changed yet

  • I5: an existing PostgreSQL entry still doesn't move on a major upgrade.

Still open

  • I2: the owner confirmation of the gate change.

@obasilakis

Copy link
Copy Markdown
Contributor Author

I2: @obasilakis made this call during the sprint for abilityai/trinity-enterprise#1094. The boot check plus operator confirmation is the submission gate, and it replaces team-member QA. Chat with an agent stays uncovered because it needs a model credential, and that gap is accepted.

@dolho

dolho commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

/review report at d6144d0

Verdict: no criticals, but I1 and I2 should be fixed before merge. Both are small and reproduced. I1 lets a snapshot through the submission gate after its re-check failed. I2 leaks a billing droplet.

This re-reviews the report at 5665ab3, so earlier items aren't repeated. No status-needs-fix label: nothing here is a critical.

Scope: clean.

Issue criterion State
Step 1 checks tools and credentials; warns on listing version; app_id in the skill Unverifiable: companion PR
Step 9c builds, boot-checks, confirms, submits Unverifiable: scripts exist, wiring is in the companion PR
Queued listing detected; submit later without rebuild Partial: mp-status.sh:39-40, mp-submit.sh:14. Detecting it before the build is in the skill
Failed build leaves no droplet or key Partial: mp-build.sh:51-56, but see I2
Listing serves current release Not done: out of scope, stated in the PR, issue stays open
README and Step 9c agree Unverifiable: README side is done

Execution coverage

Both test files pass: 70 passed. I also ran 18 mutations in scratch copies.

Changed path Result
boot-check.sh:120,121,161 header, title and 443 checks Red when removed: the earlier I1 fix holds
mp-submit.sh:41,46, mp-build.sh:77 Red: the earlier I6 fix holds
mp-lib.sh:12 --max-time, boot-check.sh:166 port probe Red
mp-status.sh:39 not-approved branch, boot-check.sh:115,125,146,152 Red
boot-check.sh:63,65 INT and HUP traps Survived: no test sends these signals
mp-build.sh:53,58-60 kill and signal traps Survived: no test signals a build
Region, no-submit and container-name pins Source text, but guards with a live consumer (Packer, compose)

Informational

I1. A stale pass record survives a failed re-check (confidence 10, reproduced)

boot-check.sh:175 is the only write to the record, and nothing removes it on a new run:

printf 'tag=%s\n' "$TAG" > "${HOME}/.trinity-marketplace/${SNAPSHOT}.pass"

Repro: boot-check passes, a re-run fails on TLS, and the record still exists. mp-submit.sh then exits 0 and sends the PATCH. The gate honours the old pass over the newer failure, and a bad submission locks the listing.

Fix: rm -f the record before creating the droplet, and add a test.

I2. A signal during cleanup leaks the droplet (confidence 9, reproduced)

boot-check.sh:53 runs trap - EXIT INT TERM HUP, which restores default signal handling. The diagnostic SSH on :56 then runs before reap_tag.

  • boot-check.sh: one TERM during that diagnostic gives rc -15, with droplet 111 still in the fake's world and no warning.
  • mp-build.sh:51-56: its traps stay live during the reap, so TERM exits 143 at once, also without the "may still exist" warning.

This breaks the header's "destroyed on every exit a shell can trap" and MKT-002. It also weakens the acceptance of the earlier I3, since the operator isn't told to look.

Fix: start both cleanups with trap '' INT TERM HUP, and add tests for the signal paths that survived above.

I3. Stopped containers pass the image check (confidence 8, by reading)

boot-check.sh:133 runs docker inspect -f '{{.Config.Image}}', which succeeds on an exited container, yet the failure message says "is not running". The backend and frontend get exercised later, but nothing else exercises scheduler or mcp-server. A snapshot with either one crashing can pass and be submitted.

Fix: also assert {{.State.Status}} is running and RestartCount is 0, checked after the agent step.

I4. The listing version may never move, and the manual step is gone (confidence 7)

The body at mp-submit.sh:49-67 has no top-level version, but DigitalOcean's own PATCH example sends "version": "3" (digitalocean/marketplace-partners README:253). That field isn't in their parameter list, so its effect is unclear.

This PR also deletes the README step "Update the listing's version string", and mp-status.sh:32 reports customData.version as live_version. The PR flags the PATCH behaviour as unverified, but nothing handles the bad outcome: live_version could stay stale and the planned Step 1 warning could fire on every cut.

Fix: send version: $version, or restore the manual step until the first real submit settles it.

I5. The 45-minute shutdown isn't armed until first boot finishes (confidence 7, by reading)

boot-check.sh:71 schedules the shutdown in runcmd, which runs in scripts-user. firstboot.sh:46-49 says per-instance code runs before that, and 001-trinity:9 runs first boot synchronously. A hung first boot on a closed laptop never schedules the shutdown, contrary to MKT-002.

Fix: arm it from bootcmd, and check on a real droplet.

I6. Remote calls with no time limit (confidence 8)

The /setup claim's remote curl at boot-check.sh:101 has no -m, and the docker calls at :128-137 have no limit either. DEADLINE only covers wait_for. A hung backend stalls the run with the droplet up, the same class as the earlier mp_api finding.

Fix: add -m 30, or wrap remote in timeout.

I7. A real snapshot ID in a public test (confidence 9, low impact)

_SNAPSHOT at tests/unit/test_ent1094_marketplace_release.py:26 is the snapshot from the live boot-check run, and the CSO report claims a clean disclosure grep.

Fix: use a placeholder number.

Open question

Sign-off on the gate change. The previous review asked for an owner to confirm it. It was closed by citing the author's own call. The 2026-09-10 ruling on #2281 said "Not the author", and that ruling was posted from the same account. Does this need confirmation from another owner?

Status of the earlier findings

  • I3 (leaked droplets): accepted, relying on a warning in the companion PR, which I haven't seen.
  • I4 (licenseLink): accepted, and it can only fail loudly.
  • I5 (PostgreSQL version drift): still open, but low impact.

Checked and clean

  • Public-repo rules: the enterprise docs guard pattern has no hits on added lines.
  • SQL and auth: no database code or endpoints in this diff.
  • Credentials: token, password and JWT go over stdin or environment. boot-check.sh:146 validates the JWT before it goes into the curl config.
  • Consumers: no live references to the removed DIGITALOCEAN_API_TOKEN or TRINITY_SUBMIT_REASON. The packer/aws mp-submit.sh is a separate script.

Not verified

  • Real runs: no real packer, doctl or Vendor Portal call. Everything above used the PR's fakes, plus reading.
  • Live boot check: the cleanup helper, token check and probe changed after the only live run. One re-run on the existing snapshot is cheap and would also cover the I1 to I3 fixes.
  • Learnings: I2 and I6 belong in the PR's learnings fragment.

Boot check:
- Removes the snapshot's earlier pass before it starts, so a failed re-check
  can't reach submit.
- Ignores signals during cleanup, in mp-build.sh too, so a signal can't leave a
  billing droplet.
- Requires each service running with no restarts after the agent step.
- Puts time limits on remote docker calls and the /setup claim.
- Probes ports from a second droplet on the run tag, with 443 and an unused port
  as controls, because a local network can answer TCP itself.
- Probes every port of a published range and records the image's Caddy version.

Submit sends the listing version, moves the PostgreSQL entry and sets Caddy from
the pass record. A snapshot ID in the tests is now a placeholder.

The 45-minute shutdown stays in runcmd. systemd-run in bootcmd wedged boot on
stock Ubuntu 24.04, with and without --no-block.

Part of Abilityai/trinity-enterprise#1094

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@obasilakis

Copy link
Copy Markdown
Contributor Author

Second review addressed at the new head, plus two fixes from the first live submit.

Fixed

  • I1: every boot check run removes the earlier pass first.
  • I2: both cleanups ignore signals. Signal paths now have tests, including a signal during cleanup.
  • I3: each service must read running 0 after the agent step.
  • I4: the PATCH sends version. A live PATCH without it left the queued version at 0.9.5. Whether sending it moves the version is unverified until the next submit.
  • I6: time limits on remote docker calls and the /setup claim.
  • I7: the snapshot ID in the tests is a placeholder.
  • Earlier I5: the PostgreSQL entry now moves.
  • Learnings fragment added.

Added from the live submit

  • Port probes run from a second droplet on the run tag, with 443 and an unused port as controls, because one local network answered every TCP port. This path passed live.
  • Every port of a published range is probed.
  • The Caddy version comes from the image, through the pass record.

Not fixed: I5 (shutdown armed from bootcmd)
I tried it on stock ubuntu-24-04-x64 droplets. systemd-run in bootcmd never gave SSH, with or without --no-block. A control droplet using runcmd was up in about a minute. The cause isn't established, because I had no console. The shutdown stays in runcmd, so a hung first boot on a closed laptop isn't covered. Step 1 of the next release still warns on the droplet.

Not run live
The final script hasn't run end to end, because the snapshot was submitted and consumed. The running 0 check is the riskiest part: a restart during normal setup would fail every snapshot, and no run has read RestartCount on a real image. If it does, the next release's boot check fails loudly and nothing gets submitted.

Gate sign-off
The operator has decided this and it stands.

@obasilakis
obasilakis enabled auto-merge (squash) November 4, 2026 16:45
@obasilakis
obasilakis merged commit 760869b into dev Nov 4, 2026
25 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants