fix(cli): match bundleSkills indexer env with main worker indexer#3689
fix(cli): match bundleSkills indexer env with main worker indexer#3689ericallam wants to merge 1 commit into
Conversation
The bundleSkills indexer pass runs a child process to import every task file and read its skill registrations. It was passed `env: process.env`, but the main worker indexer (devSupervisor.#getEnvVars) injects TRIGGER_API_URL and TRIGGER_SECRET_KEY from the active CLI profile, not from .env. So any task file that reads process.env.TRIGGER_API_URL (or related CLI-injected vars) at module top level imported fine in the real worker but threw in the bundleSkills indexer, surfacing as a spurious [bundleSkills] skill discovery failed, skipping skill bundling: Failed to import some task files warning on every dev rebuild for any project that doesn't duplicate TRIGGER_API_URL into its .env. Fix: thread TRIGGER_API_URL + TRIGGER_SECRET_KEY from the client into the bundleSkills env so the two indexer passes see the same environment.
🦋 Changeset detectedLatest commit: a373c51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 32 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (24)
🧰 Additional context used📓 Path-based instructions (5)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
Files:
packages/cli-v3/src/dev/**/*📄 CodeRabbit inference engine (packages/cli-v3/CLAUDE.md)
Files:
**/*.{js,jsx,ts,tsx,json,md,yml,yaml}📄 CodeRabbit inference engine (AGENTS.md)
Files:
🧠 Learnings (4)📚 Learning: 2026-03-22T13:26:12.060ZApplied to files:
📚 Learning: 2026-03-22T19:24:14.403ZApplied to files:
📚 Learning: 2026-05-18T08:21:27.694ZApplied to files:
📚 Learning: 2026-05-18T08:21:27.694ZApplied to files:
🔇 Additional comments (2)
WalkthroughThis PR fixes a dev-session issue where the Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Summary
The
bundleSkillsstep (new in 4.5.0-rc.0) runs an extra indexer pass to discover registered Agent Skills so it can copy their folders into.trigger/skills/{id}/before the worker starts. It runs in a child process that imports every task file.The child was getting
env: process.env, while the main worker indexer atbackgroundWorker.ts:62gets the merged env fromdevSupervisor.#getEnvVars— which injectsTRIGGER_API_URLandTRIGGER_SECRET_KEYfrom the active CLI profile.So any task file that reads
process.env.TRIGGER_API_URL(or related CLI-injected vars) at module top level imported fine in the real worker but threw on import in thebundleSkillsindexer, surfacing as a spurious warning on every dev rebuild for any project that doesn't duplicateTRIGGER_API_URLinto its.env:The user's code is fine — the dev worker comes up green and tasks execute normally — but skill discovery is silently skipped, which is a real (if quiet) functional gap for any project that uses both
chat.agent+ skills AND relies on the CLI to injectTRIGGER_API_URLfrom the profile.Fix
Thread
TRIGGER_API_URL+TRIGGER_SECRET_KEYfrom theclientinto thebundleSkillsenv indevSession.ts, so the two indexer passes see the same environment. The deploy path (buildWorker.ts) is unaffected — those vars aren't meaningful at build time.Follow-up
The cleanest architectural fix is to eliminate the duplicate indexer pass entirely — the main worker indexer already returns
workerManifest.skills, sobundleSkillscould read from there instead of running its own indexer. Tracked separately; this PR is the surgical fix for the symptom.Test plan
trigger devin a project that (a) readsprocess.env.TRIGGER_API_URLat module top level in a task file and (b) doesn't haveTRIGGER_API_URLin its.env. Confirm the[bundleSkills] skill discovery failedwarning appears.