Create /sloptrap-tools/ volumes for each projects, to avoid polluting the agents HOME
This commit is contained in:
@@ -418,6 +418,9 @@ run_runtime_context_prompt() {
|
||||
if [[ -z $run_line || $run_line != *"You are running inside sloptrap"* ]]; then
|
||||
record_failure "runtime_context_prompt: startup prompt missing from fresh run"
|
||||
fi
|
||||
if ! grep -q -- "tools_bin=/sloptrap-tools/bin" "$STUB_LOG"; then
|
||||
record_failure "runtime_context_prompt: tools path missing from startup prompt"
|
||||
fi
|
||||
if ! grep -q -- "name=host-network-repo" "$STUB_LOG" \
|
||||
|| ! grep -q -- "network_mode=host" "$STUB_LOG"; then
|
||||
record_failure "runtime_context_prompt: runtime summary missing manifest state"
|
||||
@@ -480,6 +483,12 @@ run_shell_target_uses_entrypoint() {
|
||||
if grep -q -- "/codex/auth.json" "$STUB_LOG"; then
|
||||
record_failure "shell_target_uses_entrypoint: codex auth mount should not be present for opencode shell"
|
||||
fi
|
||||
if ! grep -q -- "-e PATH=/sloptrap-tools/bin:" "$STUB_LOG"; then
|
||||
record_failure "shell_target_uses_entrypoint: tools PATH export missing"
|
||||
fi
|
||||
if ! grep -q -- "-e SLOPTRAP_TOOLS_HOME=/sloptrap-tools" "$STUB_LOG"; then
|
||||
record_failure "shell_target_uses_entrypoint: tools home export missing"
|
||||
fi
|
||||
teardown_stub_env
|
||||
}
|
||||
|
||||
@@ -502,6 +511,9 @@ run_auth_file_mount() {
|
||||
if ! grep -q -- "-v ${STUB_HOME}/.codex/sloptrap/state/" "$STUB_LOG"; then
|
||||
record_failure "auth_file_mount: missing project state bind mount"
|
||||
fi
|
||||
if ! grep -q -- "--mount type=volume,source=resume_target-sloptrap-tools-" "$STUB_LOG"; then
|
||||
record_failure "auth_file_mount: missing project tools volume mount"
|
||||
fi
|
||||
teardown_stub_env
|
||||
}
|
||||
|
||||
@@ -898,6 +910,12 @@ EOF
|
||||
if ! grep -q -- "OPENCODE_CONFIG=/codex/config/opencode/opencode.json" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: opencode config path not exported"
|
||||
fi
|
||||
if ! grep -q -- "--prompt You are running inside sloptrap" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: startup prompt not passed to opencode"
|
||||
fi
|
||||
if ! grep -q -- "tools_home=/sloptrap-tools" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: tools path missing from opencode prompt"
|
||||
fi
|
||||
if grep -q -- "/codex/auth.json" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: codex auth mount should not be present for opencode"
|
||||
fi
|
||||
@@ -922,8 +940,8 @@ EOF
|
||||
if grep -q -- "--sandbox workspace-write" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: codex sandbox args leaked into opencode run"
|
||||
fi
|
||||
if grep -q -- "You are running inside sloptrap" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: codex-style startup prompt should not be passed to opencode"
|
||||
if ! grep -q -- "-e PATH=/sloptrap-tools/bin:" "$STUB_LOG"; then
|
||||
record_failure "opencode_localhost_rewrite: tools PATH export missing"
|
||||
fi
|
||||
teardown_stub_env
|
||||
}
|
||||
@@ -940,24 +958,51 @@ agent=opencode
|
||||
allow_host_network=false
|
||||
EOF
|
||||
local output
|
||||
local plain_output
|
||||
if ! output=$(env PATH="$STUB_BIN:$PATH" HOME="$STUB_HOME" FAKE_PODMAN_LOG="$STUB_LOG" FAKE_PODMAN_INSPECT_FAIL=1 \
|
||||
"$SLOPTRAP_BIN" --print-config "$scenario_dir" 2>/dev/null); then
|
||||
record_failure "opencode_print_config_runtime_flags: print-config failed"
|
||||
teardown_stub_env
|
||||
return
|
||||
fi
|
||||
if ! grep -q 'runtime_flags=' <<<"$output"; then
|
||||
plain_output=$(printf '%s' "$output" | sed -E $'s/\x1B\\[[0-9;]*m//g')
|
||||
if ! grep -q 'runtime_flags=' <<<"$plain_output"; then
|
||||
record_failure "opencode_print_config_runtime_flags: runtime_flags line missing for opencode"
|
||||
fi
|
||||
if ! grep -q 'opencode_config=' <<<"$output"; then
|
||||
if ! grep -q 'opencode_config=' <<<"$plain_output"; then
|
||||
record_failure "opencode_print_config_runtime_flags: opencode config path missing"
|
||||
fi
|
||||
if grep -q -- '--sandbox danger-full-access --ask-for-approval never' <<<"$output"; then
|
||||
if ! grep -q 'tools_volume=' <<<"$plain_output"; then
|
||||
record_failure "opencode_print_config_runtime_flags: tools volume missing"
|
||||
fi
|
||||
if ! grep -q 'tools_home=/sloptrap-tools' <<<"$plain_output"; then
|
||||
record_failure "opencode_print_config_runtime_flags: tools home missing"
|
||||
fi
|
||||
if ! grep -q 'tools_bin=/sloptrap-tools/bin' <<<"$plain_output"; then
|
||||
record_failure "opencode_print_config_runtime_flags: tools bin missing"
|
||||
fi
|
||||
if grep -q -- '--sandbox danger-full-access --ask-for-approval never' <<<"$plain_output"; then
|
||||
record_failure "opencode_print_config_runtime_flags: codex runtime flags leaked into opencode config"
|
||||
fi
|
||||
teardown_stub_env
|
||||
}
|
||||
|
||||
run_clean_removes_tools_volume() {
|
||||
local scenario_dir="$TEST_ROOT/resume_target"
|
||||
printf '==> clean_removes_tools_volume\n'
|
||||
setup_stub_env
|
||||
if ! env PATH="$STUB_BIN:$PATH" HOME="$STUB_HOME" FAKE_PODMAN_LOG="$STUB_LOG" \
|
||||
"$SLOPTRAP_BIN" "$scenario_dir" clean </dev/null >/dev/null 2>&1; then
|
||||
record_failure "clean_removes_tools_volume: clean failed"
|
||||
teardown_stub_env
|
||||
return
|
||||
fi
|
||||
if ! grep -q -- "FAKE PODMAN: volume rm -f resume_target-sloptrap-tools-" "$STUB_LOG"; then
|
||||
record_failure "clean_removes_tools_volume: tools volume not removed"
|
||||
fi
|
||||
teardown_stub_env
|
||||
}
|
||||
|
||||
run_opencode_env_overrides() {
|
||||
local scenario_dir="$TEST_ROOT/opencode_print_config"
|
||||
printf '==> opencode_env_overrides\n'
|
||||
@@ -1057,6 +1102,7 @@ run_opencode_print_config_runtime_flags
|
||||
run_opencode_env_overrides
|
||||
run_opencode_config_symlink_rejected
|
||||
run_opencode_login_rejected
|
||||
run_clean_removes_tools_volume
|
||||
|
||||
if [[ ${#failures[@]} -gt 0 ]]; then
|
||||
printf '\nTest failures:\n'
|
||||
|
||||
Reference in New Issue
Block a user