Repository navigation
feat(cli): consult_advisor in missions, delegated children and cron runs (#587 part 2b) - #655
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.
…uns (#587 part 2b) A mission (and so a delegated child, by its own profile) and a cron agent run register consult_advisor when the profile declares models.advisor; run, chat, the TUI, serve and ACP have no token budget for it and do not. The mission's provider is wrapped in the Tap with a budget seeded from what the session already spent; the cron TokenMeter charges the same Budget. After each turn the advisor's usage is written to the session tagged role advisor, so budget checks, resumes, reported tokens and the daily cap include it.
# Conflicts: # CHANGELOG.md
🔍 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 2b of #587:
consult_advisorregistered in the runs that have a token budget it can share. Closes #587.Depends on:
tole_core::advisor), merged;tole_cli::advisor_host), merged.This branch has the latest
developmerged in (a merge commit) and now targetsdevelop.Why
Your constraint: the advisor's tokens must come out of the run's own budget, and a face whose meter cannot share it gets no tool, never an uncounted advisor.
tole mission(and so a delegated child) and cron agent runs have a token budget.run,chat, the TUI,serveand ACP have none, so the tool is not registered there, and the docs say so.Changes
mission.rs: when the profile declaresmodels.advisor,MissionConfig::advisorregistersconsult_advisor, with the contractProfile: <name>plus the mission goal.Budgetstarts at what the session already spent, so a resume counts earlier advisor usage.Tap(charge = true).record_usagewrites the advisor's usage to the session, so the next budget check includes it.main.rs: a mission gets the advisor from its own profile. A delegated child is atole mission --profile <p>, so it gets one only when its profile declares it.cron/agent.rs:TokenMeternow charges a sharedBudget(the same limit as before, the same trip).Profile: <name>plus the job's own prompt (never the webhook context). It wraps the provider in theTap(charge = false, since the meter charges).profile.rs: the doctor line now says where the tool is available.docs/epics.md(AGENTS.md §7).Testing
cargo fmt --allcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspacecargo test -p tole-core --no-default-featuresNo-mcp CI commands:
cargo 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-featuresThe commands above ran on the combined tree before feat(cli): consult_advisor host tool, tap and usage records (#587 part 2a) #654 merged.
After the merge of
develop(only the CHANGELOG conflicted), I re-ran fmt, theadvisor_hostunit tests andadvisor_e2eon this head.cora review --no-llm --staged: no issues.tests/advisor_e2e.rs(new): 6 tests on the real binary. One mock provider plays the executor and the advisor (wise-model). They check:tools, does not stream, and is a system message plus one user message. It is redacted (a process secret in the question and the transcript never appears) and capped. Its window holds the run's own transcript (MISSION GOAL), and the executor gets the fenced verdict back;"role": "advisor"is written to the session;advisor_max_usesrefusal. A plain--profile coder runis not offered the tool;write_filetool call runs nothing (no file appears), and a hostile text reply cannot close its fence;Mutation breaks, each restored afterwards; the tests caught all 6 for the wiring:
Write;Together with feat(cli): consult_advisor host tool, tap and usage records (#587 part 2a) #654's 11, all 17 were caught.