From 594256f961c9079247bcf26b25dd8e5c554f3596 Mon Sep 17 00:00:00 2001 From: 35C4n0r Date: Tue, 19 May 2026 10:50:19 +0000 Subject: [PATCH] fix(coder-labs/modules/codex): address review findings from Netero - Guard jq usage with command -v check; emit a clear error and skip the remote MCP fetch when jq is not available (DEREM-1) - Remove vacuous length assertion in tftest that tested its own input, not the module behavior (DEREM-2) - Replace em-dash with period in test comment (DEREM-3) --- registry/coder-labs/modules/codex/main.test.ts | 2 +- registry/coder-labs/modules/codex/main.tftest.hcl | 5 ----- registry/coder-labs/modules/codex/scripts/install.sh.tftpl | 4 ++++ 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/registry/coder-labs/modules/codex/main.test.ts b/registry/coder-labs/modules/codex/main.test.ts index 7125efbe..72f9b88b 100644 --- a/registry/coder-labs/modules/codex/main.test.ts +++ b/registry/coder-labs/modules/codex/main.test.ts @@ -469,7 +469,7 @@ describe("codex", async () => { ).text(), }); // Drop the remote TOML payload at a path the install script will fetch - // via file:// — keeps the test self-contained (no external network). + // via file://. Keeps the test self-contained (no external network). await execContainer(id, [ "bash", "-c", diff --git a/registry/coder-labs/modules/codex/main.tftest.hcl b/registry/coder-labs/modules/codex/main.tftest.hcl index 2595204f..c4c7403f 100644 --- a/registry/coder-labs/modules/codex/main.tftest.hcl +++ b/registry/coder-labs/modules/codex/main.tftest.hcl @@ -196,11 +196,6 @@ run "test_mcp_config_remote_path" { ] } - assert { - condition = length(var.mcp_config_remote_path) == 2 - error_message = "mcp_config_remote_path should accept a list of URLs" - } - assert { condition = strcontains(local.install_script, base64encode(jsonencode(var.mcp_config_remote_path))) error_message = "install script should embed the base64-encoded mcp_config_remote_path JSON" diff --git a/registry/coder-labs/modules/codex/scripts/install.sh.tftpl b/registry/coder-labs/modules/codex/scripts/install.sh.tftpl index 1920beff..f7e63a29 100644 --- a/registry/coder-labs/modules/codex/scripts/install.sh.tftpl +++ b/registry/coder-labs/modules/codex/scripts/install.sh.tftpl @@ -158,6 +158,9 @@ function populate_config_toml() { fi if [ -n "$${ARG_MCP_CONFIG_REMOTE_PATH}" ] && [ "$${ARG_MCP_CONFIG_REMOTE_PATH}" != "[]" ]; then + if ! command -v jq > /dev/null 2>&1; then + printf "Error: 'jq' is required to process mcp_config_remote_path but was not found. Skipping remote MCP config fetch.\n" >&2 + else for url in $(echo "$${ARG_MCP_CONFIG_REMOTE_PATH}" | jq -r '.[]'); do echo "Fetching MCP configuration from: $${url}" mcp_toml=$(curl -fsSL "$${url}") || { @@ -167,6 +170,7 @@ function populate_config_toml() { printf "Appending MCP servers from %s\n" "$${url}" printf '\n%s\n' "$${mcp_toml}" >> "$${config_path}" done + fi fi if [ "$${ARG_ENABLE_AI_GATEWAY}" = "true" ] && [ -n "$${ARG_AIBRIDGE_CONFIG}" ]; then