Skip to content

fix(setup): autostart from setup opens the window at logon - #1963

Open
roboclaw-bot wants to merge 3 commits into
mainfrom
openclaw/fix-setup-autostart-background
Open

roboclaw-bot wants to merge 3 commits into
mainfrom
openclaw/fix-setup-autostart-background

Conversation

@roboclaw-bot

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

Copy link
Copy Markdown
Contributor

Closes #1957

What Problem This Solves

Fixes: autostart turned on during setup opens the Companion window at logon when the session is not elevated, and setup can report that it could not confirm a task it did create.

User Impact

User impact: every autostart registration now starts quietly in the tray. Setup no longer rejects the app's own scheduled task.

Behavior to review: MatchesExpectedTask now requires --background. A legacy task with no arguments counts as Different, the same answer it gives for any other command line.

Why This Change Was Made

Preserved invariant: docs/CONNECTION_ARCHITECTURE.md says new autostart registrations pass --background. The Run key fallback in ApplySetupPreferenceAsync was the one writer that did not, and that fallback is the normal path without elevation, because schtasks /Create /SC ONLOGON is refused. MatchesExpectedTask required empty arguments while CreateRegisterProcessStartInfo always registers --background, and its test fixture used empty arguments, so nothing caught the mismatch. CreateBackgroundLaunchCommand is now the single owner of that command.

Evidence

Windows 11 x64 build 26200, standard session without elevation:

schtasks /Create /SC ONLOGON /HRESULT exit: 0x80070005

The updated tests against the baseline matcher, with the arguments the app really registers:

Failed OnlyExactEnabledStartupTaskCountsAsCompletedRegistration(changed: "expected", matches: True)
Failed OnlyExactEnabledStartupTaskCountsAsCompletedRegistration(changed: "no-arguments", matches: False)

They pass with this change. ActivationRouterTests already pins that an unpackaged launch with no arguments opens a window and that --background does not.

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs or instructions
  • Tests or validation
  • Security hardening
  • Chore or infrastructure

Scope

  • Tray or WinUI UX
  • Windows node capability
  • Local MCP or winnode
  • Gateway, connection, or pairing
  • Setup or onboarding
  • Permissions, privacy, or security
  • Tests, CI, or docs

Required proof pools

  • windows-wsl-gateway-e2e: the startup registration written by product setup changed. Not run here.

Validation

Run on a4dd026 plus this change. Windows 11 x64 build 26200, tr-TR, .NET SDK 10.0.402.

  • ./build.ps1: succeeded.
  • Shared tests: 4809 passed, 2 failed, 26 skipped. Both failures come from this host and are in code this PR does not touch: ExecReusableCommandBinderTests.PinnedCarrier_IgnoresShadowInsertedAfterApproval (computer name longer than 15 characters) and MxcFolderAdmissionTests.OwnedJunctionAndSymbolicLinkAreRejectedWithoutFollowingTheirChildren(symbolic: True) (no symbolic link privilege).
  • Tray tests, with the OPENCLAW_TRAY_* directories isolated: 4799 passed, 0 failed.

Run-key writer regression guard

Mert-provided Windows 11 evidence at a5f03d81917b46c1fa48dab10ed3c698f08d5843, whose source tree aa19cf9252e24cb0179e993ffb94c43efdb53c32 is identical to published head fb0008158eaa2e6def19e901c79ed179d6f5b5e6. These Windows tests were not rerun in this Linux publication session.

  • SetupStartupPolicyTests: 14 passed.
  • EveryRunKeyWriteUsesTheSharedBackgroundLaunchCommand: GREEN with the shared background command in both Run-key writers.
  • RED when the setup Run-key writer was independently reverted to a bare quoted executable path.
  • RED when the Settings Run-key writer was independently reverted to a bare quoted executable path.
  • Both writers were restored to the shared background command.
  • Completing standard-user setup and logging on again remains NOT VERIFIED.

Real Behavior Proof

  • Environment tested: Windows 11 x64 build 26200 (tr-TR), not elevated.
  • PR head or commit tested: a4dd026 plus this change. CI on the PR head is the current-head result.
  • Exact steps or command run: dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --filter "FullyQualifiedName~StartupTaskInspectionTests", with and without the matcher change, plus a uniquely named transient schtasks /Create /SC ONLOGON probe that was refused.
  • Evidence after fix: Passed! - Failed: 0, Passed: 20, Skipped: 0, Total: 20.
  • Observed result: the app's real arguments match the strict inspection, and missing arguments do not.
  • Logon with the --background task at fb0008158e (MertBasar0, Windows 11 Home 26200, run outside the Claude desktop MSIX package): PASS. After signing out and in, the task ran at the logon second. It started one Dev process (parent svchost.exe, --background, no main window) in MCP-only mode. No Run value existed. The task came from an earlier test run, not from setup in this run. Proof
  • Screenshot or artifact links verified? (Yes/No/N/A): N/A
  • Not verified or blocked:
    • Completing the setup wizard and logging on again.
    • The setup Run-key fallback starting this build at logon.
    • TaskRegisteredByTheAppMatchesTheStrictInspection exits early on this host because Windows refuses the logon task, so its round trip through InspectStrict is only proven on an elevated host.
    • An existing argument-free Run value is still migrated only by the installer on upgrade.

Security Impact

  • New permissions or capabilities? (No)
  • Secrets or tokens handling changed? (No)
  • New or changed network calls? (No)
  • Command or tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any answer is Yes, explain the risk and mitigation:

Compatibility and Migration

  • Backward compatible? (Yes)
  • Config or environment changes? (No)
  • Migration needed? (No)
  • If yes, list the exact upgrade steps:

Review Conversations

  • I replied to or resolved every bot review conversation addressed by this PR.
  • I left unresolved only conversations that still need maintainer judgment.

Upgrade compatibility: measured at fb0008158e

The "Upgrade compatibility" table further down was written before the latest-stable upgrade proof (v2026.11.3 to this head, unsigned Dev-identity builds; see the upgrade-proof comment, #1963 (comment)). Two of its rows are superseded:

The other rows matched the measurements: the Settings Run value and 11.3's own --background task were unchanged, and this PR's InspectStrict reports ExpectedEnabled for that task.

Worked on by

Upgrade compatibility

This change touches no stored settings. settings.json, AutoStart and the gateway registry are read and written exactly as before. It changes only two things: the command a new autostart registration writes, and which existing scheduled task setup accepts as its own. Every registration an earlier release can leave behind:

Existing registration (who wrote it) After upgrade, before any toggle or setup Next setup or Settings apply
Run value "<exe>" --background (Settings toggle) Unchanged. Still starts in the background. Toggle reads On. Rewritten to the same value.
Run value "<exe>" (setup fallback before this fix) Unchanged. Still starts at logon, still with a window. Toggle reads On (IsAutoStartEnabled checks only that the value exists). Setup: registration is rejected on a standard account and no task exists, so the value is rewritten with --background. Settings Off then On also rewrites it. #1964's installer migration also rewrites this exact value with --background (proven live at e4affd6).
Task "<exe>" --background (created since #1541) Unchanged. Starts in the background. Previously InspectStrict reported Different for setup's own task, so setup could reject its own correct registration. Now ExpectedEnabled. This is the fix.
Task "<exe>" with no arguments (created before #1541, needs elevation) Unchanged. Still starts at logon. Exists still reports it, so the toggle reads On. /Create /F replaces it with the --background task whenever registration succeeds. If registration is rejected, InspectStrict now reports Different and setup shows its existing "could not be confirmed" warning instead of accepting a task that opens a window. No fallback Run value is created. Turning autostart off still unregisters it (Different != Absent).

Nothing stops loading or working. The only behavior difference for old data is that setup no longer silently accepts the pre-#1541 argument-free task.

Tests covering these rows:

  • StartupTaskInspectionTests.OnlyExactEnabledStartupTaskCountsAsCompletedRegistration covers --background matches, plus the no-arguments and arguments cases.
  • SetupStartupPolicyTests.ConfirmedRejectionStillRequiresExactTaskInspection and AmbiguousRegistrationNeverCreatesRunKey cover Different: a throw with no Run key.
  • DisableRequiresBothRunKeyRemovalAndSuccessfulTaskRemoval covers unregistering any present task.

Worked on by:
- @MertBasar0

Co-authored-by: MertBasar0 <[email protected]>
OpenClaw-Publication: 1f24c030-95c3-4ab0-95c7-0db0cc2ebe0a
@clawsweeper

clawsweeper Bot commented Nov 1, 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 clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codex review: needs maintainer review before merge.

What this changes

This PR makes unpackaged startup writers share the background launch command and aligns scheduled-task inspection with that command.

Example: A standard Windows session enables Start with Windows during setup and task creation is denied.

  • Before: Setup writes "C:\Apps\OpenClaw\OpenClaw.Tray.WinUI.exe" without arguments, so logon opens a window.
  • After: Setup writes "C:\Apps\OpenClaw\OpenClaw.Tray.WinUI.exe" --background, which requests a quiet tray launch.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The focused patch and regression coverage are sound; available runtime evidence covers only part of the changed user path.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Enabling startup through setup can open an unwanted window at logon or report failure despite an existing correct task.
Reason: The change restores the documented quiet-start contract and preserves the existing conservative fallback policy.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes two source-confirmed startup inconsistencies still present on current main, with no introduced correctness defect found.

Priority: P2
Reviewed head: fb0008158eaa2e6def19e901c79ed179d6f5b5e6

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Show current-head standard-user setup enabling startup, task rejection with the setup-owned Run value written, and the next logon producing one Companion process without a window, using screenshots or redacted logs with IPs, keys, phone numbers, and non-public endpoints removed.
Agent review details

How this fits together

Setup and Settings send startup preferences to AutoStartManager, which registers a scheduled task or an admitted HKCU Run fallback; Windows later launches Companion and ActivationRouter determines whether to open a window.

flowchart TD
  A[Setup and Settings] --> B[AutoStartManager]
  B --> C[Shared background command]
  C --> D[Scheduled task]
  C --> E[HKCU Run fallback]
  D --> F[Windows logon]
  E --> F
  F --> G[Companion activation]
Loading

Technical review

Best possible solution:

Land the shared background command and aligned strict matcher once the setup-written standard-user Run fallback is demonstrated at logon.

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

Current-main writers, strict inspection, fallback policy, and activation tests establish both defects; contributor evidence also demonstrates the matcher difference on a real task.

Is this the best way to solve the issue?

The patch is the smallest complete repair using existing owners: share the quiet-launch command and align inspection while retaining exact task identity and duplicate-prevention checks.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Strict setup registration and Run fallback keeps the original intent (3eed1f1: The onboarding work added explicit startup application and strict task inspection so ambiguous failures cannot create duplicate startup entries.)
  • Background task and Settings launch commands keeps the original intent (3a58bf3: The Workspace launch change made task and Settings registrations pass --background while ordinary argument-free launches open the appropriate window.)
  • Acceptance of legacy argument-free tasks changes intended behavior with a stated reason (3eed1f1: The original strict matcher expected the argument-free task form; the PR explains why that no longer satisfies quiet startup and retains rejection without a competing Run fallback.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Karen: Raw commit dae64b6 adds src/OpenClaw.Shared/WindowsStartupTaskRegistration.cs:27 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: dae64b6c49e9; files: src/OpenClaw.Shared/WindowsStartupTaskRegistration.cs)
  • Vincent Koc: Raw commit 260fb90 adds src/OpenClaw.Shared/WindowsStartupTaskRegistration.cs:28 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 260fb90c6dc7; files: src/OpenClaw.Shared/WindowsStartupTaskRegistration.cs)

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
Production and regression scope Production +13/-5; tests +57/-1 The small shared builder serves three writers; tests cover command generation, strict matching, real task inspection, and both Run writers.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #1957
Summary: This PR addresses the reported startup-command and matcher inconsistencies; installer shortcut ownership and migration hangs are distinct work.

Members:

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

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Unexpected logon windows and conditional setup confirmation failures affect a limited unpackaged startup path.
  • merge-risk: 🚨 compatibility: Legacy argument-free scheduled tasks deliberately change from accepted to Different; the PR records this direction and upgrade measurements without changing stored preferences.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

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 (4 earlier review cycles)
  • reviewed 2026-11-01T00:33:49.963Z sha 84861c4 :: blocked before merge. :: [P3] Give the round-trip test its own temporary executable
  • reviewed 2026-11-09T01:05:14.562Z sha 932ad82 :: blocked before merge. :: none
  • reviewed 2026-11-11T23:14:04.284Z sha fb00081 :: blocked before merge. :: none
  • reviewed 2026-11-17T13:37:00.693Z sha fb00081 :: blocked before merge. :: none

Reviewed November 18, 2026, 4:28 PM ET / 21:28 UTC (Revision 5).

Worked on by:
- @MertBasar0

Co-authored-by: MertBasar0 <[email protected]>
OpenClaw-Publication: c3f43654-073b-4718-aee9-3c89dfe214fa
@MertBasar0

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

1 similar comment
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 9, 2026
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

PR cleanup review

Reviewed head: 932ad829515d2e7e4f463f5e518a640d594e69f8. Main comparison: e59374c064f43d68f5c72d070d4c89ef2d20ec3b.

This remains a useful independent fix: main still writes an argument-free setup fallback while its task writer uses --background, and the strict matcher disagrees with that writer. The patch aligns all three paths without weakening fallback admission. CI is green, but the roundtrip test can return early on access denial and the actual setup-to-logon path is explicitly unverified. Please retain that proof gap until both the standard-user and task-registration paths are demonstrated on the candidate.

Action in this cleanup pass: leaving this PR open. No branch changes or runtime-proof waiver. The findings above come from source, discussion and recorded-CI review; Windows validation was not rerun in this pass.

@shanselman

Copy link
Copy Markdown
Collaborator

Hi, I'm a Copilot triage agent working for the maintainers (not Scott himself), taking an overnight look at this one. I did not push anything or change labels. This is just a status note so the next person has the details.

What I checked

I merged this PR's head (932ad829) with the current main (22c111d4) in a scratch worktree. It merges cleanly. On that merge result:

  • build.ps1: succeeded
  • Shared tests: 5764 passed, 0 failed, 27 skipped (the usual MXC and GPU opt-in skips)
  • Tray tests: 6291 passed, 0 failed (the startup, installer and activation subset is 186 tests)
  • git diff --check: clean, and my real Companion profile was untouched by the run

What looks right

The fix lines all three writers up on one --background command. The one that matters for #1957 is the Run-key fallback that setup writes in a standard session, where schtasks /Create /SC ONLOGON is refused. That value was a bare quoted path, so the logon launch opened a window. The strict matcher also now agrees with the task writer, which already passed --background.

A small test gap (suggested, not pushed)

The new tests cover the task command and the matcher. Nothing checks the two Run-key writers in AutoStartManager.cs, because that class is not linked into the Tray test project. This source-level guard keeps a later edit from putting the bare path back. It passes on the merge result, and I checked that it can fail: putting the bare quoted path back in either Run-key writer (including the setup fallback at the center of #1957) makes it fail, and restoring the code makes it pass again.

Suggested test for SetupStartupPolicyTests.cs
// also needs: using System.Text.RegularExpressions;
[Fact]
public void EveryRunKeyWriteUsesTheSharedBackgroundLaunchCommand()
{
    var source = File.ReadAllText(Path.Combine(TestRepositoryPaths.GetRepositoryRoot(),
        "src", "OpenClaw.Tray.WinUI", "Services", "AutoStartManager.cs"));
    var writes = Regex.Matches(source, @"\.SetValue\(AppName,[^;]*;").Select(match => match.Value).ToList();

    // A Run entry without --background opens a window at logon (#1957).
    Assert.NotEmpty(writes);
    Assert.All(writes, write =>
        Assert.Contains("WindowsStartupTaskRegistration.CreateBackgroundLaunchCommand(", write));
}

What I could not verify, and why I am not landing it overnight

  • A real standard-user run (task refused, fallback Run entry written, logon launch stays in the background) and the elevated task-registration path. Proving that means registering a logon entry on a shared dev machine, so I left it for a maintainer or an isolated VM. I agree with the earlier review notes that this proof gap should stay open.
  • The last green Gate on this PR is from Nov 6. It needs a fresh run on the current merge result.
  • One narrow compatibility question for a maintainer: a legacy scheduled task with no --background argument (from an older build or made by hand) would now inspect as Different, so the strict check would throw "Windows startup registration could not be confirmed" instead of accepting it. The installer's post-install step already rewrites exact legacy task and Run entries to --background, but it runs with PrivilegesRequired=lowest, so it may not be able to change a task created from an elevated session. I expect this to be rare and the error is visible, so it may be acceptable, but that is a call for the owner.

Thanks to everyone who worked on this. It is a good, small fix, and it is close.

Worked on by:
- @MertBasar0

Co-authored-by: MertBasar0 <[email protected]>
OpenClaw-Publication: deb07440-bd17-4aa6-9c41-4499ba4c2871
@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 11, 2026
@MertBasar0

Copy link
Copy Markdown
Contributor

On the compatibility question from the triage note (a legacy scheduled task with no --background argument):

This case is already covered in the PR. The "Upgrade compatibility" table in the body has a row for it ("Task "<exe>" with no arguments"), and two tests pin it: StartupTaskInspectionTests treats a task with no arguments as not matching, and SetupStartupPolicyTests shows that a rejected registration plus a Different task throws and writes no Run value.

The strict result is deliberate. Before this change the matcher accepted exactly that task, and that task opens a window at logon, which is #1957. Accepting it again would keep the bug for those users. Writing the Run fallback next to it would start Companion twice at logon. So setup shows its existing "could not be confirmed" warning, creates no fallback entry, and an elevated retry replaces the task with the --background one (/Create /F).

The affected group is narrow: the task must have been created from an elevated session, and setup must run later without elevation. If you would prefer a message specific to this case, I can add that as a follow-up.

The suggested Run-key guard test is now in the PR (head fb000815). The standard-user logon proof is still not verified.

@MertBasar0

Copy link
Copy Markdown
Contributor

Logon proof at fb0008158e (Windows 11 Home 26200, not elevated). This run was done outside the Claude desktop MSIX package. That matters: package-private AppData and HKCU writes invalidated earlier logon results on this machine, see the #1964 correction.

Setup. Every install and launch below was run by a process outside the package.

  • The Dev installer built from fb00081 was installed silently with /TASKS="".
  • Dev settings were set to {"EnableMcpServer": true}. This is MCP-only mode, so first-run setup is skipped and no Gateway, pairing or credentials are involved.
  • The logon task OpenClaw Companion (Dev) already existed from an earlier test run on this machine (created 2026-11-13). Its action is "<install>\OpenClaw.Tray.WinUI.exe" --background. Setup did not create it in this run.

After signing out and in:

  • The task's LastRunTime is the logon second. LastTaskResult is 0x41301 (still running), which is expected while Companion is up.
  • There is exactly one Dev process. Its parent is svchost.exe (Task Scheduler), its command line is "<install>\OpenClaw.Tray.WinUI.exe" --background, and its MainWindowHandle is 0.
  • The log after logon shows MCP-only mode and Application started, with no setup window lines.
  • There is no OpenClawTray-Dev Run value, so only the task could have started it.

What this shows. A --background logon task starts this build in the tray without a window. That is the task form InspectStrict now reports as ExpectedEnabled.

What it does not show:

@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Nov 17, 2026
@MertBasar0

Copy link
Copy Markdown
Contributor

Latest-stable upgrade proof for the data-model compatibility item: v2026.11.3 (66b9b5a) to fb0008158e, on Windows 11 Home 26200, run outside the Claude desktop MSIX package.

How it was run.

  • Both installers are unsigned Dev-identity builds made from source: 11.3 as 2026.11.3, this PR as 2026.11.4-proof.
  • Each row started from a clean state, then:
    1. Fresh install of 11.3 with MCP-only Dev settings.
    2. The row's state was created.
    3. Plain silent upgrade (/SILENT /SUPPRESSMSGBOXES /NORESTART, no /TASKS).
    4. The new build was started.
  • Each step was compared against a snapshot of settings, Run value, task, link and data files. The toggle was read with UI Automation.
  • InspectStrict was called through each build's own OpenClaw.Shared.dll, loaded side by side in a small harness.
  • On this machine a non-elevated schtasks /Create /SC ONLOGON is denied (RegisterForSetup = Rejected). Task rows were therefore created from an elevated process, as noted.
  • The signed release-identity upgrade is still not covered.
Row State left by 11.3 After upgrade and first start
T1 Settings On in 11.3 (Run "<install>\…exe" --background) Run value and settings unchanged, toggle On.
T2 Task created by 11.3's own Register (elevated): "<install>\…exe" --background Task unchanged. On the same real task, 11.3 InspectStrict = Different and this PR's InspectStrict = ExpectedEnabled, before and after the upgrade (also from a non-elevated process). Toggle On.
T4 The argument-free Run value "<install>\…exe" that 11.3's setup fallback writes (hand seed of that exact value) Rewritten by the installer, log Migrated existing Run registration to background launch. The new value is <install>\…exe --background, unquoted. That writer is main's MigrateLegacyBackgroundLaunch, unchanged by this PR; #1964 makes it quote the path. Settings unchanged, toggle On.
T3 Pre-#1541 argument-free task (elevated hand seed) 11.3 InspectStrict = ExpectedEnabled, this PR = Different (as designed). The upgrade hung, see below. Once it finished, the task was unchanged, settings unchanged and toggle On.
T5 Clean, this PR's RegisterForSetup (elevated) Registered, then InspectStrict = ExpectedEnabled; the task action is "<install>\…exe" with --background. Non-elevated on this machine: Rejected, so setup takes the Run fallback.

T3 hang (pre-existing, not from this PR).

  • MigrateLegacyBackgroundLaunch runs schtasks /Change /TN "OpenClaw Companion (Dev)" /TR "\"…\" --background" through Inno Exec with SW_HIDE and ewWaitUntilTerminated.
  • For this task, schtasks writes Please enter the run as password for <user>: to the hidden console and waits. A captured rerun of the same command did not exit within 15 s.
  • The silent upgrade stayed at ssPostInstall for over 6 minutes, until I ended schtasks.exe. Setup then logged Could not migrate startup task. Re-enable Start with Windows in Settings. and finished.
  • The same code is in v2026.11.3 and main. Filed separately as Installer upgrade hangs on schtasks /Change when an argument-free startup task exists #2320.

Correction to this PR's "Upgrade compatibility" table. The row for Run "<exe>" says it is unchanged after upgrade, and credits the rewrite to #1964. T4 shows that the installer already rewrites it on every upgrade. The body will be corrected.

@roboclaw-bot

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 18, 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

merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autostart turned on during setup opens the Companion window at logon

3 participants