review: 4096 tokens, so a reasoning model has room to answer
A review round of qwen3.6-35b spent all 1024 max_tokens on reasoning_content and returned empty content with finish_reason=length. Junction read that as "no_text", stopped the loop after the first round and delivered the last good answer -- so a rule with review 4 usually never reached four rounds. The review floor is now 4096. The worker call still keeps exactly the client's max_tokens; only the bodies review_serve builds are raised. Measured against kontron with the review prompt: 1024 gave empty content in 1 of 3 calls, 4096 gave a finished answer in 5 of 5 (reasoning 1.0k-3.1k chars each time). tests/review.sh checks the new floor and that the body still carries exactly one max_tokens key. tests/run.sh: PASS.
This commit is contained in:
1 parent
3ad38869ae
commit
479503eae9
4 files changed
+10
-9
No files matched your search
@@ -291,7 +291,7 @@ list; the code lives in `src/judge.c`, `src/review.c` and `review_serve` in
|
||||
`rules.set`. N rounds mean **N+1** provider calls (the worker answer plus N
|
||||
reviews), all billed and counted in `/spend` and the vkey budget.
|
||||
- Review calls use the same endpoint and model as the worker and run
|
||||
sequentially. Each review request carries at least **1024** `max_tokens` (or
|
||||
sequentially. Each review request carries at least **4096** `max_tokens` (or
|
||||
`max_completion_tokens`), even when the client asked for less; the first worker
|
||||
call keeps exactly the client's budget. The review path buffers, so **every**
|
||||
upstream call under a `review` rule (the worker call too) is sent with
|
||||
|
||||
+1
-1
@@ -239,7 +239,7 @@ req path "/v1/models" check none pass peer1, peer2, opencode-go
|
||||
#
|
||||
# Limits and failure behavior (full table in README, "Judge/review limits and
|
||||
# headers"): at most 4 judge steps and 4 review rounds (review 5 is a config
|
||||
# error). Review calls carry at least 1024 max_tokens; the first worker call
|
||||
# error). Review calls carry at least 4096 max_tokens; the first worker call
|
||||
# keeps the client's budget. n>1, content arrays, non-empty tool_calls and a
|
||||
# spent vkey budget skip the remaining rounds and deliver the original or last
|
||||
# good answer; X-Junction-Review-Skipped names the reason. Judge counters are
|
||||
|
||||
+4
-3
@@ -328,9 +328,10 @@ int j_review_nonstream(const char *body, char **out, size_t *outlen)
|
||||
|
||||
/* A review is a new answer, not a one-token continuation. If the client asked for a
|
||||
* tiny output budget, the reasoning of a #max model can eat it all and leave the
|
||||
* review with empty content. Give the review rounds a usable floor; the original
|
||||
* worker call still uses exactly the client's budget. */
|
||||
#define REVIEW_MIN_TOKENS 1024
|
||||
* review with empty content (Qwen3.6-35B spends ~3k tokens thinking and then has
|
||||
* nothing left to answer with). Give the review rounds a floor that survives the
|
||||
* reasoning; the original worker call still uses exactly the client's budget. */
|
||||
#define REVIEW_MIN_TOKENS 4096
|
||||
|
||||
static int raise_max_tokens(const char *body, char **out, size_t *outlen)
|
||||
{
|
||||
|
||||
+4
-4
@@ -94,7 +94,7 @@ contains "$(cat "$TMP/review-dump.txt")" "first answer" \
|
||||
"the first answer was fed back into the first review"
|
||||
contains "$(cat "$TMP/review-dump.txt")" "second answer" \
|
||||
"the second answer was fed back into the second review"
|
||||
contains "$(cat "$TMP/review-dump.txt")" '"max_tokens":1024' \
|
||||
contains "$(cat "$TMP/review-dump.txt")" '"max_tokens":4096' \
|
||||
"the review rounds get a usable output budget"
|
||||
RH=$(tr -d '\r' < "$TMP/review_h.txt")
|
||||
contains "$RH" "X-Junction-Review: 2" "the response header names the review count"
|
||||
@@ -375,18 +375,18 @@ for chunk in raw.split("--- ")[1:]:
|
||||
json.loads(rawbody)
|
||||
bodies += 1
|
||||
# The worker call keeps the client's budget exactly. Only the body the
|
||||
# review path builds gets the 1024 floor, and it must carry one key, not two.
|
||||
# review path builds gets the 4096 floor, and it must carry one key, not two.
|
||||
if "Review your previous answer" not in rawbody:
|
||||
continue
|
||||
if rawbody.count('"max_tokens"') != 1:
|
||||
raise SystemExit("duplicate max_tokens key in the review body")
|
||||
if json.loads(rawbody).get("max_tokens") != 1024:
|
||||
if json.loads(rawbody).get("max_tokens") != 4096:
|
||||
raise SystemExit("review max_tokens was not raised")
|
||||
reviews += 1
|
||||
if bodies != 2 or reviews != 1:
|
||||
raise SystemExit("expected 2 bodies/1 review, got %d/%d" % (bodies, reviews))
|
||||
PY
|
||||
then ok "the review body stays valid JSON with exactly one max_tokens=1024"
|
||||
then ok "the review body stays valid JSON with exactly one max_tokens=4096"
|
||||
else bad "the malformed max_tokens produced an invalid or duplicated review body"
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user