Signal blocking-script tabs so the shell can skip the interactive profile#457
Merged
Conversation
Blocking-script tabs (user scripts, archive, delete) opened a normal interactive surface, so the user's shell profile fully initialized (prompt, plugins, banners) before the script ran, with no signal to gate on. Emit SUPACODE_BLOCKING_SCRIPT=1 on every blocking-script surface, plus SUPACODE_SCRIPT_KIND (the script kind, or archive/delete for lifecycle tabs) and, for user-defined scripts, SUPACODE_SCRIPT_ID and SUPACODE_SCRIPT_SCOPE (repo/global, resolved repo-wins). The kind is recorded before the surface is built so surfaceEnvironment can read it.
Local surfaces carry the SUPACODE_BLOCKING_SCRIPT markers via the surface environment, but those don't cross the ssh boundary, so remote worktree script tabs had no signal. Apply the same markers via an env prefix on the remote login-shell invocation (SSHCommand) so the first login shell inherits them before sourcing its profile, where a plain export inside the -c script would run only after the profile loaded. Scope resolution is shared with the local path via blockingScriptEnvironment(for:).
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.
Summary
Blocking-script tabs (user scripts, archive, delete) opened a normal interactive surface, so the user's shell profile fully initialized (prompt frameworks, plugins, banners like fastfetch) before the script ran, with no signal to gate on. This exposes that signal as surface environment variables.
Markers
Every blocking-script surface exports:
SUPACODE_BLOCKING_SCRIPT=1SUPACODE_SCRIPT_KIND— the script kind (run/test/deploy/lint/format/custom), orarchive/deletefor lifecycle tabsUser-defined script tabs additionally export:
SUPACODE_SCRIPT_ID— the script's UUIDSUPACODE_SCRIPT_SCOPE—repoorglobal, resolved repo-wins (omitted only when the id resolves to neither, e.g. a since-deleted deeplink target)Users can then gate their rc, e.g.:
How it works
blockingScripts[tabId]before the surface is built, sosurfaceEnvironmentcan read it and emit the markers. Scope is resolved locally against this worktree'srepositorySettingsvs the global scripts.sshboundary, so they are applied via anenvprefix on the remote login-shell invocation (SSHCommand). This sets them before the first remote login shell sources its profile, where a plainexportinside the-cscript would only take effect after the profile had already loaded.Testing
make build-appgreenmake testgreen; new coverage for the marker env (user/global/lifecycle kinds, scope resolution), the remoteenvprefix ordering, and the empty-environment caseCloses #437