Skip to content

Make Wave bench launches responsive - #8

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

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

Conversation

@brettheap

@brettheap brettheap commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • synchronize the checked-in Wave launcher with the durable Install-Wave-Terminal source
  • display immediate startup status
  • cache the combined AI profile-launcher hash and avoid repeated Docker copies
  • carry forward the durable history-directory and Pi-profile launcher behavior

Validation

  • reproduced rustBench through Wave’s own widget-launch RPC
  • confirmed the original click eventually attached but had a long silent delay
  • confirmed the fixed launch reaches /workspace in about 4.6 seconds
  • verified the terminal displays Opening immediately and performs no redundant copies
  • validated shell syntax, exact installer/copy parity, and whitespace

Summary by Sourcery

Improve Wave container shell responsiveness, history handling, and AI profile launcher installation while keeping the host and container behavior in sync.

Enhancements:

  • Display an immediate terminal window title and startup message when launching the container shell.
  • Persist shell history in a dedicated .workbenches-history directory in the container and ensure it is initialized with correct ownership.
  • Mount and validate additional configuration directories, including .pi-profiles, into the container to align with other AI profile mounts.
  • Cache a combined hash of AI profile launchers to avoid redundant docker cp operations and extend support to a new pi-profile launcher.
  • Export HISTFILE into the container shell exec path and extend the health/check-only path to verify history and profile setup.

Copilot AI review requested due to automatic review settings July 25, 2026 06:20
@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

@codex review

@sourcery-ai

sourcery-ai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Reviewer's Guide

Aligns Wave container shell launcher with durable installer by improving startup UX, centralizing container history handling, and making AI profile launcher installation idempotent and extended to Pi profiles.

Sequence diagram for responsive Wave bench launch and idempotent AI profile installation

sequenceDiagram
    actor User
    participant WaveLauncher
    participant wave_container_shell_sh
    participant Docker
    participant Container

    User->>WaveLauncher: launch_bench
    WaveLauncher->>wave_container_shell_sh: invoke_with_block_title
    alt check_only != true
        wave_container_shell_sh->>WaveLauncher: printf_title_and_opening
    end

    wave_container_shell_sh->>Docker: docker_start(container)
    wave_container_shell_sh->>Docker: ensure_container_history
    Docker->>Container: mkdir_workbenches_history
    Docker->>Container: touch_zsh_history

    wave_container_shell_sh->>Docker: install_ai_profile_launchers
    Docker->>Container: read_profile_launchers_sha256
    alt installed_hash == bundle_hash
        wave_container_shell_sh->>Docker: skip_docker_cp
    else installed_hash != bundle_hash
        Docker->>Container: docker_cp_claude_profile
        Docker->>Container: docker_cp_codex_profile
        Docker->>Container: docker_cp_provider_profile
        Docker->>Container: docker_cp_pi_profile
        Docker->>Container: write_profile_launchers_sha256
    end

    wave_container_shell_sh->>Docker: docker_exec_shell_with_HISTFILE
    Docker->>Container: start_shell_with_history
Loading

File-Level Changes

Change Details Files
Display immediate terminal/window status and maintain history configuration in a dedicated container directory.
  • Define container-side history directory and file paths for the workbench shell user.
  • Set terminal title and print an 'Opening' message when not in check-only mode to provide immediate startup feedback.
  • Mount the history Docker volume into a directory instead of directly onto the history file, and export HISTFILE into the container for shell usage.
  • Add the history directory to required container mounts and ensure it exists with proper ownership via a helper function.
scripts/wave-container-shell.sh
Sync host/container mounts and AI-related directories with durable installer behavior, including Pi profiles.
  • Include ~/.pi-profiles in the host-side source directories to ensure it is available for mounting into containers.
  • Mount host ~/.pi-profiles into the container under the user's home as a cached volume.
  • Add .pi-profiles to the set of required mounts so check-only runs validate its presence along with other profile directories.
scripts/wave-container-shell.sh
Make AI profile launcher installation idempotent and extend it to Pi, avoiding redundant Docker copies.
  • Introduce a bundle hash over all available AI profile launcher scripts (Claude, Codex, provider, Pi) and store the hash inside the container as a marker.
  • Skip re-installation of launchers when the container marker hash matches the current bundle hash, preventing repeated docker cp operations.
  • Install the Pi profile launcher and its shorthand symlink when present, mirroring other provider launchers.
  • Ensure the marker directory exists and persist the bundle hash after installing launchers.
  • Extend check-only validation to assert the presence of new Pi launcher commands and profile directories.
scripts/wave-container-shell.sh
Propagate history and launcher configuration into check-only and interactive exec flows to match durable behavior.
  • Wire HISTFILE into docker exec calls for both check-only and interactive shell execution, ensuring the shell uses the shared history file.
  • Expand the check-only smoke test to verify HISTFILE, Pi launcher availability, and the presence of Pi profiles alongside existing AI providers.
scripts/wave-container-shell.sh

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

@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:

  • Switching the history volume from a single file to a directory (and updating mounts and HISTFILE accordingly) is a behavioral change; double-check that any host-side logic that initializes history_volume now expects and creates a directory rather than just a file to avoid mismatches or stale paths.
  • The install_ai_profile_launchers function runs several separate docker cp and docker exec commands; consider grouping related operations into fewer docker exec calls to reduce overhead and make the launcher installation flow easier to follow.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Switching the history volume from a single file to a directory (and updating mounts and HISTFILE accordingly) is a behavioral change; double-check that any host-side logic that initializes `history_volume` now expects and creates a directory rather than just a file to avoid mismatches or stale paths.
- The `install_ai_profile_launchers` function runs several separate `docker cp` and `docker exec` commands; consider grouping related operations into fewer `docker exec` calls to reduce overhead and make the launcher installation flow easier to follow.

## Individual Comments

### Comment 1
<location path="scripts/wave-container-shell.sh" line_range="305-309" />
<code_context>
+        "mkdir -p '$container_history_dir' && touch '$container_history_file' && chown -R '${container_user}:${container_user}' '$container_history_dir'"
+}
+
 install_ai_profile_launchers() {
     local claude_launcher="$workbenches_root/base-image/files/claude-profile"
     local codex_launcher="$workbenches_root/base-image/files/codex-profile"
     local provider_launcher="$workbenches_root/base-image/files/provider-profile"
+    local pi_launcher="$workbenches_root/base-image/files/pi-profile"
     [[ -f "$claude_launcher" ]] || return 0

</code_context>
<issue_to_address>
**issue:** Pi launcher installation is gated on the Claude launcher existing.

Because of `[[ -f "$claude_launcher" ]] || return 0`, the function stops if the Claude launcher is missing, even when `pi-profile` exists. This prevents installing Pi tooling (`pi-profile`, `ppi` symlink) unless Claude is present. If Pi should be installable independently, adjust the guard so it only wraps Claude-specific logic or add separate presence checks per launcher to avoid this coupling.
</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 scripts/wave-container-shell.sh Outdated
@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.

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 updates the Wave Terminal container-shell launcher script to make bench launches feel responsive and to better align host/container state (history + AI profile launchers), while reducing repeated work during startup.

Changes:

  • Show immediate terminal title + “Opening …” message before container startup work begins.
  • Persist shell history under a dedicated container directory (~/.workbenches-history) and export HISTFILE into the exec/check paths.
  • Add .pi-profiles mount support and introduce a cached hash marker to avoid redundant docker cp for AI profile launchers.

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

Comment on lines 368 to 371
if [[ "$check_only" == true ]]; then
docker exec --user "$container_user" --workdir "$workdir" "$container" "$shell_path" -lc \
'printf "%s\n" "wave-container-shell-ok"; whoami; pwd; command -v claude-profile; command -v pclaude; command -v codex-profile; command -v pcodex; command -v pgemini; command -v pgrok; command -v pglm; test -d "$HOME/.claude-profiles"; test -d "$HOME/.chatgpt-profiles"; test -d "$HOME/.gemini-profiles"; test -d "$HOME/.grok-profiles"; test -d "$HOME/.glm-profiles"'
docker exec --user "$container_user" --env "HISTFILE=$container_history_file" --workdir "$workdir" "$container" "$shell_path" -lc \
'printf "%s\n" "wave-container-shell-ok"; whoami; pwd; test "$HISTFILE" = "$HOME/.workbenches-history/.zsh_history"; command -v claude-profile; command -v pclaude; command -v codex-profile; command -v pcodex; command -v ppi; command -v pgemini; command -v pgrok; command -v pglm; test -d "$HOME/.claude-profiles"; test -d "$HOME/.chatgpt-profiles"; test -d "$HOME/.pi-profiles"; test -d "$HOME/.gemini-profiles"; test -d "$HOME/.grok-profiles"; test -d "$HOME/.glm-profiles"'
exit 0
Copilot AI review requested due to automatic review settings 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 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

scripts/wave-container-shell.sh:371

  • The --check command sequence doesn’t reliably fail when a required command/test is missing because it’s a ;-separated list and the overall exit status becomes the last test -d .... This makes --check report success even when earlier command -v ... checks fail, and it also makes the new ppi check ambiguous (since pi-profile may not be installed). Consider enabling set -e inside the shell and only requiring ppi when pi-profile is present.
            "mkdir -p '/home/${container_user}/.local/bin' && chown '${container_user}:${container_user}' '/home/${container_user}/.local' '/home/${container_user}/.local/bin'"
        docker exec --user "$container_user" "$container" sh -c \
            'ln -sfn /usr/local/bin/claude "$HOME/.local/bin/claude"'

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

Copy link
Copy Markdown
Contributor Author

@codex review

@brettheap

Copy link
Copy Markdown
Contributor Author

Addressed the review on the current head:

  • Pi, Codex, provider, and Claude launchers are now detected and installed independently
  • a disposable pi-profile-only fixture installed ppi successfully
  • the directory-backed history behavior was previously cold-start validated with writable HISTFILE
  • both OSC title writes are TTY-guarded
  • the checked-in launcher remains byte-for-byte aligned with the durable installer source

@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

@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.

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 1 out of 1 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (2)

scripts/wave-container-shell.sh:317

  • pi_launcher points at $workbenches_root/base-image/files/pi-profile, but that file does not exist in the repository (base-image/files currently contains claude-profile, codex-profile, and provider-profile only). As a result, ppi will never be installed even though the script now advertises support for it.

Please add the missing base-image/files/pi-profile to this PR (and ensure it’s copied/linked appropriately), or remove the pi-profile branch from this script if it’s not intended to ship yet.

    local claude_launcher="$workbenches_root/base-image/files/claude-profile"
    local codex_launcher="$workbenches_root/base-image/files/codex-profile"
    local provider_launcher="$workbenches_root/base-image/files/provider-profile"
    local pi_launcher="$workbenches_root/base-image/files/pi-profile"
    if [[ ! -f "$claude_launcher" \
        && ! -f "$codex_launcher" \
        && ! -f "$provider_launcher" \
        && ! -f "$pi_launcher" ]]; then
        return 0

scripts/wave-container-shell.sh:381

  • --check currently always runs command -v ppi, which fails when the optional pi-profile launcher isn’t present/installed. This makes --check brittle on checkouts that don’t ship base-image/files/pi-profile yet.

Make the ppi check conditional on the launcher file existing (or otherwise treat ppi as optional) so --check only validates what can actually be installed from the current checkout.

if [[ "$check_only" == true ]]; then
    docker exec --user "$container_user" --env "HISTFILE=$container_history_file" --workdir "$workdir" "$container" "$shell_path" -lc \
        'printf "%s\n" "wave-container-shell-ok"; whoami; pwd; test "$HISTFILE" = "$HOME/.workbenches-history/.zsh_history"; command -v claude-profile; command -v pclaude; command -v codex-profile; command -v pcodex; command -v ppi; command -v pgemini; command -v pgrok; command -v pglm; test -d "$HOME/.claude-profiles"; test -d "$HOME/.chatgpt-profiles"; test -d "$HOME/.pi-profiles"; test -d "$HOME/.gemini-profiles"; test -d "$HOME/.grok-profiles"; test -d "$HOME/.glm-profiles"'
    exit 0

Comment on lines +370 to +371
docker exec --user "$container_user" "$container" sh -c \
'ln -sfn /usr/local/bin/claude "$HOME/.local/bin/claude"'
Copilot AI review requested due to automatic review settings July 25, 2026 06:28

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 1 out of 1 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

scripts/wave-container-shell.sh:380

  • --check currently runs a long command list where command -v ... failures don’t affect the exit status, so the script can report success even when required launchers aren’t installed. If --check is meant to validate the install, make the check command fail on missing required commands (while keeping ppi optional until pi-profile exists).
    docker exec --user "$container_user" --env "HISTFILE=$container_history_file" --workdir "$workdir" "$container" "$shell_path" -lc \
        'printf "%s\n" "wave-container-shell-ok"; whoami; pwd; test "$HISTFILE" = "$HOME/.workbenches-history/.zsh_history"; command -v claude-profile; command -v pclaude; command -v codex-profile; command -v pcodex; command -v ppi; command -v pgemini; command -v pgrok; command -v pglm; test -d "$HOME/.claude-profiles"; test -d "$HOME/.chatgpt-profiles"; test -d "$HOME/.pi-profiles"; test -d "$HOME/.gemini-profiles"; test -d "$HOME/.grok-profiles"; test -d "$HOME/.glm-profiles"'

scripts/wave-container-shell.sh:372

  • ln -sfn will overwrite any existing $HOME/.local/bin/claude (including a real file), which can clobber user-installed tooling inside the container. Prefer only forcing the symlink when the destination is missing or already a symlink.
    if [[ -f "$claude_launcher" ]]; then
        docker exec --user "$container_user" "$container" sh -c \
            'ln -sfn /usr/local/bin/claude "$HOME/.local/bin/claude"'
    fi

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

Copy link
Copy Markdown
Contributor Author

@codex review

@brettheap

Copy link
Copy Markdown
Contributor Author

The current head also makes --check fail fast while validating only profile launchers present in the checkout, so clean main remains valid before the optional Pi launcher lands.

@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
brettheap merged commit dafdcf6 into main Jul 25, 2026
5 checks passed
@brettheap
brettheap deleted the fix/wave-launch-latency branch July 25, 2026 06:33

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 1 out of 1 changed files in this pull request and generated 1 comment.

Comment on lines +321 to +336
local launchers=(
"$claude_launcher"
"$codex_launcher"
"$provider_launcher"
"$pi_launcher"
)
local bundle_hash
bundle_hash="$(
for launcher in "${launchers[@]}"; do
if [[ -f "$launcher" ]]; then
sha256sum "$launcher" | awk '{print $1}'
else
printf '%s\n' missing
fi
done | sha256sum | awk '{print $1}'
)"
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