Repository navigation
refactor(cli): one tool roster for the CLI and MCP server faces (#420, 1/3) - #421
Merged
Merged
Conversation
… 1/3) Add tole_cli::tool_roster: build(approver, Roster) registers a session's tools with the per-tool rules in one place (plan mode, Destructive only behind an interactive approver, child-agent tools, probe-gated uteke/cora/gh, the cora MCP fallback, sibling tracking). build_registry (run/resume/chat/mission) and build_server_registry (tole mcp, MCP-over-HTTP) are thin adapters over it. One binary probe and one GitHub-origin probe remain.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…roster imports (#420) The pre-roster build_registry registered agent_start/agent_poll in the bare profile too; the roster had put them behind this crate's shell-tools gate (caught by the no-mcp CI job). The binary probe and AllowlistApprover imports are gated to the profiles that use them, so the bare and mcp-only profiles build without warnings.
ajianaz
added a commit
that referenced
this pull request
Oct 26, 2026
…ter (#420, 2/3) (#426) ## What `session_host::open_session` (used by `tole serve`, `tole acp` and the MCP session tools) now builds its registry with `tool_roster::build`, the same module the CLI and MCP-server faces use since #421. Part 2 of 3 of #420. ## Why `open_session` was the third copy of the per-tool registration rules and had drifted from the CLI: no `verify_package`, a binary probe that accepted non-executable files, no sibling tracking or handoff tool for children, and agent-tool registration errors silently ignored. ## Changes - `session_host.rs`: the ~95-line registration block becomes a `Roster` (workspace = session cwd for files and shell tools, plan mode, child agents without worktrees, the ACP plan emitter) passed to `tool_roster::build`. `tole_cli_binary_available` is removed (the roster's executable-only probe replaces it). Turn-end hooks, storage and todo registration are unchanged (todo moves in part 3). - Server sessions gain `verify_package`; children additionally get sibling tracking and the handoff tool, as on the CLI. Probe misses (uteke / cora / GitHub origin) are now reported on stderr. - `delete_file` still registers only behind an interactive approver (ACP); plan mode still leaves only ReadOnly tools (`update_plan`, `systemone_decide`, `web_*` and `job_poll` are ReadOnly, so plan-mode sessions keep them). - CHANGELOG. MCP servers on server faces stay out of scope: those faces refuse `--mcp-server` today, so attaching MCP there is a separate feature. ## Testing - New `roster_tests::server_sessions_use_the_shared_roster` (`open_session` with an allowlist approver): `verify_package` and `write_file` present, `delete_file` absent; in plan mode only ReadOnly tools, no `write_file` / `run_command` / `agent_start` / `todo_write`. - `cargo fmt`, `cargo clippy --workspace --all-targets -- -D warnings`, bare-profile clippy (none / shell-tools), `cargo test --workspace` (all green), plus `acp_approval` and `serve_approvals` re-run on the final code. - Cora agent-as-reviewer on the exact staged diff (`review_prepare` → own review → `review_finalize`): 0 findings, `should_block: false`. Two info `qual-clone` hits from the first pass were fixed (values moved instead of cloned). Co-authored-by: ajianaz <[email protected]>
This was referenced Oct 26, 2026
ajianaz
added a commit
that referenced
this pull request
Oct 27, 2026
… request count (#429) (#445) ## What The scripted provider mock in `crates/tole-cli/tests/config_sensitive.rs` picks its answer from the conversation instead of from a request counter. Closes #429. ## Why `on_pretool_from_config_runs_and_can_deny` and `on_posttool_and_on_turnend_from_config_run` failed intermittently under machine load (four times on 2026-10-26, once in CI on #421): the `tole run` child exited 0, but the hook marker was never written. The mock answered request n with `steps[min(n, last)]`, so a client retry consumed the next scripted step. The turn then received the final answer instead of the `write_file` tool call and never ran the tool. ## Changes - `spawn_mock`: the step is `steps[min(t, last)]`, where t is the number of `role: tool` messages already in the request's transcript. Every script in this file is one turn (a final, or a tool call then a final), so the scripts mean what they meant before; a retried request now gets the same answer. - The two hook tests keep the recorded requests and include the request count and the child's stderr in their failure messages, so a future failure is diagnosable from the log. - The now-unused request counter (`AtomicUsize`) is removed. ## Testing - `cargo test -p tole-cli --test config_sensitive`: 23 passed. - `cargo fmt --all --check`, `cargo clippy -p tole-cli --tests -- -D warnings`: clean. - Cora agent-as-reviewer on the exact staged diff, judged from `review_finalize`: `should_block: false`, 0 issues. 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::tool_rosterand moves the CLI faces (run,resume,chat,mission) and the MCP server faces (tole mcp, MCP-over-HTTP) onto it. Part 1 of 3 of #420.Why
build_registryandbuild_server_registrywere near-copies of the same per-tool rules, andsession_host::open_sessionis a third copy; they had drifted (plan mode applied three ways, twodelete_filerules, two binary probes and two GitHub-origin probes). One roster puts each rule in one place. This is the second item of the 2026-10-26 architecture review.Changes
tool_roster.rs(new):build(approver, Roster).Rostercarries what differs per face: workspace, shell dir, plan mode, child-agent options, MCP servers, plan emitter. Rules inside: plan mode skips Write-tier registration and ends withretain_read_only(MCP tools are always Write);delete_fileonly behind an interactive approver (the registry andAllowlistApproverstill refuse it on their own); agent tools only for parents outside plan mode; probe-gated uteke / cora / gh / gitea; the cora MCP →cora_searchfallback; sibling tracking and the handoff tool for children.binary_available(executable files only) andagent_depthlive here.main.rs:build_registry(approver, host, allow)andbuild_server_registry(workspace, allow, plan_mode)are thin adapters; the four copied cfg-gated call sites collapse to one line each;register_gh, the duplicatebinary_availableanddetect_github_repoare gone (−460 lines).session_host.rs:detect_github_repotakes&Path.Part 2 moves
session_host::open_session(serve, ACP, MCP session tools) onto the roster; part 3 unifies the five todo registrations.Testing
tool_roster: Destructive only behind an interactive approver, plan mode leaves only ReadOnly tools, agent tools only when the face allows children, the binary probe requires an executable.cargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(green; one earlier run had two load-related failures inconfig_sensitive, which passed 4/4 alone and in a full rerun).cargo check -p tole-cli --no-default-features,cargo clippy -p tole-cli --no-default-features --features shell-tools -- -D warnings.cora review --staged: deterministic checks clean; the LLM step timed out (504 from the gateway) twice, so the diff was also reviewed with cora 0.19's agent-as-reviewer tools (review_prepare/review_finalize):should_block: false, one minorunwrapinside a unit test.