Skip to content

Commit b568884

Browse files
committed
Fix MSYS2 python3 path issue: pipe files via cat instead of open()
MinGW python3 is a native Windows binary that doesn't understand POSIX paths like /tmp/foo.json. Piping file content through cat (which runs in MSYS2 bash and handles path translation) to python's stdin avoids the issue entirely. Fixes Windows smoke test 8a and soak baseline collection.
1 parent 5743e1a commit b568884

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/smoke-test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -523,8 +523,8 @@ printf '[existing_section]\nline_from_user = true\n' > "$FAKE_HOME/.codex/config
523523
# Run install
524524
HOME="$FAKE_HOME" PATH="$FAKE_HOME/.local/bin:$PATH" "$BINARY" install -y 2>&1 || true
525525

526-
# Helper for JSON validation
527-
json_get() { python3 -c "import json,sys,os; f='$1'; d=json.load(open(f)) if os.path.isfile(f) else {}; print($2)" 2>/dev/null || echo ""; }
526+
# Helper for JSON validation (pipe file to python — avoids MSYS2 path translation issues)
527+
json_get() { cat "$1" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print($2)" 2>/dev/null || echo ""; }
528528

529529
# 8a: Claude Code MCP (new path) — correct command
530530
CMD=$(json_get "$FAKE_HOME/.claude.json" "d.get('mcpServers',{}).get('codebase-memory-mcp',{}).get('command','')")
@@ -1044,7 +1044,7 @@ if [ -n "${SMOKE_DOWNLOAD_URL:-}" ]; then
10441044
echo "OK 14b: updated binary runs"
10451045

10461046
# 14c: Verify agent config was refreshed (stale path replaced)
1047-
UPD_CMD=$(python3 -c "import json,sys,os; f='$UPDATE_HOME/.claude.json'; d=json.load(open(f)) if os.path.isfile(f) else {}; print(d.get('mcpServers',{}).get('codebase-memory-mcp',{}).get('command',''))" 2>/dev/null || echo "")
1047+
UPD_CMD=$(cat "$UPDATE_HOME/.claude.json" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('mcpServers',{}).get('codebase-memory-mcp',{}).get('command',''))" 2>/dev/null || echo "")
10481048
if [ "$UPD_CMD" = "/old/stale/path" ]; then
10491049
echo "FAIL 14c: agent config still has stale path after update"
10501050
exit 1

scripts/soak-test.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ collect_snapshot
269269
# Derive project name (same logic as cbm_project_name_from_path)
270270
PROJ_NAME=$(echo "$SOAK_PROJECT" | sed 's|^/||; s|/|-|g')
271271

272-
BASELINE_RSS=$(python3 -c "import json; d=json.load(open('/tmp/cbm-diagnostics-${SERVER_PID}.json')); print(d.get('rss_bytes',0))" 2>/dev/null || echo "0")
273-
BASELINE_FDS=$(python3 -c "import json; d=json.load(open('/tmp/cbm-diagnostics-${SERVER_PID}.json')); print(d.get('fd_count',0))" 2>/dev/null || echo "0")
272+
DIAG_FILE="/tmp/cbm-diagnostics-${SERVER_PID}.json"
273+
BASELINE_RSS=$(cat "$DIAG_FILE" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('rss_bytes',0))" 2>/dev/null || echo "0")
274+
BASELINE_FDS=$(cat "$DIAG_FILE" 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(d.get('fd_count',0))" 2>/dev/null || echo "0")
274275
echo "OK: baseline RSS=${BASELINE_RSS} FDs=${BASELINE_FDS}"
275276

276277
# ── Phase 3: Compressed workload loop ────────────────────────────

0 commit comments

Comments
 (0)