Skip to content

Conversation

@dobrac
Copy link
Contributor

@dobrac dobrac commented Oct 13, 2025

Changes

  • Send the default user (and workdir) with the /init call (waitForEnvd) when building a template (especially in the finalize layer)
  • Update Envd
    • the user will be optional for all commands
      • when not provided, the default will be used
    • /init will receive default user (and workdir) parameters that will set global default user (and workdir)
  • We still need to create user "user" during the template build for the minimum amount of breaking changes
  • The sandbox user override (/init call) applies only for the v2.1.0 builds, all previous builds have always "user" as the default

Note

Adds template versioning (v1/v2) with SDK-based selection and propagates template-defined default user/workdir into sandboxes, updating envd API, build phases, and gRPC contracts accordingly.

  • Template Versioning:
    • Selects template version from SDK User-Agent (JS/Python); v1 handler forces templates.TemplateV1Version.
    • Passes version through API → template-manager → orchestrator; proto gains TemplateCreateRequest.version.
    • Shared: adds templates version constants and version utils.
  • Orchestrator/Builder:
    • Introduces a user phase to create/configure default user (sudo) and persist in metadata.
    • Enhances WORKDIR to resolve/normalize absolute paths and safe chowning.
    • Commands/executor accept log level; step factory sets default levels.
    • Envd init now sends default user/workdir; improved error logging on init failures.
  • envd (runtime):
    • New defaults context (env vars, default user, default workdir); POST /init supports defaultUser and defaultWorkdir.
    • Username in /files is optional; auth/signing and path resolution handle missing username via defaults and workdir.
    • Filesystem/process services use defaults for user/workdir; API version bumped to 0.4.0.
  • API Handlers:
    • V2 build handler derives version from User-Agent; fixes success flag; unified error handling.
  • Tests/Spec:
    • OpenAPI/spec and generated clients updated (optional username, new init fields).
    • Integration tests set User-Agent, use pointer usernames, and minor command arg fixes.

Written by Cursor Bugbot for commit 9798fbb. This will update automatically on new commits. Configure here.

@dobrac dobrac added the feature New feature label Oct 13, 2025
@linear
Copy link

linear bot commented Oct 13, 2025

@dobrac dobrac force-pushed the figure-out-default-user-template-root-sandbox-user-eng-3049 branch from 2a582b7 to 0d9d802 Compare October 13, 2025 18:44
@dobrac dobrac force-pushed the figure-out-default-user-template-root-sandbox-user-eng-3049 branch from 2ff2f59 to 8f679fa Compare October 13, 2025 18:58
@dobrac dobrac force-pushed the figure-out-default-user-template-root-sandbox-user-eng-3049 branch from 8f679fa to b21ee0a Compare October 13, 2025 19:01
@dobrac dobrac force-pushed the figure-out-default-user-template-root-sandbox-user-eng-3049 branch from b092565 to e1e0764 Compare October 14, 2025 10:03
@dobrac dobrac force-pushed the figure-out-default-user-template-root-sandbox-user-eng-3049 branch from e1e0764 to 6976e56 Compare October 14, 2025 10:05
@dobrac dobrac marked this pull request as ready for review October 14, 2025 10:05
@dobrac dobrac requested a review from ValentaTomas as a code owner October 14, 2025 10:05
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@dobrac dobrac requested a review from jakubno October 14, 2025 11:08
cursor[bot]

This comment was marked as outdated.

Copy link
Member

@jakubno jakubno left a comment

Choose a reason for hiding this comment

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

NITs

@dobrac dobrac requested a review from jakubno October 14, 2025 13:18
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@dobrac dobrac force-pushed the figure-out-default-user-template-root-sandbox-user-eng-3049 branch from ba40582 to daec35f Compare October 14, 2025 13:29
cursor[bot]

This comment was marked as outdated.

@dobrac dobrac enabled auto-merge (squash) October 14, 2025 13:53
@dobrac dobrac merged commit a8d150d into main Oct 14, 2025
26 checks passed
@dobrac dobrac deleted the figure-out-default-user-template-root-sandbox-user-eng-3049 branch October 14, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants