Skip to content

fix(dashmate): keep the node up when an image pull fails, and stop reporting success when it did not - #4283

Open
shumkov wants to merge 31 commits into
v5.2-devfrom
fix/dashmate/update-path-bugs
Open

shumkov wants to merge 31 commits into
v5.2-devfrom
fix/dashmate/update-path-bugs

Conversation

@shumkov

@shumkov shumkov commented Aug 4, 2026 •

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Two defects in dashmate's update path:

A failed image pull can leave a masternode down. restart stops every service and only then lets compose pull whatever is missing, so a pull that fails in that window leaves the node stopped. For a masternode that means missed blocks and PoSe-penalty exposure. group restart has the same window for every node, and builds images from local sources only after the group is stopped.

dashmate update reports success when it updated nothing. Docker reports pull failures such as rate limiting or a full disk as in-band error objects on an otherwise successful stream, and the old parser looked only for status lines. Failures surfaced as a coloured word in a table, with the reason printed only under DEBUG, and an exit code of 0. Automation could not tell "updated everything" from "updated nothing". The parser also split each chunk on CRLF and parsed every fragment, so an ordinary TCP boundary threw inside the stream handler, where nothing could catch it.

What was done?

  • Restart confirms that every image it is going to start is present before stopping anything, and pulls the missing ones (DockerCompose.pullMissingImages). Locally built image tags are inspected on the host before any registry pull. A platform-only restart pulls only the platform services.
  • Group restart pulls for every node, and builds local images, before the first node is stopped; the group start then skips the duplicate build.
  • Pulls and update parse the stream with docker-modem's followProgress, which buffers across chunk boundaries and splits on the separator Docker emits. An in-band error fails the pull. update reports each failed image and its reason on stderr, so --format=json stays parseable, and exits 1 when any image failed. Images built locally are shown as built locally instead of failing.
  • Remote text: registry and daemon text reaching the terminal is stripped of control and bidi characters and bounded in length (sanitizeRemoteText). That covers update errors and every error and progress message of the restart pull.

Split out

This pull request used to carry more. Those parts are now their own pull requests:

How Has This Been Tested?

The tests were written failing first, and each fix has a test shown red against the unfixed code:

  • restartNodeTaskFactory.spec.js and restart.spec.js: a failed pull or build stops nothing;
  • DockerCompose.spec.js: what is pulled, profiles, locally built images, an image still missing after a pull;
  • dockerPullFactory.spec.js: in-band errors, refused pulls, stream failures, sanitized text;
  • update.spec.js: exit code, stderr report, JSON output;
  • getServiceListFactory.spec.js and sanitizeRemoteText.spec.js.

All 1,938 Dashmate unit tests passed on 56af426dad. The platform regression tests cover cold and wrong-architecture caches, incompatible group-local images, Compose platform syntax, and older or unverifiable Compose versions. A loopback Docker Engine fixture verified the inspect and pull selectors and confirmed an ARM64 v9 image whose config omits the variant. Unit tests also verify that a conflicting multi-platform index cannot mask a wrong-architecture image.

Live Docker Compose and masternode checks remain unverified because the test machine has no Docker daemon.

With a nonempty DOCKER_DEFAULT_PLATFORM, restart requires a verified Docker Compose version of 2.14.2 or later before inspecting or pulling images. It then verifies the requested OS, architecture and optional variant before shutdown. An unset or empty override keeps the existing host-default path and Compose 2.0.0 minimum. Registry pulls continue to use Dockerode anonymously.

Breaking Changes

Operators who export DOCKER_DEFAULT_PLATFORM must use explicit os/arch[/variant] syntax accepted across Compose versions, such as linux/amd64 or linux/arm64/v9. Restart refuses an ambiguous spelling or an image whose metadata cannot confirm the requested target, including on older image stores. dashmate update now exits 1 when an image fails to download.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation if needed

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Generated with Claude Code

PR Hygiene · 9ea177c

  • Bots — thepastaclaw ✓
  • Self-review — post /self-reviewed
  • Build green
  • Approvals — you own every area touched; none needed

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

Summary by CodeRabbit

  • New Features
    • Restarts now check for missing Docker images before stopping services and build locally configured services when required.
    • Image preparation checks compatibility with the selected platform, and pull progress is displayed during restarts and updates.
    • Updates identify locally built images and provide clearer pull status details.
  • Bug Fixes
    • Pull and build failures during restarts stop the operation before services are stopped.
    • Image-pull errors are reported with sanitized messages; failed image updates return a non-zero exit code while retaining their error details.

@github-actions github-actions Bot added this to the v4.2.0 milestone Aug 4, 2026
@coderabbitai

coderabbitai Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review
Walkthrough

Restart commands build required local services and pull missing images before stopping nodes. Docker image updates process pull results, sanitize reported text, display failures, and return a non-zero exit code when an image update fails.

Changes: Docker image lifecycle

Layer / File(s) Summary
Local build selection
packages/dashmate/src/docker/getServiceListFactory.js, packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js, packages/dashmate/test/unit/docker/getServiceListFactory.spec.js, packages/dashmate/test/unit/listr/tasks/startGroupNodesTaskFactory.spec.js
Service metadata marks locally built images. Group startup skips the build task when ctx.skipBuildServices is true. Tests cover local-build flags and the skip condition.
Missing-image pull handling
packages/dashmate/src/docker/DockerCompose.js, packages/dashmate/src/docker/imagePlatform.js, packages/dashmate/src/docker/dockerPullFactory.js, packages/dashmate/src/docker/findPullStreamError.js, packages/dashmate/src/util/sanitizeRemoteText.js, packages/dashmate/test/unit/docker/*, packages/dashmate/test/integration/docker/restartImagePlatform.spec.js, packages/dashmate/test/unit/util/sanitizeRemoteText.spec.js
DockerCompose checks images for selected services, pulls absent remote images, and verifies pulled images and platform metadata. Pull-stream errors and remote text are sanitized. Tests cover image availability, platform checks, errors, filtering, and progress.
Restart image preparation
packages/dashmate/src/commands/group/restart.js, packages/dashmate/src/listr/tasks/restartNodeTaskFactory.js, packages/dashmate/src/listr/tasks/startGroupNodesTaskFactory.js, packages/dashmate/test/unit/commands/group/restart.spec.js, packages/dashmate/test/unit/commands/platformStartGuard.spec.js, packages/dashmate/test/unit/listr/tasks/*
Group and node restarts prepare local builds and pull missing images before stopping nodes. Group startup skips a build already performed by the restart workflow. Tests cover sequencing, profile selection, and failure handling.
Image update results and reporting
packages/dashmate/src/update/updateNodeFactory.js, packages/dashmate/src/commands/update.js, packages/dashmate/test/unit/commands/update.spec.js
Image updates skip locally built images and process pull-stream results and errors. The command includes errors in its output and sets a non-zero exit code when an image update fails. Tests cover streamed errors, output formats, sanitization, and local images.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant GroupRestartCommand
  participant BuildServicesTask
  participant DockerCompose
  participant DockerDaemon
  participant NodeTasks
  GroupRestartCommand->>BuildServicesTask: Build services when required
  GroupRestartCommand->>DockerCompose: Pull missing images for group configurations
  DockerCompose->>DockerDaemon: Inspect images and pull absent images
  DockerDaemon-->>DockerCompose: Return image status and pull progress
  GroupRestartCommand->>NodeTasks: Stop nodes, then start the group
Loading

Possibly related issues

Suggested reviewers: pshenmic, ktechmidas

Merge Risk: Minimal · previous review 56af4

This change pulls and verifies required images before stopping nodes during restart, and makes dashmate update exit non-zero when an image fails to download. No actionable merge-blocking issue remains; the one surviving comment is a minor wording nit.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title is related to the changeset. It names the two defects the PR fixes: a failed image pull that leaves a node stopped, and a success report despite pull failures. The diff covers both, includin…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title is related to the changeset. It names the two defects the PR fixes: a failed image pull that leaves a node stopped, and a success report despite pull failures. The diff covers both, including restart pre-pulls, failure handling in update, and exit code 1 on failed pulls. The title does not mention the other parts of the changeset, such as local-build handling, platform checks, and sanitization, but that is expected for a single-sentence title. The title uses the conventional 'fix(dashmate):' prefix and a descriptive subject. It is slightly long at 100 characters.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thepastaclaw

thepastaclaw commented Aug 4, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Final review complete — no blockers (commit 9ea177c) · triage: normal

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Preliminary review — Codex only

The PR improves pull failure reporting and TLS key permissions, but three in-scope blockers remain. Group restart still performs local builds after stopping every node, replacement of a historically exposed key writes the new secret through the old inode, and registry-controlled error text is printed directly to the terminal.

Validated blockers were found in the Codex precheck. Sonnet is deferred until a fresh Codex revalidation clears the blocker gate.

Review provenance

  • Codex reviewers: gpt-5.6-sol — general (completed)
  • Verifier: gpt-5.6-sol — verifier
  • Sonnet: not run (deferred by blocker gate)

🔴 3 blocking

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/dashmate/src/commands/group/restart.js`:
- [BLOCKING] packages/dashmate/src/commands/group/restart.js:47-56: Build local images before stopping group nodes
  This pre-stop phase only calls `pullMissingImages`, which intentionally excludes services marked `isBuiltLocally`. When local builds are enabled, `startGroupNodesTask` runs `buildServicesTask` as its first task, but that happens only after every node has been stopped. A missing local image or any build failure therefore still leaves the entire group down, despite the commit's stated guarantee that required images are prepared before anything stops. Run the shared local build before the stop phase and arrange for the subsequent group start to skip the duplicate build.

In `packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js`:
- [BLOCKING] packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js:35-39: Replace an exposed private key through a fresh restricted inode
  The `mode` option only affects file creation. If `private.key` already exists with mode 0644, `writeFileSync` writes the replacement secret through that world-readable inode and restricts it only afterward. A local user can also open the old inode before this operation and retain access through that descriptor after `chmodSync`, allowing them to read the newly generated key. Write the key to a temporary file in the same directory created as 0600, then atomically rename it over `private.key`; descriptors for the old inode will then expose only the old key.

In `packages/dashmate/src/commands/update.js`:
- [BLOCKING] packages/dashmate/src/commands/update.js:64-70: Sanitize registry error text before terminal output
  The `error` field can come directly from a Docker registry pull-stream `errorDetail.message`, but the stderr summary interpolates it unchanged. A registry response can therefore inject newlines, carriage returns, ANSI escapes, bidirectional controls, or an excessively long message into the operator's terminal. This path is unconditional, including when `--format=json` is selected. Strip unsafe control characters and bound the rendered length before writing remote error text to terminal streams, using protections equivalent to the new remote-diagnostic sanitization in `status/providers.js`.

shumkov and others added 7 commits August 31, 2026 19:34
…ts version

The lookup caught node-fetch's FetchError/AbortError names, but dashmate runs
on Node's native fetch, which rejects with TypeError('fetch failed') and a
TimeoutError DOMException. Neither matched, so the null branch was unreachable
and the lookup threw on essentially every network failure.

The returned tag_name was also unvalidated and one character was stripped
unconditionally, mangling tags without a "v" prefix. Anything the API returns
is now required to be a valid semver before it is returned, printed or cached,
which keeps package-manager specifiers (git+https:, file:, npm:) and terminal
control sequences out of a value the updater will act on.

Also enforces the declared response-size cap on JSON bodies, cancels bodies on
paths that skip reading them, treats rate limiting as unknown rather than as an
error, sends GITHUB_TOKEN when present, and rejects insight responses whose
shape would crash the status renderer.

Test would have caught this in CI: 14 of 18 new specs fail before the fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
… node

Docker reports pull failures such as registry rate limiting and a full disk as
in-band error objects on an otherwise successful stream, so docker-modem's
followProgress resolves and the old hand-rolled parser looked only for status
lines. Failures were therefore reported as a coloured word in a table, with the
reason printed only under DEBUG and an exit code of 0, so automation could not
tell "updated everything" from "updated nothing".

Restart compounded that: it stopped every service and only then let compose pull
whatever was missing, so a pull that failed in that window left the node down.
Required images are now confirmed present before anything is stopped, which for
a masternode is the difference between a failed command and missed blocks.

Pull-stream parsing moves to docker-modem's followProgress, which buffers across
chunk boundaries and splits on the separator Docker actually emits. The previous
parser split each chunk on CRLF and parsed every fragment, so an ordinary TCP
boundary threw inside the stream handler where nothing could catch it.

Services built from local sources are reported as such instead of being pulled,
and group restart gains the same pre-stop guarantee across every node.

Test would have caught this in CI: 11 new specs fail before the fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
…ft exposed

Keys written before Dashmate set a mode are group- and world-readable, and both
certificate writers now create and repair their own. Neither covers a key that
is never rewritten: nothing inspects the mode of an SSL file, and on the ZeroSSL
path a renewal reuses the existing key and skips the write entirely, so a
deployed host stays exposed indefinitely.

Permissions are therefore also restricted when starting the node, which is the
one action every operator performs regardless of certificate provider, and
doctor reports a key other users can read so it is visible in the meantime.
Only the group and world bits are dropped, so an owner that hardened the key
further keeps what it chose. Neither creates the file if it is absent: an empty
key would convince the certificate validators one exists.

The two historical migrations that copy the key restrict it as well, since
copyFileSync reproduces the source mode and would otherwise carry the old
permissions forward.

Also fixes config and group default printing the current name. An args default
of null is never applied by oclif's parser, so the argument stayed undefined and
both commands failed instead of reporting, which matters because a planned
feature treats them as read-only.

Test would have caught this in CI: 8 specs fail before the fix.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Group restart confirms every node's images are present before the first node is
stopped, but the confirmation is a pull, and a pull deliberately skips services
built from local sources. Those were built by the group start instead, which
runs once every node is already down - so a missing base image or a compile
error still left the whole group stopped, which is the outage the pre-stop check
exists to prevent.

The build now runs before the pull, and the group start is told the images are
already there so a restart does not pay for the build twice.

Test would have caught this in CI: 2 of the 4 new specs fail when the build is
left to the group start.

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

A failed pull is now reported with the reason the registry gave, and that text
reaches the operator's terminal unchanged. The registry chooses it: an escape
sequence in it can erase the screen, move the cursor back over lines already
printed or address the terminal itself, and an unbounded message pushes the rest
of the output out of the scrollback. The same text is also carried in the JSON
output, where a caller may hand it on somewhere else.

Control characters and bidirectional overrides are therefore removed, the
message is collapsed onto one line and its length is bounded, at the two points
where the text is taken: the failure a pull stream carries in band, and the
message the pull callback reports.

Test would have caught this in CI: the new update spec fails before the fix.

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

The replacement key is written into the inode the old one occupies, because the
gateway's bind mount follows that inode rather than the path. Tightening the
mode only after the write would leave the new secret behind the old, world
readable permissions for as long as the write takes.

The task already restricts the mode first, and the existing specs check only the
mode the file is left with - which stays correct either way. This pins the order
itself, so the window cannot be reopened by a refactor.

Test would have caught this in CI: it fails when the tightening is moved after
the write.

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

The escape sequences that rewrite a terminal were already removed, but several
characters that hide or reorder text were not: the Arabic letter mark, zero
width space and joiner, the line and paragraph separators, and the byte order
mark all survived into a message an operator reads to decide what to do next.

Test would have caught this in CI: 6 of the new cases fail before the fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
@shumkov
shumkov force-pushed the fix/dashmate/update-path-bugs branch from 93fd1ee to 68d467e Compare August 31, 2026 13:57

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Preliminary review — GLM Flash blocker gate

The current head fixes the prior group build ordering and registry-error sanitization blockers, but the TLS remediation still writes a replacement key through the previously exposed inode, allowing a descriptor opened before chmod to read the new key. Two additional in-scope suggestions remain: build requirements are derived from only one group member, and the GitHub diagnostic sanitizer omits U+061C. Source: Codex reviewers (exact model identifier unavailable in the supplied evidence), Claude reviewer (exact model identifier unavailable in the supplied evidence), and Claude final verifier (exact model identifier unavailable in the supplied evidence).

Source: reviewer 1: glm-5.3-flash (agent: phase1-reviewer, role: general); reviewer 2: glm-5.3-flash (agent: phase1-reviewer, role: security-auditor); final verifier: gpt-5.6-sol (agent: sol-verifier, role: verifier)

Validated blockers were found by the Phase-1 GLM Flash review and confirmed by a fresh Sol verifier. Phase 2 is deferred until a fresh same-head revalidation clears the blocker gate.

Review provenance

  • Phase 1 reviewers (GLM Flash): glm-5.3-flash — general (completed); agent phase1-reviewer, glm-5.3-flash — security-auditor (completed); agent phase1-reviewer
  • Fresh verifier (Sol): gpt-5.6-sol — verifier; agent sol-verifier
  • Phase 2 reviewers (Sol): not run (deferred by blocker gate)

🔴 1 blocking | 🟡 2 suggestion(s)

1 carried-forward finding(s) already raised on this PR; not re-posting as new inline comments.

🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify each finding against the current code and only fix it if needed.

In `packages/dashmate/src/commands/group/restart.js`:
- [SUGGESTION] packages/dashmate/src/commands/group/restart.js:42-64: Pre-stop group build trusts a single config to describe every node's local builds
  `configGroup.find(isServiceBuildRequired)` builds from only the first matching node. Group membership is based only on the `group` value, and no invariant requires every member to enable the same locally built services; `generateEnvs` selects the Drive, rs-dapi, and helper build compose files independently for each config. If one member enables a Drive build and another enables only an rs-dapi build, the first config does not build the second member's required image. The pull phase excludes that locally built service, and `ctx.skipBuildServices` suppresses all later per-node builds, so startup fails only after every node has stopped. Build the union of requirements from all group members before setting the shared skip flag.

In `packages/dashmate/src/status/providers.js`:
- [SUGGESTION] packages/dashmate/src/status/providers.js:21: providers.js sanitizer misses U+061C (Arabic letter mark) that sanitizeRemoteText covers
  The new diagnostic sanitizer removes bidi overrides, isolates, and directional marks, but omits U+061C, an invisible strong right-to-left mark. Remote release-tag text can therefore put U+061C into DEBUG output at line 182 and alter how the diagnostic is displayed in bidi-aware terminals. The sibling `sanitizeRemoteText` utility includes this code point for the same threat model, so the two new sanitizers should provide equivalent coverage.

In `packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js`:
- [BLOCKING] packages/dashmate/src/listr/tasks/ssl/saveCertificateTask.js:57-68: Replace an exposed private key through a fresh restricted inode
  (existing thread: https://github.com/dashpay/platform/pull/4283#discussion_r3714726980)
  Moving chmod before write prevents new opens through the old 0644 mode, but it does not revoke descriptors that another local user opened while the key was readable. Because `writeFileSync` truncates and rewrites the same inode, such a descriptor can seek back to offset zero and read the replacement private key after chmod; this behavior was reproduced directly against the current implementation's filesystem sequence. The individual-file gateway bind mount explains why a simple rename would leave the running container on the old inode, but it does not eliminate the exposure. Restoring confidentiality requires installing the replacement through a restricted inode and then remounting or recreating the gateway, or changing the mount arrangement so an atomic replacement is visible inside the container.

@QuantumExplorer
QuantumExplorer changed the base branch from v4.2-dev to v4.3-dev September 15, 2026 19:19
@github-actions github-actions Bot modified the milestones: v4.2.0, v4.3.0 Sep 15, 2026
@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Sep 20, 2026
@github-actions github-actions Bot removed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. waiting-self-review Waiting for the author to post /self-reviewed labels Sep 30, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Oct 2, 2026
shumkov and others added 3 commits October 20, 2026 18:20
Both sides added test/unit/docker/DockerCompose.spec.js: v5.1-dev with
the Tor sidecar lifecycle tests, this branch with the image pull tests.
The merged file keeps both suites.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ostics

U+061C is an invisible strong right-to-left mark, so a release tag
carrying it could change how a DEBUG diagnostic is displayed in a
bidi-aware terminal. sanitizeRemoteText already removes it; the
release lookup's own log sanitizer now does too.

Test would have caught this: the rejected tag name test with an Arabic
letter mark in the forgery fails before the fix and passes after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he first

Group restart and group start built from the first node that builds
anything locally, then told every later step the images were built.
Nodes of one group may build different services from local sources,
one Drive, another rs-dapi, so a second node's image was never built:
restart stopped the whole group and then failed to start it. Both now
build for every node that builds any of its services.

Test would have caught this: with one node building Drive and another
rs-dapi, the new restart and group start tests fail before the fix
(one build instead of two) and pass after it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 2, 2026
…metadata

Restore the ordinary Core configuration when a nested start or restart fails. Check manifest and config agreement before shutdown, accepting containerd ARM64 variant aliases in daemon responses.

Eight regression cases failed before the fix, including a loopback Engine response and nested Listr errors. All 44 focused tests now pass.
A partial descriptor or config can still contradict the selected platform. Four regressions allowed shutdown before this change and now reject the image before stopping. All 48 focused tests pass.
…ases

A successful Listr rollback throws its task title. Keep the original failure there for operators, including errors raised while constructing the start task. Treat armhf and armel as explicit variants when checking inspected metadata.

Three error-reporting cases and one ARM alias conflict failed before the fix and pass after it; all 50 focused checks pass.
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw reviewed an earlier commit, not yet this one. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 2, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

Changes requested: 1 blocker

  • Cancelling a reindex during an image pull leaves the next normal restart in reindex mode — packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js:110-115 (new)
    Impact: An operator who presses Ctrl+C during a slow preflight pull leaves the running node up, but the next ordinary restart can take Core offline for an unintended block-index rebuild.
    Not counted: 1 disputed blocking finding(s) left to maintainers.

New on this head: This revision normalizes ARM64 aliases from Docker Engine metadata, rejects conflicting image metadata before shutdown, and restores the ordinary Core configuration when reindex startup rejects. Current CI shows the Dashmate unit tests, all three Dashmate E2E jobs, JS lint, and the Platform test suite including both browser shards passed; the review and PR Hygiene checks are still pending.

A pattern across this PR's review rounds

This is review round 8, and the PR has drawn 9 blocking findings so far. 2 of them share one underlying cause. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.

1. A one-shot reindex changes the normal startup file (2 new in this round, 1 earlier finding(s))

reindexNodeTaskFactory writes reindex=1 to the ordinary core/dash.conf before restartNodeTask prepares images, so the next normal start depends on the reindex task putting that file back. A Compose version check exposed this when it refused to proceed; the Listr rollback added for that refusal does not run when Ctrl+C exits during a pull. Copying the failure message into the rollback task title preserves the text but not the original exception.

Already tracked: #5855

In this round: Cancelling a reindex during an image pull leaves the next normal restart in reindex mode; A failed reindex loses the original exception and repeats raw Compose diagnostics

Suggested decision (land the prerequisite first): Land one-shot Core reindex startup separately before routing reindex through the new image preflight. Apply reindex=1 only to the intended Core launch without changing the core/dash.conf used by normal starts. If that change does not land first, keep reindex on its existing path and limit this PR's new preflight to restart and group restart.

🔴 1 blocking | 🟡 1 suggestion(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a substantial, cross-cutting Dashmate update to Docker image pulling, restart sequencing, stream parsing, platform verification, error reporting, and sanitization, but it does not modify consensus, funds, cryptography, key handling, peer-facing deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • New since the last final review (56af426d): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): A one-shot reindex changes the normal startup file. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land one-shot Core reindex startup separately before routing reindex through the new image preflight. Apply `reindex=1` only to the intended Core launch without changing the `core/dash.conf` used by normal starts. If that change does not land first, keep reindex on its existing path and limit this PR's new preflight to `restart` and `group restart`. If that decision is not yours to make, say so to the PR's author or maintainer.

These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js`:
- [BLOCKING] packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js:110-115: Cancelling a reindex during an image pull leaves the next normal restart in reindex mode
  Impact: An operator who presses Ctrl+C during a slow preflight pull leaves the running node up, but the next ordinary restart can take Core offline for an unintended block-index rebuild.
  Cancelling a reindex before shutdown can still leave `reindex=1` in the configuration the next normal start reads. For example, if an operator configures a new image tag while the old container is running, `dashmate core reindex` writes the flag at line 97 and then enters `Pull missing images` before reaching `Stop node`. Pressing Ctrl+C there makes Listr 5.0.7 call `process.exit(127)` directly, so the new rejection rollback never runs and `BaseCommand`'s signal cleanup only handles containers. A later ordinary `dashmate restart` does not rerender `core/dash.conf` before Compose mounts it. Keep the ordinary file unchanged until preparation succeeds and the reindex-specific startup step is ready to start Core, and retain cleanup for startup errors.

  _Confirmed by an independent pass: An operator who changes a running node’s image tag to one not cached locally can press Ctrl+C during `dashmate core reindex` while the replacement image is downloading. Dashmate has already written `reindex=1` to `core/dash.conf`, and Ctrl+C exits before `Stop node` without restoring the file. Once the image is available, an ordinary `dashmate restart` mounts the stale file and unexpectedly reindexes Core, taking it offline for the rebuild._
- [SUGGESTION] packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js:110-115: A failed reindex loses the original exception and repeats raw Compose diagnostics
  Impact: An operator debugging a failed reindex gets a replacement stack and, if Compose returned remote error text, sees that text repeated without filtering in the rollback output.
  The new rollback keeps the failure message but loses the exception that identifies where startup failed. Listr 5.0.7 throws `new Error(this.title)` after a successful rollback, and in debug mode `MuteOneLineError` copies that replacement stack. If the config restore also fails, the thrown error is the restore error alone. Copying the message into the title also adds another unfiltered rendering path: on a stopped node with a missing Core image, Compose `up --no-build` can still pull the image, and `DockerComposeError` uses the resulting stderr verbatim. Preserve the child exception separately from the renderer title, report both errors if restoration fails, and sanitize remote diagnostics at the Compose reporting boundary before Listr renders them.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 2, 2026
Arm the temporary configuration immediately before Compose up on running and stopped nodes. Restore it on a rejected start or readiness check while retaining the original exception; report both exceptions when restoration also fails.

Six red regression cases covered a pending pull, rejected preparation and shutdown, launch ordering, error identity, and failed restoration. All 17 focused reindex/start/restart tests now pass.
The renderer can display only the failing leaf even when cleanup reports a second failure. Print the dedicated, sanitized combined error at both CLI entry points before muting the ordinary oclif diagnostic.

Both CLI stderr tests failed before this fix and pass after it. All 19 focused tests pass.
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw reviewed an earlier commit, not yet this one. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 2, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

Changes requested: 1 blocker

  • Core reindex stops a working node before discovering it cannot write dash.conf — packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js:63-67 (new)
    Impact: An operator reindexing a running node after a root-run restore left core/dash.conf readable but not writable can leave the node offline without starting the reindex.
    Not counted: 1 disputed blocking finding(s) left to maintainers.

New on this head: This revision defers writing reindex=1 until just before Compose starts, preserves the original startup error, and reports a sanitized combined diagnostic on stderr if restoring dash.conf also fails. Dashmate unit tests, all three Dashmate E2E jobs, JS lint, the platform suite, and both browser shards passed; review and PR Hygiene checks remain pending. The head has merge conflicts with the current v5.2-dev tip, including in both reindex commands and group restart.

A pattern across this PR's review rounds

This is review round 9, and the PR has drawn 10 blocking findings so far. 3 of them share one underlying cause. They are listed with the other findings as usual; fixing the cause is likely to be cheaper than fixing each case.

1. One-shot reindex rewrites the normal startup file (1 new in this round, 3 earlier finding(s))

reindexNodeTaskFactory still sets reindex=1 in the same core/dash.conf that ordinary starts mount, so a one-shot launch depends on restoring shared state. Writing it before image preparation let a rejected or cancelled pull leave the flag behind, and the rollback added for that case obscured the original startup error. Moving the same write into startNodeTask, just before Compose starts, avoids those early exits but puts the first attempt to write the file after restartNodeTask has already stopped the node.

Already tracked: #5855

In this round: Core reindex stops a working node before discovering it cannot write dash.conf

Suggested decision (land the prerequisite first): Land one-shot Core reindex startup separately before routing reindex through the new image preflight. Prepare the reindex-specific settings before stopping the node and apply them only to the intended Core launch, without rewriting the core/dash.conf used by normal starts. If that prerequisite does not land first, keep reindex on its existing path and limit this PR's new preflight to restart and group restart.

🔴 1 blocking

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a substantial but localized Dashmate operational and Docker update/restart behavior change, yet it does not modify consensus, funds, cryptography, key handling, peer-facing protocol parsing, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • New since the last final review (ed0ba37f): 1 new blocker(s) went to an independent confirmation pass (the final verifier's model in a fresh session, without its reasoning): 1 confirmed
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
Several findings on this PR share an underlying cause (the review's "pattern" section): One-shot reindex rewrites the normal startup file. When you fix the findings below, fix the cause, not only the reported case. The review suggests (land the prerequisite first): Land one-shot Core reindex startup separately before routing reindex through the new image preflight. Prepare the reindex-specific settings before stopping the node and apply them only to the intended Core launch, without rewriting the `core/dash.conf` used by normal starts. If that prerequisite does not land first, keep reindex on its existing path and limit this PR's new preflight to `restart` and `group restart`. If that decision is not yours to make, say so to the PR's author or maintainer.

These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js`:
- [BLOCKING] packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js:63-67: Core reindex stops a working node before discovering it cannot write dash.conf
  Impact: An operator reindexing a running node after a root-run restore left `core/dash.conf` readable but not writable can leave the node offline without starting the reindex.
  A config permission error that previously aborted reindex before shutdown now leaves the node stopped. On a running Core-only node with cached images, a root-owned `0644` `core/dash.conf` is still readable by Core, and the operator can hold the separate Dashmate config lock and run Docker. `dashmate core reindex --force` passes the Platform guard and image preflight, then `restartNodeTaskFactory.js:62–68` completes `Stop node` before the start task calls `enableReindex` at `startNodeTaskFactory.js:173`. The direct write in `writeServiceConfigsFactory.js:29` then fails with `EACCES`. Compose `up` is never called, and the catch retries the file write without restarting the node. Before `bb3cd77834`, the first write happened before the restart task was invoked. Stage a launch-specific reindex config before shutdown and use it only for that launch, leaving the ordinary config untouched during image preparation.

  _Confirmed by an independent pass: Running `dashmate core reindex --force` on a node whose readable but non-writable `core/dash.conf` is root-owned first passes the image preflight and stops the running node. The nested start then calls `enableReindex` immediately before `dockerCompose.up`; `writeServiceConfigs` throws `EACCES`, and the reindex catch retries restoration without restarting, so Compose never starts and the node remains down._
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • Compose startup diagnostics reach the terminal unfiltered — Compose can pull an absent image during startup even with --no-build. DockerComposeError copies Compose stderr verbatim, and Listr's verbose renderer prints the message at the failed task and again as the error propagates. This is the same startup reporting path on v5.2-dev; this revision removes the additional rollback-title copy.
    • Follow-up: In a separate Dashmate PR, sanitize printable Compose diagnostics before they reach Listr while preserving the raw execution result for debugging.

@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Your move: thepastaclaw requested changes on this head; dismiss the review or push a fix; thepastaclaw left review threads unresolved; resolve them.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 2, 2026
Keep Core reindex on its existing build, stop and start path. Its configuration write must still fail before stopping the node if dash.conf is not writable. Remove the reindex launch hook, restoration handling and their dedicated tests; the existing stale-flag issue is tracked in #5855.

The boundary regression failed on the previous head with a registry error and now reaches the original stop task without inspecting or pulling images. All 118 focused tests passed.
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Waiting for bot review — thepastaclaw reviewed an earlier commit, not yet this one. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed waiting-self-review Waiting for the author to post /self-reviewed labels Dec 3, 2026

@thepastaclaw thepastaclaw left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Re-review — Final validation — Phase 1 + Phase 2

GitHub still shows changes requested by this bot (review of ff41f4a4). Nothing on this head blocks except the disputed finding(s) below, which are left to the maintainers: a maintainer can dismiss that earlier review if they agree it no longer applies.

Nothing blocks: no blocking finding stands on this head.
Not counted: 1 disputed blocking finding(s) left to maintainers.

New on this head: This revision keeps image preflight on dashmate restart and dashmate group restart, while restoring Core reindex’s target-branch sequence of writing dash.conf before building, stopping, or starting services. Dashmate tests, all three Dashmate E2E jobs, JS lint, the Platform suite, and both browser shards passed; no code check failed. GitHub reports the PR mergeable against 46c3ca89856b, but merging into the newer supplied v5.2-dev tip 76e8b133623f produces conflicts, including in group restart and service-template rendering.

🔴 0 blocking | 🟡 0 suggestion(s) | 💬 0 nitpick(s)

Review provenance

Source: reviewer 1: muse-spark-1.3-contributor (agent: phase1-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 3: gpt-6.2-sol (agent: phase2-reviewer, role: architecture-layering); reviewer 4: gpt-6.2-sol (agent: phase2-reviewer, role: security-auditor); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — This is a substantial, cross-cutting dashmate runtime change affecting Docker image inspection, pulling, restart ordering, stream parsing, error reporting, platform selection, and sanitization, but it does not modify consensus, funds, cryptography, key handling, peer-facing protocol deserialization, or storage migrations.
  • Phase 1 reviewers: muse-spark-1.3-contributor — general (completed, effort xhigh); agent phase1-reviewer
  • Phase 1 model: muse-spark-1.3-contributor — not quota-gated; passed over gemini-3.8-flash-high (antigravity quota lookup failed), glm-5.3-flash (not used above high effort; tier asks max)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — architecture-layering (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — security-auditor (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review. Verify the current code and confirm that no unresolved issues remain.

No unresolved findings remain from the prior review on this head.
Out-of-scope follow-up suggestions (1)

These are valid observations, but they are outside this PR's scope and should be handled in separate issues or author/maintainer-requested PRs rather than blocking this review.

  • A failed Core reindex can leave reindex mode enabled — A stop refusal or startup failure can leave reindex=1 in core/dash.conf and trigger an unplanned rebuild on the next ordinary start. Both the target branch and this head write the flag before attempting the restart and clear it only after Core starts. The new image preflight is no longer reachable from reindex.
    • Follow-up: Handle failure and interruption cleanup in the follow-up tracked by #5855.

Not approved: 1 blocking finding(s) are disputed and left to the maintainers.

@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed and removed waiting-bots Waiting for the review bots to report on this head labels Dec 3, 2026

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

waiting-self-review Waiting for the author to post /self-reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants