Skip to content

refactor(scripts): migrate OpenClaw config generator to TypeScript#4571

Merged
cv merged 7 commits into
fix/discord-plugin-entry-4246from
codex/ts-openclaw-config
May 30, 2026
Merged

refactor(scripts): migrate OpenClaw config generator to TypeScript#4571
cv merged 7 commits into
fix/discord-plugin-entry-4246from
codex/ts-openclaw-config

Conversation

@cv
Copy link
Copy Markdown
Collaborator

@cv cv commented May 30, 2026

Summary

Migrates scripts/generate-openclaw-config.py to a TypeScript entrypoint that runs with Node's experimental type stripping, keeping the generator in line with the rest of the project. Updates Docker/build-context wiring, preserves migration parity called out by review feedback, and adds focused regression tests for the new entrypoint.

Related Issue

Stacked on #4277.

Changes

  • Replace the Python OpenClaw config generator with scripts/generate-openclaw-config.ts.
  • Run the generator via node --experimental-strip-types in the sandbox Docker build and staged build context.
  • Use the WHATWG URL parser for CHAT_UI_URL security decisions, including userinfo/ambiguous-host cases.
  • Preserve previous channel config shape by keeping channel-level enabled out of token and WhatsApp channel blocks.
  • Restore the npm-package openclaw.plugin.json WeChat metadata probe and add coverage for that layout.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

Targeted checks run:

  • npx vitest run --project cli test/generate-openclaw-config.test.ts test/seed-wechat-accounts.test.ts test/security-c2-dockerfile-injection.test.ts test/sandbox-provisioning.test.ts test/sandbox-build-context.test.ts - passed, 151 tests.
  • npx tsc --noEmit --target ES2022 --module preserve --moduleResolution bundler --lib ES2022 --types node --strict --allowImportingTsExtensions scripts/generate-openclaw-config.ts - passed.
  • npx @biomejs/biome lint scripts/generate-openclaw-config.ts test/generate-openclaw-config.test.ts - passed.
  • git diff --check - passed.

Known broader-check status:

  • npx prek run --all-files did not start because the hook runner hit self-signed certificate in certificate chain while fetching a release.

  • npm test currently fails on existing/base issues unrelated to this migration, including missing plugin dist for SSRF parity and status/rebuild/deploy failures.

  • npm run typecheck:cli currently fails in existing src/lib/deploy/index.test.ts type errors unrelated to this generator.

  • npx prek run --all-files passes

  • npm test passes

  • Tests added or updated for new or changed behavior

  • No secrets, API keys, or credentials committed

  • Docs updated for user-facing behavior changes

  • npm run docs builds without warnings (doc changes only)

  • Doc pages follow the style guide (doc changes only)

  • New doc pages include SPDX header and frontmatter (new pages only)


Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

  • Refactor

    • Migrated build-time configuration generation from Python to TypeScript for improved codebase consistency.
  • Tests

    • Updated test suite to validate the TypeScript configuration generator with expanded coverage for environment variable validation, schema constraints, and security scenarios.

Review Change Stack

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv cv self-assigned this May 30, 2026
@copy-pr-bot
Copy link
Copy Markdown

copy-pr-bot Bot commented May 30, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f8972ea4-a181-4d30-b595-af218a0fbd36

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ts-openclaw-config

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 30, 2026

E2E Advisor Recommendation

Required E2E: CI / Self-Hosted PR / build-sandbox-images, CI / Self-Hosted PR / test-e2e-sandbox, CI / Self-Hosted PR / test-e2e-gateway-isolation, CI / Self-Hosted PR / test-e2e-port-overrides, E2E / Scenario Runner / ubuntu-repo-cloud-openclaw, nightly-e2e / messaging-providers-e2e
Optional E2E: CI / Self-Hosted PR / test-non-root-sandbox-smoke, regression-e2e / onboard-inference-smoke-e2e, E2E / Scenario Runner / ubuntu-repo-cloud-openclaw-discord

Dispatch hint: ubuntu-repo-cloud-openclaw

Auto-dispatched E2E: messaging-providers-e2e via nightly-e2e.yaml at 3acb99254393049ce7aa3685d1d4dc328fc0a900nightly run

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/fix/discord-plugin-entry-4246
Head: HEAD
Confidence: high

Required E2E

  • CI / Self-Hosted PR / build-sandbox-images (medium): Required to prove the production Dockerfile still builds after replacing generate-openclaw-config.py with generate-openclaw-config.mts and invoking it through node --experimental-strip-types during the image build.
  • CI / Self-Hosted PR / test-e2e-sandbox (medium): Runs the sandbox image smoke suite inside the built image, validating OpenClaw installation, plugin install/enable paths, blueprint assets, and the generated /sandbox/.openclaw/openclaw.json created by the new TypeScript generator.
  • CI / Self-Hosted PR / test-e2e-gateway-isolation (medium): Required because the generated OpenClaw config and Dockerfile image layout are part of the gateway/sandbox security boundary; this validates config hash, permissions, gateway user separation, update disabling, iptables availability, and isolation hardening in the production image.
  • CI / Self-Hosted PR / test-e2e-port-overrides (low): The generator owns NEMOCLAW_DASHBOARD_PORT and gateway/control UI port derivation; this image-level E2E verifies valid and invalid dashboard port overrides through the real entrypoint and runtime stack.
  • E2E / Scenario Runner / ubuntu-repo-cloud-openclaw (high): Required full user-flow coverage for source install/onboard, sandbox creation, generated OpenClaw config, gateway health, live cloud inference, sandbox lifecycle, credentials/security supplemental suites, rebuild, and diagnostics after the build-time config generator rewrite.
  • nightly-e2e / messaging-providers-e2e (high): Required because the TypeScript generator re-emits messaging channel config, token placeholders, allowlists, Slack token-shape aliases, and WeChat seed integration surfaces; this existing E2E validates messaging provider creation, credential isolation, placeholder/L7 proxy behavior, and OpenClaw config patching.

Optional E2E

  • CI / Self-Hosted PR / test-non-root-sandbox-smoke (low): Useful adjacent confidence that the production image entrypoint still completes under no-new-privileges after Dockerfile/config-generation changes, although the diff does not directly alter the entrypoint script.
  • regression-e2e / onboard-inference-smoke-e2e (low): Optional inference-route confidence: the generator controls the model/provider config consumed by OpenClaw, but the direct changed code is image config generation rather than setupInference() itself.
  • E2E / Scenario Runner / ubuntu-repo-cloud-openclaw-discord (high): Optional targeted real assistant messaging-path confidence for OpenClaw Discord after the config generator rewrite; messaging-providers-e2e is the stronger required credential/L7 coverage, but this scenario exercises the typed scenario path.

New E2E recommendations

  • wechat-config-generation (high): Existing messaging-providers coverage has WeChat assertions, but some WeChat seed checks can skip when the account state is absent. Add a non-skipping E2E that onboards OpenClaw with fake WECHAT_BOT_TOKEN/WECHAT_ACCOUNT_ID metadata and asserts channels.openclaw-weixin.accounts..enabled plus placeholder-only account files in the running sandbox.
    • Suggested test: Add a targeted OpenClaw WeChat seed E2E scenario or script that fails when seed-wechat-accounts.py is not invoked by generate-openclaw-config.mts during image build.
  • typescript-config-generator-image-smoke (medium): The Python-to-TypeScript migration depends on node --experimental-strip-types inside the Docker build. A small image-build smoke could catch future Node flag/runtime incompatibilities faster than full onboarding scenarios.
    • Suggested test: Add an image-level E2E that builds the production image and directly asserts /usr/local/lib/nemoclaw/generate-openclaw-config.mts exists, is executable/readable by the sandbox user, and generated openclaw.json contains expected provider, proxy, plugin, and controlUi blocks.

Dispatch hint

  • Workflow: .github/workflows/e2e-scenarios.yaml
  • jobs input: ubuntu-repo-cloud-openclaw

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 30, 2026

PR Review Advisor

Findings: 0 needs attention, 3 worth checking, 0 nice ideas
Since last review: 0 prior items resolved, 2 still apply, 0 new items found

Review findings

🛠️ Needs attention

  • None.

