Skip to content

Commit 2fe62cf

Browse files
committed
server: let an unresolvable model contract fail at registration
Review feedback: the catch added in the previous commit swallowed real model-spec errors. An invalid spec override logged the real reason, started anyway, and then failed the request with an unrelated "model path does not exist". model_accepts_request_option already returns true for a model with no contract (it swallows only the missing-contract errors and rethrows the rest), so the catch could only ever extend permissiveness to genuine misconfigurations. It is removed rather than narrowed: nothing replaces it. An invalid spec now fails once, at registration, with the real error, instead of 500ing every request as it did before this branch.
1 parent df50919 commit 2fe62cf

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

app/server/runtime.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,21 +1188,16 @@ void ServerState::refresh_model_option_flags(LoadedModel & model) {
11881188
const auto effective_override = model.config.model_spec_override.has_value()
11891189
? model.config.model_spec_override
11901190
: config_.model_spec_override;
1191-
try {
1192-
model.accepts_reference_text = model_accepts_request_option(
1193-
model.config.family,
1194-
"reference_text",
1195-
effective_override,
1196-
model.config.path);
1197-
} catch (const std::exception & ex) {
1198-
// Keep registration robust: a model whose contract cannot be resolved gets
1199-
// the same permissive behavior as a model with no contract; the failure is
1200-
// reported so the misconfiguration stays visible.
1201-
std::cerr << "[server] model '" << model.config.id
1202-
<< "': reference_text option check failed (" << ex.what()
1203-
<< "); assuming the option is accepted\n";
1204-
model.accepts_reference_text = true;
1205-
}
1191+
// Deliberately uncaught: model_accepts_request_option already returns true for a
1192+
// model with no contract, swallowing only the missing-contract errors and
1193+
// rethrowing the rest. Anything that propagates here is therefore a real
1194+
// misconfiguration (invalid spec, missing override file, family mismatch) and
1195+
// must fail at registration rather than be assumed away.
1196+
model.accepts_reference_text = model_accepts_request_option(
1197+
model.config.family,
1198+
"reference_text",
1199+
effective_override,
1200+
model.config.path);
12061201
}
12071202

12081203
HttpResponse ServerState::handle_model_load(const std::string & body_text) {

0 commit comments

Comments
 (0)