Skip to content

fix: keep update progress reads from blocking preparation - #161982

Closed
1052326311 wants to merge 1 commit into
openclaw:mainfrom
1052326311:fix/update-progress-blocking
Closed

1052326311 wants to merge 1 commit into
openclaw:mainfrom
1052326311:fix/update-progress-blocking

Conversation

@1052326311

Copy link
Copy Markdown
Contributor

Related: #161867

What Problem This Solves

Fixes foreground update progress repeatedly blocking the CLI event loop while reading SQLite history.

User Impact

Progress observation no longer waits synchronously for a snapshot worker. Cold readers still prepare snapshots asynchronously; this does not eliminate all snapshot I/O or all reported update delay. Existing warm-reader reuse is preserved.

Why This Change Was Made

The display uses the existing asynchronous ledger reader, allows only one read at a time, and rejects stale results across suspension, resumption, disposal, and report handoff. Committed step callbacks retain their rows. Before activation, it joins either lookup outcome and drains the canonical database owner for that run's exact path. Ordinary history lookup failures remain diagnostic-only; real drainage failures stop mutation. No schema, admission, or migration policy changes.

Evidence

Matched isolated10-second observations, with valid ledger/disabled controls and real Phase: requested output:

Arm Sync polling workers Async polling snapshot preparations
Original cold 13 0 (uses synchronous workers)
Candidate cold 0 5
Original warm 0 0
Candidate warm 0 0

The candidate performed four cold and32 warm polling read dispatches. Cold initialization was516.522ms original versus9.119ms candidate; warm was0.561ms versus4.229ms. These are single bounded samples, not benchmark distributions. Both warm cases already avoid snapshots. Cold fallback remains necessary when no native database is retained; the change does not bootstrap a database to manufacture a warm path.

Published OpenClaw2026.9.4 created a real isolated ledger in a separate process, then this candidate observed it: real phase output, four polling reads, five async snapshot preparations, zero synchronous polling workers. This covers installed-ledger-to-candidate progress observation, not complete package replacement/service activation. Call-through MessagePort instrumentation counts actual dispatches, not physical bytes or successful OS child launches. Filesystem events are supplemental only.

Candidate d52f51daa7b92a8f1fce088751d3307d1e3b9c7e, base f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d; macOS arm64, Node26.8.2. Seven-file patch SHA256 242b2638dab3494121750f95c5a3986ce66edd39d5169edff4adad57e8108eba.

151 focused tests passed: progress31, execution76, command-run44. Prior unchanged adjacent ledger-reader19, migrated-update26, and warm-source5 passed. Scoped lint, core/CLI-update types, formatting, line-cap, guards, diff and secret checks passed. Execution tests took6.07s; combined progress/command-run16.85s. Hosted CI cost is unmeasured. Full repository tests/build and hosted CI were not run for this candidate.

node scripts/run-vitest.mjs src/cli/update-cli/progress.test.ts src/cli/update-cli/update-command-run.test.ts src/cli/update-cli/update-command-execution.test.ts

Independent review found no actionable P0–P2 findings on the exact patch. Earlier clean reviews were superseded after the coordinator found missing activation drainage and ordinary-error availability issues; both were corrected before the final review. Fault injection exercises the real read/close owners and distinguishes released lookup rejection from retained cleanup failure, without claiming a live worker crash reproduction.

AI assistance: Codex assisted implementation, tests and evidence collection, with separate read-only review and coordinator review. The implementation owner understands the observation, generation, and exact-path drainage contracts.

  • Include useful validation evidence.
  • Confirm understanding of the code and its ownership boundaries.
  • Complete independent review and address accepted findings.
  • Follow current hosted review feedback.

Complete inspectable driver bytes and redacted outputs follow.

Reproduce the bounded progress observations

Inspectable progress observation evidence — publication draft

This is a bounded observation proof, not a complete package-replacement/service-activation test.
Cold fallback still prepares snapshots. Warm baseline already avoids snapshots; the candidate preserves that behavior.
Dispatch counts do not measure physical bytes or successful OS child launches. Filesystem events are supplemental only.
The installed-ledger cell uses OpenClaw2026.9.4 in a separate isolated process before candidate observation.

Save the exact driver below as scripts/repro-161867-update-progress.mts inside the candidate checkout.
Prepare original owner bytes with:

git show f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d:src/cli/update-cli/progress.ts > src/cli/update-cli/progress.baseline-proof.ts

Use the repository's locked dependencies and supported scripts/tsx.mjs loader.
Run sequentially, replacing OUTPUT with an absolute evidence filename:

node --import ./scripts/tsx.mjs scripts/repro-161867-update-progress.mts OUTPUT 10000 baseline cold
node --import ./scripts/tsx.mjs scripts/repro-161867-update-progress.mts OUTPUT 10000 baseline warm
node --import ./scripts/tsx.mjs scripts/repro-161867-update-progress.mts OUTPUT 10000 candidate cold
node --import ./scripts/tsx.mjs scripts/repro-161867-update-progress.mts OUTPUT 10000 candidate warm
node --import ./scripts/tsx.mjs scripts/repro-161867-update-progress.mts OUTPUT 10000 candidate cold published

The last command requires the exact installed distribution path named in the driver; it must not be silently replaced with another version.
Each run creates private HOME/state/cache before production imports. It preserves its fixture. It does not claim runtime network blocking.
The published seed child calls the installed ledger owner; it does not invoke the live CLI or change the installation.

Redacted results

Derived directly from actual JSON; private fixture paths/run IDs and supplemental filesystem names omitted.

[
  {
    "artifact": "baseline-cold-proof",
    "variant": "baseline",
    "temperature": "cold",
    "baseSha": "f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d",
    "candidateSha": "d52f51daa7b92a8f1fce088751d3307d1e3b9c7e",
    "ownerSha256": "3658249a60d52ca0569a5aa837547d94c274d82b54968f43306b5a20eba5c859",
    "candidateDiffSha256": null,
    "publishedDriver": null,
    "observationWindowMs": 10000,
    "initializationMs": 516.5220000000008,
    "syncPollingWorkers": 13,
    "asyncPollingReads": 0,
    "asyncPollingSnapshotPreparations": 0,
    "disabledWorkers": 0,
    "renderedPhases": [
      {
        "stage": "enabled_initialization",
        "line": "Phase: requested"
      }
    ]
  },
  {
    "artifact": "baseline-warm-proof",
    "variant": "baseline",
    "temperature": "warm",
    "baseSha": "f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d",
    "candidateSha": "d52f51daa7b92a8f1fce088751d3307d1e3b9c7e",
    "ownerSha256": "3658249a60d52ca0569a5aa837547d94c274d82b54968f43306b5a20eba5c859",
    "candidateDiffSha256": null,
    "publishedDriver": null,
    "observationWindowMs": 10000,
    "initializationMs": 0.5605839999989257,
    "syncPollingWorkers": 0,
    "asyncPollingReads": 0,
    "asyncPollingSnapshotPreparations": 0,
    "disabledWorkers": 0,
    "renderedPhases": [
      {
        "stage": "enabled_initialization",
        "line": "Phase: requested"
      }
    ]
  },
  {
    "artifact": "async-cold-proof",
    "variant": "candidate",
    "temperature": "cold",
    "baseSha": "f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d",
    "candidateSha": "d52f51daa7b92a8f1fce088751d3307d1e3b9c7e",
    "ownerSha256": "f8b2de8a0071bc9fb7521480a5b3de3b1aa5ea381819c534aa8aaf796c9c20a0",
    "candidateDiffSha256": "242b2638dab3494121750f95c5a3986ce66edd39d5169edff4adad57e8108eba",
    "publishedDriver": null,
    "observationWindowMs": 10000,
    "initializationMs": 9.118624999999156,
    "syncPollingWorkers": 0,
    "asyncPollingReads": 4,
    "asyncPollingSnapshotPreparations": 5,
    "disabledWorkers": 0,
    "renderedPhases": [
      {
        "stage": "enabled_polls",
        "line": "Phase: requested"
      }
    ]
  },
  {
    "artifact": "async-warm-proof",
    "variant": "candidate",
    "temperature": "warm",
    "baseSha": "f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d",
    "candidateSha": "d52f51daa7b92a8f1fce088751d3307d1e3b9c7e",
    "ownerSha256": "f8b2de8a0071bc9fb7521480a5b3de3b1aa5ea381819c534aa8aaf796c9c20a0",
    "candidateDiffSha256": "242b2638dab3494121750f95c5a3986ce66edd39d5169edff4adad57e8108eba",
    "publishedDriver": null,
    "observationWindowMs": 10000,
    "initializationMs": 4.229040999998688,
    "syncPollingWorkers": 0,
    "asyncPollingReads": 32,
    "asyncPollingSnapshotPreparations": 0,
    "disabledWorkers": 0,
    "renderedPhases": [
      {
        "stage": "enabled_polls",
        "line": "Phase: requested"
      }
    ]
  },
  {
    "artifact": "published-candidate-cold",
    "variant": "candidate",
    "temperature": "cold",
    "baseSha": "f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d",
    "candidateSha": "d52f51daa7b92a8f1fce088751d3307d1e3b9c7e",
    "ownerSha256": "f8b2de8a0071bc9fb7521480a5b3de3b1aa5ea381819c534aa8aaf796c9c20a0",
    "candidateDiffSha256": "242b2638dab3494121750f95c5a3986ce66edd39d5169edff4adad57e8108eba",
    "publishedDriver": {
      "version": "2026.9.4",
      "ledgerSha256": "12c7786dc59e77733fecd9e802ec88e45cf851bd387e2aefcd6e383c1cd1e7cd",
      "boundary": "installed createUpdateRun in isolated child -> candidate progress observation; not full package replacement or service activation"
    },
    "observationWindowMs": 10000,
    "initializationMs": 12.4614160000001,
    "syncPollingWorkers": 0,
    "asyncPollingReads": 4,
    "asyncPollingSnapshotPreparations": 5,
    "disabledWorkers": 0,
    "renderedPhases": [
      {
        "stage": "enabled_polls",
        "line": "Phase: requested"
      }
    ]
  }
]

