Repository navigation
fix(update): rebuild stale Git runtimes when source is already current - #156996
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 24, 2026, 11:27 AM ET / 15:27 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch makes Git updates rebuild runtime artifacts when their recorded build commit is stale or absent, and adds managed-service checks around automatic source builds. Merge readiness⛔ Blocked before merge - 10 items remain Keep open. Current main still skips a Git update when source is current but the runtime is stale, so this repair remains useful. The branch has relevant before-and-after update evidence, but its source launcher can rebuild shared runtime files while a different profile’s Gateway serves them, and the first update from the published driver still requires manual recovery. Priority: P0 Review scores
Verification
How this fits togetherThe Git updater compares the checkout with built-runtime metadata before staging a candidate. Update activation and the source launcher publish runtime files that a managed Gateway may already be using. flowchart LR
A[Git checkout] --> C[Update preflight]
B[Build metadata] --> C
C -->|Stale or unknown| D[Candidate build]
C -->|Matching| G[Already current]
D --> E[Service publication check]
E --> F[Shared runtime files]
F --> H[Managed Gateway]
Decision needed
Why: The PR proves that published-driver limitation and documents a workaround, but only maintainers can accept that user-facing upgrade tradeoff against the repository’s update contract. Before merge
Findings
Agent review detailsSecurityNeeds attention: The source launcher’s selected-profile check can permit writes to shared runtime files while a different profile’s Gateway is running; no dependency or third-party execution change was found. PR surfaceSource +31, Tests +276, Docs +21, Other +39. Total +367 across 20 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Give affected installs a safe first-hop recovery through a visible update or Fix flow, and make shared runtime publication wait for authority over every Gateway serving that checkout. Do we have a high-confidence way to reproduce the issue? Yes. Current-main Git preflight has two source-SHA-only no-op exits, and the linked report plus PR body provide a concrete stale-runtime scenario; this read-only review did not execute it. Is this the best way to solve the issue? No. The build-provenance check belongs in Git preflight, but the source publication guard must cover other profiles sharing the checkout, and the published-driver first hop needs a safe recovery path or explicit maintainer acceptance. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 64b746503109. LabelsLabel changes: No label changes. Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
5a3d113 to
63aec1d
Compare
* commit '02ad6b76b1a2ee2b414b170072e6e3e606fda3d4': (134 commits) fix(build): scope normalization declarations to package sources (#157174) fix: exit after validating Codex model references (#157323) fix(gateway): guard workspace adoption during active work (#157259) fix(update): rebuild stale Git runtimes when source is already current (#156996) fix: require a click before diagnosing failed updates (#157359) test(release): provide sealed artifact inputs to writer fixtures fix(ios): preserve chat state and adapt layout when iPad windows resize (#156683) fix(test): prepare native UI fixtures before compilation fix(test): await outbound delivery readiness before assertions fix: clarify deferred Codex catalog refresh warnings (#157352) fix(skills): refresh skills after watched directories are replaced (#156324) ci: reduce Node fixture overhead and defer seven release matrices (#157341) chore(test): stop Codex Computer Use and Signal batching tests flaking under load (#157334) fix(gateway): retain owned suspension status during restart (#157258) fix(ci): scope desktop status assertions to the selected worker chore(i18n): refresh native locales (#157337) test(daemon): use the native PowerShell probe budget (#157289) fix(exec): avoid gateway stalls during background task writes (#157177) test(cli): isolate preaction title setter state fix(test): synchronize Git backoff cancellation readiness (#157315) ...
* commit 'c4333da677cbdfe1bbaf783ed01c363ff39e93b8': (100 commits) fix(test): stop preflight mocks leaking into shared workers (#157207) fix(build): scope normalization declarations to package sources (#157174) fix: exit after validating Codex model references (#157323) fix(gateway): guard workspace adoption during active work (#157259) fix(update): rebuild stale Git runtimes when source is already current (#156996) fix: require a click before diagnosing failed updates (#157359) test(release): provide sealed artifact inputs to writer fixtures fix(ios): preserve chat state and adapt layout when iPad windows resize (#156683) fix(test): prepare native UI fixtures before compilation fix(test): await outbound delivery readiness before assertions fix: clarify deferred Codex catalog refresh warnings (#157352) fix(skills): refresh skills after watched directories are replaced (#156324) ci: reduce Node fixture overhead and defer seven release matrices (#157341) chore(test): stop Codex Computer Use and Signal batching tests flaking under load (#157334) fix(gateway): retain owned suspension status during restart (#157258) fix(ci): scope desktop status assertions to the selected worker chore(i18n): refresh native locales (#157337) test(daemon): use the native PowerShell probe budget (#157289) fix(exec): avoid gateway stalls during background task writes (#157177) test(cli): isolate preaction title setter state ...
* commit '02ad6b76b1a2ee2b414b170072e6e3e606fda3d4': (122 commits) fix(build): scope normalization declarations to package sources (#157174) fix: exit after validating Codex model references (#157323) fix(gateway): guard workspace adoption during active work (#157259) fix(update): rebuild stale Git runtimes when source is already current (#156996) fix: require a click before diagnosing failed updates (#157359) test(release): provide sealed artifact inputs to writer fixtures fix(ios): preserve chat state and adapt layout when iPad windows resize (#156683) fix(test): prepare native UI fixtures before compilation fix(test): await outbound delivery readiness before assertions fix: clarify deferred Codex catalog refresh warnings (#157352) fix(skills): refresh skills after watched directories are replaced (#156324) ci: reduce Node fixture overhead and defer seven release matrices (#157341) chore(test): stop Codex Computer Use and Signal batching tests flaking under load (#157334) fix(gateway): retain owned suspension status during restart (#157258) fix(ci): scope desktop status assertions to the selected worker chore(i18n): refresh native locales (#157337) test(daemon): use the native PowerShell probe budget (#157289) fix(exec): avoid gateway stalls during background task writes (#157177) test(cli): isolate preaction title setter state fix(test): synchronize Git backoff cancellation readiness (#157315) ...
* test(ui): cover stack-free tooltip disconnect cleanup * fix(build): scope normalization declarations to package sources Give normalization-core its own TypeScript project so declaration generation does not load the repository-wide source set. Preserve the existing DTS build command and compiler policy. * Merge normalization declaration scope for tooltip proof * commit '81aeccb3db80136a118d6d2f98b67d836ec25e51': fix(build): scope normalization declarations to package sources * fix(ui): avoid retaining tooltip anchors in abort reasons * Merge main to include native wrapper source inventory repair * commit '02ad6b76b1a2ee2b414b170072e6e3e606fda3d4': (134 commits) fix(build): scope normalization declarations to package sources (#157174) fix: exit after validating Codex model references (#157323) fix(gateway): guard workspace adoption during active work (#157259) fix(update): rebuild stale Git runtimes when source is already current (#156996) fix: require a click before diagnosing failed updates (#157359) test(release): provide sealed artifact inputs to writer fixtures fix(ios): preserve chat state and adapt layout when iPad windows resize (#156683) fix(test): prepare native UI fixtures before compilation fix(test): await outbound delivery readiness before assertions fix: clarify deferred Codex catalog refresh warnings (#157352) fix(skills): refresh skills after watched directories are replaced (#156324) ci: reduce Node fixture overhead and defer seven release matrices (#157341) chore(test): stop Codex Computer Use and Signal batching tests flaking under load (#157334) fix(gateway): retain owned suspension status during restart (#157258) fix(ci): scope desktop status assertions to the selected worker chore(i18n): refresh native locales (#157337) test(daemon): use the native PowerShell probe budget (#157289) fix(exec): avoid gateway stalls during background task writes (#157177) test(cli): isolate preaction title setter state fix(test): synchronize Git backoff cancellation readiness (#157315) ... Co-authored-by: Vincent Koc <[email protected]>
openclaw#156996) * fix(update): rebuild stale git runtimes through managed handoff * fix(update): decide Git no-ops from build provenance * fix(update): rebuild Git runtimes without provenance
* test(ui): cover stack-free tooltip disconnect cleanup * fix(build): scope normalization declarations to package sources Give normalization-core its own TypeScript project so declaration generation does not load the repository-wide source set. Preserve the existing DTS build command and compiler policy. * Merge normalization declaration scope for tooltip proof * commit '81aeccb3db80136a118d6d2f98b67d836ec25e51': fix(build): scope normalization declarations to package sources * fix(ui): avoid retaining tooltip anchors in abort reasons * Merge main to include native wrapper source inventory repair * commit 'f11e16cd65951f284264bd202b49984e21091cf5': (134 commits) fix(build): scope normalization declarations to package sources (openclaw#157174) fix: exit after validating Codex model references (openclaw#157323) fix(gateway): guard workspace adoption during active work (openclaw#157259) fix(update): rebuild stale Git runtimes when source is already current (openclaw#156996) fix: require a click before diagnosing failed updates (openclaw#157359) test(release): provide sealed artifact inputs to writer fixtures fix(ios): preserve chat state and adapt layout when iPad windows resize (openclaw#156683) fix(test): prepare native UI fixtures before compilation fix(test): await outbound delivery readiness before assertions fix: clarify deferred Codex catalog refresh warnings (openclaw#157352) fix(skills): refresh skills after watched directories are replaced (openclaw#156324) ci: reduce Node fixture overhead and defer seven release matrices (openclaw#157341) chore(test): stop Codex Computer Use and Signal batching tests flaking under load (openclaw#157334) fix(gateway): retain owned suspension status during restart (openclaw#157258) fix(ci): scope desktop status assertions to the selected worker chore(i18n): refresh native locales (openclaw#157337) test(daemon): use the native PowerShell probe budget (openclaw#157289) fix(exec): avoid gateway stalls during background task writes (openclaw#157177) test(cli): isolate preaction title setter state fix(test): synchronize Git backoff cancellation readiness (openclaw#157315) ... Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes Git updates reporting
already-currentand then exiting 79 when the checkout already matches the target but its installed runtime was built from an older commit.Fixes #156893. Thanks @DonnieFi for the detailed timeline, build identities, reflog, and Gateway logs.
User Impact
A source-current checkout with stale runtime artifacts or no recorded build commit now rebuilds a separate candidate and restarts its managed Gateway onto the matching build. Update activation and automatic source-launcher rebuilds leave a serving installation intact when they do not own its service stop.
First-update limitation: a 2026.9.5 installation's installed updater can refuse before candidate code becomes reachable. Its first update still needs the bootstrap workaround documented in
docs/cli/update/how-updates-run.md, “Validation and activation”: stop the Gateway through its actual service manager, rebuild the checkout, start it through that manager, then retry. Never rebuild underneath the serving process. Explicit manualpnpm buildremains operator-controlled.Why This Change Was Made
Both Git preflight no-op exits compared source and target SHA without requiring a matching recorded build commit. They now require affirmative build provenance: missing or different commits follow candidate rebuild and managed activation. The new build records its commit, allowing the next unchanged update to finish as already current. Full artifact verification remains the separate recovery owner's decision.
The activation owner now refuses same-installation Git mutation when service preparation reports a running Gateway that the updater did not stop. The source launcher reuses the existing runtime-publication owner for automatic full builds and runtime synchronization, retaining the artifact/service/lifecycle lock order. These are separate entry points into runtime mutation, not competing service owners.
The report cannot uniquely identify the historical actor that rewrote
dist. The managed helper has no build tail after completion; a later source-launcher command or explicit build can account for those stamps. The regressions cover the automatic rebuild and update-activation paths that could violate custody.Evidence
Live proofs used isolated state, an owned systemd user service, and port 39897 on Blacksmith Testboxes. No operator Gateway or state was used.
tbx_01m38fy2q8r8xzcpcc2kvr9pd0:node openclaw.mjs update --yes --tag 2026.9.5 --timeout 1800 --json. Before the fix, the helper exited 79, the result wasalready-current/runtime-verification-failed, and old PID 11915 remained active and healthy. The parent launcher exited 75 to acknowledge managed handoff.pnpm openclaw doctorrefused automatic publication while PID 11915 served. The completedistdigest remained2454e947485a3ee053af785bc0693d2d5aa77663d5fcc7e0cdb547e1a62d101f.2026.9.5-dd04333518ae-2026-09-24T02-32-15.879Z, matching source/targetdd04333518ae9168caf928bc6032f43445d565d8.readyz=true,settled=true, no plugin errors; recorded downtime 61,503 ms. Full command, including candidate build: 6m12.466s. These are synthetic fixture commits, not PR commits.tbx_01m38m2bth4zhfks2k19702780: built exact tag commitec9c1a13db8938e5a3eaa51fca2e981cde2395a9, then advanced source without rebuilding. The tagged driver reproducedfailed/already-current, retaining PID 8301 and its old runtime. This establishes the first-update limitation above.OPENCLAW_TESTBOX=1import-dependent validation passed 57 files / 1,849 tests across six Vitest groups in 751.54s (12m43.944s remote command), Testbox run, leasetbx_01m38pz5h15833v8c0wrag2jp6. Selection includes direct imports and the relevant one-barrel callers. The synchronized source was checked against the commit hashes, then the exact candidate HEAD/index and complete tracked tree were verified. Native sync initially retained older Git metadata, which caused two sparse-harness copy failures; correcting that proof environment and replaying the same order passed without test changes.OPENCLAW_TESTBOX=1 OPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_CHANGED_LANES_RAW_SYNC=1 node scripts/check-changed.mjs --base 57f912b5f7011bae0cc5f36a4ba7f56556ed4127 -- <19 changed paths>passed, exit 0, in 28m21.223s on Testbox run, leasetbx_01m38py1pgmy5bg8qme3qxg7gx. Includes core, all 25 core-test typecheck shards, scripts/test-root types, lint, formatting, dead-export checks, and runtime import-cycle checks. The comparison base was explicitly pinned because native Testbox hydration retained an older Git ref.Fresh Codex autoreview of the final staged candidate (
--mode local --base 3948a0fd1831d3f54ebcdc695bb59004d9eeac52 --max-priority P1): scoped-clean, no accepted/actionable findings. Published commit48e5192d218d8d9f90382126ea28ea75f415d10ccontains the reviewed source unchanged.The broad run also exposed existing cost in two unchanged siblings:
src/flows/doctor-health.test.ts(94 cases, 134.488s test time) andsrc/cli/update-cli/update-command-original-service.test.ts(67 cases, 132.840s). Isolated--maxWorkers=1measurements passed at 118.724s and 109.206s of test time respectively (121.90s and 115.23s Vitest wall). Doctor's multi-agent repair table contributes 95.678s in the broad run; service recovery repeatedly checks original-state compatibility across awaited/native ownership boundaries. Both use scoped schema-reader child processes and real database fixtures. These are performance follow-ups for worker/fixture lifecycle ownership; no checks, assertions, timeouts, or coverage were weakened.Production/tooling: +105 / −35 LOC. Tests/support: +294 / −18 LOC. Docs: +22 / −1 LOC. No new options, dependencies, schemas, suppressions, or baseline exceptions.
Initial Testbox single-file
pnpm test <file> --maxWorkers=1wall times: Git candidate 22.051s (53 cases), Git tags 7.478s (13), update execution 11.272s (45), runtime publication 10.950s (41), source runner 10.824s (123), build-all 7.253s (100), artifact ownership 21.806s (30), runner lifecycle 22.156s (5). The existing large CLI suite passed all 514 cases in 208.401s wall / 200.097s test time; its prior test time was 206.900s. A bounded fixture change avoids reopening a fresh copy of the initialized state database. Coordinator ruling assigns the existing suite's splitting/performance work to L1251; no regression was weakened, skipped, or moved to another tier.Missing build provenance
Missing provenance is not evidence that a runtime is current. The no-op now requires a recorded commit matching HEAD, along with the existing target and activation checks. The snapshot no-op fixture from merge-ref CI run 36000116874 now supplies that affirmative provenance; an unknown build instead checks snapshot capacity before any mutable work. Native service authority and recovery verification remain unchanged.
New regressions reproduce source-current dev and stable checkouts whose executable runtime is from an older commit but whose build metadata has no commit. Both returned
skipped/already-currentbefore the fix. After the fix they build and validate a candidate, stop before promotion, run activation Doctor, record the target commit, and execute the new runtime. A second update isskipped/already-currentwith no second build or stop. The missing-provenance snapshot case also failed before the fix and now enforces the capacity gate.The four focused files (Git snapshot, native service authority, Git candidate, and Git tags) passed 3×: 83 tests per pass, in 122.33s / 83.44s / 72.66s. Local
node scripts/check-changed.mjs --base 3948a0fd1831d3f54ebcdc695bb59004d9eeac52passed with exit 0, including all 25 core-test typecheck shards, core/scripts/test-root types, lint, ratchets, dead-export scans, and runtime guards.Measured
pnpm test <file> --maxWorkers=1:src/infra/update-runner-git-candidate.test.tspassed 55 cases in 120.08s command wall / 108.031s test time;src/cli/update-cli/update-command-git-snapshot.test.tspassed 3 cases in 15.98s command wall / 1.009s test time. The candidate suite exercises real Git repositories and executable promoted runtimes; the new unknown-provenance cases reuse that fixture and took 1.461s and 1.531s in the third focused pass.