Skip to content

feat(updater): cancel downloads with authoritative thaw acknowledgement - #813

Merged
mergify[bot] merged 2 commits into
mainfrom
codex/w5-v16-upd-cancel-a
Oct 9, 2026
Merged

mergify[bot] merged 2 commits into
mainfrom
codex/w5-v16-upd-cancel-a

Conversation

@Cuarroc

@Cuarroc Cuarroc commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Dieser Entwurf ergänzt den Abbruch eines Update-Downloads im Backend und in der IPC-Schnittstelle.
Ein erfolgreicher Abbruch wird erst bestätigt, wenn der Wartungsmodus beendet ist und ein neuer Versuch starten kann.
Die Oberfläche folgt im Paket -b; dieser PR bleibt bis zu den zwei unabhängigen Reviews ein Entwurf.

Report

Scope and candidate

  • Package: V16-UPD-CANCEL-a, parent Z3; approved backend/IPC scope, ticket 64888ba3.
  • Base: 15305c2e1eb503df4834f5cdce1a372f3c39964c.
  • Head: 600850392d9310ea8b98c3d4bb176b7ca50c7817.
  • ALL: 298 lines (288 additions, 10 deletions), four assigned files, including tests.
  • Preconditions: test: guard state registration in every command module (D5-GUARD) #792 observed MERGED; D5-GUARD ancestor check exited 0; branch initially matched origin/main; no open PR touched main.rs at start.
  • Seam mn remains assigned to this package until merge, followed by -b. Main.rs contains wiring, state registration and the existing registration guard's evidence row. Cancellation and single-flight logic live in update_cancel.rs.

Behavior and wire contract

cancel_update_download / cancelUpdateDownload(): Promise<CancelUpdateResult> resolves to a JSON string, using Serde camelCase:

Value Meaning
"cancelled" Cancellation won before the download-to-journal handoff; the download future and install lease have been released, and thaw completed before acknowledgement. The install call rejects with Update download cancelled.
"tooLate" The download has crossed the atomic handoff to journal preparation/installation. Cancellation changes nothing and schedules no thaw. This conservative cutoff is before journal creation, not a claim that the OS installer has already executed.
"notRunning" No flight exists, or maintenance admission failed before this flight entered maintenance.

Failed thaw or interrupted execution rejects the cancellation call rather than acknowledging success, and retains the occupied slot to refuse retries. A second install returns refused: update install already running. Successful thaw clears the slot before notifying cancellation waiters. The existing ten-minute download timeout and journal recovery rules remain in force. No dependencies were added.

Evidence (2026-10-09)

Semantic RED was recorded on BASE plus a compiling stub/test scaffold, committed as ba13ad8536ece9c6da02833aff1f89455622a8cf, before implementation:

Command Exit Observation
cargo test --manifest-path src-tauri/Cargo.toml update_cancel 101 All four requested tests compiled and failed assertions.
npm run test:unit -- src/lib/ipc.test.ts 1 New cancellation wrapper test failed; 21 existing tests passed.

Green implementation evidence:

Command Exit Observation
cargo test --manifest-path src-tauri/Cargo.toml update_cancel 0 Four requested tests passed, including pending download drop, delayed thaw/ack, retry refusal and failed-thaw refusal.
cargo test --manifest-path src-tauri/Cargo.toml every_command_state_type_is_managed 0 D5-GUARD passed with the new managed state.
cargo test --manifest-path src-tauri/Cargo.toml update_cancel -- --list 0 All four exact Rust names found.
npm run test:unit -- src/lib 0 193 tests passed.
bash scripts/ci/red-first.sh --plan 0 Exact named trailers accepted.
bash scripts/ci/red-first.sh 0 Full merge-base/head verification passed for all five unique named checks. The Rust module is absent at BASE; semantic failures are separately recorded above.
CARGO_BUILD_JOBS=2 bash scripts/ci/gates.sh lane prepush 0 Own worktree and head; all gates green, 1,902 Rust tests passed, seven skipped.
bash scripts/ci/secret-scan.sh 0 Staged secret scans passed before both commits; successful commit hooks also passed.
git push -u origin codex/w5-v16-upd-cancel-a 0 Foreground push and its prepush hook passed.
git ls-remote origin codex/w5-v16-upd-cancel-a 0 Remote head equals the full candidate SHA above, checked at 02:41 UTC.

The full red-first run reused existing node_modules through a temporary-base symlink after byte-comparing package-lock.json, and reused this worker's build slot for HEAD. Dependency installation was explicitly disabled in that invocation. Tests, filters and gate code were unchanged. An intermediate normal-build failure exposed that Tokio macros were test-only; the final implementation uses std::future::poll_fn and passes normal cargo-check and clippy.

Architecture drift: no new occurrences; no allowlist changes.

NICHT ABGEDECKT

  • No real network cancellation, real updater launch, Windows installer execution, UI, screenshot or PC drill. UI and the end-to-end drill belong to -b and the release drill.
  • Linux does not compile #[cfg(windows)] tests or check Windows clippy branches; the Windows lane runs in the merge queue.
  • The prepush lane does not cover browser smoke, frontend production build or the additional workflow gates of the full linux lane. External updater service state was not verified.

Review and handover

Review: ausstehend (Stufe A). Two non-OpenAI vendor reviews are required at the candidate SHA; Root dispatches them (requested route: Anthropic + GLM 5.2). No worker review, labels, ready transition or merge performed.

Delivery stage: implemented, locally tested and pushed; draft handover. Review, acceptance, merge and usable UI remain separate. Native goal was created and checked through the harness goal tools; this worker's bounded goal ends at verified draft handover, while parent Z3 stays open.

Model evidence: system identity is Codex / GPT-6 family (OpenAI); an exact served runtime model ID and remaining provider quota were not exposed. The project-memory mirror was unavailable; live GitHub and Git evidence supplied the starting state.

Root-Abnahme (2026-10-09, head 6008503)

ID Quelle Schwere Befund Disposition
R813-A1 Claude Sonnet 5.5 (Anthropic), review-pr813-anthropic-r1-600850392d93.md low update_cancel.rs:79 .as_ref().unwrap() on the cancel path (unreachable today) follow-up UPD-CANCEL-a2
R813-A2 / G-F1(811-run) Anthropic; GLM low Install has no Drop: a panic or dropped command future between begin() and finish() keeps the single-flight slot occupied until restart (fail-closed) follow-up UPD-CANCEL-a2 (Drop guard that clears the slot and signals done)
R813-A3 Anthropic info Installing is set before produce_journal; TooLate is conservative no action; documented in the report
R813-G1 GLM 5.2 (Zhipu), local Ollama low update_cancel.rs:188-191: frozen cell never written, so the "keeps_freeze" assertion is vacuous follow-up UPD-CANCEL-a2: real freeze assertion or rename
R813-G2 / A4 GLM (medium); Anthropic (info) medium main.rs:1208-1250 glue (begin guard, finish_unstarted, thaw before ack) has no integration test follow-up UPD-CANCEL-a2; the PR is at 298/300 lines, so it cannot take the test without breaking the size rule
R813-G3 / G4 GLM low finish_unstarted reports NotRunning to a pending cancel; success path writes a synthetic error into done follow-up UPD-CANCEL-a2 (contract wording)

Verdicts: Anthropic approve; GLM approve with conditions (conditions G1/G2 → follow-up). No high finding in round 1, so no round 2 (AGENTS.md); all conditions go into UPD-CANCEL-a2 (main.rs seam, serial, directly after this merge, before UPD-CANCEL-b). Two families outside the author family (OpenAI), bound to head 6008503. Seam main.rs was assigned exclusively to this package.

NICHT ABGEDECKT (Root): Windows lane only in the merge queue; no end-to-end updater run (no real installer download); the glue path is covered by reading only until UPD-CANCEL-a2.