Exact driver bytes

SHA256: e221cd469fca7344d1842f14741f5c4ac9ddbb68a2636bc4b9b98c6fc818647a

/** Read-only baseline driver for #161867; it records real production worker calls. */
import childProcess from "node:child_process";
import { createHash } from "node:crypto";
import { watch } from "node:fs";
import { mkdtemp, mkdir, readFile, writeFile } from "node:fs/promises";
import { syncBuiltinESMExports } from "node:module";
import os from "node:os";
import path from "node:path";
import { performance } from "node:perf_hooks";
import { MessagePort } from "node:worker_threads";

type WorkerCall = { stage: string; durationMs: number; argv: string[] };
type StagingEvent = { stage: string; event: string };

const outputPath = process.argv[2] ?? "/tmp/openclaw-20260930-161867-proof.json";
const variant = process.argv[4] === "baseline" ? "baseline" : "candidate";
const temperature = process.argv[5] === "warm" ? "warm" : "cold";
const publishedSeed = process.argv[6] === "published";
const ownerFile = variant === "baseline" ? "progress.baseline-proof.ts" : "progress.ts";
const root = await mkdtemp(path.join(os.tmpdir(), "openclaw-161867-proof-"));
const stateDir = path.join(root, "state-root");
const cacheDir = path.join(root, "cache");
const homeDir = path.join(root, "home");
const env: NodeJS.ProcessEnv = { ...process.env, HOME: homeDir, XDG_CACHE_HOME: cacheDir, OPENCLAW_STATE_DIR: stateDir };
const savedEnvironment = Object.fromEntries(
  ["HOME", "XDG_CACHE_HOME", "OPENCLAW_STATE_DIR"].map((name) => [name, process.env[name]]),
);
let stage = "setup";
const workerCalls: WorkerCall[] = [];
const originalSpawnSync = childProcess.spawnSync;
const originalPostMessage = MessagePort.prototype.postMessage;
const asyncReadRequests: { stage: string; atMs: number }[] = [];
const asyncSnapshotRequests: { stage: string; atMs: number; preparationId: number }[] = [];

function restoreEnvironment() {
  for (const [name, value] of Object.entries(savedEnvironment)) {
    if (value === undefined) delete process.env[name];
    else process.env[name] = value;
  }
}

function sleep(ms: number) {
  return new Promise<void>((resolve) => setTimeout(resolve, ms));
}

function isSqliteReadOnlyWorker(args: unknown[]): args is [string[], ...unknown[]] {
  return Array.isArray(args[0]) && args[0].some((value) => String(value).includes("sqlite-readonly-location.worker"));
}

const observationWindowMs = Number(process.argv[3] ?? 3_000);
if (![3_000, 10_000].includes(observationWindowMs)) throw new Error("unsupported observation window");
const baselineSha = "f64aad1090a2b7e6cb7c73c0d2f3c2be55cc200d";
const candidateSha = originalSpawnSync("git", ["rev-parse", "HEAD"], { encoding: "utf8" }).stdout.trim();
const diff = originalSpawnSync("git", ["diff", "--full-index", "--binary", "--no-ext-diff", "--no-color", baselineSha, "HEAD", "--", "src/cli/update-cli"], { encoding: "utf8" }).stdout;
const ownerSha256 = createHash("sha256").update(await readFile(new URL(`../src/cli/update-cli/${ownerFile}`, import.meta.url))).digest("hex");

try {
  for (const [name, value] of Object.entries(env)) if (value !== undefined) process.env[name] = value;
  await Promise.all([mkdir(stateDir, { recursive: true, mode: 0o700 }), mkdir(cacheDir, { recursive: true, mode: 0o700 }), mkdir(homeDir, { recursive: true, mode: 0o700 })]);

  // Update the named builtin export before any production import binds spawnSync.
  childProcess.spawnSync = ((command: string, ...args: unknown[]) => {
    const startedAt = performance.now();
    const result = Reflect.apply(originalSpawnSync, childProcess, [command, ...args]) as ReturnType<
      typeof originalSpawnSync
    >;
    if (isSqliteReadOnlyWorker(args)) {
      workerCalls.push({
        stage,
        durationMs: performance.now() - startedAt,
        argv: args[0].map((value) => path.basename(String(value))),
      });
    }
    return result;
  }) as typeof childProcess.spawnSync;
  syncBuiltinESMExports();
  MessagePort.prototype.postMessage = function (...args: Parameters<MessagePort["postMessage"]>) {
    // The native lifetime owner forwards this exact envelope to the real worker.
    // Count dispatched tasks, not Worker creation or coalesced filesystem events.
    const request = args[0]?.type === "post" ? args[0].value : undefined;
    if (request?.input?.command?.type === "updateRuns.get") {
      asyncReadRequests.push({ stage, atMs: performance.now() });
    }
    if (request?.input?.type === "prepare" && request.input.pathname === path.join(stateDir, "state", "openclaw.sqlite")) {
      asyncSnapshotRequests.push({ stage, atMs: performance.now(), preparationId: request.input.preparationId });
    }
    return Reflect.apply(originalPostMessage, this, args);
  };

  // All production imports occur after the state, cache, and HOME sandbox is active.
  const [{ createUpdateProgress }, { createUpdateRun, getUpdateRun }, { closeOpenClawStateDatabaseAsync, closeOpenClawStateDatabaseForTest }, { resolveOpenClawStateSqlitePath }, { resolvePrivateSqliteSnapshotStagingRoot }] = await Promise.all([
    import(`../src/cli/update-cli/${ownerFile}`),
    import("../src/infra/update-run-ledger.ts"),
    import("../src/state/openclaw-state-db-cache.ts"),
    import("../src/state/openclaw-state-db.paths.ts"),
    import("../src/infra/sqlite-private-directory.ts"),
  ]);
  const stagingRoot = resolvePrivateSqliteSnapshotStagingRoot();
  const { openOpenClawStateDatabase } = await import("../src/state/openclaw-state-db.ts");
  const { defaultRuntime } = await import("../src/runtime.ts");
  const originalLog = defaultRuntime.log;
  const renderedPhases: { stage: string; line: string }[] = [];
  defaultRuntime.log = (...args) => {
    for (const value of args) if (typeof value === "string" && value.startsWith("Phase:")) renderedPhases.push({ stage, line: value });
    return originalLog(...args);
  };
  await mkdir(stagingRoot, { recursive: true, mode: 0o700 });
  const stagingEvents: StagingEvent[] = [];
  const watcher = watch(stagingRoot, (eventType, filename) => stagingEvents.push({ stage, event: `${eventType}:${filename?.toString() ?? ""}` }));
  try {
    const publishedLedger = "/opt/homebrew/lib/node_modules/openclaw/dist/update-run-ledger-B_LBZZgT.mjs";
    let publishedDriver: { version: string; ledgerSha256: string; boundary: string } | undefined;
    let run: { runId: string };
    if (publishedSeed) {
      // Separate process: installed and candidate native singleton owners never mix.
      // Its environment is isolated before the installed module is evaluated.
      const seeded = originalSpawnSync(process.execPath, ["--input-type=module", "-e",
        `const { r: createUpdateRun } = await import(${JSON.stringify(publishedLedger)}); console.log(JSON.stringify(createUpdateRun({ trigger: "cli" }, { env: process.env })));`,
      ], { env, encoding: "utf8", timeout: 30_000 });
      if (seeded.status !== 0 || seeded.error) throw new Error(`published ledger seed failed: ${seeded.error ?? seeded.stderr}`);
      run = JSON.parse(seeded.stdout.trim());
      if (!run.runId) throw new Error("published ledger did not return a run identity");
      publishedDriver = {
        version: JSON.parse(await readFile("/opt/homebrew/lib/node_modules/openclaw/package.json", "utf8")).version,
        ledgerSha256: createHash("sha256").update(await readFile(publishedLedger)).digest("hex"),
        boundary: "installed createUpdateRun in isolated child -> candidate progress observation; not full package replacement or service activation",
      };
    } else {
      run = createUpdateRun({ trigger: "cli" }, { env });
    }
    await closeOpenClawStateDatabaseAsync();
    if (temperature === "warm") openOpenClawStateDatabase({ env });

    stage = "disabled";
    const disabled = createUpdateProgress(false, { runId: run.runId, env });
    await sleep(observationWindowMs);
    disabled.dispose();
    await closeOpenClawStateDatabaseAsync();
    stage = "enabled_setup";
    if (temperature === "warm") openOpenClawStateDatabase({ env });

    stage = "enabled_initialization";
    const scheduledAt = performance.now();
    const timer = new Promise<number>((resolve) => setTimeout(() => resolve(performance.now() - scheduledAt), 0));
    const enabledStartedAt = performance.now();
    const enabled = createUpdateProgress(true, { runId: run.runId, env });
    const enabledInitializationMs = performance.now() - enabledStartedAt;
    const initialTimerLagMs = await timer;

    stage = "enabled_polls";
    await sleep(observationWindowMs);

    stage = "enabled_disposal";
    enabled.dispose();
    await closeOpenClawStateDatabaseAsync();

    stage = "verification";
    const record = getUpdateRun(run.runId, { env });
    await closeOpenClawStateDatabaseAsync();
    let warmSuspensionJoined = false;
    if (variant === "candidate") {
      stage = "warm_suspension";
      const warmRun = createUpdateRun({ trigger: "cli" }, { env });
      const warmObserver = createUpdateProgress(true, { runId: warmRun.runId, env });
      await warmObserver.suspend();
      // Deliberately use the native synchronous close as the post-join oracle:
      // unlike closeAsync it cannot hide an outstanding reader by draining it.
      closeOpenClawStateDatabaseForTest();
      warmObserver.dispose();
      warmSuspensionJoined = true;
    }
    const byStage = (name: string) => workerCalls.filter((entry) => entry.stage === name);
    if (!record || record.runId !== run.runId || record.status !== "running") throw new Error("production progress did not retain the isolated running update record");
    if (byStage("disabled").length !== 0) throw new Error("disabled display launched a SQLite read-only worker");
    if (asyncReadRequests.some((entry) => entry.stage === "disabled") || asyncSnapshotRequests.some((entry) => entry.stage === "disabled")) throw new Error("disabled display dispatched async reads or snapshots");
    if (variant === "candidate" && asyncReadRequests.filter((entry) => entry.stage === "enabled_polls").length < 3) throw new Error("fewer than three real async polling reads dispatched within fixed window");
    if (!renderedPhases.some(({ stage, line }) => stage !== "enabled_disposal" && line === "Phase: requested")) throw new Error("production observer did not render the valid ledger phase within the fixed window");
    if (initialTimerLagMs < enabledInitializationMs - 1) throw new Error("the initial timer did not observe synchronous progress-read blocking");

    const evidence = {
      issue: 161867,
      variant,
      temperature,
      publishedDriver,
      baseSha: baselineSha,
      candidateSha,
      candidateDiffSha256: variant === "candidate" ? createHash("sha256").update(diff).digest("hex") : null,
      ownerSha256,
      command: `node --import ./scripts/tsx.mjs scripts/repro-161867-update-progress.mts ${outputPath} ${observationWindowMs} ${variant} ${temperature}${publishedSeed ? " published" : ""}`,
      observationWindowMs,
      productionModulesLoadedAfterIsolation: true,
      productionPath: variant === "baseline" ? ["createUpdateProgress", "readDisplayRecord", "getUpdateRun", "prepareSqliteReadOnlyLocationSync"] : ["createUpdateProgress", "getUpdateRunAsync", "executeExistingOpenClawStateRead", "state read worker"],
      isolated: { stateDir, databasePath: resolveOpenClawStateSqlitePath(env), cacheDir, homeDir, network: "source-inspected path has no network entrypoint; this harness does not claim runtime network blocking" },
      run: { runId: run.runId, status: record.status, phase: record.phase },
      controls: {
        disabledWorkerCalls: byStage("disabled").length,
        enabledInitializationMs,
        initialTimerLagMs,
        enabledInitializationWorkerCalls: byStage("enabled_initialization"),
        naturallyScheduledPollWorkerCalls: byStage("enabled_polls"),
        disposalWorkerCalls: byStage("enabled_disposal"),
        asyncReadRequests,
        asyncSnapshotRequests,
        renderedPhases,
        warmSuspensionJoined,
        stagingEventsSupplementalOnly: stagingEvents,
      },
      limitations: [
        "spawnSync instrumentation calls the original production function and counts only worker argv; it does not emulate the worker",
        "fs.watch events are retained as supplemental evidence because event coalescing cannot count snapshots",
        "MessagePort instrumentation calls the original transport and counts real updateRuns.get and snapshot prepare dispatches; dispatch counts are not physical bytes or successful child-process counts",
        "the bounded local state database demonstrates repeated blocking and worker launches, not the reporter's installed database size or total update delay",
      ],
    };
    await writeFile(outputPath, `${JSON.stringify(evidence, null, 2)}\n`, { mode: 0o600 });
    process.stdout.write(`${JSON.stringify(evidence)}\n`);
  } finally {
    defaultRuntime.log = originalLog;
    watcher.close();
  }
} finally {
  childProcess.spawnSync = originalSpawnSync;
  MessagePort.prototype.postMessage = originalPostMessage;
  syncBuiltinESMExports();
  restoreEnvironment();
  // Retain the isolated fixture for inspection; this task authorizes no deletion.
}

@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
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.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: M labels Sep 30, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 30, 2026
@clawsweeper

clawsweeper Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 30, 2026, 12:25 PM ET / 16:25 UTC.

ClawSweeper review

What this changes

The update CLI moves progress polling to the existing asynchronous SQLite reader and waits for that reader to settle before update activation.

Merge readiness

✅ Ready for maintainer review

Current main and the latest release still use synchronous reads for update progress. This PR addresses the reported blocking path, and its bounded production-path observations show the intended improvement. No actionable patch defect was established.

Priority: P1
Reviewed head: d52f51daa7b92a8f1fce088751d3307d1e3b9c7e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent owner-level repair and strong scoped runtime evidence, with no established correctness finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed CLI progress owner was exercised through its production ledger reader and real worker transport in isolated cold and warm setups, including a ledger created by published OpenClaw 2026.9.4. The captured after-fix result shows phase output, asynchronous polling dispatches, and no synchronous polling workers; it does not claim complete package-replacement or service-activation coverage. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed CLI progress owner was exercised through its production ledger reader and real worker transport in isolated cold and warm setups, including a ledger created by published OpenClaw 2026.9.4. The captured after-fix result shows phase output, asynchronous polling dispatches, and no synchronous polling workers; it does not claim complete package-replacement or service-activation coverage. No stored-data contract changes.
Evidence reviewed 6 items Introduced progress path: The pinned PR delta replaces synchronous polling with getUpdateRunAsync, limits reads to one at a time, and discards results from an earlier display generation.
Existing reader contract: The asynchronous ledger API dispatches an updateRuns.get request through the existing state read worker.
Activation ordering: The update command awaits progress suspension and the canonical database close for the run path; execution rechecks its fence before entering mutation.
Findings None None.
Security None None.

How this fits together

The update CLI reads a SQLite run ledger to display preparation phases. Its progress observer feeds phase output to the terminal, while the update executor later takes over for package replacement and service activation.

flowchart LR
  A[Update run ledger] --> B[Async progress reader]
  B --> C[Phase display]
  B --> D[Suspend and drain]
  D --> E[Update activation]
  E --> F[Package or Git mutation]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +56, Tests +198. Total +254 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 76 20 +56
Tests 3 218 20 +198
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 294 40 +254

Review metrics

Metric Value Why it matters
Production and test lines production +76/-20, tests +218/-20 The production growth adds observer lifecycle coordination; the larger test change covers stale reads and activation ordering.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #161867
Summary: The PR is a candidate fix for the reported synchronous update-progress polling; it does not claim to solve every reported update delay.

Members:

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

Technical review

Best possible solution:

Land the existing asynchronous observer through the normal exact-head review gates, preserving the ledger owner’s activation drain and the update executor’s post-await fence.

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

Yes. The related report gives a bounded installed-release probe, current main retains the synchronous polling path, and the PR records matched before-and-after production-reader observations; this review did not execute the probe.

Is this the best way to solve the issue?

Yes. Reusing the existing asynchronous ledger reader is a narrow repair, and the activation handoff waits for its read and database owner before mutation.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The reported synchronous polling repeatedly delayed a real user's update preparation, and this PR targets that active workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed CLI progress owner was exercised through its production ledger reader and real worker transport in isolated cold and warm setups, including a ledger created by published OpenClaw 2026.9.4. The captured after-fix result shows phase output, asynchronous polling dispatches, and no synchronous polling workers; it does not claim complete package-replacement or service-activation coverage. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed CLI progress owner was exercised through its production ledger reader and real worker transport in isolated cold and warm setups, including a ledger created by published OpenClaw 2026.9.4. The captured after-fix result shows phase output, asynchronous polling dispatches, and no synchronous polling workers; it does not claim complete package-replacement or service-activation coverage. No stored-data contract changes.

Evidence

What I checked:

  • Introduced progress path: The pinned PR delta replaces synchronous polling with getUpdateRunAsync, limits reads to one at a time, and discards results from an earlier display generation. (src/cli/update-cli/progress.ts:150, d52f51daa7b9)
  • Existing reader contract: The asynchronous ledger API dispatches an updateRuns.get request through the existing state read worker. (src/infra/update-run-reader.ts:76, d52f51daa7b9)
  • Activation ordering: The update command awaits progress suspension and the canonical database close for the run path; execution rechecks its fence before entering mutation. (src/cli/update-cli/update-command.ts:536, d52f51daa7b9)
  • Production-path proof: The PR body, captured with source body SHA256 30cc659744270754b5dd188db699928f0f9e5a07be8ea0055df36326e9fc77b2, reports a real production reader and transport observation: 13 synchronous polling workers in the cold baseline versus zero in the candidate, with four asynchronous polling reads and visible 'Phase: requested' output. A published 2026.9.4 ledger was also read by the candidate. This proves scoped progress observation, not complete package replacement.
  • Current main and release check: Fetched main still calls the synchronous progress reader at activation, and v2026.9.7 still imports getUpdateRun for polling. The central change is therefore not already implemented. (src/cli/update-cli/progress.ts:139, c074824a27c9)
  • Area history: Recent merged update-progress work includes commits by Peter Steinberger and Jason (Json). Historical source-line introduction was not established because a needed parent blob could not be read from this partial checkout. (src/cli/update-cli/progress.ts, 30e80e790da1)

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@1052326311

Copy link
Copy Markdown
Contributor Author

Superseded by #162345, which landed the async live progress reader and its lifecycle coverage on main. Closing this older conflicting implementation so the merged owner remains canonical.

@1052326311 1052326311 closed this Oct 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant