Repository navigation
feat(cli): consult_advisor host tool, tap and usage records (#587 part 2a) - #654
Merged
Merged
Conversation
…t 2a) tole_cli::advisor_host: ConsultAdvisor (ReadOnly) makes one advisor call with no tools, no streaming and no fallback chain, built from the task contract, the question and an in-memory window of the run's transcript kept by Tap, and returns only the fenced verdict. A consultation the run's shared Budget cannot fit, or past advisor_max_uses, is refused before any call; what a call spent is charged and queued even when it fails, and record_usage writes it to the session tagged role advisor. No run registers the tool yet.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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
Part 2a of #587:
tole_cli::advisor_host, the host side ofconsult_advisor. No run registers the tool yet; part 2b (#655, stacked on this PR) wires it into missions, delegated children and cron runs.Depends on: #653 (part 1,
tole_core::advisor), which is merged. Based on the latestdevelop.Why
Part 1 decided what the advisor sees, what is read back and what it costs. This module makes the call under your constraints of 2026-11-13:
parse_reply;role: advisor.The split keeps both PRs under ~900 lines.
Changes
ConsultAdvisor(ReadOnly,questioninput):tole_core::advisor::requestfrom the task contract, the question and the window: redacted, neutralized and capped;Budgetcannot fit (the request plus 600 tokens for the reply); then refuses pastadvisor_max_uses;Factory. The productionfactoryis the advisor model on the run's provider connection, with the process secrets, no tools, no streaming and no fallback chain (a fallback would be another model);{advisor: <fenced verdict>, verdict, use, of, tokens}; a provider error is reported redacted and capped;Tap: wraps the run's provider. On each step it keeps the last 12 entries of the transcript the turn loop sends, in memory. Withcharge, it charges each step's usage to the sharedBudget; a face whose own meter charges the budget passesfalse.record_usage: writes the queued advisor usage to the session as usage records tagged"role": "advisor".[Unreleased]. The design note, threat-model row, README and epics update ship with feat(cli): consult_advisor in missions, delegated children and cron runs (#587 part 2b) #655, which makes the tool reachable.Testing
cargo fmt --allcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspacecargo test -p tole-core --no-default-featurescargo check -p tole-cli --no-default-featurescargo clippy -p tole-cli --no-default-features --features shell-tools -- -D warningscargo test -p tole-cli --no-default-featurescora review --no-llm --staged: no issues.advisor_host_tests.rs, with a recording fake provider, cover: