Skip to content

Just for benchmarking: add force launch option#93

Open
lukaskratzel wants to merge 1 commit intomainfrom
benchmark/force-launch-option
Open

Just for benchmarking: add force launch option#93
lukaskratzel wants to merge 1 commit intomainfrom
benchmark/force-launch-option

Conversation

@lukaskratzel
Copy link
Copy Markdown

@lukaskratzel lukaskratzel commented Mar 19, 2026

Summary by CodeRabbit

  • New Features
    • Workspace names now include an additional unique identifier suffix for improved differentiation.
    • Ephemeral sessions can now be configured to reuse existing sessions or create new ones based on request settings.

Copilot AI review requested due to automatic review settings March 19, 2026 11:26
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 70765780-d97d-4a98-9afd-6ca7319e9b27

📥 Commits

Reviewing files that changed from the base of the PR and between bc6e557 and 6f52f10.

📒 Files selected for processing (5)
  • java/common/org.eclipse.theia.cloud.common/src/main/java/org/eclipse/theia/cloud/common/util/WorkspaceUtil.java
  • java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/K8sUtil.java
  • java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/LaunchRequest.java
  • java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/RootResource.java
  • java/service/org.eclipse.theia.cloud.service/src/main/java/org/eclipse/theia/cloud/service/session/SessionResource.java

📝 Walkthrough

Walkthrough

Changes introduce session reuse control for ephemeral launches. WorkspaceUtil.java appends UUID suffixes to workspace names. K8sUtil.launchEphemeralSession() accepts a new reuseExistingSession boolean parameter to control session naming behavior. LaunchRequest, RootResource, and SessionResource are updated to propagate this parameter through the API call chain.

Changes

Cohort / File(s) Summary
Workspace and Session Naming
java/common/.../WorkspaceUtil.java, java/service/.../K8sUtil.java
WorkspaceUtil now appends an 8-character UUID suffix to generated workspace names. K8sUtil's launchEphemeralSession() accepts a new reuseExistingSession parameter that controls whether to generate a new session identity or reuse an existing one.
API Layer and Request Handling
java/service/.../LaunchRequest.java, java/service/.../RootResource.java, java/service/.../session/SessionResource.java
LaunchRequest adds a public reuseExistingSession boolean field (default true) with OpenAPI metadata. RootResource and SessionResource updated to pass this parameter when invoking launchEphemeralSession().

Sequence Diagram

sequenceDiagram
    participant Client
    participant RootResource
    participant K8sUtil
    participant WorkspaceUtil
    
    Client->>RootResource: POST /launch (LaunchRequest with reuseExistingSession)
    
    alt reuseExistingSession = true
        RootResource->>K8sUtil: launchEphemeralSession(..., true, ...)
        K8sUtil->>K8sUtil: getSessionName(user, app, false)
        K8sUtil->>WorkspaceUtil: generateUniqueWorkspaceName(user, app)
        WorkspaceUtil->>WorkspaceUtil: append UUID suffix to workspace name
        WorkspaceUtil-->>K8sUtil: ws-{epochMillis}-{uuidSuffix}{app}-{user}
    else reuseExistingSession = false
        RootResource->>K8sUtil: launchEphemeralSession(..., false, ...)
        K8sUtil->>K8sUtil: getSessionName(user, app, true)
        K8sUtil->>WorkspaceUtil: generateUniqueWorkspaceName(user, app)
        WorkspaceUtil->>WorkspaceUtil: append UUID suffix to workspace name
        WorkspaceUtil-->>K8sUtil: ws-{epochMillis}-{uuidSuffix}{app}-{user}
    end
    
    K8sUtil->>K8sUtil: launchSession with computed name
    K8sUtil-->>RootResource: session identifier
    RootResource-->>Client: 200 OK
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A UUID suffix springs to life,
No workspace names in strife!
Sessions reuse or start anew,
The parameter flows right through—
Eight random chars, a rabbit's delight! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title refers to a 'force launch option' but the changes actually implement a 'reuseExistingSession' parameter that controls whether to reuse existing sessions versus force-generating new ones—this is semantically inverted from what the title suggests. Revise the title to accurately reflect the new reuseExistingSession parameter, such as 'Add option to control session reuse behavior' or 'Add reuseExistingSession parameter to control ephemeral session naming'.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch benchmark/force-launch-option
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a benchmarking-oriented option to control whether ephemeral session launches should reuse an existing session or force creation of a fresh one, by threading a new request flag down into the Kubernetes launch logic. Also improves uniqueness of generated workspace names to reduce collisions.

Changes:

  • Add reuseExistingSession flag to LaunchRequest (default true) and include it in request logging.
  • Extend K8sUtil.launchEphemeralSession(...) with a reuse/force-new parameter and wire it from RootResource.
  • Make unique workspace naming more collision-resistant by adding a short UUID suffix.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
java/service/.../session/SessionResource.java Updates ephemeral launch call to match new K8sUtil.launchEphemeralSession signature (keeps reuse behavior).
java/service/.../RootResource.java Passes new reuseExistingSession flag through to ephemeral session launches.
java/service/.../LaunchRequest.java Introduces reuseExistingSession request field and logs it via toString().
java/service/.../K8sUtil.java Adds reuse/force-new parameter to ephemeral session launch and uses it to decide unique vs stable session naming.
java/common/.../WorkspaceUtil.java Adds UUID-based suffix to unique workspace name generation to reduce collisions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return asValidName((WORKSPACE_PREFIX + Instant.now().toEpochMilli() + getWorkspaceDescription(appDefinitionName)
+ "-" + user).toLowerCase(), WORKSPACE_NAME_LIMIT);
String suffix = UUID.randomUUID().toString().substring(0, 8);
return asValidName((WORKSPACE_PREFIX + Instant.now().toEpochMilli() + "-" + suffix
Comment on lines 98 to 102
if (request.isEphemeral()) {
info(correlationId, "Launching ephemeral session " + request);
return k8sUtil.launchEphemeralSession(correlationId, request.appDefinition, user, request.timeout,
request.env);
return k8sUtil.launchEphemeralSession(correlationId, request.appDefinition, user,
request.reuseExistingSession, request.timeout, request.env);
}
SessionSpec sessionSpec = new SessionSpec(getSessionName(user, appDefinition, false), appDefinition, user);
public String launchEphemeralSession(String correlationId, String appDefinition, String user,
boolean reuseExistingSession, int timeout, EnvironmentVars env) {
SessionSpec sessionSpec = new SessionSpec(getSessionName(user, appDefinition, !reuseExistingSession),
@Schema(description = "If true no workspace will be created for the session.", required = false)
public boolean ephemeral;

@Schema(description = "If false, ephemeral launches will always create a fresh session instead of reusing an existing one for the same user and app definition.", required = false)
@lukaskratzel lukaskratzel force-pushed the benchmark/force-launch-option branch from 6f52f10 to 8a76748 Compare March 19, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants