radiance 1.0.5

- Answers no longer stop partway through. A request without max_tokens got 512 tokens, and a
  reasoning model can think for thousands before it answers, so the reply ended inside the
  reasoning with finish_reason "length", which chat clients do not show. It now gets whatever
  the context leaves after the prompt, as in vLLM. --default-max-tokens N sets a number, and
  --max-tokens-cap bounds every request.
- Qwen3.8-Flash-Next in Docker without --security-opt seccomp=unconfined is refused at startup,
  in about a second, with a message naming that option. It used to load the whole model and then
  fail every request as "unsupported", and a restart policy reloaded it over and over. The
  n-gram table is read through io_uring, which Docker's default seccomp profile refuses.
- A request the engine fails says what failed, in the 500 or the stream's error event. It read
  "the engine failed this request: ok".
- Flash-Next no longer crashes at startup about one start in seven (a race between the
  parallel declares that size the activation arena).
- rad-convert no longer needs io_uring, so it converts in a sandbox that forbids it.
This commit is contained in:
Deadcode committed 2026-10-04 18:44:29 +02:00
1 parent 09fb41735b
commit 6c11671bdd
30 files changed
+541 -120

No files matched your search

+7 -2
View File
@@ -109,8 +109,13 @@ struct OaiLimits {
std::string model_id = "radiance";
int64_t max_ctx = 0; /* 0 = unknown, no length check */
/* What a request that names no max_tokens may generate. 0 is "whatever the context leaves",
* resolved against the prompt in clamp_max_tokens. */
int64_t default_max_tokens = 512;
* resolved against the prompt in clamp_max_tokens, which needs max_ctx to resolve against.
*
* 0 BY DEFAULT, as vLLM's is: many clients send no max_tokens, and a reasoning model spends
* the first thousands of tokens of an answer thinking. A fixed default of 512 ended those
* answers inside the reasoning, with finish_reason "length" that a chat client does not show,
* so they read as a model that stops at random. */
int64_t default_max_tokens = 0;
/* The most any request may generate; a larger max_tokens is clamped, not refused. 0 = none. */
int64_t max_tokens_cap = 0;
int max_n = 8;
+13 -4
View File
@@ -412,6 +412,16 @@ bool Server::pump(std::vector<Generation>& gens, const OaiRequest& r) {
/* ------------------------------------------------------------------ metrics bookkeeping */
/* WHAT FAILED, for the client: the sentence the failing component gave, and the status. A failed
* request always carries a status -- an engine that stopped carries the one that stopped it -- so
* this never reads "ok". */
static std::string engine_failure(const Sink& s) {
const int st = s.status() < 0 ? s.status() : RAD_E_STATE;
const char* why = s.why();
return why ? fmt("the engine failed this request: %s (%s)", why, rad_strerror(st))
: fmt("the engine failed this request: %s", rad_strerror(st));
}
static SuccessReason to_reason(Finish f) {
switch (f) {
case Finish::Length: return SuccessReason::Length;
@@ -536,14 +546,14 @@ HttpResponse Server::blocking_completion(const HttpRequest& req, OaiRequest& r)
/* An engine-side failure is not a 200 with an empty answer. */
for (auto& g : gens) {
if (g.finish == Finish::Error) {
int st = g.sink->status();
const std::string why = engine_failure(*g.sink);
retire(gens);
release(r.n_choices());
record(r, gens, Finish::Error);
ApiError e;
e.status = 500;
e.type = "internal_server_error";
e.message = std::string("the engine failed this request: ") + rad_strerror(st);
e.message = why;
return error_response(e);
}
}
@@ -689,8 +699,7 @@ HttpResponse Server::streaming_completion(const HttpRequest& req, OaiRequest& r)
ApiError e;
e.status = 500;
e.type = "internal_server_error";
e.message = std::string("the engine failed this request: ") +
rad_strerror(g.sink->status());
e.message = engine_failure(*g.sink);
out += sse_error(e);
}
}
+1 -1
View File
@@ -66,7 +66,7 @@ struct ServerOptions {
int retry_after_s = 1;
int64_t max_ctx = 0;
int64_t default_max_tokens = 512; /* 0: what the context leaves (OaiLimits) */
int64_t default_max_tokens = 0; /* 0: what the context leaves (OaiLimits) */
int64_t max_tokens_cap = 0; /* 0: none */
int max_n = 8;
int64_t max_stops = 64;
+2 -1
View File
@@ -89,8 +89,9 @@ void Sink::finish(Finish f) {
}
}
void Sink::fail(int rad_status) {
void Sink::fail(int rad_status, const char* why) {
status_.store(rad_status, std::memory_order_release);
why_.store(why, std::memory_order_release);
finish(Finish::Error);
}
+7 -3
View File
@@ -79,7 +79,9 @@ public:
/* Terminal. Idempotent -- the first call wins, so a cancel racing a natural stop does not
* produce two finish reasons. */
void finish(Finish f);
void fail(int rad_status);
/* `why` says what failed, in a sentence a client can read; a string that outlives the sink
* (a literal), or null. */
void fail(int rad_status, const char* why = nullptr);
/* The scheduler polls this to learn that the client hung up, and frees the blocks (spec §14).
* It is also told by IScheduler::cancel(); this is the cheap path that needs no lookup. */
@@ -100,6 +102,7 @@ public:
bool done() const { return finish_.load(std::memory_order_acquire) != (int)Finish::None; }
Finish finish_reason() const { return (Finish)finish_.load(std::memory_order_acquire); }
int status() const { return status_.load(std::memory_order_acquire); }
const char* why() const { return why_.load(std::memory_order_acquire); }
bool overflowed() const { return overflow_.load(std::memory_order_acquire); }
/* The HTTP thread calls this when the peer disappears. It does NOT free anything itself --
@@ -135,6 +138,7 @@ private:
std::atomic<int> finish_{(int)Finish::None};
std::atomic<int> status_{RAD_OK};
std::atomic<const char*> why_{nullptr};
std::atomic<bool> overflow_{false};
std::atomic<bool> cancel_{false};
std::atomic<bool> quiesced_{false}; /* the producer will not touch this object again */
@@ -159,8 +163,8 @@ inline bool sink_push(void* s, int32_t token, float logprob = 0.0f) {
inline void sink_finish(void* s, Finish f) {
if (s) static_cast<Sink*>(s)->finish(f);
}
inline void sink_fail(void* s, int rad_status) {
if (s) static_cast<Sink*>(s)->fail(rad_status);
inline void sink_fail(void* s, int rad_status, const char* why = nullptr) {
if (s) static_cast<Sink*>(s)->fail(rad_status, why);
}
inline bool sink_cancelled(const void* s) {
return s && static_cast<const Sink*>(s)->cancel_requested();