Repository navigation
oss-sync 2026-11-19: GID cache, launch perf, entrypoint set -e fix #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ramseymcgrath
wants to merge
1
commit into
main
Choose a base branch
from
oss-sync/2026-11-19
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| #!/usr/bin/env bats | ||
| # | ||
| # Regression for the v0.38.2 "container exits the moment setup finishes" bug. | ||
| # | ||
| # Several phase functions ended with a bare verbose guard: | ||
| # [ "${BACK2BASE_VERBOSE:-0}" = "1" ] && echo "..." | ||
| # When BACK2BASE_VERBOSE is unset (the normal interactive launch) the test is | ||
| # false, the && short-circuits, and the compound command returns 1. As the | ||
| # LAST command of a function, that becomes the function's return value. The | ||
| # function is dispatched by _phase under the top-level `set -e`, so the call — | ||
| # a simple command returning 1 — trips set -e and aborts entrypoint.sh right | ||
| # after the previous phase's ✓. The container dies before `exec claude`. | ||
| # | ||
| # (At the top level `false && echo` is exempt from set -e, which is why the | ||
| # bug only manifested through a function call, not the inline guard itself.) | ||
| # | ||
| # Fix: route all verbose logging through _vlog, which always returns 0, and | ||
| # forbid inline verbose guards from creeping back in. | ||
|
|
||
| setup() { | ||
| REPO_DIR="$(cd "$BATS_TEST_DIRNAME/.." && pwd)" | ||
| ENTRYPOINT="$REPO_DIR/entrypoint.sh" | ||
| } | ||
|
|
||
| # Print the definition of a shell function from entrypoint.sh (sed range). | ||
| extract_fn() { | ||
| sed -n "/^$1()/,/^}/p" "$ENTRYPOINT" | ||
| } | ||
|
|
||
| @test "_vlog is defined in entrypoint.sh" { | ||
| run extract_fn _vlog | ||
| [ -n "$output" ] | ||
| } | ||
|
|
||
| @test "_vlog returns 0 with verbose off (safe as a function's last command)" { | ||
| fn="$(extract_fn _vlog)" | ||
| run bash -c " | ||
| set -e | ||
| unset BACK2BASE_VERBOSE | ||
| $fn | ||
| _vlog ':: some detail' | ||
| echo RC=\$? | ||
| " | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" == *"RC=0"* ]] | ||
| } | ||
|
|
||
| @test "_vlog still prints when verbose on" { | ||
| fn="$(extract_fn _vlog)" | ||
| run bash -c " | ||
| set -e | ||
| export BACK2BASE_VERBOSE=1 | ||
| $fn | ||
| _vlog ':: visible detail' | ||
| " | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" == *"visible detail"* ]] | ||
| } | ||
|
|
||
| @test "_vlog is silent when verbose off" { | ||
| fn="$(extract_fn _vlog)" | ||
| run bash -c " | ||
| set -e | ||
| unset BACK2BASE_VERBOSE | ||
| $fn | ||
| _vlog ':: hidden detail' | ||
| echo DONE | ||
| " | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" != *"hidden detail"* ]] | ||
| [[ "$output" == *"DONE"* ]] | ||
| } | ||
|
|
||
| @test "a function ending in _vlog returns 0 under set -e with verbose off" { | ||
| vlog="$(extract_fn _vlog)" | ||
| run bash -c " | ||
| set -e | ||
| unset BACK2BASE_VERBOSE | ||
| $vlog | ||
| some_phase() { | ||
| local x=1 | ||
| _vlog ':: tail detail' | ||
| } | ||
| some_phase | ||
| echo SURVIVED | ||
| " | ||
| [ "$status" -eq 0 ] | ||
| [[ "$output" == *"SURVIVED"* ]] | ||
| } | ||
|
|
||
| @test "no inline BACK2BASE_VERBOSE && guards remain (use _vlog instead)" { | ||
| # A bare `[ ... BACK2BASE_VERBOSE ... ] && echo` is the footgun. After the | ||
| # fix every such line must be gone — verbose logging goes through _vlog, | ||
| # which is exit-status-safe in any position. | ||
| # Exclude comment lines (the _vlog doc block intentionally shows the old | ||
| # idiom as the anti-pattern to avoid). | ||
| run grep -nE '^[^#]*\[ "\$\{BACK2BASE_VERBOSE:-0\}" = "1" \][[:space:]]*&&' "$ENTRYPOINT" | ||
| [ -z "$output" ] | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On normal default/auto-profile launches, this cache never hits:
filter_mcp_by_profileinentrypoint.shreplaces.mcp.jsonon every start, making it newer thanCLAUDE.md. The subsequentgenerate_claude_mdinvokesrender-claude-md.py, whose mtime-based invalidation rebuilds the file from the template and removes the overview markers before this check runs. Consequently, an unchanged repository still incurs the Claude overview call and nondeterministic prompt rewrite every launch. Preserve the overview during base-file regeneration, or cache its body separately and splice it back without invoking Claude.Useful? React with 👍 / 👎.