[Fix] Dev login breaks in sandboxes when the deployment app env leaks into task processes - #195
Merged
Conversation
Contributor
Author
|
No code issues found. See task Reviewed keeping the deployment app env worker-internal: |
mrubens
marked this pull request as ready for review
July 11, 2026 16:28
mrubens
requested review from
brunobergher,
daniel-lxs and
mrubens
as code owners
July 11, 2026 16:28
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Worker sandboxes no longer inject the hosting deployment's app env into user-facing task processes.
WorkerEnv.buildUserFacingEnv()previously re-exported the capturedAPP_ENV/R_APP_ENV(e.g.productionon the hosted deployment) into every setup command, PM2-managed dev server, and terminal session, and those values were written as unconditionalexportlines into~/.roomote/env.sh. Because every non-interactive bash re-sources that file (the__ROOMOTE_ENV_LOADEDguard is unset at the end), nested shells clobbered per-commandR_APP_ENV=developmentoverrides, andresolveAppEnv()only readsR_APP_ENV, so.env.localand partial inline overrides could not win. In Roomote-on-Roomote sandboxes this made the web app resolve a production app env and disable/auth/dev-logindespiteWEB_DEV_LOGIN_ENABLED=true.The deployment app env now stays worker-internal:
workerConfig.appEnvstill feeds keepalive defaults, Sentry, and telemetry, but it is never exported to task processes. The legacyROOMOTE_APP_ENValias (still injected by the controller for pre-rename snapshot workers) is now scrubbed from the worker process env alongsideR_APP_ENV/APP_ENV. The checked-in.roomote/environments/roomote.yamldrops itssedexport-guard workaround, which this change makes unnecessary.Why this change was made
The deployment's app env describes Roomote's own deploy context, not the environment of the user project running inside the sandbox — forwarding it into task processes was a category error that the dev-login route's own comments already anticipated ("a sandbox that inherits a stray app env"). Fixing it at the source removes the need for brittle per-environment-config workarounds that must track the full alias trio.
Impact
Dev login and development app-env defaults work out of the box in dogfood sandboxes without env-config
sedhacks; sandbox task processes fall back to the documenteddevelopmentapp-env default unless an environment config sets the value explicitly. No behavior change for the worker's own keepalive, monitoring, or telemetry, and no change to production deployments' own app-env handling. Sandboxes resumed from old snapshots self-heal on their next run under the new worker release because~/.roomote/env.shis rewritten every run. Deployed environment configs that carry the samesedworkaround (e.g. the hosted "Roomote" dogfood environment) can drop it once this ships in a worker release.How it was tested
apps/worker/src/env/__tests__/worker-env.test.tswith regression assertions thatbuildUserFacingEnv()contains none ofAPP_ENV,R_APP_ENV, orROOMOTE_APP_ENV, plus scrub coverage for the legacy alias.@roomote/workerVitest suite passes (135 files, 1302 tests).pnpm lintandpnpm check-typespass across all workspaces.Checklist
[Fix],[Feat],[Improve],[Refactor],[Docs], or[Chore]followed by a user-facing descriptionpnpm lintandpnpm check-typespass locallypnpm changeset