🔎 Worth checking

  • Source-of-truth review needed: WeChat seed subprocess invocation in scripts/generate-openclaw-config.mts: The advisor marked localized patch analysis as needs_followup.
    • Recommendation: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
    • Evidence: scripts/generate-openclaw-config.mts uses spawnSync("python3", [seedScript], { stdio: "inherit", env: process.env }); the deleted Python generator used runpy.run_path(seed_script).
  • Use a trusted Python interpreter path for WeChat seeding (scripts/generate-openclaw-config.mts:938): The migrated generator invokes the WeChat seed script with spawnSync("python3", ...), which resolves python3 through the ambient PATH. This is not shell-string injection because the argument vector is fixed, but it widens the trusted-code boundary for a build-time sandbox configuration path compared with the deleted Python generator's in-process runpy.run_path flow.
    • Recommendation: Invoke a known interpreter path in the sandbox image, such as /usr/bin/python3, or pass a sanitized PATH containing only trusted system directories. Add a regression test that places a fake python3 earlier in PATH and verifies the generator uses the trusted interpreter or fails closed.
    • Evidence: scripts/generate-openclaw-config.mts calls spawnSync("python3", [seedScript], { stdio: "inherit", env: process.env }). No test covering a fake python3/PATH poisoning case was found.
  • Source-of-truth follow-up needed for the WeChat seed subprocess boundary (scripts/generate-openclaw-config.mts:938): The migration keeps WeChat account seeding as a localized Node-to-Python subprocess workaround after moving the generator itself to TypeScript. The code does not document why the source cannot be fixed in this PR, whether the seed script should be ported/imported instead, what exact invalid state the subprocess boundary handles, or when the workaround can be removed.
    • Recommendation: Document the source boundary and removal condition, or eliminate the workaround by moving the seed logic to the same trusted TypeScript path. At minimum, pair the trusted-interpreter fix with a regression test that exercises the WeChat seed path through the generator executable boundary.
    • Evidence: The deleted Python generator used runpy.run_path(seed_script) in-process; the new TypeScript generator shells out via spawnSync("python3", [seedScript], ...).

🌱 Nice ideas

  • None.
Since last review details

Current findings:

  • Source-of-truth review needed: WeChat seed subprocess invocation in scripts/generate-openclaw-config.mts: The advisor marked localized patch analysis as needs_followup.
    • Recommendation: Identify the invalid state, source boundary, source-fix constraint, regression test, and removal condition before merging the localized behavior.
    • Evidence: scripts/generate-openclaw-config.mts uses spawnSync("python3", [seedScript], { stdio: "inherit", env: process.env }); the deleted Python generator used runpy.run_path(seed_script).
  • Use a trusted Python interpreter path for WeChat seeding (scripts/generate-openclaw-config.mts:938): The migrated generator invokes the WeChat seed script with spawnSync("python3", ...), which resolves python3 through the ambient PATH. This is not shell-string injection because the argument vector is fixed, but it widens the trusted-code boundary for a build-time sandbox configuration path compared with the deleted Python generator's in-process runpy.run_path flow.
    • Recommendation: Invoke a known interpreter path in the sandbox image, such as /usr/bin/python3, or pass a sanitized PATH containing only trusted system directories. Add a regression test that places a fake python3 earlier in PATH and verifies the generator uses the trusted interpreter or fails closed.
    • Evidence: scripts/generate-openclaw-config.mts calls spawnSync("python3", [seedScript], { stdio: "inherit", env: process.env }). No test covering a fake python3/PATH poisoning case was found.
  • Source-of-truth follow-up needed for the WeChat seed subprocess boundary (scripts/generate-openclaw-config.mts:938): The migration keeps WeChat account seeding as a localized Node-to-Python subprocess workaround after moving the generator itself to TypeScript. The code does not document why the source cannot be fixed in this PR, whether the seed script should be ported/imported instead, what exact invalid state the subprocess boundary handles, or when the workaround can be removed.
    • Recommendation: Document the source boundary and removal condition, or eliminate the workaround by moving the seed logic to the same trusted TypeScript path. At minimum, pair the trusted-interpreter fix with a regression test that exercises the WeChat seed path through the generator executable boundary.
    • Evidence: The deleted Python generator used runpy.run_path(seed_script) in-process; the new TypeScript generator shells out via spawnSync("python3", [seedScript], ...).

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
Copy link
Copy Markdown
Collaborator Author

cv commented May 30, 2026

Addressed the PR Review Advisor items in d8a8a8602:

  • Replaced the custom CHAT_UI_URL parser with Node/WHATWG URL parsing for security decisions, so userinfo/ambiguous authorities use the effective browser host.
  • Added generator-output regressions for http://127.0.0.1:18789@evil.example and http://localhost@evil.example forcing dangerouslyDisableDeviceAuth: true.
  • Removed the unintended top-level enabled: true drift from WhatsApp and token-based channel config blocks, with assertions preserving the prior shape.
  • Restored the npm-package openclaw.plugin.json WeChat metadata candidate and added coverage for that installed-package layout.

Focused verification now passes at 151 tests:
npx vitest run --project cli test/generate-openclaw-config.test.ts test/seed-wechat-accounts.test.ts test/security-c2-dockerfile-injection.test.ts test/sandbox-provisioning.test.ts test/sandbox-build-context.test.ts

Also passed the standalone strict TypeScript check, Biome lint for the touched TS/test files, and git diff --check. npx prek run --all-files is still blocked before hooks run by self-signed certificate in certificate chain.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
Copy link
Copy Markdown
Collaborator Author

cv commented May 30, 2026

Added a small direct-import unit-test path in 5cd42c701 so Vitest can report real coverage for the migrated TypeScript generator while keeping the black-box subprocess tests for executable/script behavior.

Focused generator coverage command:
npx vitest run --coverage --project cli --coverage.include=scripts/generate-openclaw-config.ts test/generate-openclaw-config.test.ts

Coverage for scripts/generate-openclaw-config.ts:

  • Statements/lines: 55.93% (231/413)
  • Branches: 46.31% (176/380)
  • Functions: 68.18% (30/44)

Validation after the split:

  • npx vitest run --project cli test/generate-openclaw-config.test.ts - passed, 92 tests.
  • npx vitest run --project cli test/generate-openclaw-config.test.ts test/seed-wechat-accounts.test.ts test/security-c2-dockerfile-injection.test.ts test/sandbox-provisioning.test.ts test/sandbox-build-context.test.ts - passed, 151 tests.
  • strict standalone TS check, Biome lint for touched files, and git diff --check - passed.

Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
Copy link
Copy Markdown
Collaborator Author

cv commented May 30, 2026

Expanded the direct unit coverage in 82efa3a44 by testing generator behavior under controlled process.env instead of routing most assertions through a subprocess. The subprocess path remains as a smoke test for the executable node --experimental-strip-types boundary.

Updated focused coverage command:
npx vitest run --coverage --coverage.reporter=text --project cli --coverage.include=scripts/generate-openclaw-config.ts test/generate-openclaw-config.test.ts

Coverage for scripts/generate-openclaw-config.ts is now:

  • Statements/lines: 95.15%
  • Branches: 89.73%
  • Functions: 100%

Validation after the expansion:

  • npx vitest run --project cli test/generate-openclaw-config.test.ts - passed, 102 tests.
  • npx vitest run --project cli test/generate-openclaw-config.test.ts test/seed-wechat-accounts.test.ts test/security-c2-dockerfile-injection.test.ts test/sandbox-provisioning.test.ts test/sandbox-build-context.test.ts - passed, 161 tests.
  • strict standalone TS check, Biome lint for touched linted files, and git diff --check - passed.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
test/security-c2-dockerfile-injection.test.ts (2)

115-123: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use a JavaScript-shaped payload in this Node regression.

After the migration to node -e, this case still uses a Python payload/comment, so it can stay green without exercising the JavaScript injection surface the file is meant to cover.

♻️ Suggested update
-  it("semicolons and import statements in URL are literal data", () => {
-    const dangerous = "http://x; import subprocess; subprocess.run(['id'])";
+  it("semicolons and require calls in URL are literal data", () => {
+    const dangerous =
+      "http://x; require('node:child_process').execSync('id')";
     const result = runNode(fixedSource(), { CHAT_UI_URL: dangerous });
-    // The URL is treated as data — urlparse may or may not raise, but
-    // the key property is that no code injection occurs. Check stdout or stderr
-    // does NOT contain evidence of os.system/subprocess execution.
+    // The URL is treated as data.
+    // The key property is that no injected JavaScript executes.
     const combined = result.stdout + result.stderr;
     expect(!combined.includes("uid=")).toBeTruthy();
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/security-c2-dockerfile-injection.test.ts` around lines 115 - 123, The
test "semicolons and import statements in URL are literal data" currently uses a
Python payload string in dangerous and thus doesn't exercise the Node/JavaScript
injection surface; update the dangerous value passed into runNode(fixedSource(),
{ CHAT_UI_URL: dangerous }) to a JavaScript-shaped payload (e.g., something that
would execute when interpreted by node -e such as using ;
require('child_process').execSync('id') or similar) so the test asserts no JS
code execution; keep the test flow (result, combined = result.stdout +
result.stderr, expect(!combined.includes("uid=")).toBeTruthy()) and only change
the CHAT_UI_URL payload.

130-159: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fail when the generator RUN layer is not found.

If the regex stops matching because the Dockerfile command is reformatted, the fallback expect(promoted).toBeTruthy() still passes as long as the ENV appears somewhere. That weakens this from an ordering assertion to an existence check.

♻️ Suggested update
   it("NEMOCLAW_DISABLE_DEVICE_AUTH is promoted to ENV before the config generator RUN layer", () => {
     const src = fs.readFileSync(DOCKERFILE, "utf-8");
     const lines = src.split("\n");
     let promoted = false;
     let inEnvBlock = false;
+    let sawGeneratorRun = false;
     for (let i = 0; i < lines.length; i++) {
       const line = lines[i];
       if (/^\s*FROM\b/.test(line)) {
         promoted = false;
         inEnvBlock = false;
@@
       if (
         /^\s*RUN\b.*node\s+--experimental-strip-types\s+\/usr\/local\/lib\/nemoclaw\/generate-openclaw-config\.ts\b/.test(
           line,
         )
       ) {
+        sawGeneratorRun = true;
         expect(promoted).toBeTruthy();
         return;
       }
     }
-    expect(promoted).toBeTruthy();
+    expect(sawGeneratorRun).toBeTruthy();
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/security-c2-dockerfile-injection.test.ts` around lines 130 - 159, The
test currently falls back to expect(promoted).toBeTruthy() even if the generator
RUN line (the regex
/^\s*RUN\b.*node\s+--experimental-strip-types\s+\/usr\/local\/lib\/nemoclaw\/generate-openclaw-config\.ts\b/)
was never matched, turning an ordering assertion into a mere existence check;
add a boolean flag (e.g., foundGeneratorRun) that is set true when that RUN
regex matches, assert foundGeneratorRun is true (fail if the RUN line isn’t
found), and only then assert promoted is true (or assert promoted &&
foundGeneratorRun) so the test fails if the generator RUN layer cannot be
located while still checking ENV promotion using the existing
promoted/inEnvBlock logic.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Dockerfile`:
- Around line 397-403: The Docker build breaks because
/usr/local/lib/nemoclaw/generate-openclaw-config.ts is ESM-only but is executed
with node --experimental-strip-types without a nearby package.json declaring
"type":"module"; fix by either: (A) add/copy a minimal package.json containing
{"type":"module"} into /usr/local/lib/nemoclaw/ during the Dockerfile steps so
Node treats generate-openclaw-config.ts as ESM at build time (ensure the Docker
COPY places this package.json next to generate-openclaw-config.ts before the RUN
invocation), or (B) rename scripts/generate-openclaw-config.ts to
generate-openclaw-config.mts and update the Dockerfile COPY, RUN (node
--experimental-strip-types /usr/local/lib/nemoclaw/generate-openclaw-config.mts)
and chmod entries to reference the .mts filename so Node treats it as ESM
automatically.

---

Outside diff comments:
In `@test/security-c2-dockerfile-injection.test.ts`:
- Around line 115-123: The test "semicolons and import statements in URL are
literal data" currently uses a Python payload string in dangerous and thus
doesn't exercise the Node/JavaScript injection surface; update the dangerous
value passed into runNode(fixedSource(), { CHAT_UI_URL: dangerous }) to a
JavaScript-shaped payload (e.g., something that would execute when interpreted
by node -e such as using ; require('child_process').execSync('id') or similar)
so the test asserts no JS code execution; keep the test flow (result, combined =
result.stdout + result.stderr, expect(!combined.includes("uid=")).toBeTruthy())
and only change the CHAT_UI_URL payload.
- Around line 130-159: The test currently falls back to
expect(promoted).toBeTruthy() even if the generator RUN line (the regex
/^\s*RUN\b.*node\s+--experimental-strip-types\s+\/usr\/local\/lib\/nemoclaw\/generate-openclaw-config\.ts\b/)
was never matched, turning an ordering assertion into a mere existence check;
add a boolean flag (e.g., foundGeneratorRun) that is set true when that RUN
regex matches, assert foundGeneratorRun is true (fail if the RUN line isn’t
found), and only then assert promoted is true (or assert promoted &&
foundGeneratorRun) so the test fails if the generator RUN layer cannot be
located while still checking ENV promotion using the existing
promoted/inEnvBlock logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 86b08610-8d9a-47b1-b5a6-a6ca6db152e8

📥 Commits

Reviewing files that changed from the base of the PR and between 44115d5 and 5cd42c7.

📒 Files selected for processing (10)
  • Dockerfile
  • scripts/generate-openclaw-config.py
  • scripts/generate-openclaw-config.ts
  • scripts/seed-wechat-accounts.py
  • src/lib/sandbox/build-context.ts
  • test/generate-openclaw-config.test.ts
  • test/sandbox-build-context.test.ts
  • test/sandbox-provisioning.test.ts
  • test/security-c2-dockerfile-injection.test.ts
  • test/seed-wechat-accounts.test.ts
💤 Files with no reviewable changes (1)
  • scripts/generate-openclaw-config.py

Comment thread Dockerfile Outdated
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Comment thread test/security-c2-dockerfile-injection.test.ts Fixed
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/generate-openclaw-config.test.ts (1)

55-81: 💤 Low value

Optional: deduplicate env construction between withConfigEnv and runConfigScriptRaw.

Both build the same { PATH, ...BASE_ENV, ...envOverrides, HOME } shape (Lines 40-45 and Lines 57-62). Extracting a small buildTestEnv(envOverrides) helper keeps the subprocess and in-process paths from drifting.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/generate-openclaw-config.test.ts` around lines 55 - 81, Extract the
duplicated environment construction into a shared helper (e.g., buildTestEnv)
that accepts envOverrides and returns the merged env object ({ PATH,
...BASE_ENV, ...envOverrides, HOME: tmpDir }); update withConfigEnv to call
buildTestEnv(envOverrides) instead of reconstructing the object inline, and
update runConfigScript (and any runConfigScriptRaw variant) to use buildTestEnv
when preparing the env for subprocess/in-process runs so both paths use the same
source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/generate-openclaw-config.test.ts`:
- Around line 55-81: Extract the duplicated environment construction into a
shared helper (e.g., buildTestEnv) that accepts envOverrides and returns the
merged env object ({ PATH, ...BASE_ENV, ...envOverrides, HOME: tmpDir }); update
withConfigEnv to call buildTestEnv(envOverrides) instead of reconstructing the
object inline, and update runConfigScript (and any runConfigScriptRaw variant)
to use buildTestEnv when preparing the env for subprocess/in-process runs so
both paths use the same source of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 024dc4f0-19db-4dae-a53c-d6fb3e194271

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd42c7 and a58248a.

📒 Files selected for processing (9)
  • Dockerfile
  • scripts/generate-openclaw-config.mts
  • scripts/seed-wechat-accounts.py
  • src/lib/sandbox/build-context.ts
  • test/generate-openclaw-config.test.ts
  • test/sandbox-build-context.test.ts
  • test/sandbox-provisioning.test.ts
  • test/security-c2-dockerfile-injection.test.ts
  • test/seed-wechat-accounts.test.ts
💤 Files with no reviewable changes (1)
  • scripts/generate-openclaw-config.mts
✅ Files skipped from review due to trivial changes (2)
  • scripts/seed-wechat-accounts.py
  • test/seed-wechat-accounts.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
  • test/sandbox-build-context.test.ts
  • Dockerfile
  • src/lib/sandbox/build-context.ts
  • test/security-c2-dockerfile-injection.test.ts

cv and others added 2 commits May 30, 2026 15:06
…o local variable'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
@cv
Copy link
Copy Markdown
Collaborator Author

cv commented May 30, 2026

Addressed the CodeRabbit review from pullrequestreview-4396054818 in 3acb992 by extracting shared buildTestEnv() setup for both the subprocess and in-process generator test helpers.

Validation:

  • npx vitest run --project cli test/generate-openclaw-config.test.ts
  • npx vitest run --project cli test/generate-openclaw-config.test.ts test/security-c2-dockerfile-injection.test.ts test/sandbox-build-context.test.ts test/sandbox-provisioning.test.ts test/seed-wechat-accounts.test.ts
  • git diff --check

@cv cv marked this pull request as ready for review May 30, 2026 22:31
@cv cv merged commit 4228af3 into fix/discord-plugin-entry-4246 May 30, 2026
25 checks passed
@cv cv deleted the codex/ts-openclaw-config branch May 30, 2026 22:31
@github-actions
Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26696782468
Target ref: 3acb99254393049ce7aa3685d1d4dc328fc0a900
Workflow ref: fix/discord-plugin-entry-4246
Requested jobs: messaging-providers-e2e
Summary: 1 passed, 0 failed, 0 skipped

Job Result
messaging-providers-e2e ✅ success

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants