Skip to content

feat(release-bot): add the release bot runner and its container image - #2211

Open
pietrodimarco-dfinity wants to merge 5 commits into
mainfrom
feat/release-bot-runner
Open

pietrodimarco-dfinity wants to merge 5 commits into
mainfrom
feat/release-bot-runner

Conversation

@pietrodimarco-dfinity

Copy link
Copy Markdown
Contributor

What

Adds the runner for the Open SaaS Release Agent (A-0236381470000002), the agent that will run the weekly IC OS release thread in Open Messaging #eng-release (Component 1 of the zero-touch release plan). It also adds the container image to run it on dm1-dre1.

This version is read-only. Each turn:

  1. checks in with Open Agents, and skips the turn if the agent is paused or not linked;
  2. reads the bot's mentions, if it has an Open Messaging role (it doesn't yet: the grant is pending in Open Team);
  3. writes a dry-run note to the run journal, sends a heartbeat and schedules its next turn.

It cannot post, call the AI, propose or merge. Every canister method it may call is on ALLOWED_METHODS, and anything else is refused before dfx runs. Message text never goes into the journal, only ids and counts.

Changes

  • release-bot/release_bot.py: the runner. It calls the live canisters through dfx as the bot's own identity (release-bot). Canister IDs checked against the live suite on 2026-12-01.
  • release-bot/test_release_bot.py: 16 unit tests with a fake canister layer (allowed-methods guard, no message text in the journal, paused and not-linked agents, failed turns, setup refusing a key that isn't the release agent, secret redaction).
  • release-bot/BUILD.bazel: py_binary, py_test, and //release-bot:oci_image, published by the main workflow as ghcr.io/dfinity/dre/release-bot:<commit>.
  • MODULE.bazel, 3rdparty/BUILD.dfx.bazel: dfx 0.29.2, pinned by the checksum published with the release. It goes in its own image layer at /usr/local/bin/dfx, so code changes don't re-upload the ~100 MB binary.

Testing

  • bazel build //release-bot:dfx_layer //release-bot:release-bot and bazel test //release-bot:release_bot_test pass locally (macOS). The layer contains only usr/local/bin/dfx (mode 0755).
  • mypy --strict with the repo's mypy.ini is clean.
  • Not verified locally: the full Linux image (//release-bot:oci_image). CI builds it.

Deployment

The dm1-dre1 deployment is a separate PR in dfinity-ops/k8s (bases/apps/release-bot). It needs the image tag from this PR's merge commit and the bot's key as a SOPS secret, which a person adds. Once that file exists in k8s, a follow-up can add it to the image-bump list in .github/workflows/main.yaml.

🤖 Generated with Claude Code

The runner for the Open SaaS "Release Agent" (A-0236381470000002), which
will run the weekly IC OS release thread in Open Messaging #eng-release.
This version is read-only: each turn checks in with Open Agents, reads
the bot's mentions if it has an Open Messaging role, and writes a
dry-run note to its run journal. It cannot post, call the AI, propose or
merge; every canister method it may call is on an allowed list.

- release-bot/release_bot.py: the runner, calling the live canisters
  through dfx as the bot's own identity.
- release-bot/test_release_bot.py: unit tests with a fake canister layer.
- //release-bot:oci_image: published as ghcr.io/dfinity/dre/release-bot,
  with dfx 0.29.2 (pinned by checksum) in its own layer at
  /usr/local/bin/dfx.

The dm1-dre1 deployment follows in dfinity-ops/k8s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pietrodimarco-dfinity
pietrodimarco-dfinity requested a review from a team as a code owner December 1, 2026 14:53
Copilot AI balanced review requested due to automatic review settings December 1, 2026 14:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved issues can drop mentions after journaling failures, expose partial secrets in stderr, ignore the configured dfx executable during setup, and terminate the runner or leave turns open after transient failures.

4 open issues
What changed in this PR

Adds a dry-run runner and container image for the Open SaaS Release Agent, laying the groundwork for automated weekly IC OS release threads without posting messages or calling AI.

Changes:

  • Adds setup, status, and scheduled turns with allowlisted canister calls and IDs-only mention summaries.
  • Adds unit tests for access checks, lifecycle behavior, identity validation, and secret redaction.
  • Packages the runner with a separately layered, checksum-pinned dfx binary and documents deployment requirements.
File Description
release-bot/​test_release_bot.py Adds unit tests using fake canister responses.
release-bot/​release_bot.py Implements agent setup, status, and the dry-run loop.
release-bot/​README.md Documents commands, configuration, deployment, and limitations.
release-bot/​BUILD.bazel Defines Python targets and the container image with a separate dfx layer.
MODULE.bazel Pins the Linux dfx archive and checksum.
3rdparty/​BUILD.dfx.bazel Exposes the downloaded dfx binary to Bazel.

Review effort: Balanced

Comment thread release-bot/release_bot.py Resolved
Comment thread release-bot/release_bot.py Resolved
Comment thread release-bot/release_bot.py Resolved
Comment thread release-bot/release_bot.py Resolved
…ures

Addresses review feedback on #2211:
- Redact the secret from dfx's stderr before truncating it, so a cut
  can't leave half of an invite or onboarding code in the error.
- Commit the mentions cursor only after the turn is journaled; on a
  journaling failure, memory and disk keep the previous cursor.
- Handle failures anywhere in an iteration: back off 60s, doubling up to
  15 minutes, instead of exiting, and always end a turn once begun.
- setup's dfx identity commands use RELEASE_BOT_DFX like the canister calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 15:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A rejected journal append still commits the advanced mentions cursor, causing subsequent turns to skip unrecorded mentions instead of rolling back and backing off.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Prevent cursor advancement when journal append fails

release-bot/​release_bot.py:292

If journalAppend returns {"ok": false, "message": "append refused"}, execution still reaches save_state() and commits the advanced mentions cursor even though the journal entry was rejected. Subsequent turns then skip those mentions. Check the reply's ok field and raise CallError inside this try on rejection so the existing rollback and backoff handle it.

4 resolved since last review

Review effort: Balanced

Addresses review feedback on #2211: journalAppend answering {ok: false}
no longer commits the mentions cursor. The cursor is restored, the turn
is still ended, and the runner backs off like on any other failure.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 15:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The image supports arm64 but always packages the x86_64 dfx binary, so arm64 builds can produce images whose canister calls fail with executable-format errors.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Match the DFX binary architecture to the target image

release-bot/​BUILD.bazel:70

Please constrain this image to x86_64 or select an architecture-matched dfx archive. //images:ubuntu_24_04 explicitly supports Linux arm64 and selects an arm64 image configuration (images/BUILD.bazel:153–156), but :dfx_layer always contains the x86_64 binary from @dfx_linux. An arm64 build can therefore produce an image whose canister calls all fail with an executable-format error.

Review effort: Balanced

…cture

Addresses review feedback on #2211: //images:ubuntu_24_04 builds for
amd64 and arm64, but the dfx layer always held the x86_64 binary. Pin
dfx 0.29.2 for both Linux architectures (checksums from the release's
.sha256 files) and select the one matching the target CPU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human review is needed to assess the risk of permanently skipped mentions at pagination boundaries and silently ignored heartbeat and end-turn refusals.

No open issues 🎉

Review effort: Balanced

Addresses review feedback on #2211:
- Open Messaging's listMentions returns only the newest mentions after the
  cursor, one page at most, and cannot page back. When a page comes back
  full, the journal now says older mentions may not have been listed,
  instead of moving the cursor past them silently.
- A refused heartbeat or end-turn ({ok: false}) is now logged instead of
  ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 15:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Maintainer validation is needed because private canister interfaces are unavailable, fake-only tests cannot establish live contract compatibility, and the complete Linux image remains unvalidated.

No open issues 🎉

Review effort: Balanced

This branch has not been deployed

No deployments
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