Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
- name: Checkout
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
# Required so paths-filter can diff push events using github.event.before without fetching.
fetch-depth: 0
persist-credentials: false

- name: Set merge-group defaults
Expand Down
33 changes: 33 additions & 0 deletions .mux/tool_env
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# .mux/tool_env
# Sourced by Mux before every bash tool invocation.
# Docs: https://mux.coder.com/hooks/tools

run_and_report() {
local step_name="${1:-}"
if [[ -z "${step_name}" ]]; then
echo "assertion failed: run_and_report requires a non-empty step name" >&2
return 97
fi
shift

if [[ "$#" -eq 0 ]]; then
echo "assertion failed: run_and_report requires a command after the step name" >&2
return 97
fi

local safe_name
safe_name="$(printf '%s' "${step_name}" | tr -cs 'A-Za-z0-9._-' '_')"
local workspace_tag="${MUX_WORKSPACE_ID:-local}"
local log_file="/tmp/mux-${workspace_tag}-${safe_name}.log"

echo "==> Running ${step_name}"
if "$@" >"${log_file}" 2>&1; then
echo "==> ${step_name} passed"
return 0
else
local exit_code=$?
echo "==> ${step_name} failed (showing tail from ${log_file})" >&2
tail -n 120 "${log_file}" >&2 || true
return "${exit_code}"
fi
}
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ Run from repository root.
- **Clean:** `go clean -cache -testcache && rm -f ./coder-k8s && rm -rf ./dist`
- **Shell scripts:** `find . -type f -name '*.sh' -not -path './vendor/*'`

## Mux Tooling Helpers

- `.mux/tool_env` is sourced before every `bash` tool call (Mux docs: `/hooks/tools`).
- Use `run_and_report <step_name> <command...>` for multi-step validation in one bash invocation.
- The helper writes full logs to `/tmp/mux-<workspace>-<step>.log`, prints pass/fail markers, and tails failures.
- Example:
- `run_and_report verify-vendor make verify-vendor`
- `run_and_report test make test`

## Patterns

- **Do** preserve fail-fast assertions for impossible states (nil manager/client/scheme, mismatched fetched objects).
Expand Down