Test-First: src-tauri/src/update_cancel.rs::cancel_during_download_aborts_and_thaws_before_ack
Test-First: src-tauri/src/update_cancel.rs::cancel_after_installer_started_is_too_late_and_keeps_freeze
Test-First: src-tauri/src/update_cancel.rs::cancel_without_running_install_reports_not_running
Test-First: src-tauri/src/update_cancel.rs::second_install_is_refused_until_thaw_completed
Test-First: src/lib/ipc.test.ts::cancels update download through the typed command
Test-First: src-tauri/src/update_cancel.rs::cancel_during_download_aborts_and_thaws_before_ack
Test-First: src-tauri/src/update_cancel.rs::cancel_after_installer_started_is_too_late_and_keeps_freeze
Test-First: src-tauri/src/update_cancel.rs::cancel_without_running_install_reports_not_running
Test-First: src-tauri/src/update_cancel.rs::second_install_is_refused_until_thaw_completed
Test-First: src/lib/ipc.test.ts::cancels update download through the typed command
@mergify

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 All 2 merge protections satisfied — ready to merge.

Show 2 satisfied protections

🟢 Paket-PR bringt seinen Bericht mit

Package branches (w<N>-, df<N>, ki-<N>, hq2-, dr-, z<N>-) must carry their report in the PR body, in a section that starts with "## Report".

  • body ~= (?m)^## Report

🟢 🚦 Auto-queue

When all merge protections are satisfied and these conditions match, this pull request will be queued automatically.

  • -conflict
  • -draft
  • base = main
  • check-success = gates (linux)
  • check-success = gates (windows)
  • check-success = red-first
  • label != do-not-merge
  • label = review-ok

@Cuarroc
Cuarroc marked this pull request as ready for review October 9, 2026 02:54
@Cuarroc Cuarroc added the review-ok Pipeline: review disposition complete, no open high finding label Oct 9, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T02:57:53.404740Z 6008503 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 600850392d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src-tauri/src/main.rs
Comment on lines +1250 to +1253
let _ = install
.finish(std::future::ready(Err(
"installer may have started; restart before retrying".into(),
)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Ignore completed journals when acknowledging cancellation

After the app has completed any earlier update, its writable Installed/Promoted journal remains on disk; produce_journal normally replaces it only after the next download completes (delivery_recovery/install.rs:79-87). If that next download is cancelled, journal production is skipped, lines 1236-1239 mistake the old journal for evidence that the current installer started, and this branch reports an error without thawing. Consequently cancel_update_download rejects, maintenance remains active, and another attempt is refused until restart instead of returning the promised authoritative cancelled acknowledgement. Track whether this flight created/crossed its own journal boundary, or discard a replaceable completed journal before beginning the cancellable download.

Useful? React with 👍 / 👎.

@mergify mergify Bot added the queued label Oct 9, 2026
@mergify
mergify Bot merged commit 78415d7 into main Oct 9, 2026
17 checks passed
@mergify
mergify Bot deleted the codex/w5-v16-upd-cancel-a branch October 9, 2026 03:22
@mergify

mergify Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

This pull request spent 19 minutes 1 second in the queue, including 18 minutes 46 seconds running CI.

Required conditions to merge
  • check-success = gates (linux)
  • check-success = gates (windows)
  • check-success = red-first
  • github-review-approved [🛡 GitHub repository ruleset rule main-pr-required-checks]
  • label != do-not-merge
  • all of [🛡 Merge Protections rule Paket-PR bringt seinen Bericht mit]:
  • any of [🛡 GitHub repository ruleset rule main-pr-required-checks]:
    • check-success = @github-actions/gates (linux)
    • check-neutral = @github-actions/gates (linux)
    • check-skipped = @github-actions/gates (linux)
  • any of [🛡 GitHub repository ruleset rule main-pr-required-checks]:
    • check-success = @github-actions/gates (windows)
    • check-neutral = @github-actions/gates (windows)
    • check-skipped = @github-actions/gates (windows)
  • any of [🛡 GitHub repository ruleset rule main-pr-required-checks]:
    • check-success = @github-actions/red-first
    • check-neutral = @github-actions/red-first
    • check-skipped = @github-actions/red-first
  • any of [🛡 GitHub repository ruleset rule main-pr-required-checks]:
    • check-neutral = @mergify/Mergify Merge Protections
    • check-skipped = @mergify/Mergify Merge Protections
    • check-success = @mergify/Mergify Merge Protections

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-ok Pipeline: review disposition complete, no open high finding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant