Skip to content

fix(plugins): keep deferred jiti transforms in a durable user cache - #117355

Merged
steipete merged 1 commit into
mainfrom
codex/issue-113550
Aug 1, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/issue-113550

Conversation

@steipete

@steipete steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep third-party jiti compiler artifacts in the durable, per-install user cache so deferred plugin imports survive temporary-directory cleanup.
  • Preserve explicit cache opt-outs and trusted platform cache-root handling.
  • Production LOC: +4; no new configuration, SQLite state, or public API.

Independently verified remote proof

Trusted Blacksmith Testbox tbx_01kyydkhpsztxmwdwke6vvrvdj; reviewed patch SHA-256 f9034adaa33d7847edaa36c812b894e33e55e4d94a78eab5b71a34f3558f155d.

$ node scripts/run-vitest.mjs src/plugins/sdk-alias.test.ts --testNamePattern "keeps deferred jiti imports working after the temporary directory is deleted" --reporter=verbose
PINNED_JITI_ORIGINAL_OWNER_EXPECTED_RED_CONFIRMED

$ node scripts/run-vitest.mjs src/plugins/sdk-alias.test.ts src/plugins/plugin-module-loader-cache.test.ts --reporter=verbose
BOTH_CHANGED_OWNER_SUITES_AND_REAL_NESTED_CHILD_PASS

$ pnpm check:changed -- src/plugins/sdk-alias.ts src/plugins/sdk-alias.test.ts src/plugins/plugin-module-loader-cache.test.ts
TARGETED_CHANGED_GATE_PASS
FINAL_REMOTE_FULL_INDEX_HASH f9034adaa33d7847edaa36c812b894e33e55e4d94a78eab5b71a34f3558f155d
OPENCLAW_ISSUE_113550_PROOF_COMPLETE
blacksmith run summary sync=delegated command=5m10.044s total=5m10.076s exit=0

The original production owner fails the real pinned-jiti parent → deleted TMPDIR → deferred nested-child import regression; the repaired owner and both existing suites pass. Independent source/security and authenticated Codex reviews passed.

Fixes #113550

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added 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. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 11:03 AM ET / 15:03 UTC.

ClawSweeper review

What this changes

Moves jiti’s plugin-loader transform cache from the temporary directory to a durable per-user cache and adds coverage for a deferred dynamic import after temporary-directory cleanup.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 3 items remain

Keep this PR open for explicit maintainer handling. The focused cache-root change appears to repair the reported deferred-import failure, but the current head was force-pushed after the previous review and the posted terminal proof is not verifiably bound to the current diff.

Priority: P1
Reviewed head: 531918e714abc69125f3b5ced4ee9f2a3dd45ca2
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation and regression test are strong, but current-head real-behavior proof remains uncorrelated after the force-push.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR contains a strong terminal-style regression transcript, but its stated patch hash does not identify the current force-pushed diff; rerun the same real jiti deferred-import case on the current head and redact any private paths or environment details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR contains a strong terminal-style regression transcript, but its stated patch hash does not identify the current force-pushed diff; rerun the same real jiti deferred-import case on the current head and redact any private paths or environment details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current main still uses temporary storage: The current implementation derives the jiti filesystem cache from os.tmpdir() and places artifacts under jiti/openclaw/...; the durable cache-root helper is absent from current main.
PR implements the durable cache boundary: The branch accepts an absolute XDG_CACHE_HOME, otherwise selects the platform user-cache root, and scopes jiti artifacts under openclaw/jiti/<version>/<install-marker> while retaining the existing jiti cache opt-outs.
Regression path is concrete: The added test compiles a TypeScript parent through jiti, removes TMPDIR, then resolves the parent’s deferred child import and checks that the child transform landed in the durable cache.
Findings None None.
Security None None.

How this fits together

The plugin loader supplies jiti with alias and transform-cache options when OpenClaw loads plugin runtime modules. Those compiled artifacts are later used by deferred imports in the running gateway, so their cache location affects whether channel work can continue after temporary storage is cleaned.

flowchart LR
  A[Plugin runtime module] --> B[Plugin loader]
  B --> C[Jiti options]
  C --> D[Durable user cache]
  D --> E[Deferred module import]
  E --> F[Gateway message handling]
Loading

Decision needed

Question Recommendation
After refreshed exact-head proof for commit 531918e714abc69125f3b5ced4ee9f2a3dd45ca2, should this durable jiti-cache repair be merged? Merge after exact-head proof: Update the PR body with the deferred-import regression command and successful output from the current head, then merge if the required checks pass.

Why: The patch is narrowly scoped and cleanly mergeable, but the current proof transcript cannot be tied to the force-pushed head and the maintainer label requires explicit human handling.

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR contains a strong terminal-style regression transcript, but its stated patch hash does not identify the current force-pushed diff; rerun the same real jiti deferred-import case on the current head and redact any private paths or environment details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The posted remote terminal transcript identifies a different patch hash from the current force-pushed diff, so merge would rely on proof whose exact-head applicability is not yet established.
Agent review details

Security

None.

PR surface

Source +4, Tests +103. Total +107 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 17 13 +4
Tests 2 108 5 +103
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 125 18 +107

Review metrics

None.

Stored data model

Persistent data-model change detected: persistent cache schema: src/plugins/sdk-alias.test.ts, persistent cache schema: src/plugins/sdk-alias.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #113550
Summary: This PR is the explicit candidate repair for the temporary jiti-cache failure reported in the linked issue.

Members:

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

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the durable per-user cache design and add a fresh, redacted exact-head run of the deferred-import regression before a maintainer decides whether to merge.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the durable per-user cache design and add a fresh, redacted exact-head run of the deferred-import regression before a maintainer decides whether to merge.

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

Yes—current main constructs the plugin-loader cache beneath the temporary directory, and the PR’s focused regression test exercises a jiti parent-to-child deferred import after that directory is deleted. This read-only review did not execute the test locally.

Is this the best way to solve the issue?

Yes at the code-design level: placing compiler artifacts in the platform user-cache location preserves the existing jiti opt-outs and fixes the state at its owner boundary. Fresh proof must be tied to the current head before treating the proposed patch as merge-ready.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: This repair targets the reported channel-agnostic runtime failure where temporary-cache cleanup can prevent deferred module loads and stop message handling.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR contains a strong terminal-style regression transcript, but its stated patch hash does not identify the current force-pushed diff; rerun the same real jiti deferred-import case on the current head and redact any private paths or environment details. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current main still uses temporary storage: The current implementation derives the jiti filesystem cache from os.tmpdir() and places artifacts under jiti/openclaw/...; the durable cache-root helper is absent from current main. (src/plugins/sdk-alias.ts:54, 7cc2e6d83003)
  • PR implements the durable cache boundary: The branch accepts an absolute XDG_CACHE_HOME, otherwise selects the platform user-cache root, and scopes jiti artifacts under openclaw/jiti/<version>/<install-marker> while retaining the existing jiti cache opt-outs. (src/plugins/sdk-alias.ts:55, 531918e714ab)
  • Regression path is concrete: The added test compiles a TypeScript parent through jiti, removes TMPDIR, then resolves the parent’s deferred child import and checks that the child transform landed in the durable cache. (src/plugins/sdk-alias.test.ts:2427, 531918e714ab)
  • Existing behavior provenance: Blame attributes the current temporary-cache helper and cache-directory construction to the commit that introduced the present behavior; this identifies the established owner surface rather than relying only on the PR diff. (src/plugins/sdk-alias.ts:54, 75830f027af8)
  • Current-head proof cannot be correlated: The PR body names patch SHA-256 f9034a…, while the current head’s binary merge diff against its parent hashes to 4b54ff…; because the body does not define a matching hash procedure, its terminal transcript does not conclusively prove the force-pushed head. (src/plugins/sdk-alias.ts:55, 531918e714ab)
  • Merge result is clean but unshipped: A three-way merge against current main is clean, and no local branch or release tag contains the PR head; the repair is therefore neither on current main nor in the stated latest release. (src/plugins/sdk-alias.ts:55, 531918e714ab)

Likely related people:

  • DaigoSoup: Git blame assigns both the temporary-cache helper and the jiti cache-directory construction on current main to the same commit. (role: current behavior introducer and recent area contributor; confidence: high; commits: 75830f027af8; files: src/plugins/sdk-alias.ts)

Rank-up moves

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

  • Run the documented deferred parent-to-child jiti import after deleting TMPDIR on commit 531918e714abc69125f3b5ced4ee9f2a3dd45ca2, then update the PR body with the redacted command, result, and unambiguous head identity.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-01T10:47:01.402Z sha 6373896 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/issue-113550 branch from 6373896 to 531918e Compare August 1, 2026 14:56
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed 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 Aug 1, 2026
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer rank-up decision for exact reviewed head 531918e: no duplicate expensive runtime rerun is required. The rebase preserves all three independently approved owner file blobs and the identical full-index patch SHA256 f9034adaa33d7847edaa36c812b894e33e55e4d94a78eab5b71a34f3558f155d. The earlier real pinned-jiti parent process -> deleted TMPDIR -> deferred nested child import reproduced the original failure and passed with these exact repaired owner bytes; both owner suites and the scoped changed gate also passed on the actual Testbox run documented above. Current main changed no touched owner, direct loader caller, jiti dependency or lockfile; its package.json-only drift removes an unrelated canvas build script. The branch also inherits the merged PTY CI repair. Product-owner accepts the genuine existing subprocess proof for this byte-identical rebased fix.

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

Labels

maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

[Bug]: Gateway caches compiled runtime modules in /tmp/jiti — tmp cleaners delete them mid-run, causing silent inbound message drops

1 participant