refactor(launcher): remove code no launch runs #70

Merged
claudiomaradonna merged 3 commits from refactor/launcher-dead-code into master 2026-11-11 15:04:48 +01:00
Collaborator

Why

bin/azkaban is the launcher that starts each client in its container
and decides what the container may see; it is the file a contributor
reads to change a launch, and a reviewer to audit one. Two things in it
did no work and cost that reader time.

The check that no component of ~/.azkaban/mcp is a symlink could not
fire. Every component above the directory also lies on the path of the
identity folder, which the launcher checks first on every launch, and
the directory itself has its own test one line above. No test reached
the check, and the test written for that case accepted either message.

Eight array expansions carried the guard "${a[@]+"${a[@]}"}", which
Bash older than 4.4 needs under set -u. The launcher refuses such a
shell at its twelfth line, and install.sh already expands empty arrays
plainly.

Set aside: keeping the check as a second guard, which no test can
exercise while the first one stands.

What changed

Nothing a user meets changes: a launch refuses the same paths with the
same messages. A reader of _azk_require_safe_mcp_dir now finds the one
check that can fire, with a comment saying where the components above
the directory are checked, and arrays expanded as "${name[@]}".

The first commit pins, in tests/integration/test_mcp.sh, that a
symlinked ~/.azkaban stops a dry run too, and that the identity
folder's check is the one that refuses it; the other two change
bin/azkaban.

How to verify

Have Git and Bash 4.4 or newer, on Linux. No container engine is
needed: the launch below stops before it would call one.

git clone https://git.unitoo.it/claudiomaradonna/azkaban.git
cd azkaban
scratch="$(cd "$(mktemp -d)" && pwd -P)"
mkdir "$scratch/home" "$scratch/elsewhere" "$scratch/project" "$scratch/bin"
ln -s "$scratch/elsewhere" "$scratch/home/.azkaban"
ln -s "$PWD/bin/azkaban" "$scratch/bin/codex"
HOME="$scratch/home" "$scratch/bin/codex" "$scratch/project" --dry-run </dev/null; echo "exit $?"
grep -c 'MCP path.*contains a symlink component' bin/azkaban
grep -c '\[@\]+"' bin/azkaban

On master the launch prints
codex: identity folder '<scratch>/home/.azkaban/identities/default' contains a symlink component
and exit 1: the identity folder's check answers, never the MCP one,
and the two counts are 1 and 8. After
git switch refactor/launcher-dead-code the launch prints the same
line and exit 1, and both counts are 0.

Checks run on the tip: make lint && .agents/hooks/shellcheck.sh repo && make test
passes, 352 tests; the pin passes on master as well. Not tried: Bash
4.4 itself, since the tests ran on Bash 5.3 only.

Considerations

The plain expansion of an empty array under set -u is valid from Bash
4.4, the version the launcher's gate requires; a real launch also
checks every component of the MCP path again after creating the
directory.

## Why `bin/azkaban` is the launcher that starts each client in its container and decides what the container may see; it is the file a contributor reads to change a launch, and a reviewer to audit one. Two things in it did no work and cost that reader time. The check that no component of `~/.azkaban/mcp` is a symlink could not fire. Every component above the directory also lies on the path of the identity folder, which the launcher checks first on every launch, and the directory itself has its own test one line above. No test reached the check, and the test written for that case accepted either message. Eight array expansions carried the guard `"${a[@]+"${a[@]}"}"`, which Bash older than 4.4 needs under `set -u`. The launcher refuses such a shell at its twelfth line, and `install.sh` already expands empty arrays plainly. Set aside: keeping the check as a second guard, which no test can exercise while the first one stands. ## What changed Nothing a user meets changes: a launch refuses the same paths with the same messages. A reader of `_azk_require_safe_mcp_dir` now finds the one check that can fire, with a comment saying where the components above the directory are checked, and arrays expanded as `"${name[@]}"`. The first commit pins, in `tests/integration/test_mcp.sh`, that a symlinked `~/.azkaban` stops a dry run too, and that the identity folder's check is the one that refuses it; the other two change `bin/azkaban`. ## How to verify Have Git and Bash 4.4 or newer, on Linux. No container engine is needed: the launch below stops before it would call one. ```bash git clone https://git.unitoo.it/claudiomaradonna/azkaban.git cd azkaban scratch="$(cd "$(mktemp -d)" && pwd -P)" mkdir "$scratch/home" "$scratch/elsewhere" "$scratch/project" "$scratch/bin" ln -s "$scratch/elsewhere" "$scratch/home/.azkaban" ln -s "$PWD/bin/azkaban" "$scratch/bin/codex" HOME="$scratch/home" "$scratch/bin/codex" "$scratch/project" --dry-run </dev/null; echo "exit $?" grep -c 'MCP path.*contains a symlink component' bin/azkaban grep -c '\[@\]+"' bin/azkaban ``` On `master` the launch prints `codex: identity folder '<scratch>/home/.azkaban/identities/default' contains a symlink component` and `exit 1`: the identity folder's check answers, never the MCP one, and the two counts are `1` and `8`. After `git switch refactor/launcher-dead-code` the launch prints the same line and `exit 1`, and both counts are `0`. Checks run on the tip: `make lint && .agents/hooks/shellcheck.sh repo && make test` passes, 352 tests; the pin passes on `master` as well. Not tried: Bash 4.4 itself, since the tests ran on Bash 5.3 only. ## Considerations The plain expansion of an empty array under `set -u` is valid from Bash 4.4, the version the launcher's gate requires; a real launch also checks every component of the MCP path again after creating the directory.
The refusal of a symlinked ~/.azkaban was tested on a real launch only.
A dry run reaches it through the same checks, which the coming removal
of the launcher's shadowed MCP component check must keep.
Every component of ~/.azkaban/mcp but the last also lies on the
identity folder's path, which is checked first on every launch, so the
MCP component check could not fire and no test reached it. The check
of the directory itself stays, and a real launch still checks every
component after creating the directory.
"${a[@]+"${a[@]}"}" protects an empty array from set -u in Bash older
than 4.4, which the launcher's gate refuses before this code runs.
install.sh already expands empty arrays plainly.
motoko force-pushed refactor/launcher-dead-code from aae60acbe8 to beff7a8834 2026-11-11 14:47:08 +01:00 Compare
claudiomaradonna deleted branch refactor/launcher-dead-code 2026-11-11 15:04:53 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
claudiomaradonna/azkaban!70
No description provided.