Repository navigation
refactor(cli): one session provider for every face (#428, 1/3) - #430
Merged
Merged
Conversation
tole_cli::turn_runner builds the provider for a session turn: env config with one missing-config message, the session's durable fact/model register over the default, the registry's tool specs, the pinned system prompt and the optional live-token sinks. run, resume, chat, missions and the server faces use it instead of six copies. Fixes tole resume / tole chat --resume / resumed missions ignoring a model picked in ACP, and the run of spaces inside the server faces' missing-config error.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
ajianaz
added a commit
that referenced
this pull request
Oct 26, 2026
## What The memory loop's pre-turn recall injection and session remember move into `turn_runner`, used by every face. Part 2 of 3 of #428. ## Why The CLI (`HostConfig::inject_memory` / `remember`) and the session host each had their own copy. The session host's remember dropped its result silently, so a failing store on `tole serve` / ACP went unnoticed. ## Changes - `turn_runner::with_recalled_memory(memory, prompt)`: the prompt with the recalled block appended; no memory, nothing recalled, or a failed recall (stderr note, #384) gives the bare prompt. - `turn_runner::remember(memory, session_id, first_prompt, last_answer, wrote)`: best-effort summary, reported on stderr either way; `first_prompt` is the pre-injection prompt, so recalled memory is never echoed back into the store. - `main.rs`: `HostConfig::inject_memory` / `remember` delegate to them. - `session_host.rs`: the first-turn recall and the per-turn remember use them; the `first_prompt_done` lock is released before the recall subprocess runs. - CHANGELOG. ## Testing - New unit tests with fake `uteke` binaries: a hit is appended, an empty result and a failing binary both leave the bare prompt; remember stores the pre-injection prompt in the room (`--room`, `--type decision` for a write session); no memory is a no-op. - `cargo fmt`, `cargo clippy --workspace --all-targets -- -D warnings`, bare-profile clippy (none / shell-tools), `cargo test --workspace`: all green; rebased onto #430 and rebuilt. - Cora agent-as-reviewer on the exact staged diff: `should_block: false`, 0 issues (deterministic hits were `bug-println` on the intended stderr reporting and `bug-expect` on the existing lock pattern, both ignored by `.cora.yaml`). Co-authored-by: ajianaz <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds
tole_cli::turn_runnerand moves every face's provider construction onto it. Part 1 of 3 of #428.Why
Six places built the provider for a session turn (
run,resume,chat, missions, serve/ACP run and resume) and they had drifted. Only the server faces applied the session's durablefact/modelregister (the ACP model picker, #176), so a session whose model was switched in ACP silently ran onTOLE_MODELwhen resumed withtole resumeortole chat --resume. The server faces' missing-config error also had a run of spaces inside it (a broken string continuation).Changes
turn_runner.rs(new):MISSING_PROVIDER_CONFIGandprovider_config(): one wording, used by every face.session_model(storage, default): thefact/modelregister (trimmed, non-blank) over the default.configure_provider(p, specs, system_prompt, observer): tool specs, the pinned system prompt, ACP's live text/reasoning sinks.session_provider(...): the failover chain (provider failover chain — reserve provider for mission resilience #209) with every link configured that way.main.rs(run, resume, chat),mission.rsandsession_host.rs(run and resume) use it.configure_mission_provideris gone; its regression test now exercisesconfigure_provider.Testing
session_model_e2e(real binary, mock provider echoing the requested model):tole resumeandtole chat --resumeon a session withfact/model = picked-modelsendpicked-model. Both fail on the oldmain.rsand pass with this change.cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings, bare-profile clippy (none / shell-tools),cargo test --workspace: all green on a clean build of this exact commit.review_prepare→ own review →review_finalize):should_block: false, no issues. The one info hit wasspecs.clone()inside the failover closure, which is needed per chain link.Note: two earlier local runs had failures caused by the machine (a full disk breaking the linker, then heavy IO from cleanup); a clean re-run on an idle machine is fully green. The flaky
config_sensitivehook tests are tracked separately in #429.