From a103eeab9d66a23554f5c2e20c66c2f0e69ec356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hern=C3=A2ni=20Marques?= Date: Sun, 19 Jul 2026 15:19:25 +0200 Subject: [PATCH] fix 1.23.3: ladder requires wallet-cli; settle for coins so pay can run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause of stale intro payments: koopa max-ladder minted but accept-uri failed with taler-wallet-cli not found (SKIP_ACCEPT ×16). Fail early without CLI/helper; after bank transfer_done keep polling + run-pending for available coins; pay wait 180s; host-agent max-ladder sets WALLET_CLI PATH. --- VERSION | 2 +- VERSIONS.md | 1 + check_amount_ladder.sh | 50 ++++++++++++++++++++----- host-agent/run-host-report.sh | 1 + host-agent/run-max-ladder-monitoring.sh | 6 +++ ladder/lib_pay.sh | 2 +- 6 files changed, 51 insertions(+), 11 deletions(-) diff --git a/VERSION b/VERSION index 14bee92..ac1df3f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.23.2 +1.23.3 diff --git a/VERSIONS.md b/VERSIONS.md index 82ac624..32c243b 100644 --- a/VERSIONS.md +++ b/VERSIONS.md @@ -17,6 +17,7 @@ Git tags: `vMAJOR.FEATURE.FIX` (e.g. `v1.8.0`). File `VERSION` omits the `v` pre | Tag | Date (UTC) | Notes | |-----|------------|--------| +| **v1.23.3** | 2026-07-19 | **Bugfix:** payments stale because max-ladder never got coins — root cause on koopa was **taler-wallet-cli missing** (all mint-OK → SKIP_ACCEPT). Hard-fail ladder prereq if CLI/helper missing; settle keeps polling after transfer_done + short run-pending; pay wait default 180s; max-ladder wrapper sets PATH/WALLET_CLI. | | **v1.23.2** | 2026-07-19 | **Bugfix:** max-ladder host-agent forces **RUN_TIMEOUT=10800** (koopa env had 600 → run aborted mid-ladder); install starts oneshots with **--no-block**. | | **v1.23.1** | 2026-07-19 | **Fix / scope:** only **`/monitoring-max-ladder/`** for GOA (drop classic `/monitoring-ladder`). Daily timer + install first-run. monpages catalog/Caddy bare redirs for max-ladder only. | | **v1.23.0** | 2026-07-19 | **Feature:** GOA daily mon page **`/monitoring-max-ladder/`** (max-search) on bank/exchange/taler.hacktivism.ch *(1.23.0 briefly also had classic ladder; removed in 1.23.1)*. | diff --git a/check_amount_ladder.sh b/check_amount_ladder.sh index 3bc13ed..67b6001 100755 --- a/check_amount_ladder.sh +++ b/check_amount_ladder.sh @@ -88,7 +88,7 @@ elapsed_ms() { # optional seed for reproducible max-search (empty = time-based) : "${LADDER_MAX_SEED:=}" # After withdraw, wait for spendable available>0 before pay (secs total; shows countdown) -: "${LADDER_PAY_WAIT_AVAILABLE_S:=90}" +: "${LADDER_PAY_WAIT_AVAILABLE_S:=180}" # Historic libeufin-ish absolute ceiling used as default LADDER_MAX_AMOUNT on GOA LADDER_ABS_CEILING="4503599627370496" @@ -99,8 +99,20 @@ if [ -z "${CLI_JS}" ] || [ ! -f "${CLI_JS}" ]; then CLI_JS=$(find_wallet_cli 2>/dev/null || true) fi if [ -z "${CLI_JS}" ] || [ ! -f "${CLI_JS}" ]; then - # allow PATH wrapper as last resort (wcli falls back to taler-wallet-cli) - CLI_JS="" + # PATH wrapper last resort + if command -v taler-wallet-cli >/dev/null 2>&1; then + CLI_JS="" + else + err prereq "taler-wallet-cli not found" \ + "problem: no CLI_JS / WALLET_CLI .mjs and taler-wallet-cli not on PATH — accept-uri/pay cannot run (payments stay stale). Install wallet-cli (e.g. ~/.local/bin/taler-wallet-cli.mjs) + taler-helper-sqlite3; set WALLET_CLI= in ~/.config/taler-monitoring/env" + exit 1 + fi +fi +# helper is required for real wallet DB (otherwise accept "works" empty / no coins) +if ! command -v taler-helper-sqlite3 >/dev/null 2>&1; then + err prereq "taler-helper-sqlite3 not on PATH" \ + "problem: wallet-cli needs taler-helper-sqlite3 for sqlite backend — put it on PATH next to wallet-cli" + exit 1 fi CUR="${EXPECT_CURRENCY:-GOA}" @@ -522,9 +534,16 @@ else info "explorer secret" "resolved via EXP_PW / EXP_PW_FILE / stage SSH / koopa" fi if [ -n "${CLI_JS:-}" ] && [ -f "${CLI_JS}" ]; then - info "wallet-cli" "$CLI_JS" + ok "wallet-cli" "$CLI_JS" else - info "wallet-cli" "PATH taler-wallet-cli ($(command -v taler-wallet-cli 2>/dev/null || echo missing))" + ok "wallet-cli" "PATH $(command -v taler-wallet-cli)" +fi +ok "wallet-helper" "$(command -v taler-helper-sqlite3)" +# prove wcli can start (avoids minting 32 probes then SKIP_ACCEPT command-not-found) +if ! wcli balance >"$SCRATCH/wcli-smoke.out" 2>&1; then + err prereq "wallet-cli smoke failed" \ + "problem: wcli balance failed — fix CLI_JS/PATH/helper. detail: $(tr '\n' ' ' <"$SCRATCH/wcli-smoke.out" | head -c 240)" + exit 1 fi # --- auto-account --- @@ -910,10 +929,13 @@ else: fi ok "confirm $AMT ${ms_confirm}ms (client, on selected)" - # settle: poll wallet balance + bank transfer_done only — never run-until-done + # settle: poll wallet balance + bank transfer_done — never run-until-done. + # Prefer real coin delta (status OK). If bank transfer_done first, keep polling + # briefly for available coins (OK) before accepting OK_BANK (pay needs available). t0=$(now_ms) settled=0 xfer="?" + bank_done=0 if [ "$IS_ZERO" = "1" ]; then settled=1 note="zero-amount: no coin delta expected" @@ -931,13 +953,23 @@ sys.exit(0 if Decimal(sys.argv[1]) > Decimal(sys.argv[2]) else 1) fi xfer=$(curl -sS -m 10 "${BANK}/taler-integration/withdrawal-operation/${WID}" \ | python3 -c 'import json,sys; d=json.load(sys.stdin); print(d.get("transfer_done"), d.get("status"))' 2>/dev/null || echo "?") - # bank done is enough to leave settle without hanging on wallet if echo "$xfer" | grep -qi True; then - note="bank transfer_done (no run-until-done) avail=${after} $xfer" - break + bank_done=1 + # nudge wallet to pick up wire (bounded; not run-until-done) + wcli transactions >"$SCRATCH/tx-settle-$tag.out" 2>&1 || true + if command -v timeout >/dev/null 2>&1 || command -v gtimeout >/dev/null 2>&1; then + _to=$(command -v gtimeout 2>/dev/null || command -v timeout) + "$_to" 8 wcli advanced run-pending >"$SCRATCH/run-pending-settle.out" 2>&1 || true + fi + # after bank done, still prefer coins; allow remaining rounds for available + note="bank transfer_done waiting coins avail=${after} $xfer" fi sleep "$LADDER_SETTLE_SLEEP" done + # If bank done but still no coin delta after all rounds, OK_BANK (pay-wait may finish) + if [ "$settled" != "1" ] && [ "$bank_done" = "1" ]; then + note="bank transfer_done avail=$(wallet_avail) $xfer (no run-until-done)" + fi fi ms_settle=$(elapsed_ms "$t0") after=$(wallet_avail) diff --git a/host-agent/run-host-report.sh b/host-agent/run-host-report.sh index c34ba5b..1f75caf 100755 --- a/host-agent/run-host-report.sh +++ b/host-agent/run-host-report.sh @@ -40,6 +40,7 @@ _wrap_keys=( APT_DEPLOY_ENSURE SURFACE_SCOPE TALER_DOMAIN_FROM_CLI STRICT_EXIT SOURCE_SUITE_PATH MONPAGES_INVENTORY MONPAGES_CHECK_BARE MONPAGES_BARE_STRICT MONPAGES_REQUIRE_PUBLIC CHECK_BANK MERCHANT_REQUIRED CHECK_LANDING + WALLET_CLI CLI_JS PATH LADDER_MODE LADDER_PAY LADDER_PAY_WAIT_AVAILABLE_S ) for _k in "${_wrap_keys[@]}"; do if [ -n "${!_k+x}" ]; then diff --git a/host-agent/run-max-ladder-monitoring.sh b/host-agent/run-max-ladder-monitoring.sh index ebba236..813fedd 100755 --- a/host-agent/run-max-ladder-monitoring.sh +++ b/host-agent/run-max-ladder-monitoring.sh @@ -37,6 +37,12 @@ export MONPAGES_INVENTORY="job" export LADDER_MODE=max export LADDER_PAY="${LADDER_PAY:-1}" +export LADDER_PAY_WAIT_AVAILABLE_S="${LADDER_PAY_WAIT_AVAILABLE_S:-180}" export APT_DEPLOY_ENSURE=0 +# Prefer host wallet-cli install used by mon (find_wallet_cli / WALLET_CLI) +export PATH="${HOME}/.local/bin:${PATH:-}" +if [ -z "${WALLET_CLI:-}" ] && [ -f "${HOME}/.local/bin/taler-wallet-cli.mjs" ]; then + export WALLET_CLI="${HOME}/.local/bin/taler-wallet-cli.mjs" +fi exec bash "$AGENT_DIR/run-host-report.sh" "$@" diff --git a/ladder/lib_pay.sh b/ladder/lib_pay.sh index e8ae15a..6565033 100644 --- a/ladder/lib_pay.sh +++ b/ladder/lib_pay.sh @@ -9,7 +9,7 @@ : "${LADDER_FREE_TEMPLATE:=goa-free}" : "${LADDER_FREE_TEMPLATE_INSTANCE:=}" : "${LADDER_USE_FREE_TEMPLATE:=1}" -: "${LADDER_PAY_WAIT_AVAILABLE_S:=90}" +: "${LADDER_PAY_WAIT_AVAILABLE_S:=180}" : "${LADDER_PAY_SETTLE_ROUNDS:=6}" MAX_PAY_BEST_AMT="${MAX_PAY_BEST_AMT:-}"