Skip to content

feat(registry): Let the engine controller make a cloud engine cool down - #11519

Merged
mraszyk merged 3 commits into
masterfrom
mraszyk/engine-controller-cooling-down
Sep 25, 2026
Merged

mraszyk merged 3 commits into
masterfrom
mraszyk/engine-controller-cooling-down

Conversation

@mraszyk

@mraszyk mraszyk commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Adds cooling_down to the small set of UpdateSubnetPayload fields the engine
controller canister may set, alongside subnet_admins and is_halted. The
engine controller can thus let a cloud engine subnet quiesce -- drain its subnet
queues and its streams while executing no canister messages and serving no
queries (see #11495) -- before halting it.

The scope check exists twice: once in the engine controller proxy
(ensure_only_allowed_fields_set) and once as a defence-in-depth check in the
registry (ensure_engine_controller_payload_scope). Both are widened, and their
exhaustive destructuring of UpdateSubnetPayload keeps them from drifting.
Every other field remains rejected for that caller, and the registry still
requires the target subnet to be of type CloudEngine.

The stale comment in engine_controller.did, which claimed only subnet_id and
subnet_admins could be set, now names the actual surface.

Tests: the registry's engine_controller_cannot_set_cooling_down becomes
engine_controller_can_set_cooling_down, asserting the flag round-trips both
ways on a CloudEngine subnet; the proxy gains
ensure_only_allowed_fields_set_accepts_cooling_down, and its combined-fields
test now sets all three allowed fields.

🤖 Generated with Claude Code

Adds `cooling_down` to the small set of `UpdateSubnetPayload` fields the
engine controller canister may set, alongside `subnet_admins` and
`is_halted`. The engine controller can thus let a cloud engine subnet
quiesce -- drain its subnet queues and its streams while executing no
canister messages and serving no queries -- before halting it.

The scope check exists twice, once in the engine controller proxy
(`ensure_only_allowed_fields_set`) and once as a defence-in-depth check
in the registry (`ensure_engine_controller_payload_scope`); both are
widened, and their exhaustive destructuring keeps them from drifting.
Everything else stays rejected for that caller.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The scope expansion is consistently enforced at both layers and adequately tested.

Pull request overview

Enables the engine controller to set cooling_down for CloudEngine subnets before halting them.

Changes:

  • Allows cooling_down through both scope validators.
  • Adds tests for enabling and disabling cooldown.
  • Updates interface comments and changelogs.
File summaries
File Description
rs/registry/canister/unreleased_changelog.md Documents the expanded registry scope.
rs/registry/canister/src/mutations/do_update_subnet.rs Permits and tests registry cooldown updates.
rs/engine_controller/unreleased_changelog.md Documents engine-controller support.
rs/engine_controller/engine_controller.did Corrects the declared scope comment.
rs/engine_controller/canister/tests.rs Tests cooldown payload validation.
rs/engine_controller/canister/canister.rs Allows cooling_down through the proxy.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mraszyk
mraszyk marked this pull request as ready for review September 9, 2026 14:56
@mraszyk
mraszyk requested review from a team as code owners September 9, 2026 14:56

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This pull request changes code owned by the Governance team. Therefore, make sure that
you have considered the following (for Governance-owned code):

  1. Update unreleased_changelog.md (if there are behavior changes, even if they are
    non-breaking).

  2. Are there BREAKING changes?

  3. Is a data migration needed?

  4. Security review?

How to Satisfy This Automatic Review

  1. Go to the bottom of the pull request page.

  2. Look for where it says this bot is requesting changes.

  3. Click the three dots to the right.

  4. Select "Dismiss review".

  5. In the text entry box, respond to each of the numbered items in the previous
    section, declare one of the following:

  • Done.

  • $REASON_WHY_NO_NEED. E.g. for unreleased_changelog.md, "No
    canister behavior changes.", or for item 2, "Existing APIs
    behave as before.".

Brief Guide to "Externally Visible" Changes

"Externally visible behavior change" is very often due to some NEW canister API.

Changes to EXISTING APIs are more likely to be "breaking".

If these changes are breaking, make sure that clients know how to migrate, how to
maintain their continuity of operations.

If your changes are behind a feature flag, then, do NOT add entrie(s) to
unreleased_changelog.md in this PR! But rather, add entrie(s) later, in the PR
that enables these changes in production.

Reference(s)

For a more comprehensive checklist, see here.

GOVERNANCE_CHECKLIST_REMINDER_DEDUP

@zeropath-ai

zeropath-ai Bot commented Sep 9, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to a1744c6.

Security Overview
Detected Code Changes
Change Type Relevant files
Enhancement ► rs/engine_controller/canister/canister.rs
• Update doc comment to include cooling_down in allowed fields and adjust related logic
• Update ensure_only_allowed_fields_set to accept cooling_down
• Update update_subnet doc to reflect cooling_down as allowed field
Enhancement ► rs/engine_controller/canister/tests.rs
• Add tests for accepting cooling_down on UpdateSubnetPayload
• Add test for accepting all allowed fields including cooling_down
Enhancement ► rs/engine_controller/engine_controller.did
• Update type surface description to include cooling_down among allowed fields
Enhancement ► rs/engine_controller/unreleased_changelog.md
• Describe acceptance of cooling_down in engine controller scope
Enhancement ► rs/registry/canister/src/mutations/do_update_subnet.rs
• Update defence-in-depth check to include cooling_down among allowed fields
• Adjust error messaging and payload scope documentation
Enhancement ► rs/registry/canister/src/mutations/do_update_subnet.rs (tests section references)

…roller-cooling-down

# Conflicts:
#	rs/engine_controller/engine_controller.did
Addresses review feedback: turn the inline enumerations of the allowed
fields (`subnet_admins`, `is_halted`, `cooling_down`) into bulleted lists
so they are easier to skim and adding a field later touches a single line.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

Both authorization layers, interface documentation, and relevant tests are updated consistently.

Review effort: Balanced
Findings: None

@mraszyk
mraszyk enabled auto-merge September 25, 2026 09:24
@mraszyk
mraszyk added this pull request to the merge queue Sep 25, 2026
Merged via the queue into master with commit 89dd01c Sep 25, 2026
41 checks passed
@mraszyk
mraszyk deleted the mraszyk/engine-controller-cooling-down branch September 25, 2026 10:30
basvandijk pushed a commit to Ocheretovich/ic that referenced this pull request Oct 23, 2026
…'s state limits (dfinity#11863)

Lets the engine controller canister set a cloud engine subnet's state
limits (`maximum_state_size`, `maximum_state_delta`), both when it
creates the subnet and afterwards. Today every cloud engine subnet is
created with the protocol defaults, whatever hardware its nodes have,
and the engine controller cannot change them later. A subnet is only as
big as its smallest node, so an engine on small nodes needs tighter
limits than the defaults, and an engine whose nodes are upgraded should
be able to grow its limits again.

**`create_engine`** takes an optional `resource_limits`
(`EngineResourceLimits`: the two state limits only), forwarded to the
new subnet's `CreateSubnetPayload`. Omitted, the subnet keeps the
protocol defaults as before. The field is an `opt`, so existing callers
are unaffected.

**`update_subnet`** now also accepts the state limits in
`resource_limits`. As in dfinity#11519, the scope check exists twice: in the
engine controller proxy (`ensure_only_allowed_fields_set`) and as the
registry's defence-in-depth check
(`ensure_engine_controller_payload_scope`). Both are widened to allow
`maximum_state_size` and `maximum_state_delta`. The query limits
(`maximum_query_instructions`, `maximum_query_walltime_seconds`) remain
rejected for this caller, along with every other field, and the registry
still requires the target to be a `CloudEngine` subnet.

`update_subnet` replaces `resource_limits` as a whole, so an engine
controller update would otherwise reset limits it is not allowed to
manage, for example query limits set by a proposal. For the engine
controller as caller, the registry therefore keeps the current value of
every limit the payload leaves unset, as ic-admin does client-side with
`ResourceLimits::inherit_from`. Governance updates keep the existing
replace semantics.

**Tests:**
- Proxy: `ensure_only_allowed_fields_set_accepts_state_limits` and
`_rejects_query_limits`.
- Registry:
`test_engine_controller_sets_state_limits_and_keeps_unset_limits` (a
state-size-only update keeps the delta and the governance-set query
limits) and `test_engine_controller_cannot_set_query_limits`, following
`STANDARDS_AND_CONVENTIONS.md`.
`engine_controller_cannot_update_disallowed_fields` now expects the
offending field rather than the exact panic wording.
- PocketIC: `create_engine_sets_resource_limits` checks that the limits
land on the new subnet record.
- Existing `CreateEngineArgs` literals, including the
`standard_engine_replica_version_test` system test, pass
`resource_limits: None`.

Both `unreleased_changelog.md` files are updated.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants