Skip to content

fix(pr): keep in-flight landings working after dependency refreshes - #182147

Merged
steipete merged 2 commits into
mainfrom
steipete/team-depsanchor
Oct 24, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/team-depsanchor

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes native PR landings becoming stranded when main refreshes dependencies after their workflow binding was created. #182065 and #182046 were bound to main with dotenv 18.0.7; after #182010 installed 18.0.8, their next commands stopped at the trust anchor requires 18.0.7 before acquiring a lock.

User Impact

Maintainers can continue an admitted review or landing after a dependency refresh without downgrading a shared checkout or replacing its workflow binding. Exact-version checks and the original trusted workflow remain in force.

Why This Change Was Made

The old recovery in scripts/pr:533 (pr_materialize_dependencies) could only fast-forward and reinstall a separate tooling checkout. That cannot satisfy an older anchor. The wrapper now prepares an isolated frozen installation from the authenticated anchor commit, verifies the extracted source before lifecycle hooks execute, rechecks exact package versions, and pins the resolved package directories as before. It atomically publishes complete cache entries, reuses them, and sweeps old entries whose recorded consumers have exited. The forward-only refresh is removed; explicit tooling-root validation remains.

The cache key includes the full source tree, platform, architecture, and Node ABI. Using the full tree covers workspace manifests, patches, and install-hook inputs, at the cost of less sharing between source revisions with identical lockfiles. Concurrent first installs may duplicate work; only one complete entry survives. PID reuse can delay cleanup.

Evidence

  • The older-anchor regression fails on the baseline wrapper and passes with this fix. It asserts one install across two commands, including explicit and default tooling roots.
  • All four new regression cases pass: older-anchor install/reuse, overlapping creators, changed manifest, and extra package hook. The workspace-only dependency case also fails before the staging-projection correction and passes with it.
  • Targeted tooling typecheck, lint, formatting, shell syntax, and line-cap ratchet pass. The actual pre-commit hook passes on the exact staged candidate.
  • Independent Codex reviews: no actionable P0–P2 findings.
  • An unchanged workflow-retention test exceeded its existing 120-second limit in two local attempts (261 and 359 seconds under heavy host load). No timeout or test expectation was changed; broad validation remains with PR CI.

Production delta: +145 / −60 lines (net +85); tests: +153 / −100 (net +53). The added bootstrap owns frozen-install recovery; no new eager import is introduced.

Real historical-anchor proof completed against main commit 7b71c23797646bed71dc869b83a1c51764c267a6: the normal frozen install reused 1,592 packages, including lifecycle scripts. On the final committed head, scripts/pr ls then exited 0 using the completed cache without reinstalling. The cached dotenv is 18.0.7; both the task checkout and shared tooling remain at 18.0.8.

CI is green on f70c1ce062be4eb2cb564f5c6618da1dc1eaaf47: https://github.com/openclaw/openclaw/actions/runs/40057330854. The exact-head watcher accepted eight superseded checks; current required gates succeeded.

Validation commands:

pnpm test test/scripts/pr-wrappers.test.ts test/scripts/eager-import-closure.test.ts --maxWorkers=1 -t 'older anchor|creators overlap|unverified frozen install|keeps the admitted workflow after|PR wrapper inventory'
node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.root.tooling.json --incremental
node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json test/scripts/pr-wrappers.test.ts test/scripts/eager-import-closure.test.ts scripts/pr-lib/materialize-dependencies.mjs
bash -n scripts/pr

The focused test command passed all four new cases and the import inventory; its exit was nonzero solely for the investigated local timeout described above. Typechecking, lint, syntax, formatting, line-cap ratchet, and pre-commit checks passed.

@clawsweeper

clawsweeper Bot commented Oct 24, 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.

@chatgpt-codex-connector

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

Copy link
Copy Markdown
Contributor

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T03:15:18.250315Z f70c1ce PR opened
ℹ️ About Codex in GitHub

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

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

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: M labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR restores retained workflows’ exact dependencies through isolated frozen installations instead of refreshing shared tooling checkouts.

Example: A retained landing requires dotenv 18.0.7 after the shared installation advances to 18.0.8.

  • Before: The next command refuses the version mismatch, and refreshing main cannot restore the older dependency.
  • After: The wrapper installs the authenticated anchor’s dependency set privately and pins dotenv 18.0.7 without downgrading the shared checkout.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The implementation appears coherent and exact-head CI is green, but the material source-to-lifecycle authority boundary remains unproven by completed behavior evidence.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) Security review found an item that needs attention.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Maintainers cannot continue an admitted landing when its retained dependency versions disappear from a refreshed shared installation.
Reason: The reported failure contradicts the retained-workflow contract, and the maintainer-authored direction restores continuity while preserving shared-checkout ownership.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep this PR open: it addresses a concrete retained-workflow failure still present on main, and inspection found no discrete introduced code defect.

Priority: P2
Reviewed head: f70c1ce062be4eb2cb564f5c6618da1dc1eaaf47

Before merge

  • Add real behavior proof - Authority-chain proof required: scripts/pr now turns an authenticated historical source tree into an executable dependency installation; the supplied tests replace pnpm, and the complete body still describes the real historical-anchor run as pending, so completed allowed-source and nearest-forbidden-source evidence before lifecycle I/O is not yet available. After adding proof, update the PR body, then request a new review with @clawsweeper re-review. The PR author or someone with repository write access can request it.
  • Resolve security review attention item - This PR expands trusted wrapper recovery to execute historical-anchor package lifecycle hooks.
  • Resolve merge risk - Before merge, the PR owner must establish that the new historical-source installation path admits only authenticated source to package lifecycle execution on the maintainer host.

Findings

None.

Tests

  • Missing end-to-end proof: Supply inspectable real-wrapper output for historical-anchor installation and reuse with the newer shared dependency intact, plus rejection of altered or unauthenticated source before lifecycle execution; redact credentials and non-public endpoints.
Agent review details

How this fits together

The PR wrapper selects trusted workflow source and supplies its dependency context before supervision and operation locking; retained workflow bindings and installed package directories enter this subsystem, and verified selective package pins leave it.

flowchart TD
  A[Retained workflow anchor] --> B[Check installed dependencies]
  B --> C[Verify anchor and extracted source]
  C --> D[Install frozen dependencies privately]
  D --> E[Publish complete installation]
  E --> F[Pin exact package directories]
  B --> F
  F --> G[Run retained workflow]
Loading

Technical review

Best possible solution:

Keep recovery in the existing wrapper bootstrap, preserve retained bindings and selective pins, and complete the source-to-lifecycle boundary evidence.

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

Current-main source requires exact anchored versions but can only refresh a separate tooling checkout forward, matching the reported dotenv 18.0.7-versus-18.0.8 refusal; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The approach repairs dependency availability at its existing owner, removes the ineffective refresh path, and preserves exact-version and retained-workflow contracts without modifying shared installations.

AGENTS.md: found and applied where relevant.

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

Merge-risk options

Maintainer options:

  1. Verify source admission before lifecycle execution (recommended)
    The PR owner should supply the completed historical-anchor run and inspectable final-effect evidence that altered or unauthenticated source is rejected before pnpm or package hooks execute.

Provenance checked

  • Forward-only tooling-root refresh changes intended behavior with a stated reason (1abf60d: Recover stale host tooling through a separate clean main checkout without changing anchored code or exact dependency checks.)
  • Streamed tooling-root refresh changes intended behavior with a stated reason (35ba90b: Avoid captured-output overflow when a far-behind tooling checkout fast-forwards; the replacement removes that fetch-and-merge operation entirely.)
  • Selective dependency pins and child completion keeps the original intent (7f2637f: Let an authenticated anchor complete its dependency context while preserving existing real-directory pins and avoiding whole-workspace dependency links.)
  • Retained workflow continuity keeps the original intent (c821108: Keep the admitted source and dependency contract stable between maintainer commands until verified native completion.)

Testing

Proof path: in-process harness.

Security

Needs attention: This PR expands trusted wrapper recovery to execute historical-anchor package lifecycle hooks.

Evidence

What I checked:

  • Introduced change verified: The pinned introduction replaces forward-only tooling-root refresh with authenticated historical-source installation, complete source verification, atomic publication, and reuse. (scripts/pr:618, f70c1ce062be)
  • Current main retains the failure path: Current main still requires exact anchored package versions and offers only a forward refresh of an explicitly selected separate tooling checkout; the affected production files are unchanged from the introduction baseline. (scripts/pr:592, 57714a697a82)
  • Original recovery intent: fix(scripts): prevent host tooling drift from blocking PR workflows #152078 introduced separate tooling-root recovery while preserving anchored code and exact versions; this PR explains why forward refresh cannot satisfy an older retained anchor. (scripts/pr:533, 1abf60d28c8e)
  • Retained workflow contract: fix(pr): keep the reviewed workflow stable between maintainer commands #167350 established that an ongoing operation retains its admitted workflow and dependency contract; the proposed recovery preserves that owner. (scripts/pr:397, c82110895d71)
  • Supplied proof inspected: The complete live body reports baseline failure and passing installer-fixture regressions, but explicitly says the real historical-anchor installation is still running; discussion supplies no completed result. (f70c1ce062be)
  • Boundary regression coverage: The added cases exercise the actual wrapper with a replacement pnpm executable, covering install reuse, overlapping creators, changed manifests, and an injected extra hook before installer invocation. (test/scripts/pr-wrappers.test.ts:1323, f70c1ce062be)

Likely related people:

  • Peter Steinberger: Raw commit 1abf60d adds scripts/pr:107 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1abf60d28c8e; files: scripts/pr)
  • Vincent Koc: Raw commit c821108 adds scripts/pr:298 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: c82110895d71; files: scripts/pr)

PR surface

Tests +53, Docs +17, Other +85. Total +155 across 7 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 2 153 100 +53
Docs 3 27 10 +17
Config 0 0 0 0
Generated 0 0 0 0
Other 2 145 60 +85
Total 7 325 170 +155

Review metrics

Metric Value Why it matters
Production versus test LOC Production +145/-60; tests +153/-100 The growth replaces shared-checkout refresh with isolated installation and distinct recovery/security regressions; the simplification review found no clearly unnecessary parallel owner.

Labels

Label changes:

  • add P2: The failure blocks retained maintainer landing workflows after dependency refreshes, with no demonstrated end-user runtime outage.
  • add merge-risk: 🚨 security-boundary: The new recovery path executes historical-anchor package lifecycle hooks on the host, and its source-admission boundary lacks completed final-effect evidence.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Label justifications:

  • P2: The failure blocks retained maintainer landing workflows after dependency refreshes, with no demonstrated end-user runtime outage.
  • merge-risk: 🚨 security-boundary: The new recovery path executes historical-anchor package lifecycle hooks on the host, and its source-admission boundary lacks completed final-effect evidence.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add final-effect proof that the authenticated historical anchor installs and runs, while altered or unauthenticated source is rejected before pnpm or lifecycle hooks execute.

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.

Reviewed October 23, 2026, 11:27 PM ET / October 24, 2026, 03:27 UTC.

@steipete
steipete merged commit 8776378 into main Oct 24, 2026
133 of 135 checks passed
@steipete
steipete deleted the steipete/team-depsanchor branch October 24, 2026 04:39
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

docs Improvements or additions to documentation merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant