fix(terraform): run the OpenComputer snapshot builder from the repo root#842
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe snapshot build script now changes into ChangesAbsolute repo root for snapshot build
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Terraform Validation Results
Pushed by: @ColeMurray, Action: |
There was a problem hiding this comment.
Summary
PR #842, fix(terraform): resolve OpenComputer build repo root to absolute path, by @ColeMurray changes one file (+8/-4) to pass an absolute repository root into the OpenComputer snapshot builder. The change is minimal and correctly addresses the relative-path mismatch caused by running the builder through an npm workspace.
Critical Issues
None found.
Suggestions
None.
Nitpicks
None.
Positive Feedback
- The fix is scoped to the actual integration boundary: the shell script now exports the path in the form expected by
build-template.ts. - Resolving after
cd "${PROJECT_ROOT}"avoids duplicating path resolution logic and works whetherPROJECT_ROOTis relative or absolute. - The expanded comment documents the non-obvious npm workspace cwd behavior that caused the bug.
Questions
None.
Verdict
Approve: ready to merge.
The Terraform-managed OpenComputer snapshot build ran the builder via `npm run build:opencomputer-template`, which uses `npm -w` and moves cwd into packages/opencomputer-infra. build-template.ts resolves the sandbox-runtime source relative to cwd, so `terraform apply` failed: Missing sandbox runtime directory: ../../../packages/sandbox-runtime/src/sandbox_runtime Mirror the sibling Vercel builder (terraform/modules/vercel-sandbox-infra): build the bundle, then run `node packages/opencomputer-infra/dist/build-template.js` directly from the repo root. The script already `cd`s into the repo, so cwd is the repo root and the runtime dir resolves with no env override and no git dependency. Validated with `--print-manifest` from the repo root: 26 runtime files resolved (incl. the 4 skills/*/SKILL.md prompts) and the cacheKey computed, before the snapshot API call.
891f5f4 to
27c1e0d
Compare
Terraform Validation Results
Pushed by: @ColeMurray, Action: |
Summary
Fixes the Terraform-managed OpenComputer snapshot build (added in #840). A real
terraform applywithSANDBOX_PROVIDER=opencomputerfails immediately with:Root cause
The script ran the builder through
npm run build:opencomputer-template, which usesnpm -w @open-inspect/opencomputer-infraand moves cwd into the workspace (packages/opencomputer-infra).build-template.tsresolves thesandbox-runtimesource relative to that cwd, so it looked for the runtime dir under the workspace instead of the repo root.Fix
Mirror the sibling Vercel builder (
terraform/modules/vercel-sandbox-infra/scripts/build-base-snapshot.sh), which splits build from run and invokes the builder directly from the repo root:The script already
cds into the repo, so runningnodefrom there keeps cwd at the repo root and the runtime dir resolves — with noOPENINSPECT_REPO_ROOTenv override and no git dependency. This keeps repo-root resolution consistent with how the other providers' Terraform builders work.Validation
Ran the new invocation with
--print-manifest(which builds the image and returns before the snapshot API call) from the repo root:sandbox_runtime/*files resolved, including the 4skills/*/SKILL.mdpromptsThe original
$(pwd)approach was also proven end-to-end against a real OpenComputer build (image built all 36 steps); this revision keeps that working while removing the env contract per review.Pure shell change —
bash -nclean, file mode (100755) preserved.Summary by CodeRabbit