Repository navigation
fix(installer): install.sh prints color codes only on a terminal and honors NO_COLOR - #4429
Merged
Merged
Conversation
…honors NO_COLOR install.sh set its color variables unconditionally, so piped installer output and `apm self-update` output carried escape characters. Colors now need `[ -t 1 ]` and an unset NO_COLOR. The STRICT output cell self-update-installer-color-codes is removed. Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 20, 2026 17:11
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The installer still emits ANSI escapes when NO_COLOR is set to an empty value, violating the stated contract and requiring a presence check with terminal-backed tests.
1 open issue
What changed in this PR
This PR addresses #4308 by making the Unix installer’s color output terminal-aware, preventing ANSI escapes from leaking into piped or captured apm self-update output.
Changes:
- Gates installer colors on terminal stdout and
NO_COLOR. - Adds captured-output regression tests for direct installation and self-update under
bashandsh. - Removes the known lifecycle output exception and records the fix in the bug ledger and changelog.
| File | Description |
|---|---|
tests/utils/lifecycle_evidence.py |
Removes the installer color-code exception from the output invariant checks. |
tests/unit/test_unix_installer_checksums.py |
Adds regression coverage for escape-free captured output. |
tests/fixtures/lifecycle_bug_ledger.json |
Links issue #4308 to its regression tests. |
install.sh |
Conditionally initializes color variables based on stdout and NO_COLOR. |
CHANGELOG.md |
Documents the installer and self-update output fix. |
Review effort: Balanced
| YELLOW=$(printf '\033[1;33m') | ||
| NC=$(printf '\033[0m') # No Color | ||
| # Colors for output: only on a terminal, and never when NO_COLOR is set. | ||
| if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then |
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 20, 2026
… on a terminal and honors NO_COLOR Co-authored-by: Copilot App <[email protected]> # Conflicts: # tests/fixtures/lifecycle_bug_ledger.json # tests/utils/lifecycle_evidence.py
5 of 10 tasks
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.

Description
install.shset its color variables (RED,GREEN,BLUE,YELLOW,NC) unconditionally, so its output carried ANSI escape sequences even when stdout was not a terminal.apm self-updatepasses the installer output through, so piped or captured self-update output had escape characters too (lifecycle output invariant I6).Colors are now set only when stdout is a terminal (
[ -t 1 ]) andNO_COLORis unset; otherwise the variables are empty and the output is plain text.scripts/install.shprints no colors and is unchanged.Strict cells flipped
self-update-installer-color-codes(install.sh emits ANSI color codes when stdout is not a terminal #4308) is removed fromKNOWN_OUTPUT_CELLS; the global I6 oracle now fails any regression.Issue and approved scope
Issue: Fixes #4308 (scope record: #4308 (comment))
Human scope-approval comment: the scope record above.
Does this PR complete the issue, or what remains? It completes #4308.
Type of change
Testing
Tested locally
All existing tests pass
Added tests for new functionality (if applicable)
Red before:
pytest -n 0 tests/unit/test_unix_installer_checksums.py -k piped(newtest_piped_output_has_no_color_codes, direct andapm self-updateinvocations, underbashandsh) failed on main. The output began with\x1b[0;34m.Green after:
pytest tests/unit/test_unix_installer_checksums.pypassed (106 passed).Self-update: with the cell removed,
APM_E2E_TESTS=1 pytest -n 0 tests/integration/test_self_update_release_lifecycle.pypassed (8 passed; the 2 fish variants are skipped because fish is not installed). The zsh variants oftest_self_update_with_real_installer_preserves_shell_setup_staterun the real installer under the I6 oracle.Shell syntax:
bash -n install.shandsh -n install.shpassed.Lint:
uvx [email protected] checkandformat --checkon the changed Python files passed.Ledger:
tests/quality/test_lifecycle_bug_ledger.pypassed.Changelog
## [Unreleased]inCHANGELOG.mdSpec conformance (OpenAPM v0.1)