Skip to content

fix: finish Companion upgrades that hung on the old startup task - #2373

Open
roboclaw-bot wants to merge 2 commits into
mainfrom
openclaw/brisk-langoustine-1ebc80
Open

roboclaw-bot wants to merge 2 commits into
mainfrom
openclaw/brisk-langoustine-1ebc80

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2320

What Problem This Solves

Upgrading Companion can hang forever when the PC still has the old startup task that launches Companion without --background. Setup moves that task to --background with schtasks /Change. schtasks then asks for the account's password on a console window that setup keeps hidden, and setup waits for an answer that never comes.

The task does not have to be unusual. A plain task created by the signed-in user, with no stored password, triggers the prompt (proof below).

User Impact

User impact: an upgrade over the old startup task finishes. The task is moved to --background, and its account, logon type, triggers and enabled state stay as they were. If Windows refuses the change, setup logs the existing "Re-enable Start with Windows in Settings" line and carries on.

Why This Change Was Made

The migration already reads the task through the Task Scheduler COM object (Schedule.Service). It now changes the action's arguments on that same definition and saves it with RegisterTaskDefinition, passing the task's own logon type and no account or password. The flags are TASK_UPDATE, TASK_IGNORE_REGISTRATION_TRIGGERS (saving cannot start a task that has a registration trigger) and TASK_DONT_ADD_PRINCIPAL_ACE (the task's security descriptor is left as it is). This API has no console and cannot prompt. Its errors are caught, so a refused update fails closed instead of stopping setup.

What did not change:

  • the guards: one action, this installation's executable, empty arguments;
  • the Run-value migration above it;
  • the uninstall path (schtasks /Delete /F).

Required proof pools

  • windows-clean-installer-upgrade: the installer's upgrade path changed. The runs below use unsigned Dev-identity installers, not the signed artifacts this pool requires.

Validation

First commit: source 2a70483b (tree 0950211f) on main 17cadf79, Windows 11 Home 26200 x64. The installer used in the first proof runs below was built from this tree's installer.iss (blob 1f95bfd4).

  • InstallerIssAssertionTests: RED on main (2 of 22 failed: the updated existing assertion and the new Installer_UpdatesTheLegacyStartupTaskWithoutAnInteractiveCommand). GREEN with the fix (22/22).
  • ./scripts/Test-InstallerScriptCompiles.ps1 -RequireCompiler: compiles for x64, arm64 and x64 DevBuild.
  • ./build.ps1: passed.
  • OpenClaw.Tray.Tests: 6948 passed, 1 failed. The failure is FileWorkerManifestTests…("VCRUNTIME140.dll"), which also fails on this host on plain main.
  • OpenClaw.Shared.Tests: 5958 passed, 13 failed, 30 skipped.
    • 12 of the failures are reparse-point/symlink tests that need a privilege this host does not have.
    • 1 is a machine-name casing check.
    • These categories also fail here on plain main, and none of the 13 reads the installer.
  • Flags commit (head a1a26972, tree 5b45e505, installer.iss blob f7ba8d58):
    • InstallerIssAssertionTests: 1 of 22 failed with the previous head's installer.iss, and 22/22 passed with the flags.
    • The installer compiles for x64, arm64 and x64 DevBuild, and ./build.ps1 passed.
    • Tray (6948 passed, 1 failed) and Shared (5958 passed, 13 failed) had the same host-only failures as above.

Real Behavior Proof

Run on a real Windows 11 desktop session, Dev identity only (OpenClaw Companion (Dev)), non-elevated, with /SILENT /SUPPRESSMSGBOXES /NORESTART. Before each upgrade the test registered the old task shape: one action, "<app>\OpenClaw.Tray.WinUI.exe", no arguments. Because it was registered without elevation, the task has no logon trigger: a standard user cannot create one on this machine.

Run Setup Result
Before main installer (installer.iss identical to 17cadf79) Still running after 120 s, with one child schtasks.exe /Change /TN "OpenClaw Companion (Dev)" /TR "\"<app>\OpenClaw.Tray.WinUI.exe\" --background". After that child was ended, setup logged Could not migrate startup task. and exited. Task arguments still empty.
After this PR Exited by itself in 9.5 s and logged Migrated existing scheduled task to background launch. Task arguments --background. Logon type Interactive, run level Limited, same user, enabled, and same trigger and action count as before.
After, again this PR, over the migrated task Exited in 11.6 s with no migration line. Task unchanged.

The same schtasks /Change command run directly against such a task, with redirected input, printed Please enter the run as password for <user>: and did not exit within 15 s. A COM update of the same task finished in 17 ms and kept its logon type.

Task created from an elevated prompt (the #2320 case)

The legacy task was created elevated with schtasks /Create /SC ONLOGON and no /RU. That gives a logon trigger, Interactive, Limited, and no arguments. The signed-in user gets read access only. The upgrade then ran without elevation.

Setup Result
main Still running after 120 s, with a schtasks.exe /Change child. After that child was ended, setup logged Could not migrate startup task. and exited. Task unchanged.
this PR Exited by itself in 9.9 s and logged Could not migrate startup task. Re-enable Start with Windows in Settings. Task unchanged: no arguments, Interactive, Limited, logon trigger, enabled.

Here the change ends the hang, but it cannot migrate the task because a standard user cannot write it. The end state is the same one main reaches after its hang is ended.

Afterwards the Dev install, its folders and its task were removed. The installed Companion and its OpenClaw Companion startup task were unchanged.

Registration trigger (flags commit)

A legacy task can also carry a registration trigger, and saving its definition with TASK_UPDATE alone runs it. Both upgrades below ran over an argument-free task with one registration trigger, created by the signed-in user.

Setup Result
previous head 7b919f57 (TASK_UPDATE only) Migrated to --background, and the save started Companion: "<app>\OpenClaw.Tray.WinUI.exe" --background, and the task's last-run time moved.
flags commit Migrated to --background in 9.4 s. Nothing started, and the last-run time was unchanged.

Other runs with the flags build:

  • The plain legacy task from the first table was migrated in 10.5 s with every other field unchanged.
  • A rerun over the migrated task made no change.
  • The elevated-task case was not rerun, because the flags do not change whether Windows refuses that update.

TASK_DONT_ADD_PRINCIPAL_ACE made no difference that could be seen on this host. In a direct Task Scheduler probe, a task with a customized security descriptor kept it unchanged with TASK_UPDATE alone and with the new flags. Here this flag is a safeguard, not a fix for an observed problem.

Not verified / blocked

  • Signed installers and the windows-clean-installer-upgrade pool (maintainer-scheduled).
  • A task that stores a password (logon type Password). It could not be created here without entering account credentials.
  • A real logon trigger on a task the user can update. The non-elevated seeded task has none, for the reason above.

Data compatibility

The only stored state this change touches is the existing Windows scheduled task. It writes no app settings or files. On upgrade, the task either gets --background with every other field kept, or it stays exactly as it was:

Existing task After an upgrade with this PR
Argument-free, created by the signed-in user Arguments --background. Account, logon type, run level, enabled state, triggers and actions unchanged.
Argument-free, with a registration trigger Arguments --background, and saving does not start the task. Other fields unchanged.
Argument-free, created from an elevated prompt Unchanged (update refused and logged).
Already migrated (--background) Unchanged, no migration line.
Any other shape (other executable, arguments, or action count) Unchanged. The guards are the same as on main.

CI attribution at 7b919f57 (previous head)

This PR changes only installer.iss and InstallerIssAssertionTests.cs.

  • Setup and connect E2E (WSL Latest) failed in SetupAndConnectTestsSearchProof.ReleasedGateway_SearchDenialAndDashboardRoutes. The same test failed on main 3981f636, this PR's base, in run 45558413148.
  • Mock Gateway application and compatibility tests failed in the chat UI test GatewayFixtureUiTests.LocalDraft_SendAcceptedAfterAwayAndBack_PromotesNavigationIdentity. That test does not use the installer.
  • CI Gate reports those two failures.

Work sessions

Linked for team reference; these sessions aren’t public.

Worked on by

Worked on by:
- @MertBasar0

Co-authored-by: MertBasar0 <[email protected]>
OpenClaw-Publication: 6362370f-8338-46de-9b4f-b21b8863d148
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P1 Urgent regression or broken agent/channel workflow affecting real users now. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 25, 2026
@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Codex review: blocked before merge.

What this changes

This PR replaces an interactive startup-task migration command with a noninteractive Task Scheduler COM update.

Example: A Windows 11 silent upgrade encounters an argument-free OpenClaw Companion startup task.

  • Before: Setup waits indefinitely while hidden schtasks.exe asks for an account password.
  • After: Setup updates the task to --background when permitted, or logs the refusal and finishes.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correct repair with native installer behavior and task-preservation evidence; exact-head CI is pending and signed release acceptance remains separately gated.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): Supplied Windows 11 Dev-installer output exercises successful migration, repeat execution, and denied updates; the flags-build run verifies that saving a registration-trigger task does not launch Companion, while official signed-artifact acceptance remains a separate maintainer-owned gate.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: An upgrade can finish copying files but never exit because startup-task migration waits for an invisible password prompt.
Reason: This is a focused repair of demonstrated shipped behavior that preserves the existing best-effort migration policy and requires no new product option.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR fixes a verified installer hang that remains on main and in v2026.11.3; no actionable correctness or security defect was found.

Reviewed head: a1a269725f1643cc69c75c331eacbbe0896831a0

Before merge

  • Await maintainer action - Approve and schedule windows-clean-installer-upgrade using exact signed artifacts for the reviewed change.

Findings

None.

Tests

  • Missing end-to-end proof: The declared signed-artifact clean-install, previous-release upgrade, repair, and uninstall pool remains unexecuted and requires maintainer scheduling.
Agent review details

How this fits together

The Inno installer runs legacy startup migration after installing files, reads the installation's existing Windows scheduled task, and saves its action arguments through Task Scheduler.

flowchart TD
  A[Companion installer] --> B[Post install migration]
  B --> C[Existing task definition]
  C --> D[Installation ownership guards]
  D --> E[Task Scheduler COM update]
  E --> F[Updated task or logged refusal]
  F --> G[Setup finishes]
Loading

Technical review

Best possible solution:

Retain the guarded COM update in the existing installer migration and complete the required signed-artifact validation.

Do we have a high-confidence way to reproduce the issue?

Current-main source confirms the hidden synchronous wait, and the linked report and PR supply Windows reproductions with the password prompt and blocked installer; this review did not execute them.

Is this the best way to solve the issue?

The direct COM update addresses the interactive command at its existing owner, preserves the original migration guards, and catches refused saves without adding timeout or child-process machinery.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against e4bedeb1d2cc.

Provenance checked

  • Legacy startup-task migration and its source assertions keeps the original intent (3a58bf3: The original change migrated installation-owned argument-free startup registrations to background launch without enabling tasks or replacing their principal and triggers.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change: The pinned introduction diff replaces schtasks /Change entirely within the existing migration owner, retains its ownership guards, and adds preservation flags plus focused source assertions. (installer.iss:498, a1a269725f16)
  • Still needed on main and released source: Verified main and v2026.11.3 both contain installer blob da9e9b6d253ae2fe268752d0c43dcf5cdfb543df, whose post-install migration waits synchronously for hidden schtasks /Change. (installer.iss:506, e4bedeb1d2cc)
  • Native behavior and compatibility evidence: The full PR body, captured as sourceRevision 3513e022d2107a1067c7b6204af2bc91f682f2da75613646876d93cf57f12c19, supplies Windows 11 Dev-installer results for successful migration, repeat upgrade, access-denied preservation, and current-head registration-trigger suppression; MertBasar0 independently records the original elevated-task case at fix: finish Companion upgrades that hung on the old startup task #2373 (comment). (installer.iss:525, a1a269725f16)
  • Maintainer-owned signed installer gate: The applicable windows-clean-installer-upgrade pool requires official signed artifacts and maintainer approval; its declared execution remains blocked rather than being satisfied by unsigned Dev runs. (.github/proof-pools.json:265, a1a269725f16)
  • Original intent and feature history: The patch of feat(workspace): add native Home and Sessions workspace #1541 (feat(workspace): add native Home and Sessions workspace) introduced this migration and its guarded background-launch behavior; this PR preserves that intent while replacing the blocking mechanism. (installer.iss:464, 3a58bf34902f)
  • Task Scheduler producer contract: Microsoft's RegisterTaskDefinition contract documents definition-supplied credentials, update-only registration, preservation of principal ACEs, and suppression of registration triggers, matching the changed call.

Likely related people:

  • Scott Hanselman: Raw commit 006fcd2 adds installer.iss:32 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 006fcd288b43; files: installer.iss)

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Focused change size Installer +32/-14 lines; tests +31/-3 lines Growth supports the direct API replacement, task-preservation flags, and distinct installer source contracts without adding another production owner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #2320
Summary: This PR directly repairs the hidden password-prompt wait documented by the linked installer report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-11-25T08:26:01.057Z sha 7b919f5 :: blocked before merge. :: none
  • reviewed 2026-11-25T13:04:34.577Z sha 7b919f5 :: blocked before merge. :: none

Reviewed November 25, 2026, 8:22 AM ET / 13:22 UTC (Revision 3).

@MertBasar0

Copy link
Copy Markdown
Contributor

I also ran the original #2320 case on the same Windows 11 machine: a legacy task created from an elevated prompt, then a non-elevated silent upgrade. It used the Dev identity and the same two installers as the PR body: main 2A5A1786…, and this change's installer.iss built as 350CEC0E….

The task was created elevated with schtasks /Create /SC ONLOGON /TN "OpenClaw Companion (Dev)" /TR "\"<app>\OpenClaw.Tray.WinUI.exe\"" and no /RU. That gives a logon trigger, Interactive, Limited, and no arguments. Its security descriptor gives Administrators and SYSTEM full control and the signed-in user read access only.

Setup Result
main Still running after 120 s, with a schtasks.exe /Change child. After that child was ended, setup logged Could not migrate startup task. and exited. Task unchanged.
this PR Exited by itself in 9.9 s and logged Could not migrate startup task. Re-enable Start with Windows in Settings. Task unchanged: no arguments, Interactive, Limited, logon trigger, enabled.

For this case the change ends the hang, but it does not migrate the task. A standard user cannot write a task that an administrator created, so setup logs the existing line and finishes. The task keeps starting Companion at logon without --background, which is the same end state main reaches once its hang is ended. The Dev install and the task were removed afterwards.

@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Nov 25, 2026
Worked on by:
- @MertBasar0

Co-authored-by: MertBasar0 <[email protected]>
OpenClaw-Publication: eda987ee-d21a-416d-946b-c599de625a54
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

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

impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P1 Urgent regression or broken agent/channel workflow affecting real users now. proof: sufficient Contributor real behavior proof is sufficient. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Installer upgrade hangs on schtasks /Change when an argument-free startup task exists

2 participants