Skip to content

Make Wave bench launches responsive - #2

Merged
brettheap merged 2 commits into
mainfrom
fix/wave-launch-latency
Jul 25, 2026
Merged

Make Wave bench launches responsive#2
brettheap merged 2 commits into
mainfrom
fix/wave-launch-latency

Conversation

@brettheap

@brettheap brettheap commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • print startup status as soon as a Wave bench launcher begins
  • hash the shared AI profile launchers and skip repeated Docker copies when unchanged
  • preserve synchronization when launcher content changes

Validation

  • reproduced the original rustBench widget launch from Wave’s own wsh launch path
  • confirmed the original block eventually attached but appeared idle during a long silent startup
  • relaunched after the fix and reached /workspace in about 4.6 seconds
  • confirmed the terminal showed Opening immediately and performed no repeated docker cp operations
  • passed shell syntax and whitespace checks

Summary by Sourcery

Improve Wave bench launcher responsiveness by providing immediate startup feedback and avoiding redundant profile launcher synchronization.

New Features:

  • Display immediate container shell startup status when launching a Wave bench.

Enhancements:

  • Cache and compare a combined hash of AI profile launchers to skip unnecessary copies into running containers.
  • Document the new launcher behavior around startup status and profile-launcher synchronization in README and workbenches widget docs.

Copilot AI review requested due to automatic review settings July 25, 2026 06:18
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai

sourcery-ai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Makes Wave bench container launches more responsive by printing immediate startup status and avoiding redundant AI profile launcher copies via content hashing, while documenting the behavior in README and workbench widget docs.

Sequence diagram for responsive Wave bench container launch and hashed AI profile synchronization

sequenceDiagram
    actor User
    participant wave_container_shell_sh as wave-container-shell.sh
    participant Docker

    User->>wave_container_shell_sh: launch bench (check_only != true)
    wave_container_shell_sh->>User: printf OSC title with block_title
    wave_container_shell_sh->>User: echo Opening block_title container shell...

    User->>wave_container_shell_sh: install_ai_profile_launchers
    wave_container_shell_sh->>wave_container_shell_sh: compute bundle_hash from launchers
    wave_container_shell_sh->>Docker: docker exec cat /usr/local/share/workbenches/profile-launchers.sha256
    Docker-->>wave_container_shell_sh: installed_hash

    alt installed_hash == bundle_hash
        wave_container_shell_sh->>User: skip docker cp profile launchers
    else installed_hash != bundle_hash
        wave_container_shell_sh->>Docker: docker cp claude_launcher ...
        wave_container_shell_sh->>Docker: docker cp codex_launcher ...
        wave_container_shell_sh->>Docker: docker cp provider_launcher ...
        wave_container_shell_sh->>Docker: docker cp pi_launcher ...
        wave_container_shell_sh->>Docker: docker exec write bundle_hash to marker
    end
Loading

File-Level Changes

Change Details Files
Emit immediate startup feedback when opening a container shell to avoid long periods of apparent idleness.
  • Before running the devcontainer setup, set the terminal OSC title to the block title when not in check-only mode.
  • Print a human-readable "Opening '<block_title>' container shell..." message whenever a launch begins in non-check-only mode.
bin/wave-container-shell.sh
Skip repeated AI profile launcher installation when the launcher bundle content is unchanged, while preserving synchronization when it differs.
  • Compute a combined SHA-256 hash across the set of AI profile launcher scripts, substituting a placeholder when any launcher file is missing.
  • Read a previously stored bundle hash marker from inside the container and short-circuit installation when the installed hash matches the current bundle hash.
  • After copying and wiring up the profile launchers and user symlink, write the current bundle hash back into the container marker location, creating its directory if needed.
bin/wave-container-shell.sh
Document the new responsive startup behavior and hash-based profile launcher synchronization for bench widgets and container shells.
  • Update the README to describe immediate startup status for running containers and the skip behavior when the profile-launcher content hash matches.
  • Extend workbenches widget documentation to note the "Opening ..." status and hash-based synchronization that avoids repeated docker cp calls on healthy benches.
README.md
docs/workbenches-widgets.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • Consider guarding the OSC title and "Opening" status print with a TTY check so non-interactive or redirected runs of wave-container-shell.sh aren’t polluted with escape sequences and status text.
  • The profile-launchers hash marker path (/usr/local/share/workbenches/profile-launchers.sha256) is embedded inline; factoring it into a named constant at the top of the script would make future changes and reuse clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider guarding the OSC title and "Opening" status print with a TTY check so non-interactive or redirected runs of `wave-container-shell.sh` aren’t polluted with escape sequences and status text.
- The profile-launchers hash marker path (`/usr/local/share/workbenches/profile-launchers.sha256`) is embedded inline; factoring it into a named constant at the top of the script would make future changes and reuse clearer.

## Individual Comments

### Comment 1
<location path="bin/wave-container-shell.sh" line_range="332-333" />
<code_context>
+
+    local installed_hash
+    installed_hash="$(docker exec --user root "$container" sh -c "cat '$marker' 2>/dev/null" || true)"
+    if [[ "$installed_hash" == "$bundle_hash" ]]; then
+        return 0
+    fi
+
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Skipping the whole installer when hashes match may leave user-level symlinks out of sync.

The early return on matching `installed_hash` prevents creation of the `$HOME/.local/bin/claude` symlink. If the marker exists and binaries are unchanged but the user-level symlink was removed or corrupted, the installer will now exit without restoring it.

To avoid this drift, keep the hash check but limit the skip to the heavy `docker cp`/chmod/ln steps, and always run the user-level symlink creation so the CLI entry point is consistently present.

Suggested implementation:

```
    local installed_hash
    installed_hash="$(docker exec --user root "$container" sh -c "cat '$marker' 2>/dev/null" || true)"

    # If the bundle hash matches the hash recorded in the container, we can skip
    # re-copying binaries into the container, but we still want to ensure that
    # user-level symlinks are present and correct.
    local skip_container_install=false
    if [[ "$installed_hash" == "$bundle_hash" ]]; then
        skip_container_install=true
    fi


```

You will also need to:
1. Wrap the heavy container install steps (the `docker cp` of the bundle into the container, any `chmod` calls in the container, and container-level `ln` commands) in a conditional `if [[ "$skip_container_install" != true ]]; then ... fi` so they are skipped when hashes match.
2. Ensure the logic that creates or refreshes the user-level symlink (e.g. `ln -sf "$claude_launcher" "$HOME/.local/bin/claude"` or similar) is *not* inside the `skip_container_install` guard, so it always runs regardless of the hash comparison.
3. If any existing early `return` was used elsewhere to skip both container install and symlink creation on matching hashes, remove or adjust it so that only the container work is skipped while the user-level symlink creation still executes.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread bin/wave-container-shell.sh Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR improves perceived responsiveness when launching Wave workBench containers by printing startup status immediately and avoiding redundant profile-launcher synchronization when nothing has changed.

Changes:

  • Print an immediate Opening ... status (and set the terminal title) when starting a bench shell.
  • Cache a combined SHA-256 hash of AI profile launcher scripts inside the container to skip repeated docker cp operations when unchanged.
  • Document the new startup/status and synchronization behavior in the README and workbenches widget docs.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.

File Description
README.md Documents immediate startup status + hash-based skipping of profile-launcher copies.
docs/workbenches-widgets.md Documents Opening ... status and avoids repeated docker cp via combined content hash.
bin/wave-container-shell.sh Adds immediate “Opening …” feedback and introduces a marker-based hash check to skip redundant launcher sync.

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

Copilot AI review requested due to automatic review settings July 25, 2026 06:22
@brettheap

Copy link
Copy Markdown
Contributor Author

@codex review

@sonarqubecloud

Copy link
Copy Markdown

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@brettheap

Copy link
Copy Markdown
Contributor Author

Addressed the review on the updated head:

  • OSC title output is now TTY-guarded
  • the marker path is a named script-level constant
  • matching hashes skip only the heavy container copies
  • the user-level Claude symlink is always refreshed

Validation deliberately replaced that symlink with a broken target, ran the cached path, and confirmed it was repaired without any docker cp operations.

@brettheap
brettheap merged commit c758a53 into main Jul 25, 2026
3 checks passed
@brettheap
brettheap deleted the fix/wave-launch-latency branch July 25, 2026 06:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants