Skip to content

fix(cli): tolerate removed cwd in plugin authoring output#106425

Merged
steipete merged 1 commit into
openclaw:mainfrom
Leon-SK668:llagy007/plugin-authoring-deleted-cwd-20260713
Jul 14, 2026
Merged

fix(cli): tolerate removed cwd in plugin authoring output#106425
steipete merged 1 commit into
openclaw:mainfrom
Leon-SK668:llagy007/plugin-authoring-deleted-cwd-20260713

Conversation

@Leon-SK668

Copy link
Copy Markdown
Contributor

What Problem This Solves

openclaw plugins build and openclaw plugins init rendered their final output paths with process.cwd(). If the launch directory disappeared after the command completed its file writes, Node threw uv_cwd and turned successful authoring work into a reported failure.

Why This Change Was Made

Plugin-authoring output now uses the existing tryProcessCwd() boundary. It preserves relative paths while cwd is available and falls back to the already resolved absolute target when it is not.

User Impact

Plugin build/init commands with explicit absolute targets can finish cleanly even if their launch directory is removed before final status output. Normal relative-path output is unchanged.

Evidence

  • Exact-head focused test on Node 24.15.0: node scripts/run-vitest.mjs src/cli/plugins-authoring-command.test.ts (13 tests passed).
  • Regression coverage performs real manifest/package/scaffold writes and proves both build and init reporting survive the deleted-cwd timing.
  • oxfmt on both touched files: passed.
  • git diff upstream/main...HEAD --check: passed.

AI-assisted: yes (implementation and tests).

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Jul 13, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 13, 2026
@clawsweeper

clawsweeper Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 13, 2026, 10:48 AM ET / 14:48 UTC.

Summary
The PR makes plugin build/init completion messages fall back to resolved absolute target paths when the process cwd is unavailable and adds deleted-cwd regression tests.

PR surface: Source +6, Tests +64. Total +70 across 2 files.

Reproducibility: yes. at source level: current main calls process.cwd() after successful authoring writes, and the focused tests exercise the resulting failure branch. A real current-main CLI reproduction transcript has not been supplied.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add a redacted terminal transcript, screenshot, recording, or runtime log showing an actual openclaw plugins build or openclaw plugins init run completing after its launch directory is removed.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR provides filesystem-writing regression tests with a mocked cwd failure, but no actual after-fix CLI transcript or runtime artifact; add redacted terminal output, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.

Risk before merge

  • [P1] The simulated regression tests do not prove that an installed or source-checkout CLI completes successfully after its real launch directory is removed; that contributor-environment proof remains the merge gate.

Maintainer options:

  1. Decide the mitigation before merge
    Keep the focused tryProcessCwd() output fallback and regression coverage, then land it after a redacted real terminal run demonstrates successful build or init completion when the launch directory disappears.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] No automated code repair is indicated; wait for contributor-supplied real CLI proof, then refresh review on the exact head.

Security
Cleared: The two-file source/test change adds no dependency, workflow, secret, permission, download, package-resolution, or other supply-chain-sensitive behavior.

Review details

Best possible solution:

Keep the focused tryProcessCwd() output fallback and regression coverage, then land it after a redacted real terminal run demonstrates successful build or init completion when the launch directory disappears.

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

Yes at source level: current main calls process.cwd() after successful authoring writes, and the focused tests exercise the resulting failure branch. A real current-main CLI reproduction transcript has not been supplied.

Is this the best way to solve the issue?

Yes. Reusing the existing safe-cwd helper only while formatting final status paths is narrower and more maintainable than changing target resolution, write behavior, or adding a new fallback/configuration path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f167089d6176.

Label changes

Label justifications:

  • P2: The PR fixes a real but narrow plugin-authoring CLI failure mode without affecting normal command behavior or broad runtime availability.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR provides filesystem-writing regression tests with a mocked cwd failure, but no actual after-fix CLI transcript or runtime artifact; add redacted terminal output, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +6, Tests +64. Total +70 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 11 5 +6
Tests 1 65 1 +64
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 76 6 +70

What I checked:

  • Current-main failure path: Current main formats successful plugin build and init output with path.relative(process.cwd(), ...) after completing file writes, so a removed launch directory can convert successful work into an uv_cwd exception. (src/cli/plugins-authoring-command.ts:307, f167089d6176)
  • Focused implementation: The branch introduces a local formatter that calls the existing tryProcessCwd() helper, preserves relative output when cwd exists, and returns the already-resolved target path when it does not. (src/cli/plugins-authoring-command.ts:63, a00b1bc5dc6e)
  • Covered entry points: The formatter is applied to both final build outputs and the final init output; the PR does not alter target resolution, generated contents, validation, or write ordering. (src/cli/plugins-authoring-command.ts:315, a00b1bc5dc6e)
  • Regression coverage: The added build and init cases perform real scaffold/manifest/package writes but simulate the unavailable-cwd condition by mocking process.cwd(), so they establish code-path coverage rather than real CLI behavior proof. (src/cli/plugins-authoring-command.test.ts:316, a00b1bc5dc6e)
  • Documented command surface: Public plugin documentation confirms that plugins init scaffolds a tool plugin and plugins build writes the generated manifest and aligned package metadata, matching the two user-facing paths changed here. (docs.openclaw.ai) Public docs: docs/cli/plugins.md. (docs/cli/plugins.md:46, f167089d6176)
  • Proof continuity: The PR body still lists only the focused test, formatting, and diff checks; no redacted terminal transcript, runtime log, screenshot, recording, or linked artifact demonstrates an actual after-fix CLI run, and the head remains the previously reviewed SHA. (a00b1bc5dc6e)

Likely related people:

  • steipete: Recent merged history shows broad ownership of plugin architecture, CLI documentation, and plugin API refactors adjacent to this authoring command surface. (role: plugin architecture contributor; confidence: low; commits: 7a6be3d531, 90b6665ded; files: src/cli/plugins-authoring-command.ts, docs/cli/plugins.md)
  • vincentkoc: Recent release history repeatedly connects this contributor to plugin lifecycle, packaging, marketplace, and compatibility work, making them a plausible adjacent reviewer for plugin-authoring behavior. (role: recent plugin-system contributor; confidence: low; files: src/cli/plugins-authoring-command.ts, docs/cli/plugins.md)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-13T14:28:24.232Z sha a00b1bc :: needs real behavior proof before merge. :: none

@steipete steipete self-assigned this Jul 14, 2026
@steipete

Copy link
Copy Markdown
Contributor

Maintainer proof complete on exact head a00b1bc5dc6eae74d68913a099acba4b2d600e0e.

  • Blacksmith Testbox tbx_01kxf03a9k56v6sa8qgvcnh1pn (run 29295775761): corepack pnpm test src/cli/plugins-authoring-command.test.ts passed 13/13; corepack pnpm build passed; exact remote-child corepack pnpm check:changed passed format, production/test tsgo, lint, and guards.
  • Corrected source-blind behavior proof on Testbox tbx_01kxf1e648sxfg184jdd91v5e7 (run 29296837850): a real plugins build probe observed both manifest and package writes while stdout/stderr were still empty, stopped the process group, removed the complete launch tree, then resumed it. The command exited 0 with absolute Wrote and Updated paths and no uv_cwd or ENOENT; the normal-CWD control retained relative output. The harness used plugin-owned process.chdir(".") plus a write-syscall delay only for deterministic scheduling; it did not mock or hook OpenClaw.
  • Fresh autoreview via /opt/homebrew/bin/codex: no accepted/actionable findings; patch correct at 0.95 confidence.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 106425: hosted CI/Testbox gates passed, prep and PR heads remained identical, and no rebase or push was needed.

Known proof gaps: none.

@steipete
steipete merged commit 4100d19 into openclaw:main Jul 14, 2026
144 of 150 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

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

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S 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.

2 participants