-
fix(rlm): wire real recursive substrate; bump 0.6.4
发布于
2026-04-27 05:36:59 +00:00 The v0.6.3 RLM loop had Algorithm 1's outer shape but the substrate was
non-functional:llm_query()was a Python stub that returned a hardcoded
string andchild_modelwas bound with an underscore prefix and silently
dropped. The recursive sub-LLM call advertised by /rlm never fired.This commit wires the substrate end-to-end per Zhang/Kraska/Khattab
(arXiv:2512.24601, Algorithm 1):- New axum HTTP sidecar (
rlm/sidecar.rs) bound to 127.0.0.1:0 for the
duration of one RLM turn. Python'sllm_query()andsub_rlm()are
realurllib.requestPOSTs; Rust services them via the existing
DeepSeek client. Token usage from sidecar-served calls folds into the
parentRlmTurnResult.usage. child_modelis plumbed throughOp::RlmQuery→AppAction::RlmQuery
→run_rlm_turn→ sidecar handlers; default remainsdeepseek-v4-flash.- New
sub_rlm(prompt)Python helper runs a full Algorithm-1 turn at
depth-1 (paper'ssub_RLM). Defaultmax_depth = 2from/rlm. The
recursive opaque-future cycle is broken by returning a concrete
Pin<Box<dyn Future + Send>>fromrun_rlm_turn_inner. - Strict termination: the loop ends only via
FINAL(value)(or the
iteration cap). One fence-less round is tolerated with a reminder
appended; two consecutive ones surface the model text as a
RlmTermination::DirectAnswerexit. NewRlmTerminationenum lets
callers tellFinal | DirectAnswer | Exhausted | Errorapart. - Richer
Metadata(state): includes paper-required access patterns
(repl_get/ slicing /splitlines/repl_set/llm_query/
sub_rlm/FINAL) and a live list of variable keys currently in
the REPL state file. - Unicode-safe
truncate_text(was mixing bytes with chars), per-turn
state-file cleanup,ROOM_TEMPERATUREtypo →ROOT_TEMPERATURE. - New end-to-end test
sidecar_url_is_exported_to_python_envstands up
a stand-in axum server, runsprint(llm_query('hello'))in the real
PythonRuntime, and asserts the reply round-trips. Catches future
regressions in sidecar URL passthrough.
Versions: workspace 0.6.3 → 0.6.4 in Cargo.toml; npm wrapper 0.6.3 → 0.6.4
in npm/deepseek-tui/package.json.Gates: cargo fmt, cargo clippy --all-targets --all-features --locked
-D warnings, cargo test --workspace --all-features --locked (1088
passed), parity_protocol/parity_state/snapshot, RUSTDOCFLAGS=-Dwarnings
cargo doc --workspace --no-deps — all green.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
下载附件
- New axum HTTP sidecar (