Skip to content

feat(cli): multi-round discussion host driver as a library, entry point left open (#588 part 2c) - #689

Merged
ajianaz merged 5 commits into
developfrom
feat/discussion-driver
Nov 13, 2026
Merged

ajianaz merged 5 commits into
developfrom
feat/discussion-driver

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

What

Part 2c of #588: the multi-round discussion's host driver, tole_cli::discussion_host, as a library. It runs a discussion over the ledger from #667/#685 with the roles from #686 until the gate reports or escalates. No CLI command and no model-facing tool: how a discussion starts is an open question, laid out with its security consequences in docs/automation-design.md ("Entry point: open question", recommendation: (c) in two steps).

Why

The ledger, the sanitizer, the digest validator, the gate and the roles existed, but nothing called the models. The driver is the orchestration of A8.3 with every rule enforced by code: the gate alone decides, dissent survives, the budget and max_rounds are hard stops, and a crash resumes without re-running or overspending.

Changes

  • Driver::from_config(cfg, paths, participants, log, secrets, factory, pot): participants are user-config profiles (persona read now), never scribe or claim-checker; the role models come from discussion_roles::resolve. Driver::start(contract) refuses a participant it does not voice and a budget above what the pot has left. carve(requested, pot) takes a discussion's budget from the goal's pot (requested, else half of what is left; never more).
  • Driver::run() follows the ledger's Next until Done:
    • inline participants: one call per turn with the fixed participant instructions plus the redacted persona, on the profile's default-tier model; no tools, no streaming, no process. A reply goes through pass 1 (discussion::sanitize) before contribute; a tool call in a reply runs nothing and is recorded as "no contribution".
    • scribe (big rounds only): the reply is read only through parse_digest; a refused digest or a failed scribe gives RoundSummary::Fallback with the pass-1 text and a sanitized reason.
    • claim-checker: read only through parse_checker; an unreadable checklist meets nothing, so it can never report.
    • gate: DiscussionLog::decide, computed from the ledger. No text a model wrote can report, write, change the roster or call a tool.
    • close: the host's text: outcome, checklist with evidence ids, and the last round fenced as data.
  • Budget: every call (participants, scribe, checker) is reserved in the ledger at its estimate before it runs and settled at its reported usage after (the estimate when none is reported), and charged to the pot. A call the discussion budget or the pot cannot fit records Escalate(Budget); max_rounds escalates through the gate.
  • Resume: a new driver continues at the ledger's next step; finished turns are not called again and a crashed call stays counted.
  • factory(OpenAiConfig, secrets): the run's provider connection with the process secrets, no streaming, no fallback chain (as the advisor's).
  • Docs: "Entry point: open question" in automation-design.md, a threat-model row, epics.md; CHANGELOG.

The diff is about 1,000 lines (500 code with doc comments, 470 tests).

Testing

  • discussion_host_tests.rs with a scripted mock provider (no network): a small discussion to a checked report (no scribe call, models per role, persona redacted, report text, idempotent re-run); a big round digested, a refused digest and a failed scribe falling back; the discussion budget and the goal pot as hard stops (the call that does not fit never runs); carving; a crash (failed provider, and a reserve with no settle) resumed by a new driver without re-asking a finished voice and with exact token accounting; hostile replies (fence close, fake gate JSON, a secret, a tool call, a checker citing a non-existent entry) that change nothing; participants from the user config only, never a role.
  • Mutation checks, each made a test fail: no role refusal, no participant check on start, no pot check, usage ignored, pot not charged, persona not redacted, contributions not sanitized, a refused digest recorded as an empty digest, an unreadable checklist treated as met.
  • cargo fmt --all --check, cargo clippy --workspace --all-targets --all-features -- -D warnings, cargo test --workspace, cargo test -p tole-core --no-default-features, cora review --no-llm: all clean.

… caps (#588 part 2a)

Every provider call of a discussion is reserved before it runs and settled after it; a call that does not fit the budget records the budget escalation at once. A refused digest falls back to the round as written. Records and the log are capped on write as well as read, and the log and its lock are never opened through a symlink.
# Conflicts:
#	CHANGELOG.md
#	crates/tole-cli/src/lib.rs
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants