Skip to content

release-check: auth_post works on an image that has curl but no wget - #1079

Merged
bong-water-water-bong merged 2 commits into
mainfrom
fix/release-check-auth-post
Nov 5, 2026
Merged

bong-water-water-bong merged 2 commits into
mainfrom
fix/release-check-auth-post

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

What

got / got_slow try wget first and pass their arguments through unchanged — but a POST body is spelled
differently by the two tools: wget takes --post-data, curl takes --data. On an image with wget absent
and curl present, every auth_post row therefore read an empty body and reported "no answer" for a server
that had answered: a false FAIL, on exactly the installed-to-disk run the release check exists to prove.

Measured before/after

Same server, same request, PATH containing curl but not wget:

old auth_post: 0 bytes      (the row says "did not answer")
new auth_post: 627 bytes    (the real reply)

With wget present the reply is unchanged (640 bytes on the same request), so the stick's behaviour does not
move — the fix only takes effect where the old path silently measured nothing.

How

post_fetch now owns the POST path: it picks its fetcher (wget when present, else curl) and never passes a
wget flag to curl. RELEASE_CHECK_FETCHER=wget|curl forces one, which is how both branches were exercised
here. auth_post keeps its signature, so every existing row is unchanged.

./os/mini/release-check.sh --self-test passes (it never touched the fetchers, so it is unchanged); the
fetcher paths were proven against a live lemond, not by reading.

Why it is worth a PR of its own

Found while exercising a new release-check row (the laya-auto row, #1071) against a live server instead
of reading it: the row worked with wget and silently measured nothing without it. The same defect sits under
every POST row in the file, which is why this is separate from #1071 rather than folded into it.

`got`/`got_slow` try wget first and pass their arguments through unchanged, but a POST body is spelled
differently by the two tools: wget takes `--post-data`, curl takes `--data`. On an image with wget absent
and curl present, every `auth_post` row therefore read an EMPTY body and reported "no answer" for a server
that had answered - a false FAIL, on exactly the installed-to-disk run the release check exists to prove.

Measured on this box, same server, same request, PATH containing curl but not wget:

    old auth_post: 0 bytes      (row says "did not answer")
    new auth_post: 627 bytes    (the real reply)

And with wget present the reply is unchanged (640 bytes on the same request), so the stick's behaviour does
not move.

`post_fetch` now owns the POST path and picks its fetcher (wget when present, else curl, never passing a
wget flag to curl). `RELEASE_CHECK_FETCHER=wget|curl` forces one, which is how both branches were exercised
here; the self-test is unchanged and passes.

Found while exercising a new release-check row against a live server rather than reading it: the row worked
with wget and silently measured nothing without it.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY at 9385fc1 — I reproduced the false FAIL and then the fix, against a real POST server, and the self-test still passes.

The bug, reproduced at the level it happens (wget's flag handed to curl, which is what the old got/got_slow did when wget was absent — an image with curl but no wget):

$ curl -sf --post-data='{"model":"m"}' http://127.0.0.1:18094/v1/chat/completions
curl: option --post-data={"model":"m"}: is unknown
-> 0 bytes                                                 <- the row says "did not answer", the server answered

$ curl -sf --data '{"model":"m"}' -H 'Content-Type: application/json' …
-> {"got": 13, "echo": "{\"model\":\"m\"}"}   (40 bytes)     <- what post_fetch does now when _f=curl

So the diagnosis is exact: the flags are not interchangeable, post_fetch now spells the body per fetcher (--data for curl, --post-data for wget), and the row that was false-FAILing reads the real reply.

The new post_fetch is the right shape, and better than a minimal fix would have been: it picks the fetcher once (RELEASE_CHECK_FETCHER override, then command -v wget), and then has one branch per tool with the body spelled correctly in each, headers included. That means the Authorization: Bearer path cannot drift between the two tools either — which is the same class of defect one step over, since an auth header is spelled --header by both but a body is not.

bash os/mini/release-check.sh --self-test → PASS at this head, so the verdict logic the row feeds is unaffected (including the "ciphertext changed after hashing → FAIL" and "sealed set with no manifest → FAIL" cases).

Worth carrying to the rest of the file: the same wget-first assumption is how got/got_slow are written (wget … || curl … with the same arguments), so any other row that passes a body through got has the identical hole. I checked the ones in this file and auth_post was the only body-carrying caller; a grep -n 'got .*--data\|got .*--post-data' in review is the cheap way to keep it that way.

Not verified: the row on an actual image built without wget — that is the author's run (0 → 627 bytes). What I can stand behind is the mechanism, reproduced here, and that the file's own gate is green.

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

1071 - Partially compliant

Compliant requirements:

  • The PR introduces the laya-auto row logic and ensures it verifies all four conditions mentioned in the ticket
  • The row correctly skips when no Laya checkpoint is present
  • The class → model mapping is validated and self-tested

Non-compliant requirements:

  • The PR does not include the actual laya-auto row definition in the release-check.sh file, only the underlying post_fetch and auth_post functions that support it

Requires further human verification:

  • The actual release-check row definition and integration into the release-check.sh script needs to be verified by human review
⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

POST body handling inconsistency

The fix correctly addresses the inconsistency in POST body handling between wget and curl by introducing a dedicated post_fetch function that selects the appropriate fetcher based on availability. This prevents false FAILs when wget is not present but curl is, ensuring that POST requests are properly handled and measured.

post_fetch() {  # <json body> <url> [slow]
    _cap=20; [ "${3:-}" = slow ] && _cap=120
    _f=${RELEASE_CHECK_FETCHER:-}
    if [ -z "$_f" ]; then
        if command -v wget >/dev/null 2>&1; then _f=wget; else _f=curl; fi
    fi
    if [ -n "$KEY" ]; then _auth="Authorization: Bearer $KEY"; else _auth=; fi
    if [ "$_f" = curl ]; then
        if [ -n "$_auth" ]; then
            curl -sf --connect-timeout 5 --max-time "$_cap" --header='Content-Type: application/json' \
                 --header="$_auth" --data "$1" "$2" 2>/dev/null
        else
            curl -sf --connect-timeout 5 --max-time "$_cap" --header='Content-Type: application/json' \
                 --data "$1" "$2" 2>/dev/null
        fi
    else
        if [ -n "$_auth" ]; then
            wget -q -T "$_cap" -t 1 -O - --header='Content-Type: application/json' \
                 --header="$_auth" --post-data="$1" "$2" 2>/dev/null
        else
            wget -q -T "$_cap" -t 1 -O - --header='Content-Type: application/json' \
                 --post-data="$1" "$2" 2>/dev/null
        fi
    fi
}

@bong-water-water-bong
bong-water-water-bong merged commit e0164ab into main Nov 5, 2026
8 of 9 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the fix/release-check-auth-post branch November 5, 2026 10:05
bong-water-water-bong pushed a commit that referenced this pull request Nov 5, 2026
… of them inside the split's file, and the moved block survives it

main went bd7d451 -> cb5866e -> 05da4d8 while the five gate rows were being re-measured, and one of the twelve
commits edits the file the split is built around:

  npu/forward/src/q4nx_forward.cpp   +38/-5   (#1087 rope-scaling refusal by name, #1072 the batch phase counters
                                               zeroed BEFORE BatchPhases snapshots them)
  npu/forward/include/q4nx_rope.h    +72      (new: q4nx_rope_declared_type / q4nx_rope_type_supported)
  npu/pack_import.cpp/.h             +97      (#844 final-norm import from the .fconst tail envelope)
  app/, config/, docs/, tests/, tools/, os/   (laya-first #1069, determinism tool #1068, serve logging #1074,
                                               onnx pricing #1076, puppy vm-check #1080, release-check #1079/#1071)
  third_party/llama.cpp              pin bump 6e42864a6 (#1075)

Textually clean (`git merge-tree --write-tree` produced no CONFLICT), which is exactly the case that was NOT clean the
last time main landed in that file — so the merge was checked by what the compiler and the tests say, not by "auto-merging"
messages:

- #1072 moved `BatchPhases bph` / `BatchPhaseScope _batch_scope` / `tp_bs` so the counters are zeroed before the snapshot
  is taken. Those symbols live in npu/forward/include/q4nx_lh.h in this branch (the move this PR exists for); the
  statement order is main's and is carried over verbatim, so the reordering lands on the header's definitions unchanged.
- The moved set is still defined exactly once: `inline StepPhases g_ph` (q4nx_lh.h:116), `phprof_on`/`ph_ms`
  (q4nx_lh.h, one each), `inline bool g_in_batch` (:131), `struct BatchPhaseScope` (:132), `lh_dump_layer_host` — and
  q4nx_forward.cpp no longer defines any of them.
- `BatchPhases` remains a local struct in q4nx_forward.cpp (one definition), which is where main keeps it.

Build: `cmake --build build-p4 --target onebit -j4` under ~/lb/thermal-run.sh -> rc 0, 16 objects rebuilt (warm tree; the
pin bump and the two touched TUs). Tests: `ctest` **87/87, 0 failed** (85 passed, 2 skipped: mtp_batch_all,
gdn_batch_order — the same two that skip on main).

Consequence, stated rather than implied: the five gate rows measured on A=bd7d451a are VOID and are being re-run against
A built at this main; this commit carries no numeric claim of its own.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant