You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reproducibility: integer and NULL variants each reproduced 3/3 on CN1 and 3/3 on CN2
Problem
Starlark LLM helpers perform an unchecked Go type assertion when reading @llm_model and related session variables. A non-string value or NULL reaches the client as an internal recovered panic instead of a validated SQL/Starlark error.
Reproduction
The echo model is local and avoids any external model or network dependency.
createdatabaseif not exists starlark_llm_bug;
use starlark_llm_bug;
create procedure p_llm(in q varchar, out o varchar) language 'starlark'
$$
mo.llm_connect("", "", "", "")
reply, err =mo.llm_chat(q)
out_o = err if err != None else reply
$$;
-- Valid controlset @llm_model='echo';
call p_llm('[{"role":"user","content":"local-ok"}]', @o);
select @o;
-- Failure variantsset @llm_model=1;
call p_llm('x', @o);
set @llm_model=null;
call p_llm('x', @o);
Actual result
The string control returns local-ok. The two invalid values return internal errors containing recovered Go panics:
panic interface conversion: interface {} is int64, not string
panic interface conversion: interface {} is nil, not string
Both CN sessions remain usable after the errors, but internal implementation details and stack frames are exposed to the SQL client.
Expected result
The helper should validate or explicitly convert the session-variable value. Unsupported values should produce a stable argument/type error, never a Go panic.
Code evidence
pkg/frontend/starlark_interpreter.go function llmGetVar returns value.Value.(string) without checking the dynamic type. llmConnect calls this path for llm_server, llm_addr, llm_model, and llm_options, so all four variables share the same risk.
Regression-test placement
Add a small Starlark procedure test covering string, numeric, boolean, binary, and NULL session-variable values. This is deterministic MOTR/procedure coverage and does not require big-data, stability, or chaos.
Activity
fix(frontend): validate @llm_* session variables instead of panicking
fix(frontend): validate and safely initialize Starlark LLM clients (#…
Ariznawlll commentedon Oct 12, 2026
测试版本
main;commit:02a2823c2007d5e4fb4ada148e93743df337551a;日期:2026-10-12。echo模型,不访问外部 LLM 服务。原问题验证
沿用原 issue 的
mo.llm_connect/mo.llm_chat存储过程。将@llm_model设为整数 1 和 NULL,连续 3 轮分别返回明确的must be a string, got int64、invalid model消息;不再返回 Gopanic interface conversion。每次异常后连接SELECT 1正常。Happy Path 覆盖
@llm_model='echo'且输入合法 JSON 时,3/3 返回local-ok。对其余三个变量@llm_server、@llm_addr、@llm_options使用 NULL 时,本地 echo 仍可正常返回,均无 panic。Unhappy Path 覆盖
四个 LLM session 变量分别设为整数和布尔值,3 轮 × 4 变量 × 2 类型均返回明确的类型错误,不暴露 panic;NULL 也逐变量覆盖。另测二进制字面量
x'0102':按当前会话变量的字符串解释路径处理,server/model返回合法校验错误,addr/options在 echo 模型下不影响结果;均无 panic。所有异常后连接仍可用。白盒验证
验收重点是 session 变量的动态类型在 Starlark LLM helper 边界被安全处理,而非依赖外部模型服务的网络结果。未测试第三方 LLM 提供商或真实 API key。
回归测试
已加入 MOTR PR #229 的 Starlark 脚本回归;包含本地 echo、四变量整数/布尔/NULL、会话恢复,compare 3/3。二进制字面量在本次独立扩展测试覆盖。无需 big-data。
测试证据
SELECT 1正常。测试结论
测试通过。
Ariznawlll commentedon Oct 12, 2026
回归归档:本 issue 在 MatrixOne main
02a2823c2007d5e4fb4ada148e93743df337551a上的原问题、正常与边界/异常路径已有上方详细验证记录,MOTR 对应用例本地 compare 3/3 通过。回归 PR https://github.com/matrixorigin/motr/pull/229 已合入(merge commit0ed4301b164aa42d0affa0dc27e17f7435b7bf04)。据此关闭本 issue;本次关闭未增加先前评论未覆盖的验收范围。测试通